LAB PROCEDURE Renesas e2studio Advanced Features Page 1 of 10 Renesas e2studio Advanced Features RX Family Eclipse Labs Description: e 2 studio Advanced Features Lab Sections 1 Setup 2 2 Hello World 5 3 Editor Features 6 4 Sections 7 5 Viewing Global Variables 9 6 Libraries and Output Files 10 Lab Objectives 1. Project Generator 2. Hello World Creation 3. Basic Editor Features 4. Sections 5. Expression View 6. Output Files Skill Level 1. Previous C programming experience required 2. Previous MCU debugging experience recommended Time to Complete Lab 90 Minutes Lab Materials Please verify you have the following materials at your lab station. • Renesas e2studio (1.1.0.25 or later) • GNURX 12.02 Compiler or later • RDKRX63N Board and USB Cable • This Handout LAB PROCEDURE Renesas e2studio Advanced Features Page 2 of 10 1 Setup Overview: Getting Started Procedural Steps Step 1.1 Open Renesas Eclipse by using the Shortcut on the Desktop: Step 1.2 When it gives you the option of choosing a Workspace directory, choose: C:\Workspace Step 1.3 Once Eclipse is open at the Welcome page, click on the Workbench Arrow. LAB PROCEDURE Renesas e2studio Advanced Features Page 3 of 10 Step 1.4 Click File > New and create a new C Project Step 1.5 Give it a name and select the GNU RX Toolchain. Click Next. Step 1.6 Select the most recent version of GNU Toolchain, Segger J-Link and choose RX63NB LAB PROCEDURE Renesas e2studio Advanced Features Page 4 of 10 Step 1.7 Use the default settings for the remaining settings Step 1.8 Your Workspace should now look like this LAB PROCEDURE Renesas e2studio Advanced Features Page 5 of 10 2 Hello World Overview: Get your blank project to do something useful. Procedural Steps Step 2.1 Expand out your Project in the Project Explorer and look under the “src” directory for lab1.c (or your project wizard generated main C file) – open it. Feel free to have a look around at the other files and directories; they were created with the standard project generator. Step 2.2 Edit the existing project file named lab1.c to replace the existing code with new badly formatted code (all against the left margin) which prints a text string: #include <stdio.h> #include "iodefine.h" int main(void) { while (1) { printf("Hello World! \n"); } return 0; } Step 2.3 Build the project Step 2.4 Run the application within the GDB simulator (right click on the project in the navigation pane and select Run As >> Renesas GDB Simulator LAB PROCEDURE Renesas e2studio Advanced Features Page 6 of 10 3 Editor Features Overview: Work with e2studio to modify a project Procedural Steps Step 3.1 Highlight the entire main() function and press CTRL+i This will auto-indent the selected code and tidy it up for you. Step 3.2 Highlight all the code in your main c file. Click Tab. Click [Shift] Tab. Step 3.3 You can indent whole chunks of code ! Step 3.4 In main() function add a local variable and counter sig1++; #include <stdio.h> #include "iodefine.h" int main(void) { unsigned int sig1 = 0; while (1) { printf("Hello World! \n"); sig1++; } return 0; } Highlight the sig1++; line of code and press CTRL+Space Create a do while loop that counts to 10000 for a simple delay. Note the other auto-complete options that are available for this variable. One it exits the loop, reset sig1 to Zero Press CTRL+B to Rebuild the projects in the workspace Step 3.5 Click Help > Key Assist to view all available shortcuts and features. These are customizable from Windows > Preferences > General > Editors > Keys LAB PROCEDURE Renesas e2studio Advanced Features Page 7 of 10 4 Sections Overview: Using e2studio to manage program memory sections. Procedural Steps Step 4.1 Terminate the previous Debug Session Step 4.2 Return to the C/C++ Perspective (CTRL+Shift+F8) Step 4.3 Close Lab1 and Create a New C Project – Lab2 Step 4.4 Once the blank project is created and built, Use Run > Debug to connect to the RDK board and familiarize yourself with Restart , Step and Resume MCU debug features. Be careful not to use RUN which runs and resets the debugger session – not the MCU. Step 4.5 Use Project > Properties or right click your project in the Project Explorer pane and select Properties Step 4.6 Navigate to C/C++ Build > Settings Step 4.7 In the Renesas Tool Settings window, you will see all the available compiler, assembler and linker options. Select Linker / Sections Step 4.8 Create a New Section at Fixed Address 0xFFFC0E00 called .mysection LAB PROCEDURE Renesas e2studio Advanced Features Page 8 of 10 Step 4.9 Once your Section has been created, make a new project with the following code to demonstrate placing a function in a specified area of memory: Note: Underscores are DOUBLE underscore _ _ #include "iodefine.h" void myfunction (void) __attribute__ ((section (". mysection "))); unsigned int i, j = 0; int main(void) { while (1) { myfunction(); i++; } return 0; } void myfunction(void) { j++; } Step 4.10 Build the Project Step 4.11 Click Run > Debug to connect to the Debugger Step 4.12 Click Window > Show View > Trace to pull up the Trace window in the Debug Perspective Step 4.13 Set a Breakpoint in myfunction Step 4.14 Run the code (Resume). Pay attention to the Stack Trace – it should show you jumping through memory to your section as it executes code there. LAB PROCEDURE Renesas e2studio Advanced Features Page 9 of 10 5 Viewing Global Variables Overview: Using e2studio to manage program memory sections. Procedural Steps Step 5.1 Continuing to use the previous lab content, click on the Expressions Tab in the Debug Perspective Step 5.2 Expressions are where we show Global variables Step 5.3 Click “Add new expression” and add j – our Global that is incremented in myfunction() Step 5.4 Set a breakpoint at j++; by double clicking in the blue gutter next to the source code Step 5.5 Click Resume and observe the variable j is incremented each time Step 5.6 Now double click to remove the breakpoint and then right-click on j in the Expressions window Step 5.7 Select “Monitor in Realtime” then right-click again and click “Add to Chart” – observe the realtime watch and chart when you Resume code execution Step 5.8 Create a do while loop around j++; (highlight the variable in source and CTRL+Space) Step 5.9 Use this to count up to a specific point then reset j. Observe a saw-tooth wave in the Realtime Chart window. LAB PROCEDURE Renesas e2studio Advanced Features Page 10 of 10 6 Libraries and Output Files Overview: How to Modify Project options Procedural Steps Step 6.1 Switch back to the C/C++ Perspective Step 6.2 Use Project > Properties or right click your project in the Project Explorer pane and select Properties Step 6.3 Navigate to C/C++ Build > Settings Step 6.4 In the Renesas Tool Settings window, you will see all the available compiler, assembler and linker options. Select Library Generator / Settings Step 6.5 Newlib = Complete ISO C/C++ Library / Optimized = Subset C only Pre-built = Object Files only in Project / Project Built = Source Level Debug available Step 6.6 Choose Optimized, Project Built Library and Rebuild your project – observe the time taken to build and the ability to debug the printf() in the stdio library from Section 3 of this handout. Step 6.7 Time Left? Open Play…Please try to break Renesas e2studio, but make notes as you do, we welcome the feedback . LAB PROCEDURE Renesas e2studio Advanced Features Page 1 of 10 Renesas e2studio Advanced Features RX Family Eclipse Labs Description: e 2 studio Advanced Features . lab station. • Renesas e2studio (1.1.0.25 or later) • GNURX 12.02 Compiler or later • RDKRX63N Board and USB Cable • This Handout LAB PROCEDURE Renesas e2studio Advanced Features Page. Renesas e2studio Advanced Features Page 4 of 10 Step 1.7 Use the default settings for the remaining settings Step 1.8 Your Workspace should now look like this LAB PROCEDURE Renesas e2studio