Presentation is loading. Please wait.

Presentation is loading. Please wait.

Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Class ID: CC05B RX Project Configuration Tips John Breitenbach,

Similar presentations


Presentation on theme: "Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Class ID: CC05B RX Project Configuration Tips John Breitenbach,"— Presentation transcript:

1 Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Class ID: CC05B RX Project Configuration Tips John Breitenbach, Senior Engineering Manager CC05B

2 © 2012 Renesas Electronics America Inc. All rights reserved.2 Senior Engineering Manager Manage apps engineering team for RX & RL78 Software libraries, app notes, sample code Custom work for customers Life before Renesas Patent #7,054,045 for Holographic HMI First computers: Atari 800 Timex Sinclair 1000 – 16K! John Breitenbach

3 © 2012 Renesas Electronics America Inc. All rights reserved.3 Renesas Technology & Solution Portfolio

4 © 2012 Renesas Electronics America Inc. All rights reserved.4 Microcontroller and Microprocessor Line-up Wide Format LCDs  Industrial & Automotive, 130nm  350µA/MHz, 1µA standby 44 DMIPS, True Low Power 165 DMIPS, FPU, DSC 1200 DMIPS, Performance 1200 DMIPS, Superscalar 500 DMIPS, Low Power 165 DMIPS, FPU, DSC 25 DMIPS, Low Power 10 DMIPS, Capacitive Touch  Industrial & Automotive, 150nm  190µA/MHz, 0.3µA standby  Industrial, 90nm  500µA/MHz, 1.6µA deep standby  Automotive & Industrial, 90nm  600µA/MHz, 1.5µA standby  Automotive & Industrial, 65nm  600µA/MHz, 1.5µA standby  Automotive, 40nm  500µA/MHz, 35µA deep standby  Industrial, 40nm  200µA/MHz, 0.3µA deep standby  Industrial & Automotive, 130nm  144µA/MHz, 0.2µA standby 2010 2012 32-bit 8/16-bit

5 © 2012 Renesas Electronics America Inc. All rights reserved.5 Challenge: “The Smart Society can only be made possible by Smart Products. You, the Smart Engineers, are the ones who must create these Smart Products in ever shorter design cycles.” Solution: “This session will make you Smarter Engineers by shining a light on some of the most common stumbling blocks for engineers working on RX-based products.” ‘Enabling The Smart Society’

6 © 2012 Renesas Electronics America Inc. All rights reserved.6 Reset & interrupt vectors Flash-based options ID code Stacks & heaps Clock C runtime environment Review of startup code Q & A Agenda

