Using a Renesas Code Generation Tool for RL78 Devices_LabProcedures

20 701 0
Using a Renesas Code Generation Tool for RL78 Devices_LabProcedures

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

LAB PROCEDURE 1.1.1.1Using a Renesas Code Generation Tool for RL78 Devices RL78 Description: This hands-on lab will step through how to generate the RL78 code for IAR compiler using Renesas code generator tool, Applilet Then bring the Applilet generated code to Renesas new 2 Eclipse-based IDE, e studio enviornment, Build and run the project in e studio using IAR Tool chain This lab will work through the Applilet configuration for system and peripherals setting and e studio configuration to edit, build the project Lab Objectives How to Generate RL78 code for IAR platform using Applilet Edit/Compile/build/debug the project in e studio Skill Level New to RL78/Applilet/e studio Tools This is so easy anyone can it Lab Materials Please verify you have the following materials at your lab station • Laptop PC with e studio /Applilet tools preinstalled • YRDKRL78-G14 Target board • USB cable • This lab sheet Time to Complete Lab hours Lab Sections Generate IAR Project using Applilet Bring Applilet code to e2studio Edit and Build the Project 14 Debug and Run the Program 16 Output File for Renesas Programmer 19 Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Generate IAR Project using Applilet Overview: This lab section will step through the system and peripheral setting and generates the device driver code for RL78 device The project uses RL78G14 Family device, R5F104PJ In this lab, we will create a project that blinks LED 15 every 100ms with timer interrupt I/O port: P41 Timer Unit: Channel Procedural Steps Step 2.1 Open Applilet Start -> All Programs -> Applilet -> Applilet3 for RL78_G14 -> V1.01.01 Step 2.2 From Applilet3, select “File>New” This will open “New Project” window Enter the options below to configure project environment for R5F104PJ device Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Kind of project = “Project for RL78/78K0R” Using microcontroller = RL78/G14(ROM:256KB)-> R5F104PJ(100pin) Using Build Tools = IAR Compiler Project name =‘myRL78Project Place = C:\workspace Click ‘OK to make project framework Step 2.3 The next screen shows the Applilet Code Generator The screen includes all the peripheral available in the device You may recognize this from CubeSuite+ or from previous Applilet versions Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Step 2.4 The first thing to decide is how the Pin assignment is set This setting can only be done once per project For this project, set it to Default assignment by clicking “Fix settings” Other settings are handy for projects that need enhanced serial or timer functionalities Step 2.5 Select “Clock setting” tabs and Review the Power and Clock settings Leave all setting as default setting Step 2.6 Select the On-Chip Debug setting Tab and make these settings: On-Chip Debug operation setting: Used Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE The security ID is used to prevent unauthorized debugger connection By default, this value is 20, 0's Step 2.7 Review “Confirming Reset Source” and “Function Safety” tab and leave the setting to its default Step 2.8 Double Click on Port from Project tree window to open the port tab.Select Port4 tab, and set bit as output, with level at This is for driving the on-board LED15 (other pins should be left as unused) Step 2.9 The Interrupt, Serial, A/D Converter, D/A converter tabs are not used in this example, so we will skip those Step 2.10 Next, Select Timer from the project tree Select Channel as interval timer Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Step 2.11 Select Channel tabs Set Interval value as 100ms Step 2.12 Select Watch Dog Timer tab from the project tree, and set the Watchdog Timer operating setting as UNUSED Step 2.13 Look at but don’t change the settings for Real Time Clock, Interval timer, Comparator, Clock Output/Buzzer output, Data Transfer Controller, Event Link Controller, and Voltage Detector We will leave these at their defaults button, and note the messages below It should Step 2.14 Click Generate Code report that the project was created successfully Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE The Code Generator produces all the primary setup code for each peripheral chosen in the design It generates a source file for the primary configuration settings and a “user” file for allowing the user to customize use the function of the peripheral and add associated application code (i.e r_cg_timer.c and r_cg_timer_user.c) Step 2.15 Save the project, “File->Save” Step 2.16 Go to OptionsGenerate Type and notice the default Code generator configuration setting as “Merge files” In order to retain previous and incorporate new information, it is necessary to use merge files This allows not to overwrite any user modified code entered in section designated for the user area Step 2.17 Finally, the Applilet can generate a report on what it did Go ahead and click the FileOutput Report The Applilet will generate two reports in the project directorymacro.html, shows the summary of the all peripheral settings and Function.html, which shows the functions generated by the Applilet You can look at this later in HTML format if you have time Function.html Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Macro.html file Applilet can also generate report in CSV format apart from the html format Step 2.18 Exit Applilet3, “File-> Exit” Question Name the compiler options supported by the Applilet for code generation? Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Bring Applilet code to e2studio Overview: This section explains how to bring the Applilet code to e studio workspace Procedural Steps Step 3.1 Step 3.1 Step 3.2 2 Start -> All Programs -> Renesas Electronics e studio -> Renesas e studio In the Workspace Launcher, select C:\Workspace or any other directory where you want to create the project A window similar to the one will appear Close the “Welcome” window Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Step 3.3 Click “FileNew  C Project”, a below window will open Enter the below information and click Next Project Name  myProject Project type  IAR RL78 Executable Toolchains  IAR Toolchain for RL78 Step 3.4 Step 3.5 In the next window browse the path for the IAR tool chain as “C:\Program Files\IAR Systems\Embedded Workbench 6.0_2” and click OK Select the RL78 device “R5F104PJ” and click the Finish button Using Renesas Code Generator Tool for RL78 Devices Page 10 of 20 LAB PROCEDURE Step 3.6 Step 3.7 Step 3.8 A Project will be created “myProject” Now Applilet generated code for IAR compiler will be imported to e studio's project file Click FileImport Select “File System” under General category in the import window and click “Next” There is a "From directory" textbox near the top, press the "Browse" button next to it in order to go to the directory where you generated the code from the Applilet and select Applilet3_src Using Renesas Code Generator Tool for RL78 Devices Page 11 of 20 LAB PROCEDURE Step 3.9 Put a check mark on applilet3 _src as shown below to select all files under this folder Under options, put a check mark on “Create complete folder structure” and Click “Finish” Step 3.10 You will see a new folder added in the project explorer window “applilet3_src” including all the source file and header files generated by the Applilet Using Renesas Code Generator Tool for RL78 Devices Page 12 of 20 LAB PROCEDURE Question 2 Can you guess if it is possible to open the IAR project directly from e studio without importing source files? Using Renesas Code Generator Tool for RL78 Devices Page 13 of 20 LAB PROCEDURE Edit and Build the Project Overview: This section edit the source code for the target application and Build the imported project files Procedural Steps Step 4.1 Before editing the source file, build the project “Project Build All” to make sure there is no compilation error in the Applilet generated code The Console window will show the results of the build command Step 4.2 Open the cg_main.c file and add the “R_TAU0_Channel0_Start();” in main() Make sure the code is written under the user code area marked as below to avoid overwriting the code when code is re-generated from Applilet /* Start user code for adding Do not edit comment generated here */ /* End user code Do not edit comment generated here */ Using Renesas Code Generator Tool for RL78 Devices Page 14 of 20 LAB PROCEDURE Step 4.3 Open r_cg_timer_user.c Enter the highlighted code as below: #pragma vector = INTTM00_vect interrupt void MD_INTTM00(void) { /* Start user code Do not edit comment generated here */ P4_bit.no1++; /* End user code Do not edit comment generated here */ } /* Start user code for adding Do not edit comment generated here */ /* End user code Do not edit comment generated here */ Step 4.4 Build the project Project->Build All Using Renesas Code Generator Tool for RL78 Devices Page 15 of 20 LAB PROCEDURE Debug and Run the Program Overview: This section describes how to launch the debugger and run the program on the target board Procedural Steps Step 5.1 Right click on Project name “myProject” and click on Property tab Step 5.2 Click on “C/C++ BuildSettingIAR RL78 XLINK linkerOutput” Change the format from default “C SPY(ubrof)” to “ELF/Dwarf” and Format variant to “Renesas compatible (yspc)” Using Renesas Code Generator Tool for RL78 Devices Page 16 of 20 LAB PROCEDURE Step 5.3 Connect the RDK board to PC via USB cable Make sure RDK board has DIP switch SW5 setting as below: 1: ON, 2:OFF, 3:ON, 4: ON Step 5.4 Go to “Run Debug Configuration” Double click on “Renesas GDB Hardware Debugging” This will create a entry as myProject Debug Click on “myProject Debug “under “Renesas GDB Hardware Debugging” Step 5.5 Click on the Debugger tab and select the Debug hardware as E1(RL78) and Target device as R5F104PJ Using Renesas Code Generator Tool for RL78 Devices Page 17 of 20 LAB PROCEDURE Step 5.6 Click “Debug” button to start the TK debugger Step 5.7 Click yes, to confirm the perspective switch from C/C++ to Renesas Debug perspective Step 5.8 Go to “r_cg_timer_user.c”, line 59 (Approx) and put a break in the following line of code Step 5.9 Step 5.10 Run the program The program will break at Interval timer interrupt function Remove the break point by double clicking on the breakpoint Step 5.11 Click Resume button Step 5.12 to run the program and observe the LED15 on the RDK board Click terminate button to stop the debugger Using Renesas Code Generator Tool for RL78 Devices Page 18 of 20 LAB PROCEDURE Output File for Renesas Programmer Overview: In order for the target device to run in stand-alone mode, the application must be written to the flash This section describes the procedure for how to generate an output file in Motorola hex format Procedural Steps Step 6.1 Select the Build configuration from “Project-> Build Configurartion->set activeRelease Step 6.2 Click on “C/C++ BuildSettingIAR RL78 XLINK linkerOutput” Change the output format from default“C SPY(ubrof)” to “Motorola” Step 6.3 Click on Build Artifact tab and replace the default Artifact extension from d87 to mot Using Renesas Code Generator Tool for RL78 Devices Page 19 of 20 LAB PROCEDURE Step 6.4 Build the project by “ProjectBuild All” Step 6.5 A folder name “Release “will be created and added in the project tree which includes the output file myProject.mot Question What is the default output format for the IAR tool chain in e2studio? Using Renesas Code Generator Tool for RL78 Devices Page 20 of 20 ... later in HTML format if you have time Function.html Using Renesas Code Generator Tool for RL78 Devices Page of 20 LAB PROCEDURE Macro.html file Applilet can also generate report in CSV format... “under ? ?Renesas GDB Hardware Debugging” Step 5.5 Click on the Debugger tab and select the Debug hardware as E1 (RL78) and Target device as R5F104PJ Using Renesas Code Generator Tool for RL78 Devices... variant to ? ?Renesas compatible (yspc)” Using Renesas Code Generator Tool for RL78 Devices Page 16 of 20 LAB PROCEDURE Step 5.3 Connect the RDK board to PC via USB cable Make sure RDK board has DIP

Ngày đăng: 22/06/2015, 14:17

Mục lục

  • 1.1.1.1 Using a Renesas Code Generation Tool for RL78 Devices

  • Kind of project = “Project for RL78/78K0R”

  • Using microcontroller = RL78/G14(ROM:256KB)-> R5F104PJ(100pin)

  • Using Build Tools = IAR Compiler

  • Project name =‘myRL78Project

  • Step 2.6 Select the On-Chip Debug setting Tab and make these settings:

  • Project type ( IAR RL78 Executable

  • Step 4.3 Open r_cg_timer_user.c. Enter the highlighted code as below:

  • Step 5.3 Connect the RDK board to PC via USB cable. Make sure RDK board has DIP switch SW5 setting as below:

  • 6 Output File for Renesas Programmer

    • Step 6.1 Select the Build configuration from “Project-> Build Configurartion->set active(Release

Tài liệu cùng người dùng

Tài liệu liên quan