Download presentation
Presentation is loading. Please wait.
Published byHugh Walton Modified over 9 years ago
1
Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. IAR Embedded Workbenches for Renesas
2
© 2012 Renesas Electronics America Inc. All rights reserved.2 Renesas Technology & Solution Portfolio
3
© 2012 Renesas Electronics America Inc. All rights reserved.3 Tour of the Embedded Workbench Renesas MCU support Hardware debugger support Example Projects C-SPY debugger advanced features visualSTATE overview Eclipse support Customer support Writing more efficient code Live demonstration Summary Agenda
4
© 2012 Renesas Electronics America Inc. All rights reserved.4 Introduction The Embedded Workbench enables developers to write the tightest and fastest code possible for their embedded designs. This session will explore the features of the toolchain and show you how to use them effectively.
5
© 2012 Renesas Electronics America Inc. All rights reserved.5 IAR Embedded Workbench
6
© 2012 Renesas Electronics America Inc. All rights reserved.6 Overview IAR Embedded Workbench IDE Custom plug-ins (editors, source code control systems, etc.) Plug-in to Eclipse IDE Segger J-Link Renesas E1 Renesas E20 3 rd party probes Segger J-Link Renesas E1 Renesas E20 3 rd party probes IAR visualSTATE Integrated RTOS partners
7
© 2012 Renesas Electronics America Inc. All rights reserved.7 Renesas MCU Support 32-bit RX SuperH V850 R32C RH850 16-bit RL78 78K0R M32C/M16C R8C H8S H8/300H 8-bit 78K0 78K0S
8
© 2012 Renesas Electronics America Inc. All rights reserved.8 IAR Embedded Workbench for Renesas RH850 Beta version planned for Autumn 2012 Based on the current EWV850 with: New instructions added Improved optimization including re-written arithmetic libraries C99 support New editor (source browser, auto completion, code folding, block selection, etc.) Improved inline assembler (GNU style) Improved stack analysis (Link-time analysis of max stack depth) Elf/Dwarf as object format Renesas ABI (Application Binary Interface) compliant – Link compatibility between toolchains – Ability to port existing object code into EWRH850 C-SPY support for Renesas emulators
9
© 2012 Renesas Electronics America Inc. All rights reserved.9 IAR Embedded Workbench for Renesas The only toolchain that supports virtually ALL Renesas devices! One IDE to access all your Renesas projects An Embedded Workbench workspace can have multiple projects, each one targeting a different Renesas architecture
10
© 2012 Renesas Electronics America Inc. All rights reserved.10 Hardware Debugging Support for Renesas
11
© 2012 Renesas Electronics America Inc. All rights reserved.11 Example Projects Ready-made example projects demonstrating the different peripheral’s of the MCU Most popular boards supported Kickstart version of EW included in Renesas Starterkits
12
© 2012 Renesas Electronics America Inc. All rights reserved.12 IAR Embedded Workbench for RX v2.40 2.76 Coremarks/MHz! Coremark Board: RDKRX62N, 96Mhz Result: 2.76 Coremarks/Mhz CoreMark Size : 666 Total ticks : 542918054 Total time (secs): 11.310793 Iterations/Sec : 265.233400 Iterations : 3000 Compiler version : Compiler flags : Memory location : STACK seedcrc : 0xe9f5 [0]crclist : 0xe714 [0]crcmatrix : 0x1fd7 [0]crcstate : 0x8e3a [0]crcfinal : 0xcc42 Correct operation validated. See readme.txt for run and reporting rules. CoreMark 1.0 : 265.233400 / / STACK
13
© 2012 Renesas Electronics America Inc. All rights reserved.13 EEMBC Benchmarks Published by Renesas
14
© 2012 Renesas Electronics America Inc. All rights reserved.14 IAR Embedded Workbench for RX v2.40 RX size benchmark This is a code size test on real customer applications where the size of linked code + constants has been compared. The test was performed with the following tools: IAR EWRX v2.40.0 Options: -e -Ohz --double=32 --data_model=f --align_func=1 --endian l --core RX600 –mfc Renesas RX v1.02.01 Options: -cpu=rx600 -fpu -optimize=max -size -goptimize Linker: -noprelink –optimize GNURX v12.01 -Os -fno-function-cse -funit-at-a-time -falign-jumps -fdata-sections -ffunction- sections -g3 -g -flto -mlittle-endian-data -mcpu=rx600 -c -x c Linker: --gc-sections -no-keep-memory -e _PowerON_Reset -loptm -loptc - lnosys –flto Customer application NameGNURXHEWRXEWRXEWRX vs GNURX EWRX vs HEWRX Blowfish algorithmblowfish65228222627596,2%76,3% Functions to descramble CSS encrypted DVD content. decrypt75219062723096,1%79,8% Reed-Solomon encoding/decoding Reed_Solom on 116158539624053,7%73,1% Microwave sensor application microwave20883282501825587,4%64,6% Bluetooth stackbt_stack54104634385371699,3%84,7% Car navigation system car_navig78194645735459669,8%84,5% Turbogenerator technology, "turbocompounding" engine_contr12875812496411677290,7%93,4% Remote monitoring and operation for generators and engines. generator22149918919118217782,2%96,3% Sum: 52909649623944526184,2%89,7%
15
© 2012 Renesas Electronics America Inc. All rights reserved.15 Embedded Workbenches Available Now! See www.iar.com/renesas for more informationwww.iar.com/renesas
16
© 2012 Renesas Electronics America Inc. All rights reserved.16 IAR C-SPY Debugger – Advanced Features
17
© 2012 Renesas Electronics America Inc. All rights reserved.17 IAR C-SPY Debugger Performance Analysis Dedicated breakpoint type Capable of measuring these execution aspects: total time total number of cycles number of cycles spent in interrupts and other exceptions the number of executed instructions the number of accepted interrupts and other exceptions.
18
© 2012 Renesas Electronics America Inc. All rights reserved.18 IAR C-SPY Debugger Complex Breakpoints Allows break at address condition and/or data condition Useful to detect access to a certain memory area and within a certain data range Can help you find where data gets clobbered in code Can help you see unauthorized access to memory areas
19
© 2012 Renesas Electronics America Inc. All rights reserved.19 IAR C-SPY Debugger Profiling/Code Coverage Profiling helps you to find the functions in your source code where the most time is spent during execution. Lets you know where to focus optimization efforts Can also help you see when you should inline a function call Code coverage helps you to verify whether all parts of the code have been executed.
20
© 2012 Renesas Electronics America Inc. All rights reserved.20 IAR C-SPY Debugger Trace Functionality Trace lets you inspect the program flow to a specific state. Information based on E1/E20 and J-Link trace capabilities. Choose between non-intrusive mode and richer trace information modes
21
© 2012 Renesas Electronics America Inc. All rights reserved.21 IAR C-SPY Debugger “During Execution” Features Breakpoints can be set/removed “Live watch” displays live data in the “Watch” window “Live memory” displays live data in the memory window The “RAM monitor” enables display of data read, written or both, with different colors in the memory window.
22
© 2012 Renesas Electronics America Inc. All rights reserved.22 IAR C-SPY Debugger Hot Attach Feature Possibility to let the debugger attach to a running application at its current location, without resetting the target system. When a board in the field is “in the weeds”, you can attach to it without resetting in order to determine what went wrong.
23
© 2012 Renesas Electronics America Inc. All rights reserved.23 IAR C-SPY Debugger Power Debugging Feature Ability to sample power consumption and correlate it to the program's instruction sequence and hence with the source code. C-SPY visualizes power consumption data in different views. Provides a view of the power profile of an application. Allows a developer to try different approaches to the application to minimize power footprint.
24
© 2012 Renesas Electronics America Inc. All rights reserved.24 IAR C-SPY Debugger RTOS Awareness RTOS kernel awareness Displays RTOS properties like: task lists, mailboxes, timers, semaphores, queues, and resources Built in support is currently available for: -ThreadX - Micrium uC/OS-II / III - Segger embOS - OSEK ORTI -FreeRTOS RTOS Overview Task List
25
© 2012 Renesas Electronics America Inc. All rights reserved.25 visualSTATE C-SPY Debug Integration Direct graphical feedback in C-SPY for state machines on various levels of detail, like current state vector, executed actions, received events etc.
26
© 2012 Renesas Electronics America Inc. All rights reserved.26 IAR C-SPY Debugger – Advanced Features Be sure to attend our lab section to see advanced debug features in action!
27
© 2012 Renesas Electronics America Inc. All rights reserved.27 Learning Renesas Tools Renesas provides a wide variety of starter, evaluation and development kits to fit any price point. All of these kits are supported by IAR Systems and many have a bevy of example applications to get your development effort kick-started!
28
© 2012 Renesas Electronics America Inc. All rights reserved.28 Eclipse Support Eclipse build chain plug-ins available for RX, V850, RL78, R32C and 78K Supports any Eclipse IDE distribution with CDT v3.5 (Galileo) or later Plug-ins included in Renesas e2studio
29
© 2012 Renesas Electronics America Inc. All rights reserved.29 Customer Support Support and Update Agreement (SUA) Free software updates First class world-wide technical support by telephone, e-mail and fax VIP Support contracts available ”My Pages” at www.iar.comwww.iar.com Read about new product releases Download product updates Transfer licenses to co-workers Manage your contact information Different architectures, one solution! We have compilers to support over 30 different architectures We are your one-stop compiler supplier
30
© 2012 Renesas Electronics America Inc. All rights reserved.30 Writing Efficient Code
31
© 2012 Renesas Electronics America Inc. All rights reserved.31 Controlling Optimization Global setting Over entire project Per-file settings When functions in a file must run as fast as possible. Per-function settings Use #pragma Compiler version dependent, so check your manual #pragma optimize=s 0 void delay(int time) {... }
32
© 2012 Renesas Electronics America Inc. All rights reserved.32 Structuring an Application Hardware Device Driver Files Generic Program Files Tuned Program Files To be efficient and portable, an application should: Isolate device-dependent code Leave most of the code undisturbed Use tuned code where needed
33
© 2012 Renesas Electronics America Inc. All rights reserved.33 Use Correct Data Sizes Different architectures have different natural data size Different available memories, sizes, etc. Using “Unnatural” data size might cost A 32-bit MCU might need to shift, mask and sign- extend operations to use smaller types A smaller MCU will need to store 32-bit data in multiple registers to hold all its contents and perform operations in RAM It is therefore better to use a natural size unless there is a compelling reason not to do so, e.g.: Perhaps you are doing I/O and you need a precise number of bits Bigger types like a char array might take up too much room
34
© 2012 Renesas Electronics America Inc. All rights reserved.34 Use Signedness Appropriately Think about signedness Division by a negative number is treated differently than that for a positive number (by the rules of the C language) Signed Negative values possible Arithmetic operations performed Using a signed number that never will be negative, incurs an extra test-and-jump condition Unsigned Negative values impossible Bit operations performed > | & ^ ~ > | & ^ ~ + - * / %
35
© 2012 Renesas Electronics America Inc. All rights reserved.35 Avoid Floating Point Arithmetic if Possible Floating point very expensive Brings in large library (from C runtime) Use only when really needed Can be done inadvertently: Example code: #define Other 20 #define ImportantRatio (1.95 * Other) #define ImportantRatioBetter int i=a + b * ImportantRatio;
36
© 2012 Renesas Electronics America Inc. All rights reserved.36 Avoid Floating Point Arithmetic if Possible IEEE 754: float Wide range: Float 10 -38 to 10 38, Double 10 -308 to 10 308 Good precision: Float 10 -7, Double 10 -16 Designed for giving small error in complex computations Expensive in size and speed –...unless there’s hardware support ”Real-world” data usually have: Fixed range Fixed precision Fixed-point arithmetic: Implemented using integers Can give significant savings (size and speed)...do the math before writing the code Use ”relaxed floating-point semantics”
37
© 2012 Renesas Electronics America Inc. All rights reserved.37 Avoid Becoming a Castaway C has implicit and explicit casts Casting is (usually) not free: Sign-extension and zero-extension Complex conversions to and from floating-point numbers Extending pointers Casting to/from pointers is bad Can lose information (smaller size) Inefficient code (larger size) Avoid unless really necessary Don’t do explicit casts Don’t mix types in expressions
38
© 2012 Renesas Electronics America Inc. All rights reserved.38 Structure your Structures Carefully Structures are padded when the CPU requires alignment or gains from it struct foo { uint8_t byte; uint32_t word; }; byte 1 byte padding to align “word” word 4 bytes 0 4 8 thus, foo 8 bytes
39
© 2012 Renesas Electronics America Inc. All rights reserved.39 Structure your Structures Carefully Waste of memory to pad? Packed structures require more code Simple guideline reduces need of padding Guideline: Order fields by size Largest object first, smallest object last struct record { long id;/* 4 bytes */ char* name;/* 2 bytes */ char* title;/* 2 bytes */ char tag;/* 1 byte */ };
40
© 2012 Renesas Electronics America Inc. All rights reserved.40 Use Global Variables Locally Copy value into a local variable Local variable probably placed in register, so operations on it is fast No memory reads Write back the value if needed. Gives more info to compiler “No function call will change the variable”
41
© 2012 Renesas Electronics America Inc. All rights reserved.41 Use Parameters and Local Variables Parameters and local variables: Give compiler more freedom Usually placed in registers …but can be placed in memory Parameter passing: First parameters usually in registers Registers to use = “calling convention” Register allocation targets: Simple values (integers, pointers, floating-point numbers) Hard to allocate: Arrays – indexed addressing the norm Structs – large, often pointed to Struct as parameter: Value copied, and a pointer passed Pass pointer directly for efficiency!
42
© 2012 Renesas Electronics America Inc. All rights reserved.42 Use Parameters and Local Variables Register usage: Variables can share a register Only present in register while “live” Don’t worry about “extra” variables Optimize: Minimize lifetime Minimize overlap void foo(char a) { char b,i,j; char h[10]; b=a<<5; for(i=0;… ) OUTPUT(b); for(j=0;… ) h[j]=a; } abi j live ranges
43
© 2012 Renesas Electronics America Inc. All rights reserved.43 Don’t Write “Clever” Code! ”Clever” code: “Fewer source characters = better code” Using dark corners of C semantics Straightforward code: Easy to read = easy to optimize Easy to maintain Use common constructions: – Likely to be better optimized “Clever” code unsigned long int a; unsigned char b; b |= !!(a<<11); Better code unsigned long int a; unsigned char b; if((a & 0x1FFFFF) != 0) b |= 0x01;
44
© 2012 Renesas Electronics America Inc. All rights reserved.44 Avoid Tight Timing Loops Empty delay loop does not work Code with no effect Gets removed Delay is always zero To really delay: Access volatile variable Use OS services Use CPU timer void delay(int time) { int i; for (i=0;i<time;i++) continue; return; } void InitHW(void) { OUT_SIGNAL (0x20); delay(120); OUT_SIGNAL (0x21); delay(121); OUT_SIGNAL (0x19); }
45
© 2012 Renesas Electronics America Inc. All rights reserved.45 Live Demonstration
46
© 2012 Renesas Electronics America Inc. All rights reserved.46 Questions? Questions?
47
© 2012 Renesas Electronics America Inc. All rights reserved.47 Tour of the Embedded Workbench Renesas MCU support Hardware debugger support Example Projects C-SPY debugger advanced features visualSTATE overview Eclipse support Customer support Writing more efficient code Live demonstration Summary
48
Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.