7 © 2012 Renesas Electronics America Inc. All rights reserved.7 Two vector tables Fixed vector table – top of memory (0xFFFFFF80 to 0xFFFFFFFF) Relocatable vector table (auto-generated & #pragmas) Fixed Vectors Reset Vector - make sure you have one! Fixed_Vectors[] in vector_table.c Other Exceptions: undefined inst., NMI, supervisor violation Also includes ID code for some parts Relocatable vectors Contains vectors for peripherals (>200) Startup code points INTB to relocatable vector table Tip: Use the default handler (“Empty Vector”) Reset & Interrupt Vectors

8 © 2012 Renesas Electronics America Inc. All rights reserved.8 WDT, IWDT, LVDT, HOCO, endian Some located in the fixed vector table Some located in User Boot Flash All 0xFF’s (erased) means No watchdogs Little-endian HOCO off at boot Low-voltage monitor 0 reset disabled Located in the one of the following places HEW project generator: Flash_options.c e 2 studio blank project: vector_table.c FIT: r_bsp_config.h Flash-Based Options (RX63X, RX21x)

9 © 2012 Renesas Electronics America Inc. All rights reserved.9 Used to protect chip from unauthorized read/modifications Three modes: No protection Always reports non-matching ID (permanent lock) Allows access w/ matching ID Detailed in “ROM” chapter of HW Manual Lives in fixed vector table Be careful you don’t have code/constants there – If you do, you’ll lock yourself out! Locked chips can be erased & recovered in serial boot mode Where to find it: Fixed vector table in vector_table.c FIT: r_bsp_config.h Flash-Based ID Code

10 © 2012 Renesas Electronics America Inc. All rights reserved.10 Stacks & Heaps Q: What’s the difference between stack and heap? StackHeap Automatic variables (locals)Dynamically allocated memory Parameters for function callsMalloc/Calloc Return address for function callsC++ new() Automatic create & clean-upStays allocated until clean-up Fast create/deleteSlow create/delete RequiredOptional

11 © 2012 Renesas Electronics America Inc. All rights reserved.11 Stacks & Heaps Stacks Two stacks on the RX: User & Interrupt User stack is optional Each has independent size Three steps to use: – 1. Define the size – 2. Define the location – 3. Load them at startup Project TypeSizeLocationLoad RX CStacksct.hLinker map#pragma stacksize FIT ProjectsR_bsp_config.hLinker map#pragma stacksize GCCLinker map** Reset_program.asm

12 © 2012 Renesas Electronics America Inc. All rights reserved.12 Stacks & Heaps Heap Must include sbrk.c Located in RAM w/ the rest of static variables (section B_1) HEW project generator w/ RX C: Size defined in sbrk.h – #define HEAPSIZE 0x4000 FIT projects: Size defined in r_bsp_config.h – #define HEAP_BYTES (0x4000) GCC projects: uses ALL left-over RAM by default – May not be what you want!

13 © 2012 Renesas Electronics America Inc. All rights reserved.13 Tips Put stacks at start of RAM (they grow down) Fill stack memory at startup with pattern – Monitor it in debugger memory window Old school: Don’t use heap if you can avoid it! – Dynamic memory problems are hard to debug – Can lead to non-deterministic behavior – No error checking in default handler If you must use the heap – Allocate memory soon after startup; don’t free it – Useful when buffers allocated based on runtime config Stacks & Heaps

14 © 2012 Renesas Electronics America Inc. All rights reserved.14 Specific to chip RX63x, RX21x Starts on LOCO (125 kHz) Switch to high speed before C init RX610, RX62x Starts @ crystal speed (usually 12 MHz) OK to do clock switch after C init Where to find it: HEW project generator: HWSetup.C (maybe) FIT: r_bsp_config.h Clock Setup

15 © 2012 Renesas Electronics America Inc. All rights reserved.15 Copies initialized data from ROM to RAM char prompt[] = “Enter name”; float setpoint = 72.5f; Zeroes uninitialized data Can be time-intensive Especially if running off LOCO Check ResetPRG.c for _INITSCT() call Switch to high-speed clock is BEFORE _INITSCT() Add additional sections to copy ROM to RAM Code for flash programming Add linker section; modify dbsct.c C Runtime Environment Initialization

16 © 2012 Renesas Electronics America Inc. All rights reserved.16 #pragma entry PowerON_Reset_PC void PowerON_Reset_PC(void) { MVTC#00001000H,USP// Only in mixed mode view MVTC#00001400H,ISP // Relocatable vectors set_intb((void *)__sectop("C$VECT")); set_fpsw(FPSW_init);// Floating point status _INITSCT();// Init C runtime … HardwareSetup();// Setup clock other hardware set_psw(PSW_init);// Set Ubit & Ibit for PSW Change_PSW_PM_to_UserMode();// Change PSW PM bit … main();// Call user code … brk();// Should never get here } RX startup code: RX610/RX62N (ResetPrg.c)

17 © 2012 Renesas Electronics America Inc. All rights reserved.17 void PowerON_Reset_PC(void) { MVTC#00001000H,USP// Only in mixed mode view MVTC#00001400H,ISP // Relocatable vectors set_intb((void *)__sectop("C$VECT")); set_fpsw(FPSW_init);// Floating point status operating_frequency_set();// Set clock to high-speed _INITSCT();// Init C runtime … HardwareSetup();// Setup other hardware set_psw(PSW_init);// Set Ubit & Ibit for PSW Change_PSW_PM_to_UserMode();// Change PSW PM bit … main();// Call user code … brk();// Should never get here } RX startup code: RX63x/RX210 (ResetPrg.c)

18 © 2012 Renesas Electronics America Inc. All rights reserved.18 Optimization Dang near impossible to outsmart the compiler Choose either “Speed” or “Size” – A side note about the RX210 and the RX instruction set Turn off for debug Default project settings in HEW Doubles are singles by default Chars are unsigned by default Bit fields are right-to-left by default Endian settings A Quick Note On Other Settings Warp speed, Scotty! I can’t do it, Captain!

19 © 2012 Renesas Electronics America Inc. All rights reserved.19 Questions? Questions?

20 © 2012 Renesas Electronics America Inc. All rights reserved.20 Challenge: “The Smart Society can only be made possible by Smart Products. You, the Smart Engineers, are the ones who must create these Smart Products in ever shorter design cycles.” Solution: “This session will make you Smarter Engineers by shining a light on some of the most common stumbling blocks for engineers working on RX-based products.” ‘Enabling The Smart Society’

21 © 2012 Renesas Electronics America Inc. All rights reserved.21 Please utilize the ‘Guidebook’ application to leave feedback or Ask me for the paper feedback form for you to use… Please Provide Your Feedback…

22 Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved.


Download ppt "Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Class ID: CC05B RX Project Configuration Tips John Breitenbach,"

Similar presentations


Ads by Google