Instruction/ maintenance manual of the product CAVR-4 Atmel
Go to page of 323
CA VR-4 A VR® IAR C/C++ Compiler Refer ence Guide for Atmel® Corporation’ s AV R ® Micr ocontr oller.
CA VR-4 COP YRIGHT NOTICE © Copyright 1996–20 05 IAR Syst ems. All rights reserved. No part of this document ma y be reproduced without the pr ior written consent of IAR Systems. The soft w are described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license.
CA VR-4 iii Brief contents T ables ............ ............ ......... ........... ........... ........... ........... ........... ........... ........... ........ xv Pr eface .... ........... ........... ........... ......... ........... ........... .
CA VR-4 iv A VR® IAR C/C++ Compiler Refer ence Guide Implementation-defined beha vior ........ ........... ........... ........... ........... ...... 255 IAR language extensions .................. ........... ......... ........... ........... .......
CA VR-4 v Contents T ables ............ ............ ......... ........... ........... ........... ........... ........... ........... ........... ........ xv Pr eface .... ........... ........... ........... ......... ........... ........... ........
CA VR-4 vi A VR® IAR C/C++ Compiler Refer ence Guide Data storage .......... ........... ........... ........... ........... ............ ........... ........... ......... ..... 15 Introduction ............ ........... ........... ........... .......
CA VR-4 Contents vii The return addres s stack ...... ........... ........... ........... ............ ........... ...... 43 The heap ........ ........... ........... ......... ........... ........... ........... ........... ......... 44 Located data .
CA VR-4 viii A VR® IAR C/C++ Compiler Refer ence Guide System startup and term ination ..... ............ ........ ............ ........... ...... 64 System startup .................. ........... ........... ........... ........... ........... ......
CA VR-4 Contents ix math.h ...... ........... ........... ........... ......... ............ ........... ........... ........... .... 83 stdio.h ...... ........... ........... ........... ............ ........... ........... ........... ........... ..
CA VR-4 x A VR® IAR C/C++ Compiler Refer ence Guide Preserved ve rsus scratch regist ers ......... ........... ........... ............. ....... 101 Function call .. ........... ........... ........... ........... ........... ............ ...........
CA VR-4 Contents xi Writing efficient code .. ........... ........... ........... ........... ............ ........... .... 130 Saving stack spa ce and RAM memory ......... ........... ............. ........... 131 Function prototypes ..... ..........
CA VR-4 xii A VR® IAR C/C++ Compiler Refer ence Guide Compiler options . ........... ........... ........... ......... ........... ........... ............ ........... ... 167 Setting command line options ............ ........... ........... ........
CA VR-4 Contents xiii Library functions as intrin sic functions ............ ........... ........... ......... 248 IAR CLIB Library ......... ........... ......... ........... ........... ........... ........... ......... 248 Library definiti ons summary .
CA VR-4 xiv A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 xv Ta b l e s 1: Typographic conventions used in this guide ..... ........... ................................. ...... xxii 2: Mapping of processor opti ons ........... .............. ........... ........... ............. ........... .........
CA VR-4 xvi A VR® IAR C/C++ Compiler Refer ence Guide 32: Floating-point t ypes ......... ............. ........... ........... ............ ........... ........... ............ 139 33: Function pointers ......... .............. ........... .........
CA VR-4 Ta b l e s xvii 66: Nearfunc pointer size ................ ........... ........... ............. ........... ............ ........... ... 211 67: Tiny address ranges ........ ........... ........... ........... ............. ........... ......
CA VR-4 xviii A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 xix Pr eface W elcome to the A VR® IAR C/C++ Compiler Ref erence Guide. Th e purpose of this guide is to pro vide you with detailed refer ence i nformation that can help you to use t he A VR IAR C/C++ Compiler to best suit your applicat ion requir ements.
CA VR-4 xx What this guide contains A VR® IAR C/C++ Compiler Refer ence Guide What this guide contains Below is a brief outline and summar y of the chapters in this guide. P art 1. Using the compiler ● Getting started giv es the information you need to get started using the A VR IAR C/C++ Compiler for eff iciently dev eloping your application.
CA VR-4 Preface xxi ● Library functions gives an introduction to the C or C++ library functions, and summarizes the header f iles. ● Implementation-def ined behavior describes how the AVR IAR C/C++ Compiler . handles the implementation-defined areas of the C language standard.
CA VR-4 xxii Document con ventions A VR® IAR C/C++ Compiler Refer ence Guide W e recommend that you visit the following websites: ● The Atmel® Corporation website, www.atmel.com , contains information and ne ws about the A VR microcontrollers. ● The IAR website, www.
CA VR-4 1 P ar t 1. Using the compiler This part of the A VR® IAR C/C++ Compiler Refer ence Guide includes the follo wing chapters: ● Getting started ● Data storage ● Functions ● Placing code.
CA VR-4 2.
CA VR-4 Part 1. Using the compiler 3 Getting star ted This chapter giv es the information you need to get star ted using the A VR IAR C/C++ Compiler for efficiently de veloping y our application.
CA VR-4 4 Building applications—an ov er view A VR® IAR C/C++ Compiler Refer ence Guide For more information about the Embedded C++ language and IAR Extended Embedded C++, see the c hapter Using C++ . Building applications—an o verview A typical application is built from a number of source files and libraries.
CA VR-4 Part 1. Using the compiler Getting started 5 In this example, myfile . r90 and myfile2.r90 are object files, lnkm128s.xcl is the linker comm and file, and cl3s-ec.r90 is th e runtime library . The option -s spe cifies the label where the appli c ation starts.
CA VR-4 6 Basic settings for project configuration A VR® IAR C/C++ Compiler Refer ence Guide Both options set up default beha vior—i mplicit assumptions—but note that the --cpu option is more precise because it contains more information about the intended tar get than the mo re generic -v option.
CA VR-4 Part 1. Using the compiler Getting started 7 --cpu=at43usb320a -v3 A T43USB320A --cpu=at43usb325 -v3 A T43USB325 --cpu=at43usb326 -v3 A T43USB326 --cpu=at43usb351m -v3 A T43USB351m --cpu=at43u.
CA VR-4 8 Basic settings for project configuration A VR® IAR C/C++ Compiler Refer ence Guide Summar y of pr ocessor configuration The follo wing table summarizes t he memory characterist ics for each.
CA VR-4 Part 1. Using the compiler Getting started 9 Note: ● *) When using the -v5 or the -v6 option, it is possible, for indi vidual functions, to ov erride the _ _farfunc attribute and instead use.
CA VR-4 10 Basic settings for project configuration A VR® IAR C/C++ Compiler Refer ence Guide Y our program may use only one memory model at a time, and the same model must be used by all user modules and all library modules.
CA VR-4 Part 1. Using the compiler Getting started 11 RUNTIME EN V IRONMENT T o create the required runtime en vironment you should choose a runtime library and set library options. Y ou may also need to ove rride certain library modules with your own customized versions.
CA VR-4 12 Special support for embedded systems A VR® IAR C/C++ Compiler Refer ence Guide Choosing a runtime librar y from the command line Use the follow ing command line options to specify the libr.
CA VR-4 Part 1. Using the compiler Getting started 13 The command line option - e makes the e xtended keywords a v ailable, and reserves them so that they cannot be used as variable names. See, -e , page 179 for additional information. For detailed descriptions of the extended k eywords, see the chapter Extended keywor ds .
CA VR-4 14 Special support for embedded systems A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part 1. Using the compiler 15 Data stora g e This chapter gives a brief introduction to the memor y lay out of the A VR microcontr oller and the fundamental wa ys data can be stor ed in memor y: on the stack, in st atic (global) m emor y , or in heap memor y .
CA VR-4 16 Introduction A VR® IAR C/C++ Compiler Refer ence Guide ● On the heap. Once memory has been allo cated on the heap, it remains va lid until it is explicitly released back to the system b y the application. This type of memory is useful when the number of objects is not known until the applic atio n executes.
CA VR-4 Part 1. Using the compiler Data storage 17 Note that the location of the pointer variable p is not af fected by the keyw ord. In the following e xample, howe ver , the pointer variable p2 is placed in far memo ry . Like p , p2 points to a character in EEPR OM memory .
CA VR-4 18 Memory types and memor y attributes A VR® IAR C/C++ Compiler Refer ence Guide Y our project can only use one memory model at a time , and the sa me model must be used by all user modules and all library modules.
CA VR-4 Part 1. Using the compiler Data storage 19 By selecting a memory model , you ha ve selected a default memory type that your application will us e. Ho wever , it is possible to sp ecify—for individual variables or pointers—different memory types.
CA VR-4 20 Memory types and memor y attributes A VR® IAR C/C++ Compiler Refer ence Guide The ke ywords are only av ailable if language extensions are enabled in the A VR IAR C/C++ Compiler . In IAR Embedded W orkbench, language extensions are enabled by def ault.
CA VR-4 Part 1. Using the compiler Data storage 21 Differ ences between pointer types A pointer must contain information needed to specify a memory location of a certain memory type. This m eans that the pointer sizes are di fferent for dif ferent memory types.
CA VR-4 22 C++ and memory types A VR® IAR C/C++ Compiler Refer ence Guide In short: C++ and memor y types A C++ class object is placed in one memory type, in the same way as for normal C structures. Ho wev er , the class members that are considered to be part of the object are the non-static member v ariables.
CA VR-4 Part 1. Using the compiler Data storage 23 Example In the example belo w , an object, named delta , of the type MyClass is defined in data16 memory .
CA VR-4 24 The stack and auto variables A VR® IAR C/C++ Compiler Refer ence Guide The stack is a fix ed block of memory , divide d into two parts. The first part contains allocated memory used b y the function that called the current fu nction, and the function that called it, etc.
CA VR-4 Part 1. Using the compiler Data storage 25 Dynamic memor y on the heap Memory for objects a llocated on the heap wil l live until the objects are explicitly released. This type of memory storage is ve ry useful for applications where the amount of data is not kno wn until runtime.
CA VR-4 26 Dynamic memory on the heap A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part 1. Using the compiler 27 Functions This chapter contains information abou t functions. First, y ou get a brief ov er view of mechanisms for contr olling functions, as w ell as information about memor y type attributes for function st orage .
CA VR-4 28 Function stor age A VR® IAR C/C++ Compiler Refer ence Guide Syntax The extended ke ywords are specified be fore the return type, for example: _ _interrupt void alpha(void); The keyw ords that are type attrib utes must be specified both when they are def ined and in the declaration.
CA VR-4 Part 1. Using the compiler Functions 29 Special function types This section describes the sp ecial function types interrupt and monitor . The A VR IAR C/C++ Compiler allo ws an application to take ful l advantage of these A VR features, without forcing you to implemen t anything in as sembler language.
CA VR-4 30 Special function types A VR® IAR C/C++ Compiler Refer ence Guide MONITOR FUNCTIONS A monitor function causes interrupts to be disabled during ex ecution of the function. At function entry , the status register is sav ed and interrupts are disabled.
CA VR-4 Part 1. Using the compiler Functions 31 The following is an example of a program fragment that uses the semaphore: void my_program(void) { if (get_lock()) { /* ... Do something ... */ /* When done, release the lock. */ release_lock(); } } The drawback using this method is that in terrupts are disabled fo r the entire moni tor function.
CA VR-4 32 Special function types A VR® IAR C/C++ Compiler Refer ence Guide void f() { static long next_stop = 100; extern void do_stuff(); long tick; /* A critical block */ { Mutex m; /* Read volati.
CA VR-4 Part 1. Using the compiler 33 Placing code and data This chapter intr oduces the concept of segments, and describes the differ ent segment groups and segment types. It al so describes how they corr espond to the memor y and function types, and how the y interact with the runtime envir onment.
CA VR-4 34 Placing segments in memory A VR® IAR C/C++ Compiler Refer ence Guide For detail ed information about i ndividual se gments, see the chapter Se gment refer ence in P art 2. Compiler refer ence . Segment memor y type XLINK assigns a se gment memory type to each of the segments.
CA VR-4 Part 1. Using the compiler Placing code and data 35 CUSTOMIZING THE LINK ER COMMAND FILE The only change you will normally ha ve to ma ke to the supplied linker command f ile is to customize it so it reflects the tar get system memory map.
CA VR-4 36 Placing segments in memory A VR® IAR C/C++ Compiler Refer ence Guide See the IAR Linker and Libr ary T ools Reference Guide for more details.
CA VR-4 Part 1. Using the compiler Placing code and data 37 Note: Copy initialization segments— BASENAME _I and B ASENAME _ID —must be placed using -Z. Data segments This section contains descriptions of the segm ents used for storing the dif ferent types of data—static, stack, heap, and located.
CA VR-4 38 Data segments A VR® IAR C/C++ Compiler Refer ence Guide would yield the se gment base name NEAR . The suf fix indicates what type of de clared data the segment holds.
CA VR-4 Part 1. Using the compiler Placing code and data 39 Initialized data In ISO/ANSI C all static v ariables—v ariables that are allocated at a f ixed memory address—ha ve to be initialized b y the run-time system to a known v alue.
CA VR-4 40 Data segments A VR® IAR C/C++ Compiler Refer ence Guide 3 Finally , global C++ objects ar e constructed, if any . Initialization of local aggr egates at function in vocation Initialized ag.
CA VR-4 Part 1. Using the compiler Placing code and data 41 address of a constant _ _flash object and use it as a default pointer object, th e compiler will issue an error .
CA VR-4 42 Data segments A VR® IAR C/C++ Compiler Refer ence Guide If externa l SRAM is av ailable it is possible t o place the stack there. Howe ver , the extern al memory is slo wer than the internal stack so mo ving it to external memory will decrease the performa nce.
CA VR-4 Part 1. Using the compiler Placing code and data 43 THE RETURN AD DRESS STACK The return address stack is used fo r storing the return address when a CALL , RCALL , ICALL , or EICALL instruction is e xecuted. Each ca ll will use two or three b ytes of return address stack.
CA VR-4 44 Data segments A VR® IAR C/C++ Compiler Refer ence Guide THE HEAP The heap contains dynamic data al located by use of the C function malloc (or one of its relati ves) or the C++ operator new .
CA VR-4 Part 1. Using the compiler Placing code and data 45 Heap siz e allocation in IAR Embedded W orkbench Select Project>Options . In the General Options category , click the Heap configuration pag e. Add the required heap size in the appropriate text box.
CA VR-4 46 Code segments A VR® IAR C/C++ Compiler Refer ence Guide LOCATED DATA A variab le that has been e xplicitly placed at an address, for example by using the compiler @ syntax, will be placed in either the SEGMENT _AC or the SEGMENT _AN segment.
CA VR-4 Part 1. Using the compiler Placing code and data 47 In the link er command file it can look like this: -Z(CODE)CODE=0-1FFF USER -DEFINED SEGMENTS If you create your o wn segments—see Contr olling data and function placement , page 47—these must also be defined in the link er command file using the -Z or -P se gment control directi ves.
CA VR-4 48 Efficient usage of segments and memory A VR® IAR C/C++ Compiler Refer ence Guide Note: Take care whe n explicitly placing a variable or functio n in a prede fined segment other than the one used by default.
CA VR-4 Part 1. Using the compiler Placing code and data 49 Example _ _no_init int alpha @ "MYSEGMENT"; /* OK */ #pragma location="MYSEGMENT" const int beta=5; /* OK */ const int g.
CA VR-4 50 V erifying the linked r esult of c ode and data placement A VR® IAR C/C++ Compiler Refer ence Guide A typical situation wher e this can be useful is if you ne ed to optimize accesses to code and data that is frequently used, and place it in a dif ferent physical memory .
CA VR-4 Part 1. Using the compiler Placing code and data 51 Normally , XLINK will not genera te an output file if ther e are any errors, such a s range errors, during the linking process.
CA VR-4 52 V erifying the linked r esult of c ode and data placement A VR® IAR C/C++ Compiler Refer ence Guide The IAR P ostlink utility Y ou can also use the IAR Postlink utility , deliv ered with the A VR IAR C/C++ Compiler to generate multiple output fi les.
CA VR-4 Part 1. Using the compiler 53 The DLIB runtime en vir onment This chapter descr ibes the runtime en vironment in which an appl ication ex ecutes.
CA VR-4 54 Introductio n to the runtime environment A VR® IAR C/C++ Compiler Refer ence Guide The runtime library is deliv ered both as prebuilt libraries and as source files, and you can find them in the product subd irectories avrlib and avrsrc , respecti vely .
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 55 SITUATIONS THAT REQUIRE LIBRAR Y BUILDING Building a customized librar y is comple x.
CA VR-4 56 Using a prebuilt library A VR® IAR C/C++ Compiler Refer ence Guide DEBUG SUPPOR T IN THE RUNTIME LIBRAR Y Y ou can make the library provide different le vels of deb ugging support—basic, runtime, and I/O debugging.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 57 ● Small flash memory option ( --64k_flash ) ● 64-bit doubles option ( --64bit_doubles ) ● Library configuration—Normal or Full.
CA VR-4 58 Using a prebuilt library A VR® IAR C/C++ Compiler Refer ence Guide On the command line, you must specify the follo wing items: ● Specify which library object file to use on t he XLINK command line, for in stance: dlavr-3s-ec-64-f.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 59 Choosing fo rmatters for printf and scanf T o ov erride the default formatter for all the printf- and scanf -related functio ns, except for wprintf and wscanf v ariants, you simply set the appropriate library options.
CA VR-4 60 Choosing formatters fo r printf and scanf A VR® IAR C/C++ Compiler Refer ence Guide For information about how to fine-tune the formatting capabilities even further, see Configuration symbols for printf and scan f , page 69 .
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 61 For information about how to fine-tune the formatting capabilities even further, see Configuration symbols for printf and scan f , page 69 .
CA VR-4 62 Building and using a customized librar y A VR® IAR C/C++ Compiler Refer ence Guide Over riding librar y modules from the command line This procedure is applicable to any source file in the library , which means library_module .c in this example can be any module in the library .
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 63 SETTING UP A LIBRAR Y PROJECT IAR Embedded W orkbench provides a library project templa te whic h can be used for customizing the runtime en vir onment configuration. This library template has full library conf iguration, see T able 13, Library configur ations , page 55.
CA VR-4 64 System startup and termination A VR® IAR C/C++ Compiler Refer ence Guide System star tup and termination This section describes the runtime en vironment actions performs during startup and termination of applications.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 65 SYSTEM STAR TUP When an applicati on is initialized , a number of steps are performed: ● When the cpu is reset it will jum p to the program entry label _ _program_start in the system startup code.
CA VR-4 66 Customizing system init ialization A VR® IAR C/C++ Compiler Refer ence Guide C-SPY interface to system termination If your project is link ed with the XLINK options With runtime control modules or With I/O emulation modules , the normal _ _exit and abort functions are replaced with special ones.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 67 MODIFYING THE FILE CSTA RTUP.S90 As noted earlier , you s hould not modify the file cstartup.s90 if a customi zed version of _ _low_level_init is enough for your needs. Ho wever , if you do need to modify the fi le cstartup.
CA VR-4 68 Standard str eams for input and output A VR® IAR C/C++ Compiler Refer ence Guide { int nChars = 0; /* Check for stdout and stderr (only necessary if file descriptors are enabled.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 69 Configuration symbols for printf and scanf When you set up your application p roject, you typically need to consider what printf and scanf formatting capabilities your application requires, see Choosing formatters for printf and scanf , page 59.
CA VR-4 70 File input and output A VR® IAR C/C++ Compiler Refer ence Guide CUSTOMIZING FORMATTING CA PABILITIES T o customize the formatti ng capabilities, yo u need to set up a library project, see Building and using a customized library , page 62. Define the configuration symbols according to your appl ication requirements.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 71 Locale Locale is a part of the C language that allows language- and country-specific settings for a number of areas, such as currency symbol s, date and time, a nd multibyte encoding.
CA VR-4 72 Locale A VR® IAR C/C++ Compiler Refer ence Guide Note: If you use multibyte characters in your C or assembler source code, make sure that you select the correct locale symbol (the local host locale).
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 73 En vir onment interaction According to the C standard, your applicati on can interact with the en vironment using the functions getenv and system . Note: The putenv function is not required by the standard, and the library does not provide an implementation of it.
CA VR-4 74 Time A VR® IAR C/C++ Compiler Refer ence Guide This does not require that you rebuild the library . Y ou can fi nd source templates in the fil es Signal.c and Raise.c in the avrsrclib directory . For information about ove rriding default library modules, see Overriding library modules , page 61.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 75 Asser t If you hav e linked your application with support for runtime debugging, C-SPY will be notified about failed asserts. If this is not the behavior you require, you must ad d the source f ile xReportAssert.
CA VR-4 76 C-SPY Debugger runtime in terface A VR® IAR C/C++ Compiler Refer ence Guide C-SPY Debugger runtime interface To include suppo rt for runtime and I/O debugging, yo u must link you r application with the XLINK optio ns With runtime control modules or With I/O emulation modules , see Debug support in the runtime l ibrary , page 56.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 77 The mechanism used for implementing this feature w orks as follows. The deb ugger will detect the presence of the function _ _DebugBreak , which will be part of the application if you hav e linked it with the XLINK options for C-SPY runtime inte rface.
CA VR-4 78 Checking module consistency A VR® IAR C/C++ Compiler Refer ence Guide Example In the following table, the obj ect f iles could (but do not hav e to) define the two runtime attribu tes color and taste . In thi s case, file1 cannot be linked with any of the other files, sinc e the runtime attribute color doe s not ma tch.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 79 PREDEFI NED RUNTIME ATTRIBUTES The table below shows the predefined runtime model attributes that are av ai lable for the A VR IAR C/C++ Com piler . These can be include d in assembler code or in mixed C or C++ and assembler code.
CA VR-4 80 Checking module consistency A VR® IAR C/C++ Compiler Refer ence Guide Examples For an example of using th e runtim e model attribute _ _rt_version for checking module consistency on used calling con vention, see Hints for using the new calling con vention , page 100.
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 81 Implementation of system star tup code This section presents some ge neral techniques used in the system startup code, including background information that might be useful if you need to modify it.
CA VR-4 82 Added C functionality A VR® IAR C/C++ Compiler Refer ence Guide This lets the system startup code specify c ode in subsequent se gm ent parts and modules that are designed so that some of the part s may not be included by XLINK. The code simply falls through to the ne xt piece of code not discarded b y the linker .
CA VR-4 Part 1. Using the compiler The DLIB runtime en vironmen t 83 ● stdlib.h STDINT.H This include f ile provide s integer charact eristics. STDBOOL.H This include file makes the bool t ype av ai lable if the Allow IAR extensions ( -e ) option is used.
CA VR-4 84 Added C functionality A VR® IAR C/C++ Compiler Refer ence Guide PRINTF, SCANF AND STRTOD The functions printf , scanf and strtod have added fun ctionality from the C99 standard. For reference info rmation about these functions, see the library reference av ailable from the Hel p menu.
CA VR-4 Part1. Using the compiler 85 The CLIB runtime en vir onment This chapter describes the runtime en vironment in which an a pplication ex ecutes. In particular , it covers the CLIB runtime librar y and how you can optimize it f or your application.
CA VR-4 86 Runtime envir onment A VR® IAR C/C++ Compiler Refer ence Guide ● Small flash memory option ( --64k_flash ) ● 64-bit doubles option ( --64bit_doubles ). For the A VR IA R C/C++ Compiler, this means there are prebuilt runtime librarie s for different combination of th ese options.
CA VR-4 Part1. Using the compiler The CLIB runtime en vironmen t 87 Input and output Y ou can customize: ● The functions rela ted to character -based I/O ● The formatters used by printf / sprintf and scanf / sscanf .
CA VR-4 88 Input and outp ut A VR® IAR C/C++ Compiler Refer ence Guide _medium_write The _medium_write formatter has the same functions as _formatted_write , except that floating-point numbers are not supported.
CA VR-4 Part1. Using the compiler The CLIB runtime en vironmen t 89 F O RMATTERS US ED BY SCANF AND SSC ANF Similar t o the printf and sprintf functions, scanf and sscanf use a common formatter, called _formatted_read . The full v ersion of _formatted_read is very large, and provides facilities that are not required in many embedded applications.
CA VR-4 90 Over riding default librar y modules A VR® IAR C/C++ Compiler Refer ence Guide ● Static v ariables are initialized e xcept for _ _no_init and _ _eeprom declare d vari ables; this include.
CA VR-4 Part1. Using the compiler The CLIB runtime en vironmen t 91 C-SPY runtime interface The low-le vel deb ugger interface is used for communication betw een the application being debugged and the deb ugger itself. The interface is simple : C-SPY will place breakpoints on certain assemble r labels in the application.
CA VR-4 92 Checking module consistency A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part1. Using the compiler 93 Assembler langua ge interface When you dev elop an application for an embedded system, ther e may be situations wher e you will find it necessar y to write parts o.
CA VR-4 94 Mixing C and assembler A VR® IAR C/C++ Compiler Refer ence Guide The advantage of an intrinsic function compar ed to using inline assembler is that the compiler has all ne cessary in formation to interface the se quence properly with register allocation and v ariables.
CA VR-4 Part1. Using the compiler Assembler language interface 95 INLINE ASSEMB LER It is possible to insert assembler code dire ctly into a C or C++ function. The asm keyw ord assembles and inserts the supplied assembler statemen t, or statements, in-line.
CA VR-4 96 Calling assembler routines fr om C A VR® IAR C/C++ Compiler Refer ence Guide Calling assembler r outines fr om C An assembler routine that is to be called from C must: ● Conform to the c.
CA VR-4 Part1. Using the compiler Assembler language interface 97 Note: In this example we use a low optimizat io n level when compiling the code to show local and global variab le access. If a higher level of optimization is used, the required references to loca l variables could be removed during the optimization.
CA VR-4 98 Calling assembler routines fr om C++ A VR® IAR C/C++ Compiler Refer ence Guide Calling assembler r outines fr om C++ The C calling con vention does not apply to C++ functions. Most importantly , a function name is not suff icient to iden tify a C++ f unction.
CA VR-4 Part1. Using the compiler Assembler language interface 99 Calling con vention A calling con vention is the way a function in a program calls another function.
CA VR-4 100 Calling convention A VR® IAR C/C++ Compiler Refer ence Guide For detail s about the --version1_calls option and the _ _version_1 attribute, see --version1_calls , page 199 and _ _version_1 , page 214, respecti vely .
CA VR-4 Part1. Using the compiler Assembler language interface 101 It is often practical to share header f ile s between C and C++. The f ollowing is an example of a declarati on that declares a funct.
CA VR-4 102 Calling convention A VR® IAR C/C++ Compiler Refer ence Guide Special registers For some registers th ere are certain prerequisites that you must consider: ● The stack pointer—register Y —must at all times point to the last element on the stack.
CA VR-4 Part1. Using the compiler Assembler language interface 103 Register assignment using the old calling con vention In the old calling convention , the two left-most parameters are passed in registers if they are scalar and up to 32 bits in size.
CA VR-4 104 Calling convention A VR® IAR C/C++ Compiler Refer ence Guide This would result in a be ing allocated to R16 (first f it), b to R19:R18 (alignment), c to R23:R22:R21:R20 (f irst fit), and d to R17 (first f it).
CA VR-4 Part1. Using the compiler Assembler language interface 105 Hidden parameters In addition to the parameters visib le in a function declarat ion and definition, there can be hidden parameters: .
CA VR-4 106 Calling convention A VR® IAR C/C++ Compiler Refer ence Guide Registers used for returning values For both calling conv entions, the registers availa ble for returning values are R16–R19 . Note that the size of a returned point er depends on the memory model in use; appropriate registers are used accordingly .
CA VR-4 Part1. Using the compiler Assembler language interface 107 Monitor functions A monitor function causes interrupts to be disabled during ex ecution of the function. At function entry , the status register SREG is saved and global interrupts are disabled.
CA VR-4 108 Call frame information A VR® IAR C/C++ Compiler Refer ence Guide It is the responsibility of the calling function to allocate a memory locat ion for the return value and pass a pointer to it as a hidden f irst parameter .
CA VR-4 Part 1. Using the compiler 109 Using C++ IAR Systems supports two le vels of the C++ language: The i ndustr y-standard Embedded C++ and IAR Extended Em bedded C++. They ar e described in this chapter . Ov er vie w Embedded C++ is a subset of the C++ pr ogramming language which is intended for embedded systems programming.
CA VR-4 110 Overview A VR® IAR C/C++ Compiler Refer ence Guide ● New cast syntax (the operators dynamic_cast , static_cast , reinterpret_cast , and const_cast ) ● Namespaces ● Mutable attrib ute. The exclusion of these language features ma kes the runtime library significantly more eff icient.
CA VR-4 Part 1. Using the compiler Using C++ 111 T o set the equi va lent option in IAR Embedded W ork bench, select Project>Options>C/C ++ Compiler>Language .
CA VR-4 112 Feature description s A VR® IAR C/C++ Compiler Refer ence Guide Example class B { public: void f(); int i; }; Class me mor y T o compensate for this limitation, a class can be associated with a class memory type .
CA VR-4 Part 1. Using the compiler Using C++ 113 Note: Whenever a cla ss type associated with a class memo ry type, like C , must be declared, the class memo ry type must be mentioned as well: class _ _far C; Also note that class types associ ated with different class memories are not compatib le types.
CA VR-4 114 Feature description s A VR® IAR C/C++ Compiler Refer ence Guide T o ov erride the default new and delete operator for a class, declare: void *operator new(size_t); void operator delete(void *); as member functions, just lik e in ordinary C++.
CA VR-4 Part 1. Using the compiler Using C++ 115 Use this syntax if you want to ove rride both global and class-specif ic operator new and operator delete for an y data memory . Note that there is a speci al syntax to name the operator new functions for each memory , while the naming for the operator delete functions relies on normal ove rloading.
CA VR-4 116 Feature description s A VR® IAR C/C++ Compiler Refer ence Guide T emplates and data memory attributes For data memory attribu tes to work as e xpected in templat es, two elements of t he standard C++ template ha ndling ha ve been change d—class templa te partial specialization matching and functio n templ ate parameter deduction.
CA VR-4 Part 1. Using the compiler Using C++ 117 For templates that are matched using thi s modified algorithm, it is impossible to get automatic generatio n of special code for pointers to small memory t ypes. For lar ge and “other” memory types (memory that cannot be pointed to by a default pointer) it is possible.
CA VR-4 118 Feature description s A VR® IAR C/C++ Compiler Refer ence Guide Example vector<int> d; // d placed in default memory, using // the default heap, uses default // pointers vector<i.
CA VR-4 Part 1. Using the compiler Using C++ 119 NAMESPACE The namespace feature is only supported in Extended EC++. This means that you can use namespaces to partition your code. Note, ho we v er , that the library itself is not placed in the std namespace.
CA VR-4 120 Feature description s A VR® IAR C/C++ Compiler Refer ence Guide T o av oid interrupts, plac e a call to the intrinsi c function _ _disable_interrupt before the call to _exit .
CA VR-4 Part1. Using the compiler 121 Efficient coding for embedded a pplications For embedded systems, the size of th e generated code and data is ver y impor tant, because using smaller external memor y or on-chip memor y can significantly decr ease the cost and power consumption of a system.
CA VR-4 122 T aking advantage of the compilation system A VR® IAR C/C++ Compiler Refer ence Guide CONTR OLLING COMPILER OPTIMIZ ATIONS The A VR IAR C/C++ Compiler allo ws you to specify whether ge nerated code should be optimized for size or for spe ed, at a selectable optimiz ation le vel.
CA VR-4 Part1. Using the compiler Efficient coding f or embedded applications 123 Both compiler options and pr agma directi ves are a vailabl e for specifying the preferred type and lev el of opti mization. The chapt er Compiler options contains reference information about the comman d line options used for spec ifying optimization type and lev el.
CA VR-4 124 T aking advantage of the compilation system A VR® IAR C/C++ Compiler Refer ence Guide Code motion Evaluation of loop-in variant expressions and common sube xpressions are mov ed to av oid redundant re-ev aluation. This optimization, which is performed at optimization lev el Medium , normally reduces code size and exec ution time.
CA VR-4 Part1. Using the compiler Efficient coding f or embedded applications 125 Clustering of variables When clustering of v aria bles is enabled, st atic and global variable s are arr anged so that v ariables that are accessed in the same function are stored cl ose to each other .
CA VR-4 126 Selecting data types and placing dat a in memory A VR® IAR C/C++ Compiler Refer ence Guide Putting strings in flash This can be done on individual strings or for the whole ap plication/ file using the option --string_literals_in_flash .
CA VR-4 Part1. Using the compiler Efficient coding f or embedded applications 127 For details about representation of supported data types, point ers, and structur es types, see the chapter Data r eprese ntation .
CA VR-4 128 Selecting data types and placing dat a in memory A VR® IAR C/C++ Compiler Refer ence Guide MEMOR Y MODEL AND MEMOR Y ATTRIBUTES FOR DATA For man y applications it is suff icient to use the memory model feature to specify the default memory for the data objects.
CA VR-4 Part1. Using the compiler Efficient coding f or embedded applications 129 Example In the follo wing example, the memb ers in the anon ymous union can be accessed, in function f , without explicitly specifying the union name: struct s { char tag; union { long l; float f; }; } st; void f(void) { st.
CA VR-4 130 Writing efficient code A VR® IAR C/C++ Compiler Refer ence Guide Anonymous structures and unions are implemented in terms of objects named a fter the first f ield, with a prefix _A to place the name in the implementation par t of the namespace.
CA VR-4 Part1. Using the compiler Efficient coding f or embedded applications 131 SA VING STACK SPACE AND RAM MEMOR Y The following is a list of programming tec hniques that will, when followed, sav e memory and stack space: ● If stack space is limited, av oid long call chains and recursi ve functions.
CA VR-4 132 Writing efficient code A VR® IAR C/C++ Compiler Refer ence Guide INTEG ER TYPES AND BIT NEGATION There are situation s when the rules for integer types and their con version lead to possibly confusing beha vior .
CA VR-4 Part1. Using the compiler Efficient coding f or embedded applications 133 Pr otecting the eeprom write mechanism A typical example of when it can be necessary to use the _ _monitor keyword is when protecting the eeprom write mechanism, wh ich can be used from two threads (for example, main code and inte rrupts).
CA VR-4 134 Writing efficient code A VR® IAR C/C++ Compiler Refer ence Guide NON-INITIALIZED VARIABLES Normally , the runtime en vironment will initi alize all global and static v ariables when the application is started. The compiler supports the declaration of vari ables that will not be initialized, using the _ _no_init type modifi er .
CA VR-4 135 P ar t 2. Compiler re f e re n c e This part of the A VR® IAR C/C++ Compiler Reference Guide contains the follo wing chapters: ● Data repr esentation ● Se g m e n t re f e re nc e ●.
CA VR-4 136.
CA VR-4 Part 2. Compiler refe rence 137 Data r epr esentation This chapter describes the data t ypes, pointers, and structure types supported by the A VR IAR C/C++ Compiler . See the chapter Eff icient coding for embedded applications for info rmat ion a bo ut which data types and pointers provid e the most efficient code for y our application.
CA VR-4 138 Basic data types A VR® IAR C/C++ Compiler Refer ence Guide Basic data types The compiler supports both all ISO/ANSI C ba sic data types and some additional types. INTEGER T YPES The follo wing table gi ves the size an d range of each integer data type: Signed v ariables are represented us ing the two’ s complement form.
CA VR-4 Part 2. Compiler refe rence Data repr esentation 139 The char type The char type is by default unsigned in the compiler , but the --char_is_signed compiler option allows you to mak e it signed. Note, howev er, that the library is compiled with the char type as unsigned .
CA VR-4 140 Basic data types A VR® IAR C/C++ Compiler Refer ence Guide * Depends on whether the --64bit_doubles option is used, see --64b it_doubles , page 201 .
CA VR-4 Part 2. Compiler refe rence Data repr esentation 141 The va lue of a denormalized number is: (-1) S * 2 (1-BIAS) * 0.Mantissa where BIAS is 127 and 1023 for 32-bit and 64-bit floating-point va lues, respectively .
CA VR-4 142 Pointer types A VR® IAR C/C++ Compiler Refer ence Guide CASTING Casts betwee n pointers have the following characteristics : ● Casting a value of an inte ger type to a pointer of a smal.
CA VR-4 Part 2. Compiler refe rence Data repr esentation 143 ptrdiff_t ptrdiff_t is the type of the signed integer requi red to hold the dif ference between two pointers to elements of the same a rray .
CA VR-4 144 Ty p e a n d o b j e c t a t t r i b u t e s A VR® IAR C/C++ Compiler Refer ence Guide Example struct { short s; /* stored in byte 0 and 1 */ char c; /* stored in byte 2 */ long l; /* sto.
CA VR-4 Part 2. Compiler refe rence Data repr esentation 145 T ype attributes can be fur ther divided into memory attributes and general type attributes . Memor y attributes A memory attribute corresponds to a cer tain logical or physical memory in the microcontroller.
CA VR-4 146 Ty p e a n d o b j e c t a t t r i b u t e s A VR® IAR C/C++ Compiler Refer ence Guide DECLARING OBJECTS IN SOU RCE FILES When declaring obj ects, note that the IAR-specif ic attrib utes work exact ly like const . One exception to this is that attributes that are declared in front of the type specif ier apply to all declared objects.
CA VR-4 Part 2. Compiler refe rence Data repr esentation 147 The A VR IAR C/C++ Compiler adheres to these rules for all 8-bit types. The follo wing object types are treated in a special way: For all combinations of object types not listed, only rule number one applies.
CA VR-4 148 Data types in C++ A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part 2. Compiler refe rence 149 Segment r efer ence The A VR IAR C/C++ Compiler places co de and data into named segments which are r eferr ed to by the IAR XLINK Link er™.
CA VR-4 150 Summary of segments A VR® IAR C/C++ Compiler Refer ence Guide HEAP Holds the heap used f or dynamically allocated data using the CLIB library . DATA HUGE_C Holds _ _huge declared constant data, including literal strings. DATA HUGE_F Holds static and global _ _hugeflash variables.
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 151 Descriptions of segments The follo wing section giv es reference inform ation about each segment. F or detailed information about the extended k eywor ds mentioned here, see the chapter Extended ke ywor ds .
CA VR-4 152 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide Description Holds the internal data stack. This se gment and its length is normally defin ed in the linker command f il.
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 153 EEPROM_I Holds non-zero initializ ed static and global _ _eeprom var i a b l es . XLINK segment memor y type XDATA Memory space EEPR OM. Description Holds static and global _ _eeprom v ariables that hav e been defined with non-zero initial values.
CA VR-4 154 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide Description Holds user program code that has been declared _ _farfunc . The _ _farfunc memory attribu te is av ailable when using the -v5 and -v6 options, in which case the _ _farfunc is implicitly used for all functions.
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 155 FAR_HEAP Holds the heap used for dynamically alloca ted data in far memory when using the DLIB library . XLINK segment memor y type DATA Memory space Data. The address range is 0x0–0xFFFFFF .
CA VR-4 156 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide FAR_ID Holds _ _far v ariable initiali zers. XLINK segment memor y type CODE Memory space Flash. The add ress range is 0x0–0x7FFFFF . Description Holds initial v alues for the variable s located in the FAR_I segment.
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 157 HEAP Used for the he ap when using the CLIB library . XLINK segment memor y type DATA Memory space Data. The address range depe nds on t he memory model: Description Holds the heap used for d ynamically allocated data.
CA VR-4 158 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide HUGE_F Holds static and global _ _hugeflash var i a bl e s . XLINK segment memor y type CODE Memory space Flash. The add ress range is 0x0–0xFFFFFF . Description Holds static and global _ _hugeflash v ariables and aggregate initiali zers.
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 159 Memory space Data. The address range is 0x0–0xFFFFFF . Description Holds static and global _ _huge v ariables that ha ve been de f ined with non-zero initial va lu e s . When the -y compiler option is used, _ _huge constant data is l ocated in this se gment.
CA VR-4 160 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide HUGE_Z Holds zero-initia lized static and global _ _huge va ri a b l e s .
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 161 NEAR_C Holds _ _tiny and _ _near constant data, incl uding string literals. XLINK segment memor y type CONST Memory space Data. The address range is 0x0–0xFFFF . Description Holds _ _tiny and _ _near constant data, incl uding string literals.
CA VR-4 162 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide This segment and its length is normally defined in the linker command f ile by the command: -Z(DATA)NEAR_HEAP+ nn = start where nn is the length and start is the locat ion.
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 163 NEAR_N Holds _ _no_init static and global _ _near vari ab l es . XLINK segment memor y type DATA Memory space Data.
CA VR-4 164 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide SWITCH Holds switch tables for all functions. XLINK segment memor y type CODE Memory space Flash. The address range is 0x0–0xFFFF . If the _ _farflash e xtended keyword and the --enhanced_core option are used, the range is 0x0 – 0x7FFFFF .
CA VR-4 Part 2. Compiler refe rence Se gm en t ref ere nc e 165 This segment and its length is normally defined in the linker command f ile by the command: -Z(DATA)TINY_HEAP+ nn = start where nn is the length and start is the locat ion. For more information a bout dynamically allocated data and the heap, see The return addr ess stack , page 43.
CA VR-4 166 Descriptions of s egments A VR® IAR C/C++ Compiler Refer ence Guide TINY_N Holds _ _no_init static and global _ _tiny vari ab l es . XLINK segment memor y type DATA Memory space Data.
CA VR-4 Part 2. Compiler refe rence 167 Compiler options This chapter explains how to set th e co mpiler options fr om the command line , and gives detailed r eference infor mation about each option.
CA VR-4 168 Setting comm and line optio ns A VR® IAR C/C++ Compiler Refer ence Guide SPECIFYING PARAMETERS When a parameter is needed for an option w ith a short name, it can be specifie d either immediately following the optio n or as the next command line ar gument.
CA VR-4 Part 2. Compiler refe rence Compiler options 169 SPECIFYING EN VIRONMENT VARIAB LES Compiler options can also be spec ified in the QCCAVR en vironment v ariable.
CA VR-4 170 Options summary A VR® IAR C/C++ Compiler Refer ence Guide -D symbol [= value ] Defines preprocessor symbols --debug Generates debug info rmation --dependencies[=[i|m]] { filename | directory } Lists file dependencies --diag_error= tag , tag ,.
CA VR-4 Part 2. Compiler refe rence Compiler options 171 -I path Specifies include file path --initializers_in_flash Places aggregate in itializers in flash memor y -l[a|A|b|B|c|C|D][N][H] { filename .
CA VR-4 172 Options summary A VR® IAR C/C++ Compiler Refer ence Guide --omit_types Excludes t ype informatio n --only_stdout Uses standard output only --preinclude includefile Includes an include fil.
CA VR-4 Part 2. Compiler refe rence Compiler options 173 Descriptions of options The following section gi ves de tailed reference inf ormation about each compiler option. --char_is_signed --char_is_signed By default, the compiler int erprets the char type as unsigned.
CA VR-4 174 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide --cross_call_passes --cross_call_passes= N Use this option to decrease the RSTACK usage b y running the cross-call optimizer N times, where N can be 1–5. The default is to run it until no more impro vements can be made.
CA VR-4 Part 2. Compiler refe rence Compiler options 175 Production v ersion: iccavr prog Te s t v e r s i o n : iccavr prog -DTESTVER T o set the equi va lent option in IAR Embedded W ork bench, select Project>Options>C/ C++ Compiler>Preprocessor .
CA VR-4 176 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide For exa mp le : foo.r90: c:iarproductincludestdio.h foo.r90: d:myprojectincludefoo.
CA VR-4 Part 2. Compiler refe rence Compiler options 177 T o set the equi va lent option in IAR Embedded W ork bench, select Project>Options>C/C ++ Compiler>Diagnostics . --diag_remark --diag_remark= tag , tag,... Use this option to classify di agnostic messages as remarks.
CA VR-4 178 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide --diagnostics_tables --diagnostics_tables { filename | directory } Use this option to list all po ssible diagnostic messages in a named file.
CA VR-4 Part 2. Compiler refe rence Compiler options 179 If you b uild your o wn customized runtime library , you should also create a corresponding customized library conf iguratio n file, which must be specified to th e compiler . For more informa tion, see Building and using a cu stomized library , page 62.
CA VR-4 180 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide --eec++ --eec++ In the A VR IAR C/C++ Compiler , the default language is C.
CA VR-4 Part 2. Compiler refe rence Compiler options 181 --enable_external_bus --enable_external_bus This option will make the co mpiler add the special _ _require statem ent which will make XLINK include the code in cstartup.s90 that enables the e xternal data b us.
CA VR-4 182 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide -f -f filename Reads command line options from the na med file, with the def ault extension xcl . By default , the compiler accepts comm and parameters only from the c ommand line itself and the QCCAVR en vironment variable.
CA VR-4 Part 2. Compiler refe rence Compiler options 183 --header_context --header_context Occasionally , to find the cause of a problem it is necessary to know which header file was included from which source line.
CA VR-4 184 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide Then the fol lowing directorie s are searched i n the order listed belo w for the f ile config.h , which in this examp le is located in the dirdebugconfig directory: dirinclude Current file.
CA VR-4 Part 2. Compiler refe rence Compiler options 185 -l -l[a|A|b|B|c|C|D][N][H] { filename | directory } By default, the compiler does not generate a listing.
CA VR-4 186 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide Example 2 If you compile the file mysource.c and want to generate a listing to a f ile mysource.lst in the working directory , you could use: iccavr mysource -l . Note: Both and / can be used as di rectory delimi ters.
CA VR-4 Part 2. Compiler refe rence Compiler options 187 By default the co mpiler generates code fo r the T i ny memory model for all processor options except -v4 and -v6 where the Small memory model is the def ault. Use the -m or the --memory_model option if you w ant to generate code for a dif ferent memory model.
CA VR-4 188 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide If the compiler is unable to check for a rule , specifying the option for that rule has no effe ct. For instance, MISRA C rule 15 is a documentation issue, and the rule is not checked b y the compiler .
CA VR-4 Part 2. Compiler refe rence Compiler options 189 Example The follo wing example—in which %1 is an operating system variable containing the name of the source file—will gi ve duplicate name errors from the linker: preproc %1.c temp.c ; preprocess source, ; generating temp.
CA VR-4 190 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide For additional information, see --cr oss_call_passes , page 174. This option is related to the Optimization options in the C/C++ Co mpiler cate gory in IAR Embedded W orkbench.
CA VR-4 Part 2. Compiler refe rence Compiler options 191 --no_ubrof_messages --no_ubrof_messages Use this option to minimize the size of your application object f ile by excluding messages from the UBR OF fil es. A file size decrease of up to 60% can be expected.
CA VR-4 192 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide --no_wrap_diagnostics --no_wrap_diagnostics By default, long lines in comp iler diagnostic messag es are broken into se veral lines to make the messag e easier to read. Use this opt ion to disable line wr apping of diagnostic messages.
CA VR-4 Part 2. Compiler refe rence Compiler options 193 --only_stdout --only_stdout Use this option to m ake the compiler use the st andard output stream ( stdout ) also for messages that a re normally direct ed to the error output stream ( stderr ).
CA VR-4 194 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide T o set the equi va lent option in IAR Embedded W orkbench, select Project>Options>C/ C++ Compiler>Preprocessor .
CA VR-4 Part 2. Compiler refe rence Compiler options 195 --root_variables --root_variables Use this option to apply the _ _root extended k eyword to all gl obal and static variables. This will make sure that the v ariables are not remov ed by the IAR XLINK Linker .
CA VR-4 196 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide For de scriptions of the av ailable memory attributes, see T able 7, Me mory attributes for data on page 19 and T able 8, Memory attrib utes for functions on page 28. F or a description of the segment name suf fixes, see Segment naming , page 37.
CA VR-4 Part 2. Compiler refe rence Compiler options 197 -v -v[0|1|2|3|4|5|6] Use this option to select the pr ocessor deri vativ e for which th e code is to be generated.
CA VR-4 198 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide -v2 Reserved for fu ture derivatives The code space is physically limited to 128 Kbytes, and, if possible, the RCALL/RJMP inst ructions are used for reaching the code space.
CA VR-4 Part 2. Compiler refe rence Compiler options 199 See also --cpu , page 173, and Pr ocessor configur ation , page 5. This option is related to the Processor configuration option in the General Options category in IAR Embedded W orkbench. --version1_calls --version1_calls This option is provide d for backward compatibility .
CA VR-4 200 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide --warnings_are_errors --warnings_are_errors Use this option to make the compi ler trea t all warnings as errors. If the compiler encounters an error , no object c ode is generated.
CA VR-4 Part 2. Compiler refe rence Compiler options 201 *The most impor tant difference between -z2 and -z3 is that at lev el 2, all non-static variables will live during th eir entire scope.
CA VR-4 202 Descriptions of op tions A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part 2. Compiler refe rence 203 Extended k e yw or ds This chapter descr ibes the extended ke yw ords that support specific featur es of the A VR micr ocontroller, the general syntax rules for the k eywor ds, and a detailed description of each k eyw ord.
CA VR-4 204 Descriptions of ext ended key words A VR® IAR C/C++ Compiler Refer ence Guide The follo wing table summariz es the extende d k eywords that can be used on data: Descriptions of extended k eyw ords The follo wing sections giv e detailed information about each extended k eyword.
CA VR-4 Part 2. Compiler refe rence Extended k eywords 205 asm, _ _asm The asm and _ _asm extended keywords both insert an assembler instruction. Howe ver , when compiling C source code, the asm keyw ord is not av ailable when the option --strict_ansi is used.
CA VR-4 206 Descriptions of ext ended key words A VR® IAR C/C++ Compiler Refer ence Guide _ _ext_io Controls the storag e of data objects in dat a memory space. The _ _ext_io memory attribute implies tha t objects are _ _no_init and v olatile, and allo ws objects to be accessed by use of the special I/O instruction s in the A VR microcontroller .
CA VR-4 Part 2. Compiler refe rence Extended k eywords 207 _ _farfunc Controls the storag e of functions in code memory space. The _ _farfunc memory attrib ute places a functi on in farfunc code memory space. Functions declared _ _farfunc have no restrictions on c ode placement , and can be placed anywhere in code memory .
CA VR-4 208 Descriptions of ext ended key words A VR® IAR C/C++ Compiler Refer ence Guide Using the strcpy_P function d eclared in pgmspace.h , a string in flash memory can be copied to another string in RAM as follows: strcpy_P(dest, msg); _ _generic Declares a generic pointer .
CA VR-4 Part 2. Compiler refe rence Extended k eywords 209 _ _hugeflash Controls the storage of data obje cts in flash (code) memory space. The _ _hugeflash memory attribute places obj ects in flash (code) memory . Note that it is prefera ble to de clare flash objects as constant.
CA VR-4 210 Descriptions of ext ended key words A VR® IAR C/C++ Compiler Refer ence Guide _ _intrinsic The _ _intrinsic keyword is reserv ed for compiler internal use only . _ _io Controls the storag e of data objects in I/O memo ry space, alternati vely data memory space.
CA VR-4 Part 2. Compiler refe rence Extended k eywords 211 _ _nearfunc Controls the storag e of functions in code memory space. The _ _nearfunc memory attrib ute allows you to def ine the memory range where a function will be located.
CA VR-4 212 Descriptions of ext ended key words A VR® IAR C/C++ Compiler Refer ence Guide _ _regvar The _ _regvar extended keyw ord is used for declaring t hat a global or static va r ia b l e should be placed permanently in the specified register or registers.
CA VR-4 Part 2. Compiler refe rence Extended k eywords 213 _ _task Allo ws functions to exit wit hout restoring re gister s. This keyw ord is typically used for the main function. By default, functions sa ve the contents of used non-sc ratch registers (permanent registers) on the stack upon entry , and restor e them at e xit.
CA VR-4 214 Descriptions of ext ended key words A VR® IAR C/C++ Compiler Refer ence Guide _ _version_1 The _ _version_1 keyword is a vailable for backward com patibility .
CA VR-4 Part 2. Compiler refe rence 215 Pra gma dir ectiv es This chapter describes the pragma dir e ctives of the A VR IAR C/C++ Compiler . The pragma directiv es control the beha vi or of the compiler , for example how it allocates memory , whether it allows extended k eyw ords, and whether it outputs warning messages.
CA VR-4 216 Descriptions of pr agma directives A VR® IAR C/C++ Compiler Refer ence Guide Note: For portability reasons, some old-style pragma directives are recognized but will give a diagnostic message. It is important to be aware of this if you need to por t existing code that contains any of t hose pragma directives.
CA VR-4 Part 2. Compiler refe rence Pragma dir ectives 217 #pragma bitfields #pragma bitfields={reversed|default} The #pragma bitfields directi ve controls the or der of bi tfield members. By default, the A VR IAR C/C++ Compile r places bitfiel d members from the least significant bit to the most signif icant bit in the container typ e.
CA VR-4 218 Descriptions of pr agma directives A VR® IAR C/C++ Compiler Refer ence Guide The segment name cannot be a pred efined se gment, see the chapter Seg ment refer ence for more information. The v ariable myBuffer will not be initialized at startup, and can for this reason not ha ve an y initializer .
CA VR-4 Part 2. Compiler refe rence Pragma dir ectives 219 #pragma diag_warning #pragma diag_warning= tag , tag ,... Changes the se verity le vel to warning for the specified d iagnostics. For example: #pragma diag_warning=Pe826 See the chapt er Diagnostics for more information a bout diagnostic messages.
CA VR-4 220 Descriptions of pr agma directives A VR® IAR C/C++ Compiler Refer ence Guide #pragma language #pragma language={extended|default} The #pragma language directi ve is used for turning on th.
CA VR-4 Part 2. Compiler refe rence Pragma dir ectives 221 The following k eywords can be used with #pragma object_attribute for a function or va riable: Example In the follo wing example, the v ariab.
CA VR-4 222 Descriptions of pr agma directives A VR® IAR C/C++ Compiler Refer ence Guide Note: If you use the #pragma optimize directive to specify an optimization level that is higher than the optimizat ion level you specify using a compiler option, the pragma directive is ignored.
CA VR-4 Part 2. Compiler refe rence Pragma dir ectives 223 #pragma required #pragma required= symbol Use the #pragma required directi ve to ensure that a symbol which is needed by another symbol is present in the linked output.
CA VR-4 224 Descriptions of pr agma directives A VR® IAR C/C++ Compiler Refer ence Guide #pragma segment #pragma segment=" segment " [ memattr ] [ align ] The #pragma segment directiv e declares a segment na me that can be used by the intrinsic functions _ _segment_begin and _ _segment_end .
CA VR-4 Part 2. Compiler refe rence Pragma dir ectives 225 #pragma vector #pragma vector= vector1 [, vector2 , vector3 , ...] The #pragma vector directive specifies the vector(s) of an interrupt function w hose declaration follows the pragma direct iv e.
CA VR-4 226 Descriptions of pr agma directives A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part 2. Compiler refe rence 227 The pr epr ocessor This chapter g ives a brief ov er view of the pr epr ocessor , including r eference information about the diff erent prepr oce ssor directives, symbols, and other related information.
CA VR-4 228 Predefined symbols A VR® IAR C/C++ Compiler Refer ence Guide SUMMARY OF PREDEF INED SYMBOLS The follo wing table summarizes the predefined symbols: Predefined symbol Identifies _ _ALIGNOF_ _ () Accesses the alignment of an object _ _BASE_FILE_ _ Identifies the name of the file being com piled.
CA VR-4 Part 2. Compiler refe rence The preprocessor 229 * This symbol is requir ed by the ISO/ANSI standard. Note: The predefined symbol _ _TID_ _ is available for backward compatibi lity. We recommend that you use the symbols _ _ICCAVR_ _ and _ _MEMORY_MODEL_ _ instead.
CA VR-4 230 Predefined symbols A VR® IAR C/C++ Compiler Refer ence Guide _ _DATE_ _ Use t his symbol to identify when the f ile was comp iled. This symbol expa nds to the date of compilation, which is returned in the form "Mmm dd yyyy" , for example "Jan 30 2002" .
CA VR-4 Part 2. Compiler refe rence The preprocessor 231 _ _HAS_ELPM_ _ This symbol determines wh ether the instruction ELPM is av ailable or not. When this symbol is def ined, the instruction ELPM is av ailable. When this symbol is not defined, the ELPM instru ction is not av ailable.
CA VR-4 232 Predefined symbols A VR® IAR C/C++ Compiler Refer ence Guide _ _IAR_SYSTEMS_ICC_ _ This predefined symbol e xpands to a number that ident ifies the IAR compil er platform. The current identif ier is 6. Note that the num ber could be higher in a future version of the product.
CA VR-4 Part 2. Compiler refe rence The preprocessor 233 _Pragma() The preprocessor operator _Pragma can be used in defines and has the equiv alent effect of the #pragma directi ve. The syntax is: _Pragma(" string ") where stri ng follows the syntax for the correspondi ng pragma directi ve.
CA VR-4 234 Predefined symbols A VR® IAR C/C++ Compiler Refer ence Guide ● The value ( m ) corresponding to the --memory_model option in use; where the valu e 1 corresponds to Tin y , the value 2 corresponds to Small, and the value 3 corresponds to Large.
CA VR-4 Part 2. Compiler refe rence The preprocessor 235 For detailed information about the calling con ventions, see Calling con vention , page 99 . Pr eprocessor e xtensions The follo wing section giv es reference info rmation about the extensions that are av ailable in addition to the pragma directi ves and ISO/ANSI directiv es.
CA VR-4 236 Prepr ocessor extensions A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part 2. Compiler refe rence 237 Intrinsic functions This chapter giv es refer ence inform ation about the intrinsic functions. The intrinsic functions pr ovide direct a ccess to low-level pr ocessor operations and can be very useful in, for example, time-critical routin es.
CA VR-4 238 Descriptions of int rinsic functions A VR® IAR C/C++ Compiler Refer ence Guide T o use intrinsic fun ctions in an a pplication, include the header f ile intrinsics.
CA VR-4 Part 2. Compiler refe rence Intrinsic functions 239 _ _fractional_multiply_signed signed int _ _fracdtional_multiply_signed(signed char, signed char); Generates a FMULS instruction. _ _fractional_multiply_signed_ with_unsigned signed int _ _fractional_multiply_signed_with_unsigned(signed char, unsigned char); Generates a FMULSU instruction.
CA VR-4 240 Descriptions of int rinsic functions A VR® IAR C/C++ Compiler Refer ence Guide _ _multiply_unsigned unsigned int _ _multiply_unsigned(unsigned char, unsigned char); Generates a MUL instruction. _ _no_operation void _ _no_operation(void); Generates a NOP instruction.
CA VR-4 Part 2. Compiler refe rence Intrinsic functions 241 signed int _ _reverse( signed int); unsigned long _ _reverse(unsigned long); signed long _ _reverse( signed long); void _ _far * _ _reverse(.
CA VR-4 242 Descriptions of int rinsic functions A VR® IAR C/C++ Compiler Refer ence Guide Note: You must have enabled language extens ions to use this intrinsic function. _ _segment_end void * _ _segment_end( segment ); Returns the address of the f irst byte after the named segment .
CA VR-4 Part 2. Compiler refe rence 243 Librar y functions This chapter gives an intr oduction to the C and C+ + library functions . It also lists the header files used for accessing librar y definitions. At the end of this chapter , all A VR-specific librar y function s are described.
CA VR-4 244 IAR DLIB Librar y A VR® IAR C/C++ Compiler Refer ence Guide LIBRARY OBJECT FILES Most of the library def initions can be used without modif ication, th at is, directly from the library object files that are supp lied with the product.
CA VR-4 Part 2. Compiler refe rence Library functions 245 ● Standard C library definitions, for user programs. ● Embedded C++ library definitions, for user programs. ● CSTARTUP , the module containing the start-up code . It is described in the chapter The DLIB runtime en vir onment in this guide.
CA VR-4 246 IAR DLIB Librar y A VR® IAR C/C++ Compiler Refer ence Guide C++ HEADER FILES This section lists th e C++ header files. Embedded C++ The follo wing table lists th e Embedded C++ header f i.
CA VR-4 Part 2. Compiler refe rence Library functions 247 Extended Embedded C++ standard template library The follo wing table lists the Extended Embe dded C++ standard temp late library (STL) header .
CA VR-4 248 IAR CLIB Librar y A VR® IAR C/C++ Compiler Refer ence Guide LIBRARY FUNCTIONS AS INTRINSIC FUNCTIONS The following C library functi ons will under some circumstan ces be handled as intrin.
CA VR-4 Part 2. Compiler refe rence Library functions 249 LIBRAR Y DEFINIT IONS SUMMAR Y This section l ists the header files. Head er files may additionally co n tain target-specific definitions. * The functions is xxx , toupper , and tolower declared in the header file ctype.
CA VR-4 250 A VR–specific librar y functions A VR® IAR C/C++ Compiler Refer ence Guide SPECIFYING READ AND W RITE FORMATTERS Y ou can override default fo rmatters for the functions printf_P and scanf_P by editing the linker command f ile.
CA VR-4 Part 2. Compiler refe rence Library functions 251 puts_P int puts_P(PGM_P _ _s); Identical to puts except that the string to be writte n is in flash memo ry , not in data memory . This function is av ailable in both the CLIB and the DLIB lib rary .
CA VR-4 252 A VR–specific librar y functions A VR® IAR C/C++ Compiler Refer ence Guide strcpy_P char * strcpy_P(char *s1, PGM_P s2); Identical to strcpy except that the string s2 being copied is in fl ash memory , not in data memory . This function is av ailable in both the CLIB and the DLIB lib rary .
CA VR-4 Part 2. Compiler refe rence Library functions 253 strncpy_P char * strncpy_P(char *s1, PGM_P s2, size_t n); Identical to strncpy except that the source string s2 is in flash memory , not in data memory . This function is av ailable in both the CLIB and the DLIB lib rary .
CA VR-4 254 A VR–specific librar y functions A VR® IAR C/C++ Compiler Refer ence Guide.
CA VR-4 Part 2. Compiler refe rence 255 Implementation-defined beha vior This chapter de scribes how the A V R IAR C/C++ Compiler handles the implementation-defined areas of the C language. ISO 9899:1990, the International Organiz ation for Standardization standard - Pro gramming Languages - C (r evision and redesign of ANSI X3.
CA VR-4 256 Descriptions of implem en tation-defined behavior A VR® IAR C/C++ Compiler Refer ence Guide EN VIRONMENT Arguments to main (5.1.2.2.2.1) The function called at program startup is called main .
CA VR-4 Part 2. Compiler refe rence Implementation-de fined beha vior 257 See Locale , page 71. Bits per character in ex ecution character set (5.2.4.2.1) The number of bits in a character is represented by the manifest constant CHAR_BIT . The standard include file limits.
CA VR-4 258 Descriptions of implem en tation-defined behavior A VR® IAR C/C++ Compiler Refer ence Guide INTEGERS Range of integ er values (6.1.2.5) The representation of inte ger values are in the two's com plement form. The most significant bit holds the sign; 1 for neg ative , 0 for positi ve and zero.
CA VR-4 Part 2. Compiler refe rence Implementation-de fined beha vior 259 Demoting floating-point values (6.2.1.4) When a floating-point va lue is conv erted to a floating-point value of narrower typ e that cannot exactly represent the v alue, the value is rounded (up or do wn) to the nearest suitable v alue.
CA VR-4 260 Descriptions of implem en tation-defined behavior A VR® IAR C/C++ Compiler Refer ence Guide Allocation order of bitfields within a unit (6.5.2.1) Bitfiel ds are allocated within an integer from least-significant to m ost-significant bit. Can bitfields straddle a storag e-unit boundar y (6.
CA VR-4 Part 2. Compiler refe rence Implementation-de fined beha vior 261 Including bracketed filenames (6.8.2) For f ile specif ications enclosed in angl e brackets, the preprocessor does not search directories of the parent file s. A parent f ile is the fi le that contains the #include directiv e.
CA VR-4 262 Descriptions of implem en tation-defined behavior A VR® IAR C/C++ Compiler Refer ence Guide include_alias inline instantiate language location memory message module_name none no_pch NOTRE.
CA VR-4 Part 2. Compiler refe rence Implementation-de fined beha vior 263 Domain errors (7.5.1) HUGE_VAL , the lar gest representable v alue in a double floating-point type, will be returned b y the mathematic functions on domain errors. Underflo w of floating-point values sets errno to ERANGE (7.
CA VR-4 264 Descriptions of implem en tation-defined behavior A VR® IAR C/C++ Compiler Refer ence Guide %p in printf() (7.9.6.1) The argument to a %p conv ersion specifier , print pointer , to printf() is trea ted as having the type 'char *' .
CA VR-4 Part 2. Compiler refe rence Implementation-de fined beha vior 265 Messag e returned b y strerr or() (7.11.6.2) The messages returned by strerror() depending on the ar gument are: The time zone (7.12.1) The time zone func tion is not supported.
CA VR-4 266 Descriptions of implem en tation-defined behavior A VR® IAR C/C++ Compiler Refer ence Guide fmod() functionality (7.5.6. 4) If the second argument to fmod() is zer o, the function returns NaN ; errno is set to EDOM . signal() (7.7.1.1) The signal part of the library is not supported.
CA VR-4 Part 2. Compiler refe rence Implementation-de fined beha vior 267 %p in printf() (7.9.6.1) The argument to a %p conv ersion specifier , print pointer , to printf() is trea ted as having the type void * . The v alue will be printed as a he xadecimal number, similar to using the %x con version specif ier .
CA VR-4 268 Descriptions of implem en tation-defined behavior A VR® IAR C/C++ Compiler Refer ence Guide system() (7.10.4.5) How the command processor works depend s on how y ou have implemented the system function. See En vironment interaction , page 73.
CA VR-4 Part 2. Compiler refe rence 269 IAR langua g e extensions This chapter describes IAR language extensions to the ISO/ANSI standar d for the C programming language. All extensions can also be used for the C++ pr ogramming langu age . In the IAR Embedded W orkbench™ IDE, language extensions are enabled by default.
CA VR-4 270 Descriptions of langu age extensions A VR® IAR C/C++ Compiler Refer ence Guide See the chapter Extended keywor ds for a complete list of attrib utes.
CA VR-4 Part 2. Compiler refe rence IAR languag e extensions 271 Inline assembler Inline assembler can be used for insertin g assembler instructions in the generated function. The syntax for inline assembler is: asm("MOVW R4,R7"); In strict ISO/ANSI mode, the use of inline assembler is disabled.
CA VR-4 272 Descriptions of langu age extensions A VR® IAR C/C++ Compiler Refer ence Guide For e xample, the structure str in the following example co ntains an anonymous union. The members of the union are accessed using the names b and c , for example obj.
CA VR-4 Part 2. Compiler refe rence IAR languag e extensions 273 Example struct str { char a; unsigned long b[]; }; struct str * GetAStr(int size) { return malloc(sizeof(struct str) + sizeof(unsigned .
CA VR-4 274 Descriptions of langu age extensions A VR® IAR C/C++ Compiler Refer ence Guide Empty translation units A translation unit (source file) is allowed to be empty , that is, it does not have to contain any declarations. In strict ISO/ANSI mode, a warning is issu ed if the translation unit is empty .
CA VR-4 Part 2. Compiler refe rence IAR languag e extensions 275 Note: ISO/ANSI C allows extra c ommas in similar situations, for exam ple after the last element of the initial izers to an array. The re ason is, that it is ea sy to get the commas wrong if parts of the list are moved using a normal cut-and-paste operation.
CA VR-4 276 Descriptions of langu age extensions A VR® IAR C/C++ Compiler Refer ence Guide The follo wing piece of code will generate a warning: switch (x) { case 1: ...; break; default: } A good way to conv ert this into a standa rd-compliant C program is to place a break; statement after the default: label.
CA VR-4 Part 2. Compiler refe rence IAR languag e extensions 277 Casting pointers to integers in static initializers In an initializer , a pointer cons tant value may be cast to an integral type if the integral type is large enough to contain it.
CA VR-4 278 Descriptions of langu age extensions A VR® IAR C/C++ Compiler Refer ence Guide Repeated typedefs Redeclarations of typedef that occur in the same scope are allowed, but a w arning is issued.
CA VR-4 Part 2. Compiler refe rence 279 Dia gnostics This chapter describes the format of th e di agnostic messag es and explain s how diagnostic messages are divided into differ ent lev els of sev erity . Messag e format All diagnostic messages are issued as comp lete, self-explanatory messages.
CA VR-4 280 Seve ri ty leve ls A VR® IAR C/C++ Compiler Refer ence Guide Err or A diagnostic that is produced when the co mpiler has found a cons truct which clearly violates the C or C++ lang uage rules, such that code cannot be produced. An error will produce a non-zero exit code.
CA VR-4 Index 281 A absolute location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 7 #pragma location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 absolute placeme nt . . . . . . . . . . . . . . . . . . . . . . .
CA VR-4 282 A VR® IAR C/C++ Compiler Refer ence Guide C C and C++ linkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 C calling con vention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 C header files . . . . . . .
CA VR-4 Index 283 locating _ _tiny v ariables . . . . . . . . . . . . . . . . . . . . 165 -z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 --char_is_signed . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CA VR-4 284 A VR® IAR C/C++ Compiler Refer ence Guide const_cast (cast operator) . . . . . . . . . . . . . . . . . . . . . . . . . 110 con ventions, typographic . . . . . . . . . . . . . . . . . . . . . . . . . xxii copyright notice . . . . . . . . .
CA VR-4 Index 285 classifying as e rrors . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 classifying as re marks . . . . . . . . . . . . . . . . . . . . . . . . . 177 classifying as warnings . . . . . . . . . . . . . . . . . . . . . . . . 177 disabling warnings .
CA VR-4 286 A VR® IAR C/C++ Compiler Refer ence Guide exception v ectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 exception (library header f ile) . . . . . . . . . . . . . . . . . . . . . . 246 experience, programming . . .
CA VR-4 Index 287 hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 floating-point format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 hints . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CA VR-4 288 A VR® IAR C/C++ Compiler Refer ence Guide C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 EC++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 errno.h . . . . . . . . .
CA VR-4 Index 289 interrupt vectors, specifyin g with pragma directiv e . . . . . . 225 interrupts disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 disabling during f unction ex ecution . . . . . . . . . . . . . . . .
CA VR-4 290 A VR® IAR C/C++ Compiler Refer ence Guide memcpy_G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 memcpy_P . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 printf . . . . . . . . . . . . . .
CA VR-4 Index 291 malloc (standard library function) . . . . . . . . . . . . . . . . . . . . 25 map (STL header file) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 math.h (library header file) . . . . . . . . . . . . . . . . . 83 , 245 , 249 _medium_write (library function) .
CA VR-4 292 A VR® IAR C/C++ Compiler Refer ence Guide ne w (keyword) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 ne w (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . . 246 ne w .h (library header f ile) .
CA VR-4 Index 293 implementation-de fined beha vior . . . . . . . . . . . . . . . . . 259 to constructor blocks . . . . . . . . . . . . . . . . . . . . . . . . . . 152 using instead of larg e non-scalar parameters . . . . . . . . 131 polymorphism, in Embedded C++ .
CA VR-4 294 A VR® IAR C/C++ Compiler Refer ence Guide preprocessor output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 preprocessor symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 defining . . . . . . . . . . . .
CA VR-4 Index 295 routines, time- critical . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 , 237 RSEG (assembler direc tiv e) . . . . . . . . . . . . . . . . . . . . . . . . 81 RST A CK (segment) . . . . . . . . . . . . . . . . . . . . . . . . .
CA VR-4 296 A VR® IAR C/C++ Compiler Refer ence Guide TINY_Z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 _ _segment_be gin (intrinsic function) . . . . . . . . . . . . . . . . 241 _ _segment_end (int rinsic function) .
CA VR-4 Index 297 stdio.h (library header f ile) . . . . . . . . . . . . . . . . . 83 , 245 , 249 stdlib .h (library hea der file) . . . . . . . . . . . . . . . . . 83 , 24 5 , 249 stdout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CA VR-4 298 A VR® IAR C/C++ Compiler Refer ence Guide type-safe memory management . . . . . . . . . . . . . . . . . . . . 109 type_attribute (pragma directi ve) . . . . . . . . . . . . . . . . . . . 224 typographic con ventions . . . . . . . . . . . .
CA VR-4 Index 299 -o (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 -r (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . 175 , 194 -s (compiler option) . . . . . . . . . . . . . . . . . . . . . . . .
CA VR-4 300 A VR® IAR C/C++ Compiler Refer ence Guide _ _CORE_ _ (predefined symbol) . . . . . . . . . . . . . . . . . . . 229 _ _cplusplus (predefined symbol) . . . . . . . . . . . . . . . . . . . 229 _ _cpu (runtime model attribute) . . . . . . . .
CA VR-4 Index 301 _ _sleep (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 242 _ _STDC_ _ (predefined symbol) . . . . . . . . . . . . . . . . . . . 233 _ _STDC_VERSION_ _ (predefined symbol) . . . . . . . . . 233 _ _swap_nibbles (int rinsic function) .
An important point after buying a device Atmel CAVR-4 (or even before the purchase) is to read its user manual. We should do this for several simple reasons:
If you have not bought Atmel CAVR-4 yet, this is a good time to familiarize yourself with the basic data on the product. First of all view first pages of the manual, you can find above. You should find there the most important technical data Atmel CAVR-4 - thus you can check whether the hardware meets your expectations. When delving into next pages of the user manual, Atmel CAVR-4 you will learn all the available features of the product, as well as information on its operation. The information that you get Atmel CAVR-4 will certainly help you make a decision on the purchase.
If you already are a holder of Atmel CAVR-4, but have not read the manual yet, you should do it for the reasons described above. You will learn then if you properly used the available features, and whether you have not made any mistakes, which can shorten the lifetime Atmel CAVR-4.
However, one of the most important roles played by the user manual is to help in solving problems with Atmel CAVR-4. Almost always you will find there Troubleshooting, which are the most frequently occurring failures and malfunctions of the device Atmel CAVR-4 along with tips on how to solve them. Even if you fail to solve the problem, the manual will show you a further procedure – contact to the customer service center or the nearest service center