Home
v1.1 ARM Tools Reference
Contents
1. File From archive Symbol causing the extraction cstart obj rtarm lib _START hello obj printf obj carm 1ib printf EAEE E A k E A k A E A E kkk kkk Li nk Res uT ttt dda e e A A k k A k A k A K K Hen ep in File in Section in Size out Offset out Section out Size ee hello obj text 1 0x00000018 0x00000000 text 1 0x00000018 cstart obj text cstart 142 0x000000d4 0x00000000 text cstart 142 0x000000d4 printf obj text libc 19 0x0000004c 0x00000000 text libc 19 0x0000004c ten ep JACI ICI CSI O AITO C IO I ICC CC GC Module Local Symbols 2 00b k k e k Ae k II III Scope hello c hello c 0x00000000 data 0x00040028 ARM ARM linear rodata 0x000015e8 rodata 0x000015f0 text 0x0000059c l Fran 6 3 ARM Embedded Tools Reference FEE SC SCO CC CC Cposs References itt HAHEI EAI I aa ae ee Definition file Definition section Symbol cstart obj text cstart 142 _START printf_int obj text libc 5 __printf_int hello obj JE IOI ICI IC kkk kkk La cate Res U tana rear i k nia I IIR k Ak A Task entry address symbol START Sections
2. The first select statement selects the section with the name mysection The second select statement selects all sections that were not selected yet A section is selected by the first select statement that matches in the union of all section layouts for the address space Global section layouts are processed in the order in which they appear in the LSL file Internal core architecture section layouts always take precedence over global section layouts e The attributes field selects all sections that carry or do not carry the given attribute With attribute you select sections that have the specified attribute set With attribute you select sections that do not have the specified attribute set You can specify one or more of the following attributes r readable sections writable sections executable sections initialized sections sections that should be cleared at program startup no ry KR scratch sections not cleared and not initialized To select all read only sections group select attributes r w amp Keep in mind that all section selections are restricted to the address space of the section layout in which this group definition occurs 8 35 ARM Embedded Tools Reference Locating a group group group _name group_specifications section_statements With the group_specifications you actually define how the linker must locate the group You can roughly defi
3. stdout Menu entry Command line only Command line syntax n stdout Description With this option you tell the compiler to send the output to stdout usually your screen No files are created This option is for example useful to quickly inspect the output or to redirect the output to other tools Related information j 5 31 ARM Embedded Tools Reference Compiler nostdinc Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Miscellaneous 3 Add the option nostdinc to the Additional C compiler options field Command line syntax nostdinc Description With this option you tell the compiler not to look in the default include directory relative to the installation directory when searching for include files This way the compiler only searches in the include file search paths you specified Related information db Compiler option l Add directory to include file search path 5 32 Tool Options Compiler Compiler O optimize Menu entry 1 a F N From the Project menu select Project Options The Project Options dialog box appears Expand the C Compiler entry and select Optimization Select an optimization level in the Optimization level box If you select Custom Optimization enable or disable the optimizations you want In addition in the Size speed trade off f
4. Define Description _ START Start label mentioned in LSL file arm sl _Next Real program address main Start label user C program exit Start label of exit function _exit exit function returns to this place _lc_ub_stack User system mode stack pointer _lc_ue_stack End of stack symbol required by debugger _lc_ub_stack_und Undefined mode stack pointer _lc_ub_stack_svc Supervisor mode stack pointer _lec_ub_stack_abt Abort mode stack pointer _lc_ub_stack_irg IRQ mode stack pointer _lc_ub_stack_fig FIQ mode stack pointer _lc_ub_table ROM to RAM copy table _ APPLICATION MODE_ Contains the processor mode and the IRQ FIQ interrupts mode __init_hardware Start label of hardware initialization routine __init vector _table Start label of vector table initialization Table 4 2 Labels used in cstart asm 4 2 Reset Handler and Vector Table Reset handler As explained in the previous section the entry point of the startup code reset handler is label START The reset handler can have a fixed ROM address run address If the reset handler is called from the vector table you do not need the specify a fixed address In this case the linker determines the address and patches the vector table There are however situations were you have to specify a fixed ROM address e f START is the entry point upon reset Typically you would set the ROM addr
5. preprocess Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Add the option E to the Additional assembler options field Command line syntax E preprocess Description With this option the assembler will only preprocess the assembly source file The assembler sends the preprocessed file to stdout Related information f 5 61 ARM Embedded Tools Reference Assembler emit locals Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Enable the option Emit local symbols Command line syntax emit locals flag You can set the following flags when you specify no flags the default is Es e E equs emit local EQU symbols s S symbols emit local non EQU symbols Description With the option emit locals equs the assembler also emits local EQU symbols to the object file Normally only global symbols and non EQU local symbols are emitted Having local symbols in the object file can be useful for debugging Related information ie 5 62 Tool Options Assembler Assembler error file Menu entry Command line only Command line syntax error file file Description With this option the assembler redirects error messages to a file If you do
6. B On the command line use the option D as follows carm D MAX A B A gt B A B test c Note that the macro name and definition are placed between double quotes because otherwise the spaces would indicate a new option Related information Compiler option U Undefine preprocessor macro Compiler option f Read options from file 5 13 ARM Embedded Tools Reference Compiler diag Menu entry 1 Inthe Help menu enable the option Show Help on Tool Errors 2 Inthe Build tab of the Output window double click on an error or warning message A description of the selected message appears Command line syntax diag format all nr Description With this option you can ask for an extended description of error messages in the format you choose The output is directed to stdout normally your screen and in the format you specify You can specify the following formats html rtf or text default To create a file with the descriptions you must redirect the output With the suboption all the descriptions of all error messages are given If you want the description of one or more selected error messages you can specify the error message numbers separated by commas With this option the compiler does not compile any files Example To display an explanation of message number 282 enter carm diag 282 This results in the following message and explanation E282 unterminated comment
7. is not in the list the behavior is undefined Length specifier and length modifier are optional the conversion character is not The conversion character must be one of the following if a character following is not in the list the behavior is undefined Libraries Character Scanned as d int signed decimal i int the integer may be given octal i e a leading 0 is entered or hexadecimal lead ing Ox or 0X or just decimal o int unsigned octal u int unsigned decimal X int unsigned hexadecimal in lowercase or uppercase c single character converted to unsigned char s char a string of non white space characters The argument should point to an array of characters large enough to hold the string and a terminating NULL charac ter f float e E float g G float n int the number of characters written so far is written into the argument No scan ning is done p pointer hexadecimal 24 bit value which must be entered without Ox prefix Matches a string of input characters from the set between the brackets A NULL character is added to terminate the string Specifying includes the character in the set of scanning characters Pes Matches a string of input characters not in the set between the brackets A NULL character is added to terminate the string Specifying includes the character in the set Literal no assignment is done Table 2
8. With the optional no_inline argument the vectors handlers are not inlined in the vector table With the optional id_symbol_prefix argument you can set an internal string representing a symbol name prefix that may be found on symbols in vector handler code When the linker detects such a symbol in a handler the symbol is assigned the vector number If the symbol was already assigned a vector number a warning is issued The fill argument sets the default contents of vectors If nothing is specified for a vector this setting is used See below When no default is provided empty vectors may be used to locate large vector handlers and other sections 8 22 Linker Script Language The vector field defines the content of vector with the number specified by id If a range is specified for id p q s t all vectors in the ranges inclusive are defined the same way With i11 symbol1_name the vector must jump to this symbol If the section in which the symbol is defined fits in the vector table size may be gt m locate the section at the location of the vector Otherwise insert code to jump to the symbol s value A template handler section name symbol name for the target code must be supplied in the LSL file 111 value s fills the vector with the specified MAU values With i111 loop the vector jumps to itself Start address The start_address keyword specifies the start address for the position where the C startup c
9. 5 140 Tool Options Control Program Control Program format Command line syntax format format You can specify the following formats ELF ELF DWARF IHEX Intel Hex SREC Motorola S records Description With this option you specify the output format for the resulting absolute object file The default output format is ELF DWARF which can directly be used by the debugger If you choose IHEX or SREC you can additionally specify the address size of the chosen format option address size Example To generate an Motorola S record output file ccarm format SREC testl c test2 c output test sre Related information Gb Control program option address size Set address size for linker IHEX SREC files Linker option o Specify an output object file Linker option c Generate hex file for each chip 5 141 ARM Embedded Tools Reference Control Program fp trap Command line syntax fp trap Description By default the control program uses one of the non trapping floating point libraries fparm lib or fpthumb 1ib With this option you tell the control program to use the trapping floating point library parmt 1lib or fpthumbt 1ib If you use the trapping floating point library exceptional floating point cases are intercepted and can be handled separately by an application defined exception handler Using this library decreases the execution speed of your application Related in
10. By default the linker generates an output file in ELF DWARF format named after the first input file with extension abs With this option you can specify an alternative filename and an alternative output format The default output format is the format of the first input file You can use the o option multiple times This is useful to generate multiple output formats With the first occurrence of the o option you specify the basename the filename without extension which is used for subsequent o options with no filename specified If you do not specify a filename or you do not specify the o option at all the linker uses the default basename taskn IHEX and SREC formats If you specify the Intel Hex format or the Motorola S records format you can use the argument adadr_size to specify the size of addresses in bytes record length For Intel Hex you can use the values 1 2 and 4 default For Motorola S records you can specify 2 S1 records 3 S2 records or 4 bytes S3 records default The name of the output file will be filename with the extension hex or sre and contains the code and data allocated in the default address space If they exist any other address spaces are also emitted whereas their output files are named filename_spacename hex sre AN Use option c chip output to create Intel Hex or Motorola S record output files for each chip defined in the LSL file Suitable for loading into a PROM programmer
11. Command line syntax c Description EDE uses this option for the graphical version of the make utility when you create sub projects In this case the make utility calls another instance of the make utility for the sub project With the option c the make utility runs as a child process of the current make The option c overrules the option err Example mkarm c The make utility runs its commands as a child processes Related information J 5 168 Tool Options Make Utility Make Utility D DD Command line syntax D DD Description With the option D the make utility prints every line of the makefile to standard output as it is read by mkarm With the option DD not only the lines of the makefile are printed but also the lines of the mkarm mk file implicit rules Example mkarm D Each line of the makefile that is read by the make utility is printed to standard output usually your screen Related information f 5 169 ARM Embedded Tools Reference Make Utility d dd Command line syntax d dd Description With the option d the make utility shows which files are out of date and thus need to be rebuild The option dd gives more detail than the option d Example mkarm d Shows which files are out of date and rebuilds them Related information J 5 170 Tool Options Make Utility Make Utility e Command line syntax e Description If you use macr
12. Creates a temporary file of the mode wb that will be automati cally removed when closed or when the program terminates nor mally Returns a file pointer Creates new file names that do not conflict with other file names currently in use The new file name is stored in a buffer which must have room for L_tmpnam characters Returns a pointer to the temporary name The file names are created in the current directory and all start with tmp At most TMP_MAX unique file names can be generated Description clearerr stream ferror stream feof stream perror s Clears the end of file and error indicators for stream Returns a non zero value if the error indicator for stream is set Returns a non zero value if the end of file indicator for stream is set Prints s and the error message belonging to the integer errno See section 2 2 4 errno h 2 2 21 stdlib h and wchar h The header file stdlib h contains general utility functions which fall into the following categories Some have parallel wide character declared in wchar h 2 22 Libraries e Numeric conversions e Random number generation e Memory management e Envirnoment communication e Searching and sorting e Integer arithmetic e Multibyte wide character and string conversions Macros RAND_MAX 32767 EXIT_SUCCES 0 EXIT_FAILURE 1 MB_CUR_MAX 1 Highest number that can be returned by the rand srand function Predefined exit codes
13. LSH expr Least significant half word of the absolute expression LSw expr Least significant word of the expression MSB expr Most significant byte of the expression MSH expr Most significant half word of the absolute expression mMsw expr Most significant word of the expression STRCAT Sstrl str2 Concatenate str1 and str2 STRCMP strl str2 Compare str with str2 STRLEN Str Return length of string 3 1 ARM Embedded Tools Reference Function Description STRPOS str1 str2 start Return position of sir7 in str2 THUMB Test if assembler runs in Thumb mode or in ARM mode 3 1 2 Detailed Description of Built in Assembly Functions ALUPCREL expression group check This function is used internally by the assembler with the generic instructions ADR ADRL and ADRLL This function returns the PC relative address of the expression for use in these generic instructions group is 0 for ADR 1 for ADRL or 2 for ADRLL With check you can specify to check for overflow 1 means true 0 means false If check is omitted the default is 1 Example The instruction ADRAL R1 label expands to ADRAL R1 PC ALUPCREL label 0 1 ARG symbol expression Returns integer 1 if the macro argument represented by symbol or expression is present 0 otherwise You can specify the argument with a symbol name the name of a macro argument enclosed in single quotes or with expression the o
14. This option is for example useful if the startup code is part of a library Because your own application does not refer to the startup code you can force the startup code to be extracted by specifying the symbol START as an unresolved external Example Consider the following invocation lkarm mylib 1lib Nothing is linked and no output file will be produced because there are no unresolved symbols when the linker searches through mylib lib lkarm e _START mylib 1lib lkarm extern _START mylib 1lib In this case the linker searches for the symbol START in the library and if found extracts the object that contains _START the startup code If this module contains new unresolved symbols the linker looks again in mylib 1lib This process repeats until no new unresolved symbols are found Related information d Section 8 4 Linking with Libraries in chapter Using the Linker of the user s manual 5 95 ARM Embedded Tools Reference Linker error file Menu entry Command line syntax error file file Description With this option the linker redirects error messages to a file If you do not specify a filename the error file is Lkarm elk Example To write errors to errors elk instead of stderr enter lkarm error file errors elk test obj Related information J 5 96 Tool Options Linker Linker error limit Menu entry Command line syntax error limit number Description
15. With these options you can control the level of optimization The default optimization level is Medium optimization option O2 or O or OabcefglklopsUwy You can overrule these settings in your C source file with the pragma pair pragma optimize flag and pragma endoptimize 5 34 Tool Options Compiler AN In addition to the command line option O you can specify the option t With this option you specify whether the used optimizations should optimize for more speed regardless of code size or for smaller code size regardless of speed Example The following invocations are equivalent and result all in the default medium optimization set carm carm carm carm carm carm carm test c 02 test c optimize 2 test c O test c optimize test c OabcefgIklopsUwy test c optimize coalesce ipro cse expression flow tglo inline schedule loop forward propagate subscript unroll pipeline peephole test c Related information d Section 5 3 Compiler Optimizations in chapter Using the Compiler of the user s manual Compiler option t Trade off between speed t0 and size t4 5 35 ARM Embedded Tools Reference Compiler o output Menu entry EDE names the output file always after the C source file Command line syntax 0 file output file Description With this option you can specify another filename for the output file of the compiler Without th
16. optimize 0 No optimization Alias for OCLTXY 01 optimize 1 Default optimization Alias for OCLtXY 02 optimize 2 All optimizations Alias for Ocltxy You can set the following flags c C delete unreferenced sections Delete unreferenced sections from the output file no effect on sources compiled with debug information L first fit decreasing Use a first fit decreasing algorithm to locate unrestricted sections in memory t T copytable compression Emit smart restrictions to reduce copy table size x X delete duplicate code Delete duplicate code sections from the output file y Y delete duplicate data Delete duplicate constant data from the output file Description With this option you can control the level of optimization the linker performs If you do not use this option OCLtXY O1 is the default Related information Gb Section 8 2 3 Linker Optimizations in chapter Using the Linker of the user s manual 5 117 ARM Embedded Tools Reference Linker o output Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Output Format 3 Enable one of the output formats Command line syntax offilename format adar_size output filename format addr_size You can specify the following formats ELF ELF DWARF IHEX Intel Hex SREC Motorola S records Description
17. 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 BZBBSEDIES SABSEDBZBSDZIADSEAZITILZSEASES R R sizeof should not be used on expressions with side effects The implementation of integer division should be documented The comma operator shall only be used in a for condition Don t use implicit conversions which may result in information loss Redundant explicit casts should not be used Type casting from any type to or from pointers shall not be used The value of an expression shall be evaluation order independent This rule is checked using worst case assumptions This means that a violation will be reported when a possible alias may cause the result of an expression to be evaluation order dependent No dependence should be placed on operator precedence rules Mixed arithmetic should use explicit casting Tests of a non Boolean value against 0 should be made explicit F P variables shall not be tested for exact equality or inequality Constant unsigned integer expressions should not wrap around There shall be no unreachable code All non null statements shall have a side effect A null statement shall only occur on a line by itself Labels should not be used The goto statement shall not be used The continue statement shall not be used The break statement shall not be used except in a switch An if or loop body shall
18. ARM Embedded Tools Reference MB101 024 00 00 May 29 2006 Software hardware documentation and related materials Copyright 2005 Altium Limited All rights reserved You are permitted to print this document provided that 1 the use of such is for personal use only and will not be copied or posted on any network computer or broadcast in any media and 2 no modifications of the document is made Unauthorized duplication in whole or part of this document by any means mechanical or electronic including translation into another language except for brief excerpts in published reviews is prohibited without the express written permission of Altium Limited Unauthorized duplication of this work may also be prohibited by local statute Violators may be subject to both criminal and civil penalties including fines and or imprisonment Altium TASKING CrossView Pro and their respective logos are trademarks or registered trademarks of Altium Limited or its subsidiaries All other registered or unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed Table of Contents Table of Contents C Language 1 1 1 1 INMOUUCHON nei oeece enna deed eka naa a koe we nae 1 1 1 2 Data TYPES sig bee terdathi isa betd eae Sethe shea we 1 2 1 3 KeYWOIdS is teperta ertai ai Gadd Hae hee eae Ra DA eager eee ws 1 3 1 4 Register Usage pcg 060 ek 4iihaw oka a bie ede ad ees 1 7 1 5
19. Example To create the output file myfile hex of the default address space 5 118 Tool Options Linker lkarm test obj omyfile hex IHEX lkarm test obj output myfile hex IHEX Related information d Linker option c Generate an output file for each chip 5 119 ARM Embedded Tools Reference Linker r incremental Menu entry Command line syntax r incremental Description Normally the linker links and locates the specified object files With this option you tell the linker only to link the specified files The linker creates a linker output file out You then can link this file again with other object files until you have reached the final linker output file that is ready for locating In the last pass you call the linker without this option with the final linker output file out The linker will now locate the file Example In this example the files test1 obj test2 obj and test3 obj are incrementally linked 1 lkarm r testl obj test2 obj otest out test1 obj and test2 obj are linked 2 lkarm incremental test3 obj test out test3 obj and test out are linked task1 out is created 3 lkarm taskl out task1 out is located Related information dE Section 8 5 Incremental Linking in chapter Using the Linker of the user s manual 5 120 Tool Options Linker Linker S strip debug Menu entry 1 From the Project menu select Project Options The Project Options dia
20. Make sure that every comment starting with has a matching Nested comments are not possible To write an explanation of all errors and warnings in HTML format to file cerrors html use redirection and enter carm diag html all gt cerrors html Related information J 5 14 Tool Options Compiler Compiler E preprocess Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Preprocessing 3 Enable the option Store the C compiler preprocess output lt file gt pre Command line syntax E flags preprocess lags You can set the following flags when you specify E without flags the default is ECMP c C comments Keep comments from the C source in the preprocessed output m M make Generate dependency lines that can be used for the makefile p P noline Strip line source position info lines starting with Line The compiler sends the preprocessed file to stdout To capture the information in a file specify an output file with the option o Description When compiling each file is preprocessed first With this option you can store the result of preprocessed C files EDE stores the preprocessed file in a file called name pre where name is the name of the C source file being compiled C comments are not preserved similar to ECMP Related information J 5 15 ARM Embedde
21. The Directories dialog box appears 2 Add a pathname in the Library files path field If you enter multiple paths separate them with a semicolon Command line syntax Loir library directory dir L ignore default library path Description With this option you can specify the path s where your system libraries specified with the I option are located If you want to specify multiple paths use the option L for each separate path The default path is PRODDIR carm 1ib If you specify only L without a pathname or the long option ignore default library path the linker will not search the default path and also not in the paths specified in the environment variable LIBARM So the linker ignores steps 2 and 3 as listed below The priority order in which the linker searches for system libraries specified with the I option is 1 The path that is specified with the L option 2 The path that is specified in the environment variable LIBARM 3 The default directory PRODDIR carm 1ib or a processor specific sub directory Example Suppose you call the linker as follows lkarm test obj Lc mylibs lcarm lkarm test obj library directory c mylibs library carm First the linker looks in the directory c mylibs for library carm lib this option If it does not find the requested libraries it looks in the directory that is set with the environment variable LIBARM Then the linker looks i
22. sl1 s2 n wmemcpy sl1 s2 n memmove sl1 s2 n strcpy sl1 s2 wescpy sl1 s2 strncpy sl s2 n wesncpy sl s2 n strcat sl1 s2 wescat sl1 s2 strncat sl1 s2 n wesncat sl s2 n Comparison functions Stdio h Wchar h wmemmove s1 s2 n Copies n characters from s2 into s7 and re turns s1 If s1 and s2 overlap the result is un defined Same as memcpy but overlapping strings are handled correctly Returns s7 Copies s2 into s1 and returns s7 If s7 and s2 overlap the result is undefined Copies not more than n characters from s2 into s1 and returns s7 If s7 and s2 overlap the result is undefined Appends a copy of s2 to s7 and returns s7 If s1 and s2 overlap the result is undefined Appends not more than n characters from s2 to s1 and returns s7 If s7 and s2 overlap the result is undefined Description memcmp sl s2 n wmemcmp sl s2 n strcemp sl1 s2 wescmp sl1 s2 strncemp sl1 s2 n wesncemp sl s2 n strcoll sl s2 wescoll sl s2 2 26 Compares the first n characters of s7 to the first n characters of s2 Returns lt 0 if s7 lt s2 0 if s1 s2 or gt Oif s7 gt s2 Compares string s7 to string s2 Returns lt 0 if s1 lt s2 0 if s1 s2 or gt O if s7 gt s2 Compares the first n characters of s7 to the first n characters of s2 Returns lt 0 if s7 lt s2 O if s7 s2 or gt Oif s7 gt
23. x Command line syntax X Description With this option the make utility shows extended error messages Extended error messages give more detailed information about the exit status of the make utility after errors EDE uses this option for the graphical version of make Example mkarm x If errors occur the make utility gives extended information Related information d 5 191 ARM Embedded Tools Reference 5 6 Librarian Options The librarian ararm is a tool to build library files and it offers the possibility to replace extract and remove modules from an existing library You can only call the librarian from the command line The invocation syntax is ararm key_option sub_option library object_file This section describes all options for the make utility Suboptions can only be used in combination with certain key options Keyoptions and their suboptions are therefore described together The miscellaneous options can always be used and are also described separately The librarian is a command line tool so there are no equivalent options in EDE Description Option Suboption Main functions key options Replace or add an object module r a b c u Vv Extract an object module from the library X 0 V Delete object module from library d V Move object module to another position m a b v Print a table of contents of the library t s0 s1 Print object module to standard output p Subop
24. 1 8 C Language __setspsr unsigned int volatile _ setspsr int set int clear Set or clear bits in the SPSR status register Returns the new value of the SPSR status register Example define SR_F 0x00000040 define SR_I 0x00000080 i setspsr 0 SRF SRI if i amp SRF SR_I exit 6 Interrupt flags not correct if __getspsr amp SRF SR_I exit 7 Interrupt flags not correct __getcpsr unsigned int volatile _ getcpsr void Get the value of the CPSR status register Returns the value of the status register CPSR __setcpsr unsigned int volatile _ setcpsr int set int clear Set or clear bits in the CPSR status register Returns the new value of the CPSR status register __swi void volatile _ swi int number Generates a software interrupt Number must be a constant value Returns nothing 1 9 ARM Embedded Tools Reference 1 6 Pragmas Pragmas are keywords in the C source that control the behavior of the compiler Pragmas overrule compiler options The syntax is pragma pragma spec ON OFF DEFAULT or _Pragma pragma spec ON OFF DEFAULT The compiler recognizes the following pragmas other pragmas are ignored alias symbol defined_symbol Define symbol as an alias for definined_symbol It corresponds to an equate directive equ at assembly level The symbol should not be defined elsewhere and defined_symbo should be defined wi
25. 2 11 islessequal 2 11 islessgreater 2 11 islower 2 2 isnan 2 12 isnormal 2 12 ISO C standard selecting 5 9 5 145 isprint 2 2 ispunct 2 2 isspace 2 2 isunordered 2 11 isupper 2 2 iswalnum 2 2 2 33 iswalpha 2 2 2 33 iswblank 2 2 iswentrl 2 2 2 33 iswctype 2 33 iswdigit 2 2 2 33 iswgraph 2 2 2 33 iswlower 2 2 2 33 iswprint 2 2 2 33 iswpunct 2 2 2 33 iswspace 2 2 2 33 iswupper 2 2 2 33 iswxdigit 2 2 iswxditig 2 33 isxdigit 2 2 L L_tmpnam 2 15 labs 2 25 Language extensions intrinsic functions 1 8 Idexp functions 2 10 Idiv 2 25 Igamma functions 2 11 Librarian options 5 193 d 5 194 f 5 195 m 5 196 p 5 197 Index r 5 198 t 5 200 V 5 201 w 5 202 x 5 203 add module 5 198 create library 5 198 delete module 5 194 extract module 5 203 move module 5 196 print list of objects 5 200 print list of symbols 5 200 print module 5 197 replace module 5 198 warning level 5 202 Libraries linking 5 100 5 115 Library specifying 5 104 5 106 5 147 5 148 5 149 Linker macro 5 92 Linker options 5 85 help 5 86 case insensitive 5 91 diag 5 94 error file 5 96 error limit 5 97 first library first 5 100 link only 5 107 long branch veneers 5 108 Isl check 5 109 Is dump 5 110 misra c report 5 113 no rescan 5 115 non romable 5 116 warnings as errors 5 125 B big endian 5 87 c
26. MACRO argumeni argumeni rier definition_statements ENDM Description With the MACRO directive you define a macro Macros provide a shorthand method for handling a repeated pattern of code or group of instructions You can define the pattern as a macro and then call the macro at the points in the program where the pattern would repeat The definition of a macro consists of three parts e Header which assigns a name to the macro and defines the arguments e Body which contains the code or instructions to be inserted when the macro is called e Terminator which indicates the end of the macro definition ENDM directive The arguments are symbolic names that the macro processor replaces with the literal arguments when the macro is expanded called Each formal argument must follow the same rules as symbol names the name can consist of letters digits and underscore characters _ The first character cannot be a digit Argument names cannot start with a percent sign Macro definitions can be nested but the nested macro will not be defined until the primary macro is expanded You can use the following operators in macro definition statements Operator Name Description Macro argument Concatenates a macro argument with adjacent alphanumeric concatenation characters Return decimal Substitutes the symbol sequence with a character string that value of symbol represents the decimal value of the symbol Ret
27. Related information Gb Compiler option D Define preprocessor macro 5 47 ARM Embedded Tools Reference Compiler u uchar Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Language 3 Enable the option Treat char variables as unsigned Command line syntax u uchar Description By default char is the same as specifying signed char With this option char is the same as unsigned char Related information d 5 48 Tool Options Compiler Compiler V version Menu entry Command line only Command line syntax V version Description Displays version information of the compiler The compiler ignores all other options or input files Related information J 5 49 ARM Embedded Tools Reference Compiler w no warnings Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Diagnostics 3 Select one of the following options e Report all warnings e Suppress all warnings e Suppress specific warningsn If you select Suppress specific warnings 4 Enter the numbers separated by commas of the warnings you want to suppress Command line syntax w nr no warnings n Description With this option you can suppress all warning messages or specific warning messages O
28. The path that is specified with the assembler option l 3 The path that is specified in the environment variable AStargetINC when the product was installed 4 The default directory ctarget include Example Suppose that your assembly source file test src contains the following line INCLUDE c myincludes myinc inc The assembler issues an error if it cannot find the file at the specified location INCLUDE myinc inc The assembler searches the file myinc inc according to the rules described above Related information Gb Assembler option l Add directory to include file search path in Section 5 2 Assembler Options of Chapter Tool Options 3 29 ARM Embedded Tools Reference LIST NOLIST Syntax NOLIST assembly source lines LIST Description If you generate a list file see assembler option I you can use the LIST and NOLIST directives to specify which source lines the assembler must write to the list file The assembler prints all source lines to the list file untill it encounters a NOLIST directive The assembler does not print the NOLIST directive and subsequent source lines When the assembler encounters the LIST directive it resumes printing to the list file starting with the LIST directive itself It is possible to nest the LIST NOLIST directives Example Suppose you assemble the following assembly code with the assembler option I SECTION text source li
29. Tool Options Linker Linker case insensitive Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Disable the option Link case sensitive Command line syntax case insensitive Description With this option you tell the linker not to distinguish between upper and lower case characters in symbols By default the linker considers upper and lower case characters as different characters AN Disabling the option Link case sensitive in EDE is the same as specifying the option case insensitive on the command line Assembly source files that are generated by the compiler must always be assembled and thus linked case sensitive When you have written your own assembly code and specified to assemble it case insensitive you must also link the obj file case insensitive Related information J 5 91 ARM Embedded Tools Reference Linker D define Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Add the option D to the Additional linker options field Command line syntax Dmacro_name macro_definition define macro_name macro_definition Description With this option you can define a macro and specify it to the linker LSL file preprocessor If you only specify a macro na
30. With this option you tell the linker to only emit the specified maximum number of errors When 0 null is specified the linker emits all errors Without this option the maximum number of errors is 42 Related information J 5 97 ARM Embedded Tools Reference Linker f option file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Add the option f to the Additional linker options field Be aware that when you specify the option f in the Additional linker options field the options are added to the linker options you have set in the other dialogs Only in extraordinary cases you may want to use them in combination EDE automatically saves the options with your project Command line syntax f file option file file Description This option is primarily intended for command line use Instead of typing all options on the command line you can create an option file which contains all options and flags you want to specify With this option you specify the option file to the linker Use an option file when the length of the command line would exceed the limits of the operating system or just to store options and save typing You can specify the option f multiple times Format of an option file e Multiple arguments on one line in the option file are allowed e To include whitespace in an argument surround
31. all debug information With this information extra debug information is generated In extra ordinary cases you may use this debug information for instance if you use your own debugger which makes use of this information With this suboption the resulting assembler object file increases significantly Related information i 5 20 Tool Options Compiler Compiler H include file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Preprocessing 3 Enter the name of the file in the Include this file before source field or click the Browse button and select a file Command line syntax Hfile include file file Description With this option set at project level you include one extra file at the beginning of each C source file in your project On file level Project Current File Options you can overrule this option with another file or no file at all The specified include file is included before all other includes This is the same as specifying include file atthe very beginning of each of your C source files Example carm Hstdio h testl c test2 c carm include file stdio h testl c test2 c The file stdio h is included at the beginning of both test1 c and test2 c Related information d Compiler option lI Add directory to include file search path Section 5 5 How the Compiler
32. chip output 5 89 C cpu 5 88 D define 5 92 d lsl file 5 93 e extern 5 95 f option file 5 98 I include directory 5 101 i user provided initialization code 5 102 k keep output files 5 103 L ignore default library path 5 104 I library 5 106 L library directory 5 104 M map file 5 111 m map file format 5 112 N no rom copy 5 114 O optimize 5 117 o output 5 118 r incremental 5 120 S strip debug 5 121 v verbose 5 123 V version 5 122 vv extra verbose 5 123 w no warnings 5 124 diagnostics 5 124 5 125 libraries 5 106 5 115 Map File 5 111 miscellaneous 5 91 5 92 5 93 5 95 5 110 optimization 5 117 output format 5 89 Linker script file 5 109 5 110 architecture definition 8 1 board specification 8 3 bus definition 8 2 derivative definition 8 2 memory definition 8 2 preprocessing 8 4 processor definition 8 2 section layout definition 8 3 specifying 5 93 5 134 structure 8 1 List file 5 72 5 74 list nolist 3 30 llabs 2 25 IIdiv 2 25 llrint functions 2 9 llround functions 2 9 localeconv 2 7 localtime 2 29 log functions 2 8 log10 functions 2 8 logip functions 2 8 log2 functions 2 8 logb functions 2 8 Long branch veneers 5 108 longjmp 2 12 Irint functions 2 9 Index 7 ARM Embedded Tools Reference lround functions 2 9 Isb 3 3 Iseek
33. lt time h gt shall not be used 9 5 ARM Embedded Tools Reference See also section 5 7 C Code Checking MISRA C in Chapter Using the Compiler of the User s manual 9 2 MISRA C 2004 This section lists all supported and unsupported MISRA C 2004 rules See also section 5 7 C Code Checking MISRA C in Chapter Using the Compiler of the User s Manual A number of MISRA C rules leave room for interpretation Other rules can only be checked in a limited way In such cases the implementation decisions and possible restrictions for these rules are listed x means that the rule is not supported by the TASKING C compiler R is a required rule A is an advisory rule Environment 1 1 R 1 2 R x 1 3 R x 1 4 R x 15 A All code shall conform to ISO 9899 1990 Programming languages C amended and corrected by ISO IEC 9899 COR1 1995 ISO IEC 9899 AMD1 1995 and ISO IEC 9899 COR2 1996 No reliance shall be placed on undefined or unspecified behavior Multiple compilers and or languages shall only be used if there is a common defined interface standard for object code to which the languages compilers assemblers conform The compiler linker shall be checked to ensure that 31 character significance and case sensitivity are supported for external identifiers Floating point implementations should comply with a defined floating point standard Language extensions 21 R 22 R 23 R 24 A 9
34. range number e e number 8 9 ARM Embedded Tools Reference 8 3 8 Architecture Definition architecture_definition architecture arch_name lt parameter list gt 9 1 lt extends arch_name lt argument_list gt 0 1 gt 0 1 arch_spec e Anarchitecture_definition defines a core architecture with the given arch_name asa unique name e Atleast one space_def and at least one bus_def have to be present in an architecture_definition e Anarchitecture_definition that uses the extends construct defines an architecture that inherits all elements of the architecture defined by the second arch_name The parent architecture must be defined in the LSL file as well parameter list parameter lt parameter gt 9 parameter IDENTIFIER lt expr gt 1 argument_list expr lt expr gt 9 arch_spec bus_def space _def endianness_def space_def space space_name lt space_descr gt gt e A space_def defines an address space with the given space_name as a unique name within an architecture space_descr space_property section_definition no space ref vector _table_statement space_property id number as used in object mau expr align expr page_size expr lt range lt range gt gt 9 gt 0 1 page direction direction stack_def heap_def copy_table_def start_address mapping e A space_def contains exactly one id and one mau stat
35. s2 Performs a local specific comparison between string s7 and string s2 according to the LC_COLLATE category of the current locale Returns lt 0 if s1 lt s2 0 if s1 s2 or gt Oif s1 gt s2 See section 2 2 12 locale h Libraries Stdio h Wchar h Description strxfrm sl1 s2 n Search functions Stdio h wesxfrm sl s2 n Wchar h Transforms a local string s2 so that a compar ison between transformed strings with strcmp gives the same result as a comparison between non transformed strings with strcol11 Returns the transformed string s7 Description memchr s c n strchr s c strrchr s c strspn s set strcespn s set strpbrk s set strstr s sub strtok s delim wmemchr s c n weschr s c wesrchr s c wesspn s set wescspn s set wespbrk s set wesstr s sub westok s delim Miscellaneous functions Stdio h Wchar h Checks the first n characters of s on the occur ence of character c Returns a pointer to the found character Returns a pointer to the first occurence of char acter c in string s or the null pointer if not found Returns a pointer to the last occurence of char acter c in string s or the null pointer if not found Searches s for a sequence of characters speci fied in set Returns the length of the first se quence found Searches s for a sequence of characters not specified in
36. select mysection else reserved myreserved size 2k 8 43 ARM Embedded Tools Reference 8 44 9 MISRA C Rules Summary This chapter contains an overview of the supported and unsupported MISRA C rules 9 1 MISRA C 1998 This section lists all supported and unsupported MISRA C 1998 rules See also section 5 7 C Code Checking MISRA C in Chapter Using the Compiler of the User s Manual LAN A number of MISRA C rules leave room for interpretation Other rules can only be checked in a limited way In such cases the implementation decisions and possible restrictions for these rules are listed x means that the rule is not supported by the TASKING C compiler R is a required rule A is an advisory rule 1 R The code shall conform to standard C without language extensions X 2 A Other languages should only be used with an interface standard 3 A Inline assembly is only allowed in dedicated C functions X 4 A Provision should be made for appropriate run time checking 5 R Only use characters and escape sequences defined by ISO C X 6 R Character values shall be restricted to a subset of ISO 106460 1 7 R Trigraphs shall not be used 8 R Multibyte characters and wide string literals shall not be used 9 R Comments shall not be nested 10 A Sections of code should not be commented out In general it is not possible to decide whether a piece of comment is C code that is comment
37. 1 Pointer pointer to function or data 32 32 0 292 1 Floating Point 3 402e38 1 175e738 Soa 32 ae 1 175e 38 3 402838 double S e 71 798e308 2 225e 7308 long double 2 225e 308 1 798308 Table 1 1 Data Types for the ARM 1 2 C Language 1 3 Keywords __unaligned _ packed __ With the type qualifier unaligned you can specify to suppress the alignment of objects or structure members struct char c _ unaligned int i aligned at offset 1 s _ unaligned int up amp s i To prevent alignment gaps in structures you can use the attribute packed__ When you use the attribute packed__ directly after the keyword struct all structure members are marked __unaligned For example the following two declarations are the same struct _ packed __ char c int i sl struct _ unaligned char c _ unaligned int i s52 __asm With the __ asm keyword you can use assembly instructions in the C source __asm instruction_template output_param_list input_param_list register _save_list instruction_template Assembly instructions that may contain parameters from the input list or output list in the form parm_nr Y parm_nr regnum Parameter number in the range 0 9 With the optional regnum you can access an individual register from a register pair output_param_list amp constraint_char C_expression input_param_list constrain
38. 5 117 code compaction 5 24 inlining 5 25 optimize for speed size 5 45 optimize endoptimize 1 11 Option file 5 18 5 98 5 139 5 178 Options saving restoring 5 18 5 98 P page 3 36 Parameter passing 1 7 Passing options 5 161 Index 9 ARM Embedded Tools Reference perror 2 22 pow functions 2 10 Pragmas 1 10 Predefined macros 1 14 Preprocessing 5 58 5 61 5 136 8 4 storing output 5 15 printf 2 17 2 21 conversion characters 2 18 Processor definition 8 2 8 29 Processor options processor definition 5 8 5 55 5 88 Processor type assembling for 5 55 compiling for 5 8 5 129 selecting 5 8 5 55 5 129 Profiling 5 37 5 154 ptrdiff_t 2 14 putc 2 20 putchar 2 20 puts 2 20 putwc 2 20 putwchar 2 20 Q qsort 2 25 R raise 2 13 rand 2 24 RAND_MAX 2 23 read 2 31 realloc 2 24 Register usage 1 7 remainder functions 2 9 remove 2 22 remquo functions 2 9 rename 2 22 Renaming sections 5 39 repeat endrep 3 37 Reset handler 4 1 4 3 Reset vector 8 23 rewind 2 22 rint functions 2 9 round functions 2 9 runtime 1 12 Index 10 S scalbln functions 2 10 scalbn functions 2 10 scanf 2 18 2 20 conversion characters 2 19 Section 3 38 section endsection 1 12 Section attributes 3 38 Section information 5 80 Section layout definition 8 3 8 33 Section renaming 5 39 Section setup definition 8 32 Sections 3 38 grouping 8 34 SEEK_C
39. 5 3 ARM Embedded Tools Reference Compiler A language Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Language 3 Enable or disable the following options e Allow C style comments in C source code only available when ISO C 90 is selected e Allow relaxed const check for string literals Command line syntax Alfflags language flags You can set the following flags g G gcc Enable a number of gcc extensions p P comments Allow C style comments in C source code x X strings Relaxed const check for string literals A language is the equivalent of AGPX which disables all language extensions The default is Agpx Description With this option you control the language extensions the compiler accepts Default the C compiler allows all language extensions With Allow C style comments in C source code Ap you tell the compiler to allow C style comments in ISO C90 mode option 90 In ISO C99 mode this style of comments is always accepted With Allow relaxed const check for string literals Ax you tell the compiler not to check for assignments of a constant string to a non constant string pointer With this option the following example produces no warning char p void main void p hello With the suboption Ag command line only you tell the compiler to enable t
40. 6 Assembly language shall be encapsulated and isolated Source code shall only use style comments The character sequence shall not be used within a comment Sections of code should not be commented out In general it is not possible to decide whether a piece of comment is C code that is commented out or just some pseudo code Instead the following heuristics are used to detect possible C code inside a comment a line ends with or a line starts with possibly preceded by white space MISRA C Rules Documentation x 3 1 R x 3 2 R x 3 3 A 3 4 R 3 5 R x 3 6 R Character sets 4 1 R 4 2 R Identifiers 5 1 R 5 2 R 5 3 R 5 4 R x 5 5 A 5 6 A x 5 7 A Types 6 1 R x 62 6 3 A All usage of implementation defined behavior shall be documented The character set and the corresponding encoding shall be documented The implementation of integer division in the chosen compiler should be determined documented and taken into account All uses of the pragma directive shall be documented and explained This rule is really a documentation issue The compiler will flag all pragma directives as violations The implementation defined behavior and packing of bit fields shall be documented if being relied upon All libraries used in production code shall be written to comply with the provisions of this document and shall have been subject to
41. Intrinsic FunctionS ociera meiride ennenen 1 8 1 6 PragmaS 4 2 0 descr ageduitees nikde n a aa a obedead 1 10 1 7 Predefined Macros 00 00 c cece ete teen eee 1 14 Libraries 2 1 2 1 INMODUCHON a cet owieGcd deeming bb ohh token nada dee a a a a 2 1 2 2 Library FUNGHONS ise weaecea eerie pehawee eds orini es be 2 2 2 2 1 ASSEN 28 Sis keh eda PE ete aca ed had aed eee tat bedi Geet 2 2 2 2 2 COMPIEXA oirrese ceni eee Ata Oo ae ee ee aaeh eee 2 2 2 2 3 ctype h and wetype h 2 tenes 2 2 2 2 4 CNN crisi ted ins ineei E Pa ana a i lddad behead haan 2 3 2 2 5 IENE Ni ossiani r n a ae GE Mee ame kas Sek pee RE 2 4 2 2 6 TOAVA niato ded mariae ad bed aha EKN EE E a E E EE 2 4 2 2 7 MOA ssenari ap ta aa win T E e a E 2 5 2 2 8 FSS Riera apea ni nT ee uae a a a Soe E EREE 2 5 2 2 9 inttypes h and stdint h 6 tees 2 6 2 2 10 ISOO4G N ce San ee bem n ad A eee ead a aera eas 2 6 2 2 11 LIMES Dio cectctie na Mate a E a E dealers eae eh aera es 2 6 2 2 12 localeAy c84ccueneode de diee aeeai dat dba deh e ded 2 7 2 2 13 math h and tgmath n 1 eens 2 7 2 2 14 SEYMPWsadsiendee ded eo bedee di waded e e e e a E 2 12 2 2 15 Signali jcieciducd tategiag ne Gee a ahs a nae E T alee 2 13 2 2 16 stdarg M sates iesiedeueeetkabade sy Vegans etalk eed 2 13 2 2 17 eito letelo E o ie icaddenghehidagled EE E en tea bawe heres 2 14 2 2 18 stddef s13csbidiateawenentamadd etl ova Gaedutitbe rayne 2 14 2 2 19 Stith vice twdieeny Caddie wile
42. Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Diagnostics 3 Select one of the following options e Report all warnings e Suppress all warnings e Suppress specific warnings If you select Suppress specific warnings 4 Enter the numbers separated by commas of the warnings you want to suppress Command line syntax w nr no warnings n Description With this option you can suppresses all warning messages or specific warning messages e If you do not specify this option all warnings are reported e If you specify this option but without numbers all warnings are suppressed e If you specify this option with a number only the specified warning is suppressed You can specify the option w multiple times Example To suppress warnings 135 and 136 enter 135 136 in the Suppress specific warnings field or enter the following on the command line lkarm w135 136 test obj lkarm no warnings 135 136 test obj Related information d gt Linker option warnings as errors Treat warnings as errors 5 124 Tool Options Linker Linker warnings as errors Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Diagnostics 3 Enable the option Treat warnings as errors Command line syntax warnings as errors number Description When
43. R R R R R R Dynamic heap memory allocation shall not be used The error indicator errno shall not be used The macro offsetof in library lt stddef h gt shall not be used The set jmp macro and the long jmp function shall not be used The signal handling facilities of lt signal h gt shall not be used The input output library lt stdio h gt shall not be used in production code The library functions atof atoi and atol from library lt stdlib h gt shall not be used The library functions abort exit getenv and system from library lt stdlib h gt shall not be used The time handling functions of library lt time h gt shall not be used Minimization of run time failures shall be ensured by the use of at least one of a static analysis tools techniques b dynamic analysis tools techniques c explicit coding of checks to handle run time faults Index Index Symbols __asm 1 3 __at 1 4 __BIG_ENDIAN_ 1 14 _ BUILD__ 1 14 __CARM_ 1 14 __CPU_ 1 14 __ DOUBLE _FP_ 1 14 __frame 1 5 __interrupt_dabt 1 5 __interrupt_fig 1 5 __interrupt_iabt 1 5 __interrupt_irg 1 5 __interrupt_swi 1 5 __interrupt_und 1 5 __noinline 1 5 __novector 1 5 1 6 __packed__ 1 3 __ REVISION __ 1 14 __SINGLE_FP_ 1 14 __ TASKING __ 1 14 __THUMB_ 1 14 __unaligned 1 3 __VERSION_ 1 14 _close 2 15 _Exit 2 24 _fss_break 2 5 _fss_init 2 5 _IOFBF 2 16 _IOLBF 2 16 _IONBF 2
44. Reference Short and long option names Options can have both short and long names Short option names always begin with a single minus character long option names always begin with double minus characters You can abbreviate long option names as long as the name is unique You can mix short and long option names on the command line Options can have flags or sub options To switch a flag on use a lowercase letter or a ongflag To switch a flag off use an uppercase letter or a longflag Separate longflags with commas The following two invocations are equivalent carm Oac test c carm optimize coalesce cse test c When you do not specify an option a default value may become active 5 2 Tool Options Compiler Compiler help Menu entry Command line only Command line syntax help item You can specify the following arguments intrinsics Show the list of intrinsic functions options Show extended option descriptions pragmas Show the list of supported pragmas Description Displays an overview of all command line options When you specify an argument you can list extended information such as a list of intrinsic functions pragmas or option descriptions Example The following invocations all display a list of the available command line options carm carm help carm The following invocation displays a list of the available pragmas carm help pragmas
45. Section Type text Code sections code data Initialized data data sdata Initialized data in read write small data area data bss Uninitialized data cleared data sbss Uninitialized data in read write small data area cleared data rodata ROM data constants data debug Debug sections debug Table 3 1 Predefined section names Sections of a specified type are located by the linker in a memory space The space names are defined in a so called linker script file files with the extension 1s1 delivered with the product in the directory installation dir include 1sl You can specify the following section attributes Example SECTION data Declare a data section SECTION data abs at 0x0 Declare a data abs section at an absolute address 3 38 Assembly Language SET Syntax symbol SET expression SET symbol expression Description With the SET directive you assign the value of expression to symbol temporarily If a symbol was defined with the SET directive you can redefine that symbol in another part of the assembly source using the SET directive again Symbols that you define with the SET directive are always local you cannot define the symbol global with the GLOBAL directive The SET directive is useful in establishing temporary or reusable counters within macros expression must be absolute and cannot include a symbol that is not yet defined no forward references are all
46. Space ARM ARM linear xrom _vector_0 174 0x00000004 0x00000000 0x00000000 xrom data 165 0x00000004 0x00000020 0x00000020 xrom data libc 166 0x000000c8 0x00000024 0x00000024 xrom text cstart 142 0x000000d4 0x000003b8 0x000003b8 xrom text 1 0x00000018 0x0000059c 0x0000059c xrom rodata 3 0x00000006 0x000015e8 0x000015e8 xrom table 164 0x00000040 0x000015fc 0x000015fc xram stack 157 0x0003fd58 0x000402a8 0x000002a8 Pr Exit 0x00000460 _START 0x000003b8 main 0x0000059c fr nnn nnn nnn nnn nnn List File Formats Symbols sorted on address a eee eet Address Name Space 0x00000010 APPLICATION MODE_ ARM ARM linear 0x000003b8 _START 0x00000460 Exit 0x0000059c main JES AE A AE R A kk Memory Usage AAAA A k k A R e A k A k e A e III Address range usage at space level Hrs ef Name Total Used abs Free abs gt free gap abs ARM ARM linear 0x00080000 0x00041639 52 0x0003e9c7 48 0x0003e9c4 48 Hen af Address range usage at memory level ee E Name Total Used abs Free abs gt free gap abs xram 0x00040000 0x00040000 100 0x00000000 0 0x00000000 o0 xrom 0x00040000 0x00001639 3 0x0003
47. a file FSS implementation Used by the function remove FSS implementation Writes a sequence of characters to a file FSS implementation 2 15 ARM Embedded Tools Reference File access Stdio h Description fopen name mode fclose name fflush name freopen name mode stream setbuf stream buffer setvbuf stream buffer mode size Opens a file for a given mode Available modes are n r read open text file for reading yy w write create text file for writing if the file already exists its contents is discarded a append open existing text file or create new text file for writing at end of file r open text file for update reading and writing w create text file for update previous contents if any is discarded ar append open or create text file for update writes at end of file Flushes the data stream and closes the specified file that was previously opened with fopen If stream is an output stream any buffered but unwritten date is written Else the effect is undefined Similar to fopen but rather then generating a new value of type FILE the existing value is associated with a new stream If buffer is NULL buffering is turned off for the stream Otherwise setbuf is equivalent to void setvbuf stream buf IOFBF BUFSIZ Controls buffering for the stream this function must be called before reading or writing Mode can have the following values _IOFBF
48. access the positions of the sections when located If the linker detects references to the TASKING initialization code an error is emitted it is either the TASKING initialization routine or your own not both Note that the options no rom copy and non romable may vary independently The copytable compression optimization is automatically disabled when you enable this option Related information f 5 102 Tool Options Linker Linker k keep output files Menu entry EDE always removes the output files when errors occurred Command line syntax k keep output files Description If an error occurs during linking the resulting output file may be incomplete or incorrect With this option you keep the generated output files when an error occurs By default the linker removes the generated output file when an error occurs This is useful when you use the make utility If the erroneous files are not removed the make utility may process corrupt files on a subsequent invocation Use this option when you still want to use the generated file For example when you know that a particular error does not result in a corrupt object file or when you want to inspect the output file or send it to Altium support Related information J 5 103 ARM Embedded Tools Reference Linker L library directory ignore default library path Menu entry 1 From the Project menu select Directories
49. also stop f double e E double g G double n int the number of characters written so far is written into the argument This should be a pointer to an integer in default memory No value is printed p pointer hexadecimal 24 bit value No argument is converted a is printed Table 2 2 Printf conversion characters All arguments to the scanf related should be pointers to variables in default memory of the type which is specified in the format string The format string can contain Blanks or tabs which are skipped Normal characters not which should be matched exactly in the input stream Conversion specifications starting with a character Conversion specifications should be built as follows in order A meaning that no assignment is done for this field A number specifying the maximum field width The conversion characters d i n o u and x may be preceded by h if the argument is a pointer to short rather than int or by l letter ell if the argument is a pointer to long or by ll for a pointer to long long The conversion characters e f and g may be preceded by if the argument is a pointer to double rather than float and by L for a pointer toa long double A conversion specifier maximum field width and length modifier are optional the conversion character is not The conversion character must be one of the following if a character following
50. appropriate validation Only those escape sequences that are defined in the ISO C standard shall be used Trigraphs shall not be used Identifiers internal and external shall not rely on the significance of more than 31 characters Identifiers in an inner scope shall not use the same name as an identifier in an outer scope and therefore hide that identifier A typedef name shall be a unique identifier A tag name shall be a unique identifier No object or function identifier with static storage duration should be reused No identifier in one name space should have the same spelling as an identifier in another name space with the exception of structure and union member names No identifier name should be reused The plain char type shall be used only for storage and use of character values signed and unsigned char type shall be used only for the storage and use of numeric values typedefs that indicate size and signedness should be used in place of the basic types 9 7 ARM Embedded Tools Reference 6 4 R _ bit fields shall only be defined to be of type unsigned int or signed int 6 5 R _ bit fields of type signed int shall be at least 2 bits long Constants 7 1 R Octal constants other than zero and octal escape sequences shall not be used Declarations and definitions 8 1 R Functions shall have prototype declarations and the prototype shall be visible at both the function definition and call
51. architecture definition 8 10 board specification 8 13 bus definition 8 8 derivative definition 8 12 memory definition 8 8 processor definition 8 13 section layout definition 8 13 Isw 3 3 ltorg 3 31 Index M macro nomacro 1 11 Macro definition 5 12 5 58 5 132 macro endm 3 32 Macros 1 14 make utility 5 165 Make utility options 5 166 a 5 167 c 5 168 D 5 169 d 5 170 DD 5 169 dd 5 170 e 5 171 err 5 172 f 5 173 G 5 174 i 5 175 K 5 176 k 5 177 m 5 178 5 184 n 5 180 p 5 181 q 5 182 r 5 183 S 5 185 t 5 186 time 5 187 V 5 188 W 5 189 w 5 190 x 5 191 defining a macro 5 165 malloc 2 24 Map file generation 5 111 Mappings 8 23 MB_CUR_MAX 2 23 2 32 MB_LEN_MAX 2 32 mblen 2 25 mbrlen 2 32 mbrtowc 2 32 mbsinit 2 32 mbsrtowcs 2 32 mbstate_t 2 32 mbstowcs 2 25 mbtowc 2 25 memchr 2 27 memecmp 2 26 memcpy 2 26 memmove 2 26 Memory definition 8 2 memset 2 27 Merging source code 5 42 message 1 11 3 34 MISRA C 5 28 5 29 MISRA C report 5 113 supported rules 1998 9 1 supported rules 2004 9 6 version 5 30 mktime 2 28 modf functions 2 10 Motorola S record format 7 2 msb 3 3 msh 3 4 msw 3 4 N nan functions 2 10 nearbyint functions 2 9 nextafter functions 2 10 nexttoward functions 2 10 NULL 2 14 O offset 3 35 offsetof 2 14 Optimization 5 33 5 76
52. as follows struct tm int int int int int int int int int i tm_sec tm_min tm_hour tm_mday tm_mon tm_year tm_wday tm_yday tm_isdst Time manipulation clock difftime t1 t0 mktime tm tp time timer 2 28 seconds after the minute 0 59 minutes after the hour 0 59 hours since midnight 0 23 day of the month 1 31 months since January 0 11 year since 1900 days since Sunday 0 6 days since January 1 0 365 Daylight Saving Time flag Returns the application s best approximation to the processor time used by the program since it was started This low level routine is not implemented because it strongly depends on the hardware To determine the time in seconds the result of clock should be divided by the value defined as CLOCKS _PER_SEC 12000000 Returns the difference t1 t0 in seconds Converts the broken down time in the structure pointed to by tp to a value of type time_t The return value has the same encoding as the return value of the time function Returns the current calendar time This value is also assigned to timer Libraries Time conversion asctime tm tp ctime timer gmtime timer localtime timer Converts the broken down time in the structure pointed to by tp into a string in the form Mon Jan 21 16 15 14 2004 n 0 Returns a pointer to this string Converts the cale
53. below Example Consider the following makefile with conditional rules to build a demo program and a real program ifdef DEMO the value of DEMO is of no importance real abs real obj main obj lkarm demo obj main obj darm 1sl lcarm lfparm else real abs real obj main obj lkarm real obj main obj darm 1sl lcarm lfparm endif You can now use a macro definition to set the DEMO flag mkarm real abs DEMO 1 In both cases the absolute object file real abs is created but depending on the DEMO flag it is linked with demo obj or with real obj Related information Make utility option e Environment variables override macro definitions Make utility option m Name of invocation file 5 165 ARM Embedded Tools Reference Make Utility Command line syntax Description Displays an overview of all command line options Example The following invocation displays a list of the available command line options mkarm Related information J 5 166 Tool Options Make Utility Make Utility a Command line syntax a Description Normally the make utility rebuilds only those files that are out of date With this option you tell the make utility to rebuild all files without checking whether they are out of date Example mkarm a Rebuilds all your files regardless of whether they are out of date or not Related information J 5 167 ARM Embedded Tools Reference Make Utility c
54. category const char locale The function above changes locale specific features of the run time library as specified by the category to change and the name of the locale The following categories are defined and can be used as input for this function LC_ALL 0 LC_NUMERIC 3 LC_COLLATE 1 LC_TIME 4 LC_CTYPE 2 LC_MONETARY gt struct lconv localeconv void Returns a pointer to type stuct lconv with values appropriate for the formatting of numeric quantities according to the rules of the current locale The struct lconv in this header file is conforming the ISO standard 2 2 13 math h and tgmath h The header file math h contains the prototypes for many mathematical functions Before C99 all functions were computed using the double type the float was automatically converted to double prior to calculation In this C99 version parallel sets of functions are defined for double float and long double They are respectively named function function function1 All long type functions though declared in math h are implemented as the double type variant which nearly always meets the requirement in embedded applications The header file tgmath h contains parallel type generic math macros whose expansion depends on the used type tgmath h includes math h and the effect of expansion is that the correct math h functions are called The type generic macro if available is listed in the second column of the tables below Trigonometric fu
55. con tents of s NOTE this function is not implemented because there is no OS Passes the string s to the environment for execution NOTE this function is not implemented because there is no OS Libraries Searching and sorting bsearch key base n size cmp qsort base n size cmp Integer arithmetic int abs j long labs j long long llabs j div_t div x y ldiv_t ldiv x y lldiv_t lldiv x y This function searches in an array of n members for the object pointed to by key The initial base of the array is given by base The size of each member is specified by size The given array must be sorted in ascend ing order according to the results of the function pointed to by cmp Re turns a pointer to the matching member in the array or NULL when not found This function sorts an array of n members using the quick sort algorithm The initial base of the array is given by base The size of each member is specified by size The array is sorted in ascending order according to the results of the function pointed to by cmp Compute the absolute value of an int long int and long long intj resepectively Compute x y and x y in a single operation X and y have respectively type int long int and long long int The result is stored in the members quot and remof struct div_t ldiv_t andlldiv_t which have the same types Multibyte wide character and string conversions mblen s n mbtowc pwc s n wctomb s
56. diag 5 60 emit locals 5 62 error file 5 63 error limit 5 64 relaxed 5 78 warnings as errors 5 84 B big endian 5 54 c case insensitive 5 56 C cpu 5 55 D define 5 58 E preprocess 5 61 f option file 5 65 g debug info 5 67 H include file 5 68 I include directory 5 69 i symbol scope 5 70 k keep output files 5 71 l list file 5 74 Index 2 L list format 5 72 m preprocessor type 5 75 O optimize 5 76 o output 5 77 t section info 5 80 T thumb 5 79 v verbose 5 82 V version 5 81 w no warnings 5 83 debug information 5 62 5 67 diagnostics 5 64 5 83 5 84 list file 5 72 5 74 5 80 optimization 5 76 preprocessing 5 58 5 61 5 68 5 75 relaxed 2 operand syntax 5 78 Thumb instructions 5 79 Assembly functions alupcrel 3 2 arg 3 2 bigendian 3 2 ent 3 2 cpu 3 3 defined 3 3 Isb 3 3 lIsh 3 3 lsw 3 3 msb 3 3 msh 3 4 msw 3 4 strcat 3 4 strcmp 3 4 strlen 3 4 strpos 3 4 thumb 3 5 detailed description 3 2 overview 3 1 atan functions 2 7 atan2 functions 2 7 atanh functions 2 8 atexit 2 24 atof 2 23 atoi 2 23 atol 2 23 atoll 2 23 Index B bigendian 3 2 Board specification 8 3 8 29 break 3 10 bs 3 11 bsb 3 11 bsd 3 11 bsearch 2 25 bsh 3 11 bsw 3 11 btowc 2 32 BUFSIZ 2 15 Build options 5 104 include
57. e maintain an overall view of the used and free physical memory within the whole system while locating The section layout definition optional The optional section layout definition enables you to exactly control where input sections are located Features are provided such as the ability to place sections at a given load address or run time address to place sections in a given order and to overlay code and or data sections Which object files sections constitute the task that will run on a given core is specified on the command line when you invoke the linker The linker will link and locate all sections of all tasks simultaneously From the section layout definition the linker can deduce where a given section may be located in memory form the board specification the linker can deduce which physical memory is still available while locating the section See section 8 9 Semantics of the Section Layout Definition for more information on how to locate a section at a specific place in memory Skeleton of a Linker Script File The skeleton of a linker script file now looks as follows architecture architecture_name architecture definition derivative derivative_name derivative definition processor processor_name processor definition memory definitions and or bus definitions 8 3 ARM Embedded Tools Reference section_layout space_name section placement statements 8 3 Syntax of the Linker Script Language 8 3 1 P
58. ea pemdideda dee ddl ae ades 2 14 2 2 20 stdio h and wehar h 21 0 tee eee 2 14 2 2 21 stdlib h and wehar h 22 2k eee 2 22 2 2 22 string h and wchar h eee 2 26 2 2 23 time h and wehar h 0 ee eee eee 2 28 2 2 24 UNISUO A herta Gace dig dtm ah dae pee enemas wet 2 31 2 2 25 WCHAEI caciddinueneadahnnd teputeded deanlband eed vaaaeiaui a 2 32 2 2 26 WOYE scinccds nerais es Pee enw EEKE a aE RA Ree hae eRe ws 2 33 ARM Embedded Tools Reference Assembly Language 3 1 3 1 1 3 1 2 3 2 3 2 1 3 2 2 3 3 3 3 1 3 3 2 Built in Assembly Functions 20 0 0 eee eee eee Overview of Built in Assembly Functions 005 Detailed Description of Built in Assembly Functions Assembler Directives 0c c cece een eee Overview of Assembler Directives 000 cee eee eees Detailed Description of Assembler Directives Generic Instructions 0 0 cece cette eee eens ARM Generic Instructions 000 cece eect e eee eee Thumb Generic Instructions 0 000 c cece eee Run time Environment 4 1 4 2 4 3 Tool Options 5 1 5 2 5 3 5 4 5 5 5 6 Startup COd seen nine a aA a E EE pa aE eed Reset Handler and Vector Table uua aaaea Stack and Heap meret canadian peed EE E EEA EE Compiler Options sa isesceidai eeni iir ene nt ee E Assembler Options 0 00 eee eens Linker OPtiONS eaer rennia coe etalde ne hh
59. expressions shall not be tested for equality or inequality The controlling expression of a for statement shall not contain any objects of floating type The three expressions of a for statement shall be concerned only with loop control A violation is reported when the loop initialization or loop update expression modifies an object that is not referenced in the loop test Numeric variables being used within a for loop for iteration counting shall not be modified in the body of the loop Boolean operations whose results are invariant shall not be permitted MISRA C Rules Control flow 14 1 14 2 14 3 14 4 14 5 14 6 14 7 14 8 14 9 14 10 33 3 R There shall be no unreachable code All non null statements shall either a have at least one side effect however executed or b cause control flow to change Before preprocessing a null statement shall only occur on a line by itself it may be followed by a comment provided that the first character following the null statement is a white space character The goto statement shall not be used The continue statement shall not be used For any iteration statement there shall be at most one break statement used for loop termination A function shall have a single point of exit at the end of the function The statement forming the body of a switch while do while or for statement be a compound statement An if expression construct shall be
60. file file Description Instead of typing all options on the command line you can create an option file which contains all options and flags you want to specify With this option you specify the option file to the control program Use an option file when the command line would exceed the limits of the operating system or just to store options and save typing You can specify the option f multiple times Format of an option file e Multiple arguments on one line in the option file are allowed e To include whitespace in an argument surround the argument with single or double quotes e If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded e When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels Example Suppose the file myoptions contains the following lines DDEMO 1 test c Specify the option file to the control program ccarm f myoptions ccarm option file myoptions This is equivalent to the following command line ccarm DDEMO 1 test c 5 139 ARM Embedded Tools Reference Related information J
61. followed by a compound statement The else keyword shall be followed by either a compound statement or another if statement Allif else if constructs shall be terminated with an else clause Switch statements 15 1 15 2 15 3 15 4 15 5 Functions 16 1 16 2 16 3 16 4 R R A switch label shall only be used when the most closely enclosing compound statement is the body of a switch statement An unconditional break statement shall terminate every non empty switch clause The final clause of a switch statement shall be the default clause A switch expression shall not represent a value that is effectively Boolean Every switch statement shall have at least one case clause Functions shall not be defined with variable numbers of arguments Functions shall not call themselves either directly or indirectly A violation will be reported for direct or indirect recursive function calls in the source file being checked Recursion via functions in other source files or recursion via function pointers is not detected Identifiers shall be given for all of the parameters in a function prototype declaration The identifiers used in the declaration and definition of a function shall be identical 9 11 ARM Embedded Tools Reference 16 5 16 6 16 7 16 8 16 9 16 10 R Functions with no parameters shall be declared with parameter type void The number of arguments passed to a function
62. following two invocations are equivalent asarm Ogs test src asarm optimize tgenerics instr size test src When you do not specify an option a default value may become active 5 52 Tool Options Assembler Assembler help Menu entry Command line only Command line syntax help options Description Displays an overview of all command line options When you specify the argument options you can list detailed option descriptions Example The following invocations all display a list of the available command line options asarm asarm help asarm To see a detailed description of the available options enter asarm help options 5 53 ARM Embedded Tools Reference Assembler B big endian Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Select Processor Definition 3 Enable the option Big endian mode Command line syntax B big endian Description By default the assembler generates machine code for a little endian target least significant byte of a word at lowest byte address With this option enabled the assembler generates machine code for a big endian target most significant byte of a word at lowest byte address Related information f 5 54 Tool Options Assembler Assembler C cpu Menu entry 1 From the Project menu select Project Options The Project Options di
63. for more information the compiler options inline max iner and inline max size section 5 1 Compiler Options in Chapter Tool Options macro nomacro Turns macro expansion on or off Default macro expansion is enabled message message Print the message string s on standard output optimize flags endoptimize You can overrule the compiler option O for the code between the pragmas optimize and endoptimize The pragma works the same as compiler option O See section 5 3 Compiler Optimizations in Chapter Using the Compiler in the user s manual See compiler option O optimize in section 5 1 Compiler Options in Chapter Tool Options ARM Embedded Tools Reference runtime flag Check for run time errors The pragma works the same as compiler option r runtime See compiler option r runtime in section 5 1 Compiler Options in Chapter Tool Options of the reference manual section name suffix f m fm endsection Rename sections by adding a suffix to all section names specified with name or restore default section naming If you specify only a suffix without a name the suffix is added to all section names See compiler option R in section Compiler Options in Chapter Tool Options See assembler directive SECTION Start or continue section in section 3 2 Assembler Directives in Chapter Assembly Language of the reference manual source nosource With these pragmas you ca
64. from file 5 59 ARM Embedded Tools Reference Assembler diag Menu entry 1 Inthe Help menu enable the option Show Help on Tool Errors 2 Inthe Build tab of the Output window double click on an error or warning message A description of the selected message appears Command line syntax diag format all nr Description With this option you can ask for an extended description of error messages in the format you choose The output is directed to stdout normally your screen and in the format you specify You can specify the following formats html rtf or text default To create a file with the descriptions you must redirect the output With the suboption all the descriptions of all error messages are given If you want the description of one or more selected error messages you can specify the error message numbers separated by commas With this option the assembler does not assemble any files Example To display an explanation of message number 241 enter asarm diag 241 This results in the following message and explanation W241 additional input files will be ignored The assembler supports only a single input file All other input files are ignored To write an explanation of all errors and warnings in HTML format to file aserrors html use redirection and enter asarm diag html all gt aserrors html Related information ie 5 60 Tool Options Assembler Assembler E
65. incr 40 inline max size 15 test c The compiler first inlines all functions with the function qualifier inline and all functions that are smaller than the specified threshold of 15 If the code size has still not increased with 40 the compiler decides which other functions it can inline Related information Gb Compiler option O Specify optimization level Section 3 7 3 nlining Functions in chapter C Language of the user s manual 5 25 ARM Embedded Tools Reference Compiler interwork Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Code Generation 3 Enable the option Compile for ARM Thumb interworking Command line syntax interwork Description With this option the compiler generates code which supports calls between functions with the ARM and Thumb instruction set Use this option if your program consists of both ARM and Thumb functions By default this option is disabled since it produces slightly larger code Related information d Compiler option thumb use Thumb instruction set 5 26 Tool Options Compiler Compiler k keep output files Menu entry EDE always removes the src file when errors occur during compilation Command line syntax k keep output files Description If an error occurs during compilation the resulting src file may be incomplete or incor
66. information f 5 66 Tool Options Assembler Assembler g debug info Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Debug Information 3 Select which debug information to include Automatic HLL or assembly level debug information Custom debug information or No debug information If you select Custom debug information 4 Select which Custom debug information to include Assembler source line information Pass HLL debug information or None 5 Enable or disable the option Assembler local symbols information Command line syntax glflag debug info flag you can set the following flags a A asm Assembly source line information h H hlil Pass high level language debug information HLL I L_ local Assembler local symbols debug information s S smart Smart debug information If you do not use this option the default is gh If you specify g without any flags the default is gs You cannot specify gah Either the assembler generates assembly source line information or it passes HLL debug information When you specify gs the assembler selects which flags to use If high level language information is available in the source file the assembler passes this information same as gAhL If not the assembler generates assembly source line information same as gaHl With gAHLS the assemb
67. is ength is never greater than FFH offset is the starting load offset specifying an absolute address in memory where the data is to be located when loaded by a tool This field is two bytes long This field is only used for Data Records In other records this field is coded as four ASCII zero characters 0000 type is the record type This value occupies one byte two hexadecimal digits The record types are Byte Type Record type 00 Data 01 End of File 02 Extended segment address not used 03 Start segment address not used 04 Extended linear address 32 bit 05 Start linear address 32 bit 7 5 ARM Embedded Tools Reference content is the information contained in the record This depends on the record type checksum is the record checksum The linker computes the checksum by first adding the binary representation of the previous bytes from ength to content The linker then computes the result of sum modulo 256 and subtracts the remainder from 256 two s complement Therefore the sum of all bytes following the header is zero Extended Linear Address Record The Extended Linear Address Record specifies the two most significant bytes bits 16 31 of the absolute address of the first data byte in a subsequent Data Record 02 0000 upper_address checksum The 32 bit absolute address of a byte in a Data Record is calculated as address offset index modulo 4G where address is the base address wh
68. isfinite f isnan and scalb f These functions have accordingly to the ISO IEC9899 standard been moved to the header file math h See also section 2 2 13 Math h and Tgmath h 2 2 8 fss h The header file ss h contains definitions and prototypes for low level I O functions used for the debugger s file system simulation FSS The low level functions are also declared in stdio h they are all implemented as FSS functions This header file is not defined in ISO IEC9899 Fss h Description _fss_break void Buffer and breakpoint functions for the debugger Opens file descriptors 0 stdin 1 stdout and 2 stderr and tsb init fdyis_ close associates them with terminal window Fss 0 of the debugger _close fd _lseek fd offset whence _open fd flags _read fd buff cnt _unlink name _write fd buffer cnt See Low Level File Access Functions in section 2 2 20 Stdio h 2 5 ARM Embedded Tools Reference 2 2 9 inttypes h and stdint h The header files stdint h and inttypes h provide additional declarations for integer types and have various characteristics The stdint h header file contains basic definitions of integer types of certain sizes and corresponding sets of macros This header file clearly refers to the corresponding sections in the ISO IEC 9899 standard The inttypes h header file incldues stdint h and adds portable formatting and conversion functions Below the conversion functions from inttypes h
69. macro_definition Description With this option you can define a macro and specify it to the assembler preprocessor If you only specify a macro name no macro definition the macro expands as 1 You can specify as many macros as you like On the command line you can use the option D multiple times If the command line exceeds the limit of the operating system you can define the macros in an option file which you then must specify to the assembler with the option ffile Defining macros with this option instead of in the assembly source is for example useful in combination with conditional assembly as shown in the example below AN This option has the same effect as defining symbols via the DEFINE SET and EQU directives similar to define in the C language With the MACRO directive you can define more complex macros Example Consider the following assembly program with conditional code to assemble a demo program and a real program IF DEMO sak instructions for demo application ELSE ie instructions for the real application ENDIF You can now use a macro definition to set the DEMO flag Macro Value DEMO 1 or empty 5 58 Tool Options Assembler asarm asarm asarm asarm DDEMO test src DDEMO 1 test src define DEMO test src define DEMO 1 test src Note that all four invocations have the same effect Related information d Assembler option f Read options
70. map by default to the address space with ID 1 Sections with one of the special names defined in the ABI Application Binary Interface may map to different address spaces e The mau field specifies the MAU size Minimum Addressable Unit of the space This field is required e The align value must be a power of two The linker uses this value to compute the start addresses when sections are concatenated An align value of n means that objects in the address space have to be aligned on n MAUs e The page_size field sets the page alignment and page size in MAUs for the address space It must be a power of 2 The default value is 1 If one or more page ranges are supplied the supplied value only sets the page alignment The ranges specify the available space in each page as offsets to the page start which is aligned at the page alignment See also the page keyword in subsection Locating a group in section 8 9 2 Creating and Locating Groups of Sections e With the optional direction field you can specify how all sections in this space should be located This can be either from low_to_high addresses this is the default or from high_to_low addresses 8 20 Linker Script Language The map keyword specifies how this address space maps onto an internal bus or onto another address space Mappings are described in section 8 5 4 Mappings Stacks and heaps The stack keyword defines a stack in the address space and assigns a name to it The a
71. module or declare it as globally accessible within another module with the GLOBAL directive If you do not use the EXTERN directive and the symbol is not defined within the current module the assembler issues a warning and inserts the EXTERN directive Example EXTERN AA CC DD defined elsewhere Related information d GLOBAL Declare global section symbol 3 23 ARM Embedded Tools Reference FOR ENDFOR Syntax label FOR var IN expression expression ENDFOR or label FOR var IN start TO end STEP step ENDFOR Description With the FOR ENDFOR directive you can repeat a sequence of assembly source lines with an iterator As shown by the syntax you can use the FOR ENDFOR in two ways 1 Inthe first mehod the loop is repeated as many times as the number of arguments following IN If you use the symbol var in the assembly lines between FOR and ENDFOR for each repetition the symbol var is substituted by a subsequent expression from the argument list If the argument is a null then the loop is repeated with each occurrence of the symbol var removed 2 Inthe second method the loop is repeated using the symbol var as a counter The counter passes all integer values from start to end with a step If you do not specify step the counter is increased by one for every repetition If you specify label it gets the value of the location counter at the start of the directive processing Exam
72. object itself and all symbols in the object s1 Displays only the symbols of all object files in the library Example ararm t mylib lib The librarian prints a list of all object modules in the libary mylib lib ararm t s0 mylib 1lib The librarian prints per object all symbols in the library This looks like prolog obj symbols mylib lib prolog obj Qabi_callee save mylib lib prolog obj Qabi_callee restore divl6 obj symbols mylib lib divl6 obj _udivl6 mylib lib divl6 obj divl 6 mylib lib divl6 obj _urem16 mylib lib divl6 obj rem16 Related information f 5 200 Tool Options Librarian Librarian V Command line syntax V Description Display version information The librarian ignores all other options or input files Example ararm V The librarian displays version information but does not perform any tasks Related information J 5 201 ARM Embedded Tools Reference Librarian w Command line syntax wievel Description With this suboption you tell the librarian to suppress all warnings above the specified level The level is a number between 0 9 The level of a message is printed between parentheses after the warning number If you do not use the w option the default warning level is 8 Example To suppresses warnings above level 5 ararm x w5 mylib lib objl obj Related information J 5 202 Tool Options Librarian Librarian x Comman
73. refers to an existing architecture definition in the same LSL file For example if you have two cores called mycore_1 and mycore_2 that have the same architecture called mycorearch you must instantiate both cores as follows core mycore_ 1 architecture mycorearch core mycore 2 architecture mycorearch If the architecture definition has parameters you must specify the arguments that correspond with the parameters For example mycorearch1 expects two parameters which are used in the architecture definition core mycore architecture mycorearchl 1 2 8 6 3 Defining Internal Memory and Buses With the memory keyword you define physical memory that is present on the target board The memory name is used to identify the memory and does not conflict with other identifiers It is common to define internal memory on chip in the derivative definition External memory off chip memory is usually defined in the board specification See section 8 7 3 Defining External Memory and Buses e The type field specifies a memory type rom read only memory ram random access memory mnvram non volatile ram 8 27 ARM Embedded Tools Reference The optional reserved qualifier before the memory type tells the linker not to locate any section in the memory by default You can locate sections in such memories using an absolute address or range restriction see subsection Locating a group in section 8 9 2 Cr
74. reserved section_name lt reserved_specs gt 1 e Special sections cannot be selected in load time groups size_spec size expr reserved_specs reserved_spec lt reserved_spec gt reserved_spec attributes fi11_spec size expr alloc_allowed absolute e fa reserved section has attributes r rw x rx or rwx and no fill pattern is defined the section is filled with zeros If no attributes are set the section is created as a scratch section attributes ws no image fill_spec fill fill _ values 8 14 Linker Script Language fill_values expr expr lt expr gt aggregate_section_statement lt section_statement gt group_descr if_statement section_creation_statement group lt group_name gt l lt group specs gt 9 1 group_descr section_statement e No two groups for an address space can have the same group_name group_specs group_spec lt group_spec gt gt 0 group_spec group alignment attributes group_load_address fill lt fill values gt 1 group_page group_run_address group_type allow_cross_references e The allow cross references property is only allowed for overlay groups e Sub groups inherit all properties from a parent group group_alignment align expr attributes attributes lt attribute gt attribute a2 readable sections writable sections executable code sections init
75. situation in which a generic instruction is used the assembler replaces the generic instruction with appropriate real assembly instruction s 3 3 1 ARM Generic Instructions The ARM assembler recognizes the following generic instructions in ARM mode ADR ADRL ADRLL ARM generics Load a PC relative address into a register The address is specified as a target label The assembler generates one ADR two ADRL or three ADRLL generic DPR instruction called ADR and one two or three PC relative relocation types for the target label The linker evaluates the relocation types calculate the PC relative offset and generates one two or three add or sub instructions each with an 8 bit immediate operand plus a 4 bit rotation If the offset cannot be encoded the linker generates an error message Instruction Replacement ADRcond Rd label ADRcond Rd PC ALUPCREL abel 0 1 ADRcondL Rd label ADRcond Rd PC ALUPCREL label 0 0 ADRcond Rd Rd ALUPCREL label 1 1 ADRcondLL Rd label ADRcond Rd PC ALUPCREL abel 0 0 ADRcond Rd Rd ALUPCREL label 1 0 ADRcond Rd Rd ALUPCREL label 2 1 LDR ARM generic Load an address or a 32 bit constant value into a register If the constant or its bitwise negation can be encoded as an 8 bit value plus a 4 bit even rotation then the assembler will generate a MOV ora MVN instruction Otherwise the assembler places the constant or the address in a literal pool and generat
76. specify to the control program with the option f file Defining macros with this option instead of in the C source is for example useful to compile or assemble conditional source as shown in the example below The control program passes the option D define to the compiler and the assembler Example Consider the following C program with conditional code to compile a demo program and a real program void main void if DEMO demo_func compile for the demo program else real _func compile for the real program endif You can now use a macro definition to set the DEMO flag With the control program this looks as follows ccarm DDEMO test c ccarm DDEMO 1 test c ccarm define DEMO test c ccarm define DEMO 1 test c Note that all four invocations have the same effect The next example shows how to define a macro with arguments Note that the macro name and definition are placed between double quotes because otherwise the spaces would indicate a new option ccarm D MAX A B A gt B A B test c 5 132 Tool Options Control Program Related information Control Program option U Undefine preprocessor macro Control Program option f Read options from file 5 133 ARM Embedded Tools Reference Control Program d IsI file Command line syntax dfile Isl file file Description A linker script file contains vital info
77. system stack This is needed in case stack overflow checking is enabled 8 Switch to Thumb code if you specified compiler option thumb 9 Initialize profiling if profiling is enabled For an extensive description of profiling refer to Chapter 6 Profiling in the user s manual 10 Initialize the argc and argv arguments to zero 11 Call the entry point of your application with a call to function main Exit code When the C application returns which is not likely to happen in an embedded environment the program ends with an endless loop at the assembly label exit When you use a debugger it can be useful to set a breakpoint on this label to indicate that the program has reached the end or that the library function exit has been called Macro Preprocessor Symbols A number of macro preprocessor symbols are used in the startup code These are enabled when you use a particular option or you can enable or disable them using the linker command line option define with the following syntax define symbol value In the startup file cstart asm the following macro preprocessor symbols are used Define Description PROF_ENABLE If defined initialize profiling _ POSIX __ If defined call posix_main instead of main Table 4 1 Defines used in cstart asm 4 2 Run time Environment The following table shows the linker labels and other labels used in the startup code
78. the ARM architecture for which you create your application The ARM target supports more than one architecture and therefore you need to specify for which architecture the processor should compile The architecture determines which instructions are valid and which are not The effect of this option is that the compiler uses the appropriate instruction set You choose one of the following architectures ARMv4 ARMV4T ARMv5 ARMv5T ARMv5TE Or XS Example To compile the file test c for the ARMv4 processor type enter the following on the command line carm CARMv4 test c The compiler compiles for the chosen processor type Related information When you call the compiler from the command line make sure you specify the same core type to the assembler to avoid conflicts 5 8 Tool Options Compiler Compiler c iso Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Language 3 Select the ISO C standard ISO C 90 or ISO C 99 Command line syntax c 90 99 iso 90 99 Description With this option you select the ISO C standard The compiler checks the C source against this standard and may generate warnings or errors if you use C language that is not defined in the standard C90 is also referred to as the ANSI C standard C99 refers to the newer ISO IEC 9899 1999 E standard C99 is the default carm c90 tes
79. the argument with single or double quotes e If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded e When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels 5 98 Tool Options Linker Example Suppose the file myoptions contains the following lines Mmymap generate a map file test obj input file Le mylibs additional search path for system libraries Specify the option file to the linker lkarm f myoptions lkarm option file myoptions This is equivalent to the following command line lkarm Mmymap test obj Lc mylibs Related information i 5 99 ARM Embedded Tools Reference Linker first library first Menu entry Command line syntax first library first Description When the linker processes a library it searches for symbols that are referenced by the objects and libraries processed so far If the library contains a definition for an unresolved reference the linker extracts the object that contains the definition from the library By default the linker processes object files a
80. the environment variable and then in the default include directory The compiler now looks for the file myinc h in the directory where test c is located If the file is not there the compiler searches in the directory myinclude If it was still not found the compiler searches in the environment variable and then in the default include directory 5 22 Tool Options Compiler Related information Compiler option H Include file at the start of a compilation Compiler option nostdine Skip standard include files directory 5 23 ARM Embedded Tools Reference Compiler inline Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Miscellaneous 3 Add the option inline to the Additional C compiler options field Command line syntax inline Description With this option you instruct the compiler to inline all functions regardless whether they have the keyword inline or not This option has the same effect as a pragma inline at the start of the source file Related information ie 5 24 Tool Options Compiler Compiler inline max incr inline max size Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Optimization 3 Set the option Maximum code size increase caused by inlining to a value defaul
81. the librarian shows which files are removed AN The suboptions a or b have no effect when an object is added to the library Examples Suppose the library mylib 1ib contains the following objects see option t obj1 obj To add obj2 obj to the end of mylib lib ararm r mylib lib obj2 obj To insert obj3 obj just before obj2 obj ararm r b obj2 obj mylib lib obj3 obj The library mylib 1ib after these two invocations now looks like obj1 obj obj3 0bj obj2 obj 5 198 Tool Options Librarian Creating a new library To create a new library file add an object file and specify a library that does not yet exist ararm r objl obj newlib lib The librarian creates the library newlib 1ib and adds the object obj1 obj to it To create a new library file and overwrite an existing library add an object file and specify an existing library with the supoption c ararm r c objl obj mylib 1lib The librarian overwrites the library mylib 1ib and adds the object obj1 obj to it The new library my 1lib 1lib only contains obj1 obj Related information Gs Librarian option t Print library contents 5 199 ARM Embedded Tools Reference Librarian t Command line syntax t s0 s1 Description Print a table of contents of the library to standard out With the suboption s the librarian displays all symbols per object file s0 Displays per object the library in which it resides the name of the
82. the linker detects an error or warning it tries to continue the link process and reports other errors and warnings When you use this option without arguments you tell the linker to treat all warnings as errors This means that the exit status of the linker will be non zero after the detection of one or more linker warnings As a consequence the linker will not produce any output files You can also limit this option to specific warnings by specifying a comma separated list of warning numbers Related information 4b Linker option w Suppress some or all warnings 5 125 ARM Embedded Tools Reference 5 4 Control Program Options The control program is a tool to facilitate use of the toolchain from the command line Therefore you can only call the control program from the command line The invocation syntax is ccarm option file Options The control program processes command line options either by itself or when the option is unknown to the control program it looks whether it can pass the option to one of the other tools However for directly passing an option to the compiler assembler or linker it is recommended to use the control program options Wc Wa WI Short and long option names Options can have both short and long names Short option names always begin with a single minus character long option names always begin with double minus characters You can abbreviate long option names as long as th
83. to SO S9 record With the linker option ofilename SREC 2 at the end of an S record file the linker generates an S9 record which contains the program start address S9 is the corresponding termination record for S1 records Layout S 9 lt length_byte gt lt address gt lt checksum_byte gt Example 9030210EA checksum _ address _ length The checksum calculation of S9 records is identical to SO 7 4 Object File Formats 7 3 Intel Hex Record Format Intel Hex records describe the hexadecimal object file format for 8 bit 16 bit and 32 bit microprocessors The hexadecimal object file is an ASCII representation of an absolute binary object file There are six different types of records e Data Record 8 16 or 32 bit formats e End of File Record 8 16 or 32 bit formats e Extended Segment Address Record 16 or 32 bit formats e Start Segment Address Record 16 or 32 bit formats e Extended Linear Address Record 32 bit format only e Start Linear Address Record 32 bit format only By default the linker generates records in the 32 bit format 4 byte addresses General Record Format In the output file the record format is Where is the record header length is the record length which specifies the number of bytes of the content field This value occupies one byte two hexadecimal digits The linker outputs records of 255 bytes 32 hexadecimal digits or less that
84. to reserve BSH The expression argument specifies the number of half words to reserve one half word is16 bits BSW The expression argument specifies the number of words to reserve one word is 32 bits BSD The expression argument specifies the number of double words to reserve one double word is 64 bits Example The BSB directive is for example useful to define and initialize an array that is only partially filled section sdata DB 84 101 115 116 initialize 4 bytes BSB 96 0xFF reserve another 96 bytes initialized with OxFF 3 11 ARM Embedded Tools Reference Related information db DS Define Storage 3 12 Assembly Language CALLS Syntax CALLS caller callee Description With this directive you indicate that a function caller calls another function callee Normally CALLS directives are automatically generated by the compiler Use the CALLS directive in hand coded assembly when the assembly code calls a C function If you manually add CALLS directives make sure they connect to the compiler generated CALLS directives the name of the caller must also be named as a callee in another directive Example CALLS main nfunc Indicates that the function main calls the function nfunc 3 13 ARM Embedded Tools Reference CODE16 CODE32 Syntax CODE16 CODE32 Description With the CODE16 directive you instruct the assembler to interpret subsequent in
85. uses the section order as shown here Clustered sections can be located in any relative order Related information Section 8 9 Generating a Map File in Chapter Using the Linker of the user s manual Linker option M Generate map file 6 8 Altium 7 Object File Formats Summ ary This chapter describes the formats of several object files 7 1 ELF DWARF Object Format The TASKING ARM toolchain by default produces objects in the ELF DWARF 2 format For a complete description of the ELF and DWARF formats please refer to the Tool Interface Standard TIS ARM Embedded Tools Reference 7 2 Motorola S Record Format With the linker option ofilename SREC option the linker produces output in Motorola S record format with three types of S records SO S3 and S7 With the options ofilename SREC 2 or ofilename SREC 3 option you can force other types of S records They have the following layout SO record S 0 lt length_byte gt lt 2 bytes 0 gt lt comment gt lt checksum_byte gt A linker generated S record file starts with a SO record with the following contents length_byte 08 comment Ikarm checksum E0 lkarm S00800006C6B61726DE0 The SO record is a comment record and does not contain relevant information for program execution The length_byte represents the number of bytes in the record not including the record type and length byte The checksum is calculated by first adding the bin
86. wc mbstowcs pwces s n wcestombs s pwcs n Determines the number of bytes in the multi byte character pointed to by s At most n characters will be examined See also mbrlen in section 2 2 25 wchar h Converts the multi byte character in s to a wide character code and stores it in pwc At most n characters will be examined Converts the wide character wc into a multi byte representation and stores it in the string pointed to by s At most MB_CUR_MAX characters are stored Converts a sequence of multi byte characters in the string pointed to by s into a sequence of wide characters and stores at most n wide charac ters into the array pointed to by pwcs See also mbsrtowcs in section 2 2 25 wchar h Converts a sequence of wide characters in the array pointed to by pwcs into multi byte characters and stores at most n multi byte characters into the string pointed to by s See also wcsrtowmb in section 2 2 25 wehar h 2 25 ARM Embedded Tools Reference 2 2 22 string h and wchar h This header file provides numerous functions for manipulating strings By convention strings in C are arrays of characters with a terminating null character Most functions therefore take arguments of type char However many functions have also parallel wide character functions which take arguments of type wchar_t These functions are declared in wchar h Copying and concatenation functions Stdio h Wchar h Description memcpy
87. whether the object pointed to by ps is an initial conversion state Returns a non zero value if so mbsrtowcs pwcs src n ps Restartable version of mbstowcs See section 2 2 21 sidlib h The initial conversion state is specified by ps The input sequence of multibyte charactersis specified indirectly by src wesrtombs s src n ps Restartable version of westombs See section 2 2 21 sidlib h The initial conversion state is specified by ps The input wide string is specified indirectly by src mbrtowc pwc s n ps Converts a multibyte character s to a wide character pwc ac cording to conversion state ps See also mbtowc in section 2 2 21 stdlib h wertomb s wc ps Converts a wide character wc to a multi byte character ac cording to conversion state ps and stores the multi byte char acter in s btowc c Returns the wide character corresponding to character c Re turns WEOF on error wetob c Returns the multi byte character corresponding to the wide character c The returned multi byte character is represented as one byte Returns EOF on error mbrlen s n ps Inspects up to n bytes from the string s to see if those char acters represent valid multibyte characters relative to the conversion state held in ps 2 32 Libraries 2 2 26 wctype h Most in wctype h represent the wide character variant of declared in ctype h and are discussed in section 2 2 3 ctype h In addition this header file provides e
88. with the descriptions you must redirect the output With the suboption all the descriptions of all error messages are given If you want the description of one or more selected error messages you can specify the error message numbers separated by commas With this option the linker does not link locate any files Example To display an explanation of message number 106 enter lkarm diag 106 This results in the following message and explanation E106 unresolved external lt message gt The linker could not resolve all external symbols This is an error when the incremental linking option is disabled The lt message gt indicates the symbol that is unresolved To write an explanation of all errors and warnings in HTML format to file Lerrors html enter lkarm diag html all gt lerrors html Related information ie 5 94 Tool Options Linker Linker e extern Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Add the option e to the Additional linker options field Command line syntax e symbol extern symbol Description With this option you force the linker to consider the given symbol as an undefined reference The linker tries to resolve this symbol either the symbol is defined in an object file or the linker extracts the corresponding symbol definition from a library
89. write to the given stream Returns EOF WEOF on error FSS implementation Libraries Stdio h Wchar h Description printf format wprintf format sprintf s E Performs a formatted write to the stream stdout Returns EOF WEOF on error FSS implementation Performs a formatted write to string s Returns format EOF WEOF on error snprintf s n swprintf s n Same as sprintf but n specifies the maxi format format mum number of characters including the termi nating null character to be written vfprintf stream vfwprintf stream Same as fprintf fwprintf but extra argu format arg format arg ments are given as variable argument list arg See section 2 2 16 stdarg h FSS implementation vprintf format vwprintf format Same as printf wprintf but extra argu arg arg ments are given as variable argument list arg See section 2 2 16 stdarg h FSS implementation vsprintf s vswprintf s Same as sprintf swprintf but extra argu format arg format arg ments are given as variable argument list arg See section 2 2 16 stdarg h FSS implementation Direct input output Stdio h Description fread ptr size nobj stream Reads nobj members of size bytes from the given stream into the array pointed to by ptr Returns the number of ele ments succesfully read FSS implementation fwrite ptr size nobj stream Writes nobj members of size bytes from to the array pointed to by ptr to the
90. 1 You can also define the symbols in EDE as preprocessor macros in dialog Project Project Options Assembler Preprocessing assembler option D 3 27 ARM Embedded Tools Reference Related information ab Assembler option D Define preprocessor macro in Section 5 2 Assembler Options of Chapter Tool Options 3 28 Assembly Language INCLUDE Syntax INCLUDE filename lt filename gt Description With the INCLUDE directive you include another file at the exact location where the INCLUDE occurs This happens before the resulting file is assembled The INCLUDE directive works similarly to the include statement in C The source from the include file is assembled as if it followed the point of the INCLUDE directive When the end of the included file is reached assembly of the original file continues The string specifies the filename of the file to be included The filename must be compatible with the operating system forward backward slashes and can contain a directory specification If you omit a filename extension the assembler assumes the extension asm If an absolute pathname is specified the assembler searches for that file If a relative path is specified or just a filename the order in which the assembler searches for include files is 1 The current directory if you use the filename construction The current directory is not searched if you use the lt filename gt syntax 2
91. 16 _lseek 2 15 _open 2 15 _read 2 15 _START 4 1 4 3 _tolower 2 3 _unlink 2 15 _write 2 15 A abort 2 24 abs 2 25 access 2 31 acos functions 2 7 acosh functions 2 8 Address spaces 8 20 alias 1 10 align 3 9 Alignment composite types 5 6 Alignment gaps 8 37 alupcrel 3 2 Architecture definition 8 1 8 18 arg 3 2 asctime 2 29 asin functions 2 7 asinh functions 2 8 Assembler directives align 3 9 break 3 10 bs 3 11 bsb 3 11 bsd 3 11 bsh 3 11 bsw 3 11 calls 3 13 code16 3 14 code32 3 14 db 3 15 dd 3 16 define 3 17 dh 3 18 ds 3 19 dsb 3 19 dsd 3 19 dsh 3 19 dsw 3 19 dw 3 20 end 3 21 equ 3 22 extern 3 23 for endfor 3 24 global 3 26 if elif else endif 3 27 include 3 29 list nolist 3 30 ltorg 3 31 Index 1 ARM Embedded Tools Reference macro endm 3 32 message 3 34 offset 3 35 page 3 36 repeat endrep 3 37 section 3 38 set 3 39 size 3 40 source 3 41 title 3 42 type 3 43 undef 3 44 ARM specific overview 3 8 assembly control overview 3 6 conditional assembly overview 3 7 data definition overview 3 7 detailed description 3 8 HLL overview 3 7 listing control overview 3 7 macros overview 3 7 overview 3 6 storage allocation overview 3 7 symbol definitions overview 3 6 weak 3 45 Assembler options 5 52 help 5 53 check 5 57
92. 2 31 Ish 3 3 LSL expression evaluation 8 17 LSL functions absolute 8 7 addressof 8 7 exists 8 7 max 8 7 min 8 7 sizeof 8 8 LSL keywords align 8 20 8 21 8 36 alloc_allowed 8 40 allow_cross_references 8 37 architecture 8 19 8 27 attributes 8 35 8 36 blocksize 8 42 bus 8 20 8 24 8 30 clustered 8 37 contiguous 8 36 copy_unit 8 21 copytable 8 21 8 42 core 8 27 derivative 8 26 8 30 dest 8 21 8 24 dest_dbits 8 24 dest_offset 8 24 direction 8 34 8 36 else 8 43 extends 8 19 8 26 fill 8 22 8 23 8 37 8 40 8 41 fixed 8 21 8 39 group 8 34 8 36 grows 8 21 heap 8 21 8 39 high_to_low 8 21 8 34 id 8 20 id_symbol_prefix 8 22 if 8 43 load_addr 8 38 low_to_high 8 21 8 34 map 8 20 8 21 8 23 8 28 mau 8 20 8 28 8 30 Index 8 mem 8 38 memory 8 27 8 30 min_size 8 21 8 39 no_inline 8 22 nvram 8 27 ordered 8 36 overflow 8 41 overlay 8 37 page 8 21 8 39 page_size 8 20 8 39 processor 8 29 ram 8 27 reserved 8 28 8 40 rom 8 27 run_addr 8 22 8 23 8 38 section 8 41 section_layout 8 34 select 8 35 size 8 22 8 24 8 28 8 30 8 39 8 40 8 41 space 8 20 8 24 speed 8 28 8 30 src_dbits 8 24 src_offset 8 24 stack 8 21 8 39 start_address 8 23 symbol 8 23 template 8 22 template_symbol 8 22 type 8 27 8 30 vector 8 23 vector_prefix 8 22 vector_size 8 22 vector_table 8 22 width 8 20 LSL syntax 8 4
93. 3 Placing an Object at an Absolute Address in Chapter C Language of the user s manual 1 4 C Language Function Qualifiers inline __noinline You can use the inline qualifier to tell the compiler to inline the function body instead of calling the function Use the noinline qualifier to tell the compiler not to inline the function body inline int funcl void inline this function __noinline int func2 void do not inline this function d For more information see section 3 7 3 nlining Functions inline in Chapter C Language of the user s manual __interrupt_und __interrupt_swi __interrupt_iabt __interrupt_dabt __interrupt_irq __interrupt_fiq __novector __frame You can define six types of exception handlers __interrupt_und Undefined instructions __interrupt_swi Software interrupt __interrupt_iabt Prefetch abort __interrupt_dabt Data abort __interrupt_irg IRQ interrupt __interrupt_figq FIQ fast interrupt 1 5 ARM Embedded Tools Reference Interrupt functions and other exception handlers cannot return anything and must have a void argument type list void _ interrupt_xxx isr void With the function qualifier novector you can prevent the compiler from generating the _vector_n symbol This can be necessary if you have more than one interrupt handler for the same exception for example for different IRQ s or for different run time phases of your application Wi
94. 3 S2 records or 4 bytes S3 records default If you do not specify adadr_size the default address size is generated Example To create the SREC file test sre with S1 records type ccarm format SREC address size 2 test c Related information Gls Control program option format Set linker output format Linker option o Specify an output object file 5 128 Tool Options Control Program Control Program C cpu Command line syntax Ccpu cpu cpu Description With this option you specify the ARM architecture for which you create your application The architecture determines which instructions are valid and which are not If the architecture is ARMv4 the assembler replaces BX instructions by MOV PC instructions The default architecture is ARMv4T and the complete list of supported architectures is ARMv4 ARMv4T ARMv5 ARMv5T ARMv5TE or XS Assembly code can check the value of the option by means of the built in function CPU Architectures ARMv4 and ARMv5 do not support the Thumb instruction set Related information Compiler option C Select architecture Assembler option C Select CPU core type 5 129 ARM Embedded Tools Reference Control Program cs co cl create Command line syntax CS create assembly co create object cl create relocatable Description Normally the control program generates an absolute object file of the specified output format
95. 3 Scanf conversion characters Stdio h Wchar h Description fgetc stream fgetwc stream getc stream getwc stream getchar stdin getwchar stdin Reads one character from stream Returns the read character or EOF WEOF on error FSS implementation Same as fgetc fgetwe except that is imple mented as a macro FSS implementation NOTE Currently defined as get char getwchar because FILE I O is not supported Returns the read character or EOF WEOF on error Reads one character from the stdin stream Returns the character read or EOF WEOF on error Implemented as macro FSS implementation 2 19 ARM Embedded Tools Reference Stdio h Wchar h Description fgets s n fgetws s n Reads at most the next n 1 characters from the stream stream stream into array s until a newline is found Re gets s n stdin ungetc c stream fscanf stream format scanf format sscanf s format vfscanf stream format arg vscanf format arg vsscanf s format arg fputc c stream putc c stream putchar c stdout fputs s stream puts s fprintf stream format 2 20 ungetwc c stream fwscanf stream format wscanf format swscanf s format vfwscanf stream format arg vwscanf format arg vswscanf s format arg fputwe c stream putwe c stream putwchar c stdout fputws s stream fwprintf stream form
96. 3 va_end 2 13 va_start 2 13 Vector table 4 5 8 22 setup 8 32 Version information 5 188 5 201 vfprintf 2 21 vfscanf 2 20 vfwprintf 2 21 vfwscanf 2 20 vprintf 2 21 vscanf 2 20 vsprintf 2 21 vsscanf 2 20 vswprintf 2 21 vswscanf 2 20 vwprintf 2 21 vwscanf 2 20 W warning 1 12 Warnings suppressing 5 50 5 83 5 124 5 162 Index 11 ARM Embedded Tools Reference treat as errors 5 84 wehar_t 2 14 wcrtomb 2 32 wcscat 2 26 weschr 2 27 wescmp 2 26 wcscoll 2 26 wcescpy 2 26 wescspn 2 27 wesncat 2 26 wesncmp 2 26 wesncpy 2 26 wespbrk 2 27 wesrchr 2 27 wcsrtombs 2 32 wesspn 2 27 wecsstr 2 27 wcestod 2 23 wcstof 2 23 wcstoimax 2 6 westok 2 27 westol 2 23 Index 12 westold 2 23 wcstoll 2 23 wcstombs 2 25 wcstoul 2 23 wcstoull 2 23 wcstoumax 2 6 wesxfrm 2 27 wctob 2 32 wctomb 2 25 wctrans 2 33 wctype 2 33 weak 1 13 3 45 WEOF 2 15 wmemehr 2 27 wmemcmp 2 26 wmemepy 2 26 wmemmove 2 26 wmemset 2 27 wprintf 2 21 write 2 31 wscanf 2 20 wstrftime 2 30
97. 3 Creating or Modifying Special Sections Instead of selecting sections you can also create a reserved section or an output section or modify special sections like a stack or a heap Because you cannot define these sections in the input files you must use the linker to create them Stack The keyword stack tells the linker to reserve memory for the stack The name for the stack section refers to the stack as defined in the architecture definition If no name was specified in the architecture definition the default name is stack With the keyword size you can specify the size for the stack If the size is not specified the linker uses the size given by the min_size argument as defined for the stack in the architecture definition Normally the linker automatically tries to maximize the size unless you specified the keyword fixed group stack mystack size 2k The linker creates two labels to mark the begin and end of the stack _1c_ub_stack_name for the begin of the stack and _1c_ue_stack_name for the end of the stack The linker allocates space for the stack when there is a reference to either of the labels See also the stack keyword in section 8 5 3 Defining Address Spaces Heap The keyword heap tells the linker to reserve a dynamic memory range for the malloc function Optionally you can assign a name to the heap section With the keyword size you can change the size for the heap If the size is not speci
98. 5 ARM Embedded Tools Reference Librarian m Command line syntax m a posname b posname Description Move the specified object modules to another position in the library The ordering of members in a library can make a difference in how programs are linked if a symbol is defined in more than one member Default the specified members are moved to the end of the archive Use the suboptions a or b to move them to a specified place instead a posname Move the specified object module s after the existing module posname b posname Move the specified object module s before the existing module posname Example Suppose the library mylib lib contains the following objects see option t obj1 obj obj2 obj obj3 0bj To move obj1 obj to the end of mylib lib ararm m mylib lib objl obj To move obj3 obj just before obj2 obj ararm m b obj3 obj mylib lib obj2 obj The library mylib 1ib after these two invocations now looks like obj3 0bj obj2 obj obj1 obj Related information dE Librarian option t Print library contents 5 196 Tool Options Librarian Librarian p Command line syntax P Description Print the specified object module s in the library to standard output This option is only useful when you redirect or pipe the output to other files or tools that serve your own purposes Normally you do not need this option Example ararm p mylib lib objl obj gt file obj Th
99. 5 __interrupt_iabt 1 5 __interrupt_irq 1 5 __interrupt_swi 1 5 __interrupt_und 1 5 __novector 1 6 fwprintf 2 20 fwrite 2 21 fwscanf 2 20 G Generic instructions 3 46 getc 2 19 getchar 2 19 getcwd 2 31 getenv 2 24 gets 2 20 getwc 2 19 getwchar 2 19 global 3 26 gmtime 2 29 H Header files 2 2 alert h 2 2 complex h 2 2 ctype h 2 2 errno h 2 3 fentl h 2 4 fenv h 2 4 float h 2 5 fss h 2 5 inttypes h 2 6 iso646 h 2 6 limits h 2 6 locale h 2 7 math h 2 7 setimp h 2 12 Index 5 ARM Embedded Tools Reference signal h 2 13 stdarg h 2 13 stdbool h 2 14 stddef h 2 14 stdint h 2 6 stdio h 2 14 stdlib h 2 22 string h 2 26 tgmath h 2 7 time h 2 28 unistd h 2 31 wehar h 2 14 2 26 2 28 2 32 wetype h 2 2 2 33 Heap 8 21 heap begin of 4 9 end of 4 9 hypot functions 2 10 l if elif else endif 3 27 ilogb functions 2 8 imaxabs 2 6 imaxdiv 2 6 include 3 29 Include directory 5 22 5 32 5 69 5 101 5 144 Include file 5 21 5 68 inline 1 5 inline noinline smartinline 1 10 Inlining 5 24 Instructions generic 3 46 Intel hex record type 7 5 Intel Hex record format 7 5 Interrupt functions __interrupt_fiq 1 5 __interrupt_irq 1 5 __interrupt_swi 1 5 Intrinsic functions 1 8 isalnum 2 2 isalpha 2 2 isblank 2 2 iscntrl 2 2 isdigit 2 2 isfinite 2 12 Index 6 isgraph 2 2 isgreater 2 11 isgreaterequal 2 11 isinf 2 12 isless
100. 5 5 How the Compiler Searches Include Files in chapter Using the Compiler of the user s manual 5 144 Tool Options Control Program Control Program iso Command line syntax iso 90 99 Description With this option you specify to the control program against which ISO standard it should check your C source C90 is also referred to as the ANSI C standard C99 refers to the newer ISO IEC 9899 1999 E standard and is the default amp Independant of the chosen ISO standard the control program always links libraries with C99 support Example To compile the file test c conform the ISO C90 standard ccarm iso 90 test c Related information Gb Compiler option c ISO C standard 5 145 ARM Embedded Tools Reference Control Program k keep output files Command line syntax k keep output files Description If an error occurs during the compilation assembling or linking process the resulting output file may be incomplete or incorrect With this option you keep the generated output files when an error occurs By default the control program removes generated output files when an error occurs This is useful when you use the make utility If the erroneous files are not removed the make utility may process corrupt files on a subsequent invocation Use this option when you still want to use the generated files For example when you know that a particular error does not result in a corrup
101. 5 9 5 43 5 48 MISRA C 5 28 optimization 5 33 5 45 preprocessing 5 12 5 15 5 21 5 47 compiler options misrac version 5 30 Conditional make rules 5 165 Control program passing options 5 161 Index 3 ARM Embedded Tools Reference Control program options 5 126 help 5 127 adress size 5 128 check 5 131 diag 5 135 error file 5 137 format 5 141 fp trap 5 142 iso 5 145 no default libraries 5 151 no map tile 5 152 static 5 156 warnings as errors 5 163 C cpu 5 129 cs co cl create 5 130 D define 5 132 d IsI file 5 134 E preprocess 5 136 F no double 5 138 f option file 5 139 g debug info 5 143 I include directory 5 144 k keep output files 5 146 L ignore default library path 5 147 I library 5 148 5 149 L library directory 5 147 n dry run 5 150 o output 5 153 p profile 5 154 t keep temporary files 5 157 U undefine 5 158 v verbose 5 160 V version 5 159 w no warnings 5 162 W pass 5 161 preprocessing 5 132 Copy table 8 21 8 42 copysign functions 2 10 cos functions 2 7 cosh functions 2 8 cpu 3 3 ctime 2 29 D Data types 1 2 Index 4 db 3 15 dd 3 16 Debug info 5 143 Debug information 5 62 define 3 17 defined 3 3 Derivative definition 8 2 8 26 dh 3 18 difftime 2 28 Directives See Assembler dir
102. 8 2 R Whenever an object or function is declared or defined its type shall be explicitly stated 8 3 R For each function parameter the type given in the declaration and definition shall be identical and the return types shall also be identical 8 4 R If objects or functions are declared more than once their types shall be compatible 8 5 R There shall be no definitions of objects or functions in a header file 8 6 R Functions shall be declared at file scope 8 7 R Objects shall be defined at block scope if they are only accessed from within a single function x 8 8 R An external object or function shall be declared in one and only one file x 8 9 R An identifier with external linkage shall have exactly one external definition x 8 10 R All declarations and definitions of objects or functions at file scope shall have internal linkage unless external linkage is required 8 11 R The static storage class specifier shall be used in definitions and declarations of objects and functions that have internal linkage 8 12 R When an array is declared with external linkage its size shall be stated explicitly or defined implicitly by initialization Initialization 9 1 R All automatic variables shall have been assigned a value before being used This rule is checked using worst case assumptions This means that violations are reported not only for variables that are guaranteed to be uninitialized but also for variables t
103. AB D gt 0x41000000 0x42000000 0x00000000 second argument is empty 0x44000000 Example TABLE DW 14 253 0x62 ABCD CHARS DW A B C D Related information d BS Block Storage DS Define Storage DB Define Byte DH Define Half Word DD Define Double Word 3 20 Assembly Language END Syntax END Description With the END directive you tell the assembler that the end of the module is reached If the assembler finds assembly source lines beyond the END directive it ignores those lines and issues a warning Example section text source lines END End of assembly module 3 21 ARM Embedded Tools Reference EQU Syntax symbol EQU expression Description With the EQU directive you assign the value of expression to symbol permanently Once defined you cannot redefine the symbol With the GLOBAL directive you can define the symbol global Example To assign the value 0x4000 permanently to the symbol MYSYMBOL MYSYMBOL EQU 0x4000 You cannot redefine the used symbols Related information d gt SET Set temporary value to a symbol 3 22 Assembly Language EXTERN Syntax EXTERN symbol symbol Description With the EXTERN directive you define an external symbol It means that the symbol is referenced in the current module while it is defined outside the current module You must define the symbols either outside any
104. C style 8 4 Linker Script Language 8 3 3 Identifiers arch_name IDENTIFIER bus_name IDENTIFIER core_name IDENTIFIER derivative_name IDENTIFIER file name DOQSTRING group_name IDENTIFIER mem_name IDENTIFIER proc_name IDENTIFIER section_name DOQSTRING space_name IDENTIFIER stack_name section_name symbol_name DOSTRING 8 3 4 Expressions The expressions and operators in this section work the same as in ISO C number OCT_NUM DEC_NUM HEX NUM expr number symbol name unary_op expr expr binary_op expr expr expr expr expr function_call unary_op logical NOT bitwise complement negative value ARM Embedded Tools Reference binary_op gt exclusive OR multiplication division modulus addition subtraction gt gt right shift lt lt left shift equal to not equal to gt greater than lt less than gt greater than or equal to lt less than or equal to amp bitwise AND bitwise OR amp amp logical AND logical OR 8 3 5 Built in Functions function_call addr_id size_id absolute expr addressof addr_id exists section_name max expr expr min expr expr sizeof size _id sect section_name group group_name sect section_name group group _name mem mem_name e Every spac
105. Embedded Tools Reference 8 5 2 Defining Internal Buses With the bus keyword you define a bus the combination of data and corresponding address bus The bus name is used to identify a bus and does not conflict with other identifiers Bus descriptions in an architecture definition or derivative definition define internal buses Some internal buses are used to communicate with the components outside the core or processor Such buses on a processor have physical pins reserved for the number of bits specified with the width statements e The mau field specifies the MAU size Minimum Addressable Unit of the data bus This field is required e The width field specifies the width number of address lines of the data bus The default value is the MAU size e The map keyword specifies how this bus maps onto another bus if so Mappings are described in section 8 5 4 Mappings bus bus_name mau 8 width 8 map map_description 8 5 3 Defining Address Spaces With the space keyword you define a logical address space The space name is used to identify the address space and does not conflict with other identifiers e The id field defines how the addressing space is identified in object files In general each address space has a unique ID The linker locates sections with a certain ID in the address space with the same ID This field is required In IEEE this ID is specified explicitly for sections and symbols ELF sections
106. F LEN Undefines the LEN substitution string that was previously defined with the DEFINE directive Related information d gt DEFINE Define substitution string 3 44 Assembly Language WEAK Syntax WEAK symbol symbol Description With the WEAK directive you mark one or more symbols as weak The symbol can be defined in the same module with the GLOBAL directive or the EXTERN directive If the symbol does not already exist it will be created A weak external reference is resolved by the linker when a global or weak definition is found in one of the object files However a weak reference will not cause the extraction of a module from a library to resolve the reference You can overrule a weak definition with a GLOBAL definition in another module The linker will not complain about the duplicate definition and ignore the weak definition Only program labels and symbols defined with EQU can be made weak Example LOOPA EQU 1 definition of symbol LOOPA GLOBAL LOOPA LOOPA will be globally accessible by other modules WEAK LOOPA Mark symbol LOOPA as weak Related information Gb EXTERN Import global section symbol GLOBAL Declare global section symbol 3 45 ARM Embedded Tools Reference 3 3 Generic Instructions The assembler supports so called generic instructions Generic instructions are pseudo instructions no instructions from the instruction set Depending on the
107. From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Script File 3 Enable the option Generated Linker Script File based on EDE settings 4 Expand the Script File entry and select Stacks Heap 4 7 ARM Embedded Tools Reference ARM Project Options DEMO PJT x Processor Definition m Stacks Heap C Compiler User stack size bytes 32k C Compiler Assembler User stack start address Linker IV Expand user stack if space left Output Format Heap size bytes ak Libraries l Script File Heap start address Startu Vector IV Expand heap if space left Memory FIQ mode stack size bytes fe Optimization Map File IRQ mode stack size bytes E Diagnostics Supervisor mode stack size bytes E Miscellaneous 3 E CrossView Pro Abort mode stack size bytes E Undefined mode stack size bytes fe Options string o abs w so ater tal d _demo sl WIOcLTXY Wi M Wh mefkiMoGrSU CARMv4T 0G 5 Make your changes For the user stack used in USR mode and in SYS mode you can specify the size and the location and you can tell the linker to add unused memory to the stack You can do the same for the heap For the other stacks you can only specify their sizes The linker will determine their locations and their sizes are fixed If you want another stack to be the primary stack for exampl
108. GE directive is for example useful in combination with conditional assembly to indicate which part is assembled Example MESSAGE I Generating tables ID EQU 4 MESSAGE E The value of ID is ID DEFINE LONG SHORT MESSAGE I This is a LONG string MESSAGE I This is a LONG string Within single quotes the defined symbol LONG is not expanded Within double quotes the symbol LONG is expanded so the actual message is printed as This is a LONG string This is a SHORT string 3 34 Assembly Language OFFSET Syntax OFFSET expression Description With the OFFSET directive you tell the assembler to give the location counter a new offset relative to the start of the section When the assembler encounters the OFFSET directive it moves the location counter forwards to the specified address relative to the start of the section and places the next instruction on that address If you specify an address equal to or lower than the current position of the location counter the assembler issues an error Example SECTION text nop nop nop OFFSET 0x20 A nop SECTION text nop nop nop OFFSET 0x02 nop the assembler places this instruction at address 0x20 relative to the start of the section WRONG the current position of the location counter is 0x0C 3 35 ARM Embedded Tools Reference PAGE Syntax PAGE width length blanktop blankbtm blankleft Descri
109. OSPC ESPIPE EROFS EPIPE ELOOP ENAMETOOLONG ON ADU BP WN FP OO NNNRFPRP RPP RP PP PPE Pw Ne OUWU AN HU BWNHEHE OO No error Not owner No such file or directory Interrupted system call I O error Bad file number No more processes Not enough core Permission denied Bad address File exists Not a directory Is a directory Invalid argument File table overflow Too many open files Text file busy No space left on device Illegal seek Read only file system Broken pipe Too many levels of symbolic links File name too long 2 3 ARM Embedded Tools Reference Floating point errors EDOM 23 Argument too large ERANGE 24 Result too large Errors returned by prinff scanf ERR_FORMAT 25 Illegal format string for printf scant ERR_NOFLOAT 26 Floating point not supported ERR_NOLONG 27 Long not supported ERR_NOPOINT 28 Pointers not supported Error returned by file positioning routines ERR_POS 29 Positioning failure Encoding error stored in errno by functions like fgetwc getwc mbrtowc etc EILSEQ 30 Illegal byte sequence including too few bytes 2 2 5 fentl h The file ont1 h contains definitions of flags used by the low level function _open This header file is not defined in ISO IEC9899 2 2 6 fenv h Contains mechanisms to control the floating point environment fegetenv Stores the current floating point environment feholdexept Saves the current floating point environment and installs an environ
110. REP Syntax label REPEAT expression ENDREP Description With the REPEAT ENDREP directive you can repeat a sequence of assembly source lines With expression you specify the number of times the loop is repeated If you specify label it gets the value of the location counter at the start of the directive processing Example In this example the loop is repeated 3 times Effectively the preprocessor repeats the source lines DB 10 three times then the assembler assembles the result REPEAT 3 DB 10 assembly source lines ENDFOR Related information d FOR ENDFOR Repeat sequence of source lines n times 3 37 ARM Embedded Tools Reference SECTION Syntax SECTION name at address ENDSEC Description With the SECTION directive you define a new section Each time you use the SECTION directive a new section is created It is possible to create multiple sections with exactly the same name If you define a section you must always specify the section name The names have a special meaning to the locating process and have to start with a predefined name optionally extended by a dot anda user defined name The predefined section name also determines the type of the section code data or debug Optionally you can specify the at attribute to locate a section at a specific address You can use the following predefined section names Section Name Description
111. Reference 7 8 8 Linker Script Language Summary This chapter describes the syntax of the linker script language LSL 8 1 Introduction To make full use of the linker you can write a script with information about the architecture of the target processor and locating information The language for the script is called the Linker Script Language LSL This chapter first describes the structure of an LSL file The next section contains a summary of the LSL syntax Finally in the remaining sections the semantics of the Linker Script Language is explained The TASKING linker is a target independent linker locator that can simultaneously link and locate all programs for all cores available on a target board The target board may be of arbitrary complexity A simple target board may contain one standard processor with some external memory that executes one task A complex target board may contain multiple standard processors and DSPs combined with configurable P cores loaded in an FPGA Each core may execute a different program and external memory may be shared by multiple cores LSL serves two purposes First it enables you to specify the characteristics that are of interest to the linker of your specific target board and of the cores installed on the board Second it enables you to specify how sections should be located in memory 8 2 Structure of a Linker Script File A script file consists of several definitions The definitions
112. Rules 9 1 9 1 MISRA C 1998 ssins ori earn eee dana sien haere 9 1 9 2 MISRA C 2004 0 diia k p ea a a A 9 6 Index ARM Embedded Tools Reference vi Manual Purpose and Structure Manual Purpose and Structure Windows Users The documentation explains and describes how to use the TASKING ARM toolchain to program an ARM processor You can use the tools either with the graphical EDE or from the command line in a command prompt window Structure The toolchain documentation consists of a user s manual Using the ARM Embedded Tools which includes a Getting Started section and a separate reference manual this manual First you need to install the software This is described in Chapter 1 Software Installation and Configuration of the user s manual After installation you are ready you are ready to follow the Getting Started in Chapter 2 of the user s manual Next move on with the other chapters in the user s manual which explain how to use the compiler assembler linker and the various utilities Once you are familiar with these tools you can use this reference manual to lookup specific options and details to make full use of the TASKING toolchain vii ARM Embedded Tools Reference Short Table of Contents Chapter 1 C Language Contains an overview of all language extensions e Data types e Keywords e Function qualifiers e Intrinsic functions e Pragmas e Predefined macros Chapter 2 L
113. SS implementation Use the file system simulation feature of the debugger to stat a file on the host platform FSS implementation Removes the named file so that a subsequent attempt to open it fails Calls _unlink FSS implementation Write a sequence of characters to a file Calls write FSS implementation 2 31 ARM Embedded Tools Reference 2 2 25 wchar h Many in wchar h represent the wide character variant of other so these are discussed together See sections 2 2 20 sidio h 2 2 21 sidlib h 2 2 22 strings h and 2 2 28 time h The remaining are described below They perform conversions between multi byte characters and wide characters In these ps points to struct mbstate_t which holds the conversion state information necessary to convert between sequences of multibyte characters and wide characters typedef struct wchar_t wc_value wide character value solved so far unsigned short n_bytes number of bytes of solved multibyte unsigned short encoding encoding rule for wide character lt gt multibyte conversion mbstate_t When multibyte characters larger than 1 byte are used this struct will be used to store the conversion information when not all the bytes of a particular multibyte character have been read from the source In this implementation multi byte characters are 1 byte long MB_CUR_MAX and MB_LEN_MAX are defined as 1 and this will never occur mbsinit ps Determines
114. Searches Include Files in chapter Using the Compiler of the user s manual 5 21 ARM Embedded Tools Reference Compiler I include directory Menu entry 1 From the Project menu select Directories The Directories dialog box appears 2 Add a pathname in the Include files path field If you enter multiple paths separate them with a semicolon Command line syntax lpath include directory path Description With this option you can specify the path where your include files are located A relative path will be relative to the current directory The order in which the compiler searches for include files is 1 The pathname in the C source file and the directory of the C source only for include files that are enclosed in 2 The path that is specified with this option 3 The path that is specified in the environment variable CARMINCwhen the product was installed 4 The default include directory relative to the installation directory unless you specified option nostdinc Example Suppose that the C source file test c contains the following lines include lt stdio h gt include myinc h You can specify the include directory myinclude to the compiler carm Imyinclude test c carm include directory myinclude test c First the compiler looks for the file stdio h in the directory myinc lude relative to the current directory If it was not found the compiler searches in
115. TASKING C compilers offer four optimization levels and a custom level at each level a specific set of optimizations is enabled No optimization O0 No optimizations are performed The compiler tries to achieve a 1 to 1 resemblance between source code and produced code Expressions are evaluated in the order written in the source code associative and commutative properties are not used Debug purposes optimizations O1 Enables optimizations that do not affect the debug ability of the source code Use this level when you are developing debugging new source code Release purposes optimization O2 Enables more aggressive optimizations to reduce the memory footprint and or execution time The debugger can handle this code but the relation between source code and generated instructions may be hard to understand Use this level for those modules that are already debugged This is the default optimization level Aggressive optimization O3 Enables aggressive global optimization techniques The relation between source code and generated instructions can be very hard to understand The debugger does not crash will not provide misleading information but does not fully understand what is going on Use this level when your program does not fit in the memory provided by your system anymore or when your program hardware has become too slow to meet your real time requirements Custom optimization Ox X you can enable disable specific optimizations
116. The following name values have special meaning With the suboption f the compiler uses the function name only for code With the suboption m the compiler uses the name of the current module With the suboption fm or mf the compiler uses the name of the current module for data sections and the function name for code sections If you do not specify a section name all sections will receive the specified suffix carm R data NEW test c carm rename sections data NEW test c To add the name of the current module name as suffix to all data sections resulting in data test carm R data m test c carm rename sections data m test c db Assembler directive SECTION 5 39 ARM Embedded Tools Reference Compiler r runtime Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Debugging 3 Inthe Run time Checks group enable one or more of the following suboptions to select which run time checks should be performed e Bounds checking e Report unhandled case in a switch e Malloc consistency checks Command line syntax r flags runtime flags You can set the following flags when you specify r without flags the default is rbcm b B bounds bounds checking c C case report unhandled case in a switch m M malloc malloc consistency checks Description This option controls a number of
117. UR 2 21 SEEK_END 2 21 SEEK_SET 2 21 set 3 39 setbuf 2 16 setjmp 2 12 setlocale 2 7 setvbuf 2 16 SIGABRT 2 13 SIGFPE 2 13 SIGILL 2 13 SIGINT 2 13 signal 2 13 signbit 2 12 SIGSEGV 2 13 SIGTERM 2 13 sin functions 2 7 sinh functions 2 7 size 3 40 size_t 2 14 smartinline 1 11 snprintf 2 21 source 3 41 source nosource 1 12 sprintf 2 21 sqrt functions 2 10 srand 2 24 sscanf 2 20 Stack 8 21 Start address 8 23 Startup code 4 1 Index stat 2 31 stderr 2 15 stdin 2 15 stdout 2 15 strcat 2 26 3 4 strchr 2 27 strcmp 2 26 3 4 strcoll 2 26 strcpy 2 26 strcspn 2 27 strerror 2 27 strftime 2 30 strlen 3 4 strncat 2 26 strncmp 2 26 strncpy 2 26 strpbrk 2 27 strpos 3 4 strrchr 2 27 strspn 2 27 strstr 2 27 strtod 2 23 strtof 2 23 strtoimax 2 6 strtok 2 27 strtol 2 23 strtold 2 23 strtoll 2 23 strtoul 2 23 strtoull 2 23 strtoumax 2 6 strxfrm 2 27 swprintf 2 21 swscanf 2 20 Syntax error checking 5 11 5 57 5 131 system 2 24 T tan functions 2 7 tanh functions 2 8 tgamma functions 2 11 thumb 3 5 5 26 Thumb instructions 5 79 time 2 28 time_t 2 28 title 3 42 tm struct 2 28 TMP_MAX 2 15 tmpfile 2 22 tmpnam 2 22 tolower 2 3 toupper 2 3 towctrans 2 33 towlower 2 3 2 33 towupper 2 3 2 33 tradeoff 1 12 trunc functions 2 9 type 3 43 U undef 3 44 ungetc 2 20 ungetwc 2 20 unlink 2 31 V va_arg 2 1
118. a adatom ea eos Control Program Options 0 cece eee eee eee Make Utility Options 0 0 cee eee Librarian Options 0 c eects List File Formats 6 1 6 2 Assembler List File Format Linker Map File Format Object File Formats 7 1 7 2 7 3 ELF DWARF Object Format 0 c cece eee eee Motorola S Record Format 0 0 0 cece cece tenes Intel Hex Record Format Linker Script Language 8 1 8 2 8 3 8 3 1 8 3 2 8 3 3 8 3 4 8 3 5 8 3 6 8 3 7 IMtOGUCHION sissy ded ated tia nde haem aed Reed aoe Ree esis Structure of a Linker Script File 0 ee eee eee Syntax of the Linker Script Language 0000 Preprocessing o ceived ole eeta ne tows Fade Maan Gea Lexical SYMtaX ae i04 eee wae ede medal anes dy pheae deena en Identifies necio ieue reniei naka eae eam eu ae Gees EXPreSSIONS sciccuducreren eddy che out uee dasa denne deed Built in Functions osses css 20 0 cece eee nia kai LSL Definitions in the Linker Script File Memory and Bus Definitions 0 cece eee T l TAT ap I l anmnoan srtr_ AA w o 19 200 160 00 o o 00 0 Table of Contents 8 3 8 Architecture Definition usuau 8 10 8 3 9 Derivative Definition 0 cece ees 8 12 8 3 10 Processor Definition and Board Specification 8 13 8 3 11 Section Layout Definition and Section Set
119. ake where the option k might be inherited from the top level make via MAKEFLAGS or if you set the option k in the environment variable MAKEFLAGS Example mkarm S The effect of the option k is cancelled so the make utility stops with the make process after it encounters an error The option k in this example may have been set with the environment variable MAKEFLAGS or ina recursive call to mkarm in the makefile Related information db Make utility option k On error abandon the work for the current target only 5 184 Tool Options Make Utility Make Utility s Command line syntax S Description With this option you tell the make utility to perform its tasks without printing the commands it executes Error messages are normally printed Example mkarm s The make utility rebuilds your files but does not print the commands it executes during the make process Related information db Make utility option n Perform a dry run 5 185 ARM Embedded Tools Reference Make Utility t Command line syntax t Description With this option you tell the make utility to touch the target files bringing them up to date rather than performing the rules to rebuild them Example mkarm t The make utility updates out of date files by giving them a new date and time stamp The files are not actually rebuild Related information J 5 186 Tool Options Make Utility Make Utility time C
120. alog box appears 2 Select Processor Definition 3 Select a processor from the Target processor box If you select Other select an Architecture Command line syntax Ccpu cpu cpu Description With this option you specify the ARM architecture for which you create your application The architecture determines which instructions are valid and which are not If the architecture is ARMv4 the assembler replaces BX instructions by MOV PC instructions The default architecture is ARMv4T and the complete list of supported architectures is ARMv4 ARMv4T ARMv5 ARMv5T ARMv5TE or XS Assembly code can check the value of the option by means of the built in function CPU Architectures ARMv4 and ARMv5 do not support the Thumb instruction set When you call the assembler from the command line make sure you specify the same core type to the compiler to avoid conflicts Related information Gb Assembly function CPU 5 55 ARM Embedded Tools Reference Assembler c case insensitive Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Disable the option Assemble case sensitive Command line syntax C case insensitive Description With this option you tell the assembler not to distinguish between upper and lower case characters By default the assembler considers upper and lower case characters as d
121. alue if and only if its argument has an infinit value isnan Returns a nonzero value if and only if its argument has NaN value isnormal Returns a nonzero value if an only if its argument has a normal value signbit Returns a nonzero value if and only if its argument 2 2 14 setjmp h value is negative The set jmp and longjmp in this header file implement a primitive form of nonlocal jumps which may be used to handle exceptional situations This facility is traditionally considered more portable than signal h int setjmp jmp buf env Records its caller s environment in env and returns 0 void longjmp jmp_buf env Restores the environment previously saved with a call to int status setjmp 2 12 Libraries 2 2 15 signal h Signals are possible asynchronous events that may require special processing Each signal is named by a number The following signals are defined SIGINT 1 Receipt of an interactive attention signal SIGILL 2 Detection of an invalid function message SIGFPE 3 Anerrouneous arithmetic operation for example zero devide overflow SIGSEGV 4 An invalid access to storage SIGTERM 5 A termination request sent to the program SIGABRT 6 Abnormal terminiation such as is initiated by the abort function The next function sends the signal sig to the program int raise int sig The next function determines how subsequent signals will be handled signalfunction signal int signalfunction The
122. always be enclosed in braces All if else if constructs should contain a final else Every non empty case clause shall be terminated with a break All switch statements should contain a final default case A switch expression should not represent a Boolean case Every switch shall have at least one case Floating point variables shall not be used as loop counters A for should only contain expressions concerning loop control A violation is reported when the loop initialization or loop update expression modifies an object that is not referenced in the loop test Iterator variables should not be modified in a for loop Functions shall always be declared at file scope Functions with variable number of arguments shall not be used 9 3 ARM Embedded Tools Reference 9 4 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 R BPIAAIAIDA SDDALEEADA 2 2 a eS ee eS ee ee ee ee ee DDD D BY oy ee ee lt 2 2 I NN ee Rata Functions shall not call themselves either directly or indirectly A violation will be reported for direct or indirect recursive function calls in the source file being checked Recursion via functions in other source files or recursion via function pointers is not detected Function prototypes shall be visible at the definition and cal
123. are detected Example FOR MYVAR IN 10 TO 20 tae assembly source lines T IF MYVAR gt 15 BREAK ENDIF ENDREP Assembly Language BS BSB BSH BSW BSD Syntax label BS expression1 expression2 label BSB expression1 expression2 label BSH expression1 expression2 label BSW expression1 expression2 label BSD expression1 expression2 Description With the Bs directive Block Storage the assembler reserves a block of memory The reserved block of memory is initialized to the value of expression2 or zero if omitted With expression you specify the number of minimum addressable units MAUs you want to reserve and how much the location counter will advance The expression must be an integer greater than zero and cannot contain any forward references to address labels labels that have not yet been defined With expression2 you can specify a value to initialize the block with Only the least significant MAU of expression2 is used If you omit expression2 the default is zero If you specify label it gets the value of the location counter at the start of the directive processing You cannot initialize of a block of memory in sections with prefix sbss or bss In those sections the assembler issues a warning and only reserves space just as with DS The BSB BSH BSW and BSD directives are variants of the BS directive BSB The expression argument specifies the number of bytes
124. are given If you want the description of one or more selected error messages you can specify the error message numbers separated by commas With this option the control program does not process any files Example To display an explanation of message number 103 enter ccarm diag 103 This results in message 103 with explanation To write an explanation of all errors and warnings in HTML format to file ccerrors html enter ccarm diag html all gt ccerrors html Related information J 5 135 ARM Embedded Tools Reference Control Program E preprocess Command line syntax Efflags preprocess flags You can set the following flags when you specify E without flags the default is ECP c C comments Keep comments from the C source in the preprocessed output m M make Generate dependency lines that can be used for the makefile p P noline Strip line source position information lines starting with line Description With this option you tell the control program to preprocess the C source The compiler sends the preprocessed file to stdout To capture the information in a file specify an output file with the option o When compiling each file is preprocessed first With this option you can store the result of preprocessed C files EDE stores the preprocessed file in a file called name pre where name is the name of the C source file being compiled C comments are not preserve
125. are listed intmax_t imaxabs intmax_t j Returns the absolute value of j imaxdiv_t imaxdiv intmax_t numer Computes numer denom and numer denom The intmax_t denom result is stored in the quot and rem components of the imaxdiv_t structure type intmax_t strtoimax const char Convert string to maximum sized integer Compare restrict nptr char restrict strtol endptr int base uintmax_t strtoumax const char Convert string to maximum sized unsigned integer restrict nptr char restrict Compare strtou1l endptr int base intmax_t westoimax const wchar_t Convert wide string to maximum sized integer restrict nptr wchar_t re Compare wetol strict endptr int base uintmax_t westoumax const wchar_t Convert wide string to maximem sized unsigned integer restrict nptr wchar_t re Compare wctoul strict endptr int base 2 2 10 iso646 h The header file iso646 h adds tokens that can be used instead of regular operator tokens define and amp amp define and_eq amp define bitand amp define bitor define compl define not define not_eq define or define or_eq define xor i define xor_eq 2 2 11 limits h Contains the sizes of integral types defined as macros 2 6 Libraries 2 2 12 locale h To keep C code reasonable portable accross different languages and cultures a number of facilities are provided in the header file local h char setlocale int
126. ary representation of the bytes following the record type starting with the length_byte to just before the checksum Then the one s complement is calculated of this sum The least significant byte of the result is the checksum The sum of all bytes following the record type is OFFH S1 record With the linker option ofilename SREC 2 the actual program code and data is supplied with S1 records with the following layout S 1 lt length_byte gt lt address gt lt code bytes gt lt checksum_byte gt This record is used for 2 byte addresses Example 1130250F03EF04DFOACE8A408A2A013EDFCDBO0E6 _ checksum _ code _ address _ length The linker has an option that controls the length of the output buffer for generating S1 records The default buffer length is 32 code bytes The checksum calculation of S1 records is identical to SO 7 2 Object File Formats S2 record With the linker option ofilename SREC 3 the actual program code and data is supplied with S2 records with the following layout S 2 lt length_byte gt lt address gt lt code bytes gt lt checksum_byte gt This record is used for 3 byte addresses Example 213FF002000232222754E00754F04AF4FAE4E22BF _ checksum _ code _ address _ length The linker has an option that controls the length of the output buffer for generating S2 records The default buffer length is 32 code bytes The checksum calcul
127. at turns s or NULL or EOF WEOF on error FSS implementation Reads at most the next n 1 characters from the stdin stream into array s A newline is ignored Returns s or NULL or EOF WEOF on error FSS implementation Pushes character c back onto the input stream Returns EOF WEOF on error Performs a formatted read from the given stream Returns the number of items converted succesfully FSS implementation Performs a formatted read from the stdin stream Returns the number of items converted succestully FSS implementation Performs a formatted read from the string s Re turns the number of items converted succesfully Same as fscanf fwscanf but extra arguments are given as variable argument list arg See section 2 2 16 stdarg h Same as scanf wscanf but extra arguments are given as variable argument list arg See section 2 2 16 stdarg h Same as scanf wscanf but extra arguments are given as variable argument list arg See section 2 2 16 stdarg h Put character c onto the given stream Returns EOF WEOF on error FSS implementation Same as fpuc fputwe except that is imple mented as a macro FSS implementation Put character c onto the stdout stream Returns EOF WEOF on error Implemented as macro FSS implementation Writes string s to the given stream Returns EOF WEOF on error Writes string s to the stdout stream Returns EOF WEOF on error FSS implementation Performs a formatted
128. ation of S2 records is identical to SO S3 record With the linker option ofilename SREC 4 which is the default the actual program code and data is supplied with S3 records with the following layout S 3 lt length_byte gt lt address gt lt code bytes gt lt checksum_byte gt The linker generates 4 byte addresses by default Example S 3070000FFFE6E6825 _ checksum _ code _ address _ length The linker has an option that controls the length of the output buffer for generating S3 records The checksum calculation of S3 records is identical to SO S7 record With the linker option ofilename SREC 4 which is the default at the end of an S record file the linker generates an S7 record which contains the program start address S7 is the corresponding termination record for S3 records Layout S 7 lt length_byte gt lt address gt lt checksum_byte gt 7 3 ARM Embedded Tools Reference Example S70500000000FA _ checksum _ address _ length The checksum calculation of S7 records is identical to SO S8 record With the linker option ofilename SREC 3 at the end of an S record file the linker generates an S8 record which contains the program start address Layout S 8 lt length_byte gt lt address gt lt checksum_byte gt Example S804FF0003F9 _ checksum _ address _ length The checksum calculation of S8 records is identical
129. ault the control program generates a file with the same basename as the first specified input file With this option you specify another name for the resulting absolute object file Example ccarm test c prog c The control program generates an ELF DWARF object file default with the name test abs To generate the file result abs ccarm o result abs test c prog c ccarm output result abs test c prog c Related information f 5 153 ARM Embedded Tools Reference Control Program p profile Command line syntax plflags profile flags Use the following option for a predefined set of flags pg profile g profiling with call graph and function timers Alias for pBcFt You can set the following flags when you specify p without flags the default is pBCfT b B block block counters c C callgraph call graph f F function function counters t T time function timers Description Profiling is the process of collecting statistical data about a running application With these data you can analyze which functions are called how often they are called and what their execution time is Several methods of profiling exist One method is code instrumentation which adds code to your application that takes care of the profiling process when the application is executed db For an extensive description of profiling refer to Chapter 6 Profiling in the user s manual With this option the c
130. ay group contain references between groups the linker reports an error The keyword allow_cross_references tells the linker to accept cross references Normally it does not make sense to have references between sections that are overlaid group ovl overlay group a select my_ovl_p1 select my_ovl_p2 group b select my_ovl_qli It may be possible that one of the sections in the overlay group already has been defined in another group where it received a load time address In this case the linker does not overrule this load time address and excludes the section from the overlay group 8 37 ARM Embedded Tools Reference 3 Restrict the possible addresses for the sections in a group The load time address specifies where the group s elements are loaded in memory at download time The run time address specifies where sections are located at run time that is when the program is executing If you do not explicitly restrict the address in the LSL file the linker assigns addresses to the sections based on the restrictions relative to other sections in the LSL file and section alignments The program is responsible for copying overlay sections at appropriate moment from its load time location to its run time location this is typically done by the startup code The run_addr keyword defines the run time address If the run time location of a group is set explicitly the given order between groups specify whether th
131. can appear in any order The architecture definition required In essence an architecture definition describes how the linker should convert logical addresses into physical addresses for a given type of core If the core supports multiple address spaces then for each space the linker must know how to perform this conversion In this context a physical address is an offset on a given internal or external bus Additionally the architecture definition contains information about items such as the hardware stack and the vector table This specification is normally written by Altium The architecture definition of the LSL file should not be changed by you unless you also modify the core s hardware architecture If the LSL file describes a multi core system an architecture definition must be available for each different type of core 8 1 ARM Embedded Tools Reference See section 8 5 Semantics of the Architecture Definition for detailed descriptions of LSL in the architecture definition The derivative definition The derivative definition describes the configuration of the internal on chip bus and memory system Basically it tells the linker how to convert offsets on the buses specified in the architecture definition into offsets in internal memory A derivative definition must be present in an LSL file Microcontrollers and DSPs often have internal memory and I O sub systems apart from one or more cores The design of such a chip is call
132. cate phase You can select the input sections with select statements You can use groups inside output sections but you can only set the align attributes and load_addr attributes The 111 field contains a bit pattern that the linker writes to all unused space in the output section When all input sections have an image code data you must specify a fill pattern If you do not specify a fill pattern all input sections must be scratch sections The fill pattern is aligned at the start of the output section As with a reserved section you can use the attributes field to set the access type of the output section group section myoutput size 4k attributes rw fill Oxaa select myinputl1 select myinput2 The available room for input sections is determined by the size blocksize and overflow fields With the keyword size you specify the fixed size of the output section Input sections are placed from output section start towards higher addresses offsets When the end of the output section is reached and one or more input sections are not yet placed an error is emitted If however the overflow field is set to another output section remaining sections are located as if they were selected for the overflow output section 8 41 ARM Embedded Tools Reference group section tskl_ data size 4k attributes rw f1i11 0 overflow overflow_data select data tsk1l sect
133. causes full buffering _IOLBF causes line buffering of text files _IONBF causes no buffering If buffer is not NULL it will be used as a buffer otherwise a buffer will be allocated size determines the buffer size Libraries Character input output The format string of printf related functions can contain plain text mixed with conversion specifiers Each conversion specifier should be preceded by a character The conversion specifier should be build in order Flags in any order specifies left adjustment of the converted argument a number is always preceded with a sign character has higher precedence than space space a negative number is preceded with a sign positive numbers with a space 0 specifies padding to the field width with zeros only for numbers specifies an alternate output form For o the first digit will be zero For x or X 0x and 0X will be prefixed to the number For e E f g G the output always contains a decimal point trailing zeros are not removed A number specifying a minimum field width The converted argument is printed in a field with at least the length specified here If the converted argument has fewer characters than specified it will be padded at the left side or at the right when the flag was specified with spaces Padding to numeric fields will be done with zeros when the flag 0 is also specified only when padding left Instead of a numeric
134. condS Rd Rn imm32 SUBcondS Rd ARn imm32 SUBcond Rd Rn imm32 ADDcond Rad Rn imm32 SUBcondS Rd Rn imm32 ADDcondS Rd Rn imm32 ADCcond Rad Rn imm32 SBCcond Rd Rn imm32 ADCcondS Rd Rn imm32 SBCcondS Rd ARn imm32 SBCcond Rd Rn imm32 ADCcond Rd Rn imm32 SBCcondS Rd Rn imm32 ADCcondS Rd Rn imm32 ANDcond Rd Rn imm32 BICcond Rd Rn LSW imm32 ANDcondS Rd Rn imm32 BlCcondS Rd Rn LSW imm32 BlCcond Rd Rn imm32 ANDcond Rd Rn LSW imm32 BICcondS Rd Rn imm32 ANDcondS Rd Rn LSW imm32 CMNcond Rn imm32 CMPcond Rn imm32 CMPcond Rn imm32 CMNcond Rn imm32 MOVcond Rd imm32 MVNcond Rd LSW imm32 MOVcondS _Rd imm32 MVNcondS Rd LSW imm32 MVNcond Rd imm32 MOVcond Rd LSW imm32 MVNcondS Rd imm32 MOVcondS Rd LSW imm32 Note that the built in function LSW must be used on the bitwise negated immediate value because all values are interpreted by the assembler as 64 bit signed values The LSW function returns the lowest 32 bits 3 47 ARM Embedded Tools Reference BX for ARMv4 The ARMV4 architecture does not support the BX instruction in hardware The assembler will replace the BX instruction by a MOV instruction if the option CARMv4 was specified If the option CARMv4T was specified the assembler will emit a relocation
135. conditional assembly directives REPEAT ENDREP FOR ENDFOR IF ELIF ELSE ENDIF MACRO ENDM UNDEF Directive Description DEFINE Define substitution string BREAK Break out of current macro expansion Repeat sequence of source lines Repeat sequence of source lines n times Conditional assembly directive End of conditional assembly directive Define macro Undefine DEFINE symbol or macro Overview of listing control assembly directives Directive Description LIST NOLIST PAGE TITLE Print do not print source lines to list file Set top of page size of page Set program title in header of assembly list file Overview of HLL directives Directive Description CALLS Pass call tree information 3 7 ARM Embedded Tools Reference ARM specific directives Directive Description CODE16 CODE32 Treat instructions as Thumb or ARM instructions respectively LTORG Assembly current literal pool immediately 3 2 2 Detailed Description of Assembler Directives Each assembler directive has its own syntax Some assembler directives can be preceeded with a label If you do not preceede an assembler directive with a label you must use white space instead spaces or tabs You can use assembler directives in the assembly code as pseudo instructions 3 8 Assembly Language ALIGN Syntax ALIGN expression Descr
136. ctor id 0 A vector table defines symbols _1c_ub fooand_1c_ue_foo pointing to start and end of the table vector _ table foo vector_size m size n run_addr x See the following example of a vector table definition vector table foo vector_size 4 size 256 run_addr 0 template text vector_ template template_symbol _lc_vector_target vector prefix _vector_ id_symbol_prefix foo no_inline default empty or ill foo or ill 1 2 3 4 or i1l1 loop vector id 0 fill START vector id 12 fill Oxab 0x21 0x32 0x43 vector id 1 11 fill 0 vector id 18 23 fill loop The template argument defines the name of the section that holds the code to jump to a handler function from the vector table This template section does not get located and is removed when the locate phase is completed This argument is required The template_symbol argument is the symbol reference in the template section that must be replaced by the address of the handler function This argument is required Vectors defined in C or assembly source files must have the section name vector_prefix vector_id The vector_prefix argument adds this prefix When a vector supplied in an object file has exactly one relocation the linker will assume it is a branch to a handler function and can be removed when the handler is inlined in the vector table Otherwise no inlining is done
137. d e When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line e Itis possible to nest command line files up to 25 levels Example Suppose the file myoptions contains the following lines k err errors txt test abs Specify the option file to the make utility mkarm m myoptions This is equivalent to the following command line mkarm k err errors txt test abs 5 178 Tool Options Make Utility Related information ie 5 179 ARM Embedded Tools Reference Make Utility n Command line syntax n Description With this option you tell the make utility to perform a dry run The make utility shows what it would do but does not actually perform these tasks This option is for example useful to quickly inspect what would happen if you call the make utility Example mkarm n The make utility does not perform any tasks but displays what it would do if called without the option n Related information db Make utility option s Do not print commands before execution 5 180 Tool Options Make Utility Make Utility p Command line syntax p Description Normally if a command in a target rule in a makefile returns an error or when the target construction is interrupted the make utility removes that target file With this option you tell the make utility to ma
138. d similar to ECMP Example ccarm EcP test c o test pre ccarm preprocess comments noline test c output test pre The compiler preprocesses the file test c and sends the output to the file test pre Comments are included but the line source position information is not stripped from the output file Related information J 5 136 Tool Options Control Program Control Program error file Command line syntax error file Description With this option the control program tells the compiler assembler and linker to redirect error messages to a file The error file will be named after the input file with extension err for compiler or ers for assembler For the linker the error file is Lkarm e1k Example To write errors to error files instead of stderr enter ccarm error file t test c Related information Gb Control Program option warnings as errors Treat warnings as errors 5 137 ARM Embedded Tools Reference Control Program F no double Command line syntax F no double Description With this option you tell the compiler to treat variables of the type double as float Because the float type takes less space execution speed increases and code size decreases both at the cost of less precision Related information J 5 138 Tool Options Control Program Control Program f option file Command line syntax f file option
139. d Tools Reference Compiler error file Menu entry Command line only Command line syntax error file file Description With this option the compiler redirects error messages to a file If you do not specify a filename the error file will be named after the input file with extension err Example To write errors to errors err instead of stderr enter carm error file errors err test c Related information J Tool Options Compiler Compiler F no double Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Floating Point 3 Enable the option Use single precision floating point only Command line syntax F no double Description With this option you tell the compiler to treat variables of the type double as float Because the float type takes less space execution speed increases and code size decreases both at the cost of less precision Related information J 5 17 ARM Embedded Tools Reference Compiler f option file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Miscellaneous 3 Add the option f to the Additional C compiler options field Be aware that when you specify the option f in the Additional C compiler options field the options are added to the compiler options you have
140. d line syntax f file Description Instead of typing all options on the command line you can create an option file which contains all options and flags you want to specify With this option you specify the option file to the librarian ararm Use an option file when the command line would exceed the limits of the operating system or just to store options and save typing Option files can also be generated on the fly for example by the make utility You can specify the option f multiple times Format of an option file e Multiple arguments on one line in the option file are allowed e To include whitespace in an argument surround the argument with single or double quotes e f you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded e When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line e Itis possible to nest command line files up to 25 levels Example Suppose the file myoptions contains the following lines x mylib lib objl obj w5 Specify the option file to the librarian ararm f myoptions This is equivalent to the following command line ararm x mylib lib objl obj w5 5 19
141. d line syntax x o v Description Extract an existing module from the library o Give the extracted object module the same date as the last modified date that was recorded in the library Without this suboption it receives the last modified date of the moment it is extracted v Verbose the librarian shows which files are extracted Examples To extract the file obj1 obj from the library mylib lib ararm x mylib lib obj1l obj If you do not specify an object module all object modules are extracted ararm x mylib lib Related information J 5 203 ARM Embedded Tools Reference 5 204 6 List File Formats Summary This chapter describes the format of the assembler list file and the linker map file 6 1 Assembler List File Format The assembler list file is an additional output file of the assembler that contains information about the generated code The list file consists of a page header and a source listing Page header The page header is repeated on every page TASKING target Assembler vx yrz Build nnn SN 00000000 Title Page 1 ADDR CODE CYCLES LINE SOURCE LINE The first line contains version information The second line can contain a title which you can specify with the assembler directive TITLE and always contains a page number With the assembler directives LIst NoLIST and PAGE and with the assembler option Lflag list format you can format the list file See Section 3 2 Assemble
142. d with EQU can be made global Example LOOPA EQU 1 definition of symbol LOOPA GLOBAL LOOPA LOOPA will be globally accessible by other modules Related information Gb EXTERN Import global section symbol 3 26 Assembly Language F ELIF ELSE ENDIF Syntax IF expression ELIF expression the ELIF directive is optional ELSE the ELSE directive is optional ENDIF Description With the IF ENDIF directives you can create a part of conditional assembly code The assembler assembles only the code that matches a specified condition The expression must evaluate to an integer and cannot contain forward references If expression evaluates to zero the IF condition is considered FALSE any non zero result of expression is considered as TRUE You can nest IF directives to any level The ELSE and ELIF directive always refer to the nearest previous IF directive Example Suppose you have an assemble source file with specific code for a test version for a demo version and for the final version Within the assembly source you define this code conditionally as follows IF TEST code for the test version ELIF DEMO code for the demo version ELSE code for the final version ENDIF Before assembling the file you can set the values of the symbols TEST and DEMO in the assembly source before the IF directive is reached For example to assemble the demo version TEST SET 0 DEMO SET
143. dout VL list Write section information to the list file Description With this option you tell the assembler to display section information For each section its memory space size total cycle counts and name is listed on stdout and or in the list file The cycle count consists of two parts the total accumulated count for the section and the total accumulated count for all repeated instructions In the case of nested loops it is possible that the total supersedes the section total With tl the assembler writes the section information to the list file You must specify this option in combination with the option I generate list file Example asarm l tcl test src asarm 1l section info console list test src The assembler generates a list file and writes the section information to this file The section information is also displayed on stdout Related information Gb Assembler option l generate list file 5 80 Tool Options Assembler Assembler V version Menu entry Command line only Command line syntax V version Description Displays version information of the assembler The assembler ignores all other options or input files Related information J 5 81 ARM Embedded Tools Reference Assembler v verbose Menu entry Command line only Command line syntax V verbose Description With this option you put the assembler in verbose mode The asse
144. e bus memory section or group your refer to must be defined in the LSL file e The addressof and sizeof functions with the group or sect argument can only be used in the right hand side of an assignment The sizeof function with the mem argument can be used anywhere in section layouts You can use the following built in functions in expressions All functions return a numerical value This value is a 64 bit signed integer 8 6 Linker Script Language absolute int absolute expr Converts the value of expr to a positive integer absolute labelA labelB addressof int addressof addr_id Returns the address of addr_id which is a named section or group To get the offset of the section with the name asect addressof sect asect AN This function only works in assignments exists int exists section_name The function returns 1 if the section section_name exists in one or more object file O otherwise If the section is not present in input object files but generated from LSL the result of this function is undefined To check whether the section mysection exists in one of the object files that is specified to the linker exists mysection max int max expr expr Returns the value of the expression that has the largest value To get the highest value of two symbols max Syml sym2 mind int min expr expr Returns the value of the expression hat has
145. e data you can analyze which functions are called how often they are called and what their execution time is Several methods of profiling exist One method is code instrumentation which adds code to your application that takes care of the profiling process when the application is executed d gt For an extensive description of profiling refer to Chapter 6 Profiling in the user s manual With this option the compiler adds the extra code to your application that takes care of the profiling process You can obtain the following profiling data see flags above 5 37 ARM Embedded Tools Reference Block counters not in combination with Call graph or Time This will instrument the code to perform basic block counting As the program runs it counts the number of executions of each branch in an if statement each iteration of a for loop and so on Note that though you can combine Block counters with Function counters this has no effect because Function counters is only a subset of Block counters Call graph not in combination with Block counters This will instrument the code to reconstruct the run time call graph As the program runs it associates the caller with the gathered profiling data Function counters This will instrument the code to perform function call counting This is a subset of the basic Block counters Time not in combination with Block counters This will instrument the code to measure the time spent in a f
146. e file with linker option Isl dump Locate Rules This part of the map file shows the rules the linker uses to locate sections Address space The names ofthe address spaces as defined in the linker script file 1s1 The names are constructed of the derivative name followed by a colon the core name another colon and the space name Type The rule type ordered contiguous clustered unrestricted Specifies how sections are grouped By default a group is unrestricted which means that the linker has total freedom to place the sections of the group in the address space absolute The section must be located at the address shown in the Properties column address range The section must be located in the union of the address ranges shown in the Properties column end addresses are not included in the range address range size The sections must be located in some address range with size not larger than shown in the Properties column the second number in that field is the alignment requirement for the address range 6 7 ARM Embedded Tools Reference ballooned Properties Sections After locating all sections the largest remaining gap in the space is used completely for the stack and or heap The contents depends on the Type column The sections to which the rule applies restrictions between sections are shown in this column lt ordered contiguous clustered For contiguous sections the linker
147. e librarian prints the file obj1 obj to standard output where it is redirected to the file file obj The effect of this example is very similar to extracting a file from the library but in this case the extracted file gets another name Related information i 5 197 ARM Embedded Tools Reference Librarian r Command line syntax r a posname b posname c u v Description You can use the option r for several purposes e Adding new objects to the library e Replacing objects in the library with the same object of a newer date e Creating a new library The option r normally adds a new module to the library However if the library already contains a module with the specified name the existing module is replaced If you specify a library that does not exist the librarian creates a new library with the specified name If you add a module to the library without specifying the suboption a or b the specified module is added at the end of the archive Use the suboptions a or b to insert them to a specified place instead a posname Add the specified object module s after the existing module posname b posname Add the specified object module s before the existing module posname c Create a new library without checking whether it already exists If the library already exists it is overwritten u Insert the specified object module only if it is newer than the module in the library V Verbose
148. e local symbols Cross references information Processor and memory information Locate rules With this option you specify which information you want to include in the map file Use this option in combination with the option M map file If you do not specify this option the linker uses the default m2 Related information Gs Linker option M Generate map file 5 112 Tool Options Linker Linker misra c report Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select MISRA C 3 Select a MISRA C configuration 4 Enable the option Produce a MISRA C report Command line syntax misra c report file Description With this option you tell the linker to create a MISRA C Quality Assurance report This report lists the various modules in the project with the respective MISRA C settings at the time of compilation If you do not specify a filename the file name mcr is used Related information Gb Compiler option misrac 5 113 ARM Embedded Tools Reference Linker N no rom copy Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Add the option N to the Additional linker options field Command line syntax N no rom copy Description With this option the linker will no
149. e name is unique You can mix short and long option names on the command line Options can have flags or sub options To switch a flag on use a lowercase letter or a ongflag To switch a flag off use an uppercase letter or a longflag Separate longflags with commas The following two invocations are equivalent ccarm Wc Oac test c ccarm pass c optimize coalescer cse test c When you do not specify an option a default value may become active 5 126 Tool Options Control Program Control Program help Command line syntax help options Description Displays an overview of all command line options When you specify the argument options you can list detailed option descriptions Example The following invocations all display a list of the available command line options ccarm ccarm help ccarm To see a detailed description of the available options enter ccarm help options 5 127 ARM Embedded Tools Reference Control Program address size Command line syntax address size adar_size Description If you specify IHEX or SREC with the control option format you can additionally specify the record length to be emitted in the output files With this option you can specify the size of addresses in bytes record length For Intel Hex you can use the values 1 2 and 4 default For Motorola S records you can specify 2 S1 records
150. e possible All declarations at file scope should be static where possible Identifiers shall not have both internal and external linkage Identifiers with external linkage shall have exactly one definition Multiple declarations for objects or functions shall be compatible External objects should not be declared in more than one file The register storage class specifier should not be used The use of a tag shall agree with its declaration All automatics shall be initialized before being used This rule is checked using worst case assumptions This means that violations are reported not only for variables that are guaranteed to be uninitialized but also for variables that are uninitialized on some execution paths Braces shall be used in the initialization of arrays and structures Only the first or all enumeration constants may be initialized The right hand operand of amp amp or shall not contain side effects The operands of a logical amp amp or shall be primary expressions Assignment operators shall not be used in Boolean expressions Logical operators should not be confused with bitwise operators Bitwise operations shall not be performed on signed integers A shift count shall be between 0 and the operand width minus 1 This violation will only be checked when the shift count evaluates to a constant value at compile time The unary minus shall not be applied to an unsigned expression MISRA C Rules 40 41 42 43 44
151. e run time address propagates to the parent group or not The location of the sections a group can be restricted either to a single absolute address or to a number of address ranges With an expression you can specify that the group should be located at the absolute address specified by the expression group run_addr 0xa00f0000 You can use the offset variant to locate the group at the given absolute offset in memory group run_addr mem A 0x1000 A range can be an absolute space address range written as expr expr a complete memory device written as mem mem_name or a memory address range mem mem_ name expr expr group run_addr mem my dram You can use the to specify an address range of more than one physical memory device group run_addr mem A mem B The load_addr keyword changes the meaning of the section selection in the group the linker selects the load time ROM copy of the named section s instead of the regular sections Just like run_addr you can specify an absolute address or an address range The load_addr keyword itself without an assignment specifies that the group s position in the LSL file defines its load time address group load_addr select mydata select ROM copy of mydata mydata The load time and run time addresses of a group cannot be set at the same time If the load time property is set for a group the group only restricts the positioning at load time o
152. e that resolving one symbol may introduce new unresolved symbols With this option you tell the linker to scan the object files and libraries only once When the linker has not resolved all symbols after the first scan it reports which symbols are still unresolved This option is useful if you are building your own libraries The libraries are most efficiently organized if the linker needs only one pass to resolve all symbols Related information d gt Linker option first library first Scan libraries in given order 5 115 ARM Embedded Tools Reference Linker non romable Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Enable the option Application is not romable Command line syntax non romable Description With this option the linker will locate all ROM sections in RAM A copy table is generated and is located in RAM When the application is started that data and BSS sections are re initialized Related information f 5 116 Tool Options Linker Linker O optimize Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Optimization 3 Enable the optimizations you want Command line syntax Offiags optimize flags Use the following options for predefined sets of flags O0
153. e the supervisor stack you need to change the LSL file The stack size is defined in the linker script file arm 1s1 in directory include 1s1 with macros Define Description __ STACK Size of user stack used in USR mode and in SYS mode __STACK_FIQ FIQ mode stack size __STACK_IRQ IRQ mode stack size __STACK_Svc Supervisor mode stack size __STACK_ABT Abort mode stack size __STACK_UND Undefined mode stack size __ STACK FIXED Defined if you do not expand the user stack if space is left __STACKADDR User stack start address Table 4 5 Stack macros used in arm lsl 4 8 Run time Environment Heap allocation The heap is only needed when you use one or more of the dynamic memory management library functions malloc calloc free and realloc The heap is a reserved area in memory Only if you use one of the memory allocation functions listed above the linker automatically allocates a heap as specified in the linker script file with the keyword heap A special section called heap is used for the allocation of the heap area The size of the heap is defined in the linker script file arm 1s1 in directory include 1s1 with the macro __ HEAP which results in a section called heap The linker defined labels _1c_ub_heapand_1c_ue_heap begin and end of heap are used by the library function sbrk which is called by malloc when memory is needed from the heap Define De
154. e value of the location counter at the start of the directive processing Multiple arguments are stored in successive address locations If an argument is NULL its corresponding address location is flled with zeros Integer arguments are stored as is but must be byte values within the range 0 255 floating point numbers are not allowed If the evaluated expression is out of the range 256 255 the assembler issues an error For negative values within that range the assembler adds 256 to the specified value for example 254 is stored as 2 In case of single and multiple character strings each character is stored in consecutive bytes whose lower seven bits represent the ASCII value of the character The standard C escape sequences are allowed DB R 0x52 DB AB D j 0x41420043 second argument is empty Example TABLE DB 14 253 0x62 ABCD CHARS DB A B C D Related information d BS Block Storage DS Define Storage DH_ Define Half Word DW Define Word DD Define Double Word 3 15 ARM Embedded Tools Reference DD Syntax label DD argument argument Description With the DD directive Define Double Word you allocate and initialize one double word of memory for each argument One double word is 64 bits An argument is e asingle or multiple character string constant e an expression e NULL indicated by two adjacent commas If you s
155. e9c7 97 0x0003e9c4 97 Hn nt JES ISIS KKA IOC IT ITC CICA Processor and Memory 7 dre Edm ESSE EIR III II e A FEI ISI A kkk Locate Rules 20rd A kd anna a III ICI I I IIIa RR Ia Hos Address space Type Properties Sections ARM ARM linear absolute 0x00000000 _vector_0 174 ARM ARM linear contiguous stack_fiq 158 stack_irq 159 stack_svc 160 stack abt 161 stack_und 162 ARM ARM linear clustered data 2 data libce 25 ARM ARM linear clustered data 165 data libc 166 ARM ARM linear unrestricted text cstart 142 ARM ARM linear unrestricted stack 157 ARM ARM linear ballooned stack 157 ARM ARM linear unrestricted alignment_protection 175 pn The meaning of the different parts is Processed Files This part of the map file shows all processed files This also includes object files that are extracted from a library with the symbol that led to the extraction ARM Embedded Tools Reference Link Result This part of the map file shows per object file how the link phase has mapped the sections from the various object files obj to output sections in File The name of an input object file in Section A section name and id from the input object file The number between Y uniquely identifies the section in Size The size of the input section out Offset The offset relative to the start of the output section out Section The resul
156. eating and Locating Groups of Sections e The mau field specifies the MAU size Minimum Addressable Unit of the memory This field is required e The size field specifies the size in MAU of the memory This field is required e The speed field specifies a symbolic speed for the memory 0 4 0 is the fastest 4 the slowest The linker uses the relative speed of the memories in such a way that optimal speed is achieved The default speed is 1 e The map field specifies how this memory maps onto an internal bus Mappings are described in section 8 5 4 Mappings memory mem_name type rom mau 8 size 64k speed 2 map map_description With the bus keyword you define a bus in a derivative definition Buses are described in section 8 5 2 Defining Internal Buses 8 28 Linker Script Language 8 7 Semantics of the Board Specification Keywords in the board specification processor derivative bus mau width map memory type reserved rom ram nvram mau size speed map map dest bus space dest_dbits dest_offset size src_dbits sro offset 8 7 1 Defining a Processor If you have a target board with multiple processors that have the same derivative you need to instantiate each individual processor in a processor definition This information tells the linker which processor has which derivative and enables the linker to distinguish between the present processors amp If you use proce
157. ect Project Options The Project Options dialog box appears 2 Select Processor Definition 3 Enable the option Big endian mode Command line syntax B big endian Description For ARM architectures the default endianness is little endian With this option you tell the linker to link the input files in big endian mode The endianess used must be valid for the architecture you are linking for Depending on the endianess used the linker links different libraries Related information f 5 87 ARM Embedded Tools Reference Linker C cpu Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Select Processor Definition 3 Select a processor from the Target processor box If you select Other select an Architecture Command line syntax Ccpu cpu cpu Description With this option you specify the ARM architecture for which you create your application The default architecture is ARMv4T and the complete list of supported architectures is ARMv4 ARMv4T ARMv5 ARMv5T ARMV5TE or XS Architectures ARMv4 and ARMv5 do not support the Thumb instruction set Related information f 5 88 Tool Options Linker Linker c chip output Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Output Format 3 Enable the option Intel HEX record
158. ect files 8 42 Linker Script Language 8 9 4 Creating Symbols You can tell the linker to create symbols before locating by putting assignments in the section layout definition Symbol names are represented by double quoted strings Any string is allowed but object files may not support all characters for symbol names You can use two different assignment operators With the simple assignment operator the symbol is created unconditionally With the operator the symbol is only created if it already exists as an undefined reference in an object file The expression that represents the value to assign to the symbol may contain references to other symbols If such a referred symbol is a special section symbol creation of the symbol in the left hand side of the assignment will cause creation of the special section section_layout 1lce_bs _1lce_ub stack when the symbol _lc_bs occurs as an undefined reference in an object file the linker allocates space for the stack 8 9 5 Conditional Group Statements Within a group you can conditionally select sections or create special sections e With the if keyword you can specify a condition The succeeding section statement is executed if the condition evaluates to TRUE 1 e The optional else keyword is followed by a section statement which is executed in case the if condition evaluates to FALSE 0 group if exists mysection
159. ection_definition no processor name core core name lt core descr gt e Acore_ def defines a core with the given core_name as a unique name e Atleast one core_def must be present ina derivative_definition Linker Script Language core_descr architecture arch_name lt argument_list gt 0 1 endianness endianness_ type lt endianness_type gt e An arch_name refers to a defined core architecture e Exactly one architecture statement must be present in a core_def 8 3 10 Processor Definition and Board Specification board_spec proc_def bus_def mem_def proc_def processor proc_name proc_descr proc_descr derivative derivative_name lt argument_list gt 0 1 e Aproc_def defines a processor with the proc_name as a unique name e If you do not explicitly define a processor for a derivative in an LSL file the linker defines a processor with the same name as that derivative e Aderivative_name refers to a defined derivative e Aproc_def contains exactly one derivative statement 8 3 11 Section Layout Definition and Section Setup section definition section_layout lt space ref gt 1 lt locate_direction gt 1 lt section_statement gt gt e A section definition inside a space definition does not have a space_ref e All global section definitions have a space_ref space_ref lt proc_name gt 1 lt core_name gt 1 space_name e f more than
160. ectives div 2 25 Double as float 5 138 ds 3 19 dsb 3 19 dsd 3 19 dsh 3 19 dsw 3 19 dw 3 20 E ELF DWARF object format 7 1 end 3 21 Endianness 5 7 5 54 5 87 EOF 2 15 equ 3 22 erf functions 2 11 erfc functions 2 11 errno 2 3 Exception handlers __interrupt_dabt 1 5 __interrupt_fiq 1 5 __interrupt_iabt 1 5 __interrupt_irq 1 5 __interrupt_swi 1 5 __interrupt_und 1 5 exit 2 24 EXIT_FAILURE 2 23 EXIT_SUCCES 2 23 exp functions 2 8 exp2 functions 2 8 expm1 functions 2 8 extension isuffix 1 10 extern 1 10 3 23 Index F fabs functions 2 10 fclose 2 16 fdim functions 2 11 FE_ALL_EXCEPT 2 5 FE_DIVBYZERO 2 5 FE_INEXACT 2 5 FE_INVALID 2 5 FE_OVERFLOW 2 5 FE_UNDERFLOW 2 5 feclearexcept 2 4 fegetenv 2 4 fegetexceptflag 2 4 feholdexept 2 4 feof 2 22 feraiseexcept 2 4 ferror 2 22 fesetenv 2 4 fesetexceptflag 2 4 fetestexcept 2 4 2 5 feupdateenv 2 4 fflush 2 16 fgetc 2 19 fgetpos 2 22 fgets 2 20 fgetwc 2 19 fgetws 2 20 FILENAME_MAX 2 15 floor functions 2 9 fma functions 2 10 fmax functions 2 11 fmin functions 2 11 fmod functions 2 9 fopen 2 16 FOPEN_MAX 2 15 for endfor 3 24 fpclassify 2 12 fprintf 2 20 fputc 2 20 fputs 2 20 fputwc 2 20 fputws 2 20 fread 2 21 free 2 24 freopen 2 16 frexp functions 2 10 fscanf 2 20 fseek 2 21 fsetpos 2 22 ftell 2 22 Function qualifiers __interrupt_dabt 1 5 __interrupt_fiq 1
161. ed a derivative When you design an FPGA together with a PCB the components on the FPGA become part of the board design and there is no need to distinguish between internal and external memory For this reason you probably do not need to work with derivative definitions at all There are however two situations where derivative definitions are useful 1 When you re use an FPGA design for several board designs it may be practical to write a derivative definition for the FPGA design and include it in the project LSL file 2 When you want to use multiple cores of the same type you must instantiate the cores ina derivative definition since the linker automatically instantiates only a single core for an unused architecture See section 8 6 Semantics of the Derivative Definition for a detailed description of LSL in the derivative definition The processor definition The processor definition describes an instance of a derivative Typically the processor definition instantiates one derivative only single core processor A processor that contains multiple cores having the same homogeneous or different heterogeneous architecture can also be described by instantiating multiple derivatives of the same or different types in separate processor definitions If for a derivative A no processor is defined in the LSL file the linker automatically creates a processor named A of derivative A This is why for single processor application
162. ed in the table below The macros are useful to create conditional C code Macro Description BIG _ENDIAN Expands to 1 if the processor accesses data in big endian Expands to 0 if the processor accesses data in little endian ARM default __CARM __ Expands to 1 for the ARM toolchain otherwise unrecognized as macro __ THUMB Expands to 1 if you used option thumb otherwise unrecognized as macro __CPU__ Expands to the CPU core name option Ccpu __SINGLE_FP__ Expands to 1 if you used option F Treat double as float otherwise unrecognized as macro __DOUBLE_FP__ Expands to 1 if you did not use option F Treat double as float otherwise unrecognized as macro __ TASKING _ Identifies the compiler as a TASKING compiler Expands to 1 if a TASKING compiler is used __VERSION__ Identifies the version number of the compiler For example if you use version 1 0r2 of the compiler _ VERSION _ expands to 1000 dot and revision number are omitted minor version number in 3 digits __REVISION __ Identifies the revision number of the compiler For example if you use version 1 0r2 of the compiler _ REVISION __ expands to 2 _ BUILD __ Identifies the build number of the compiler composed of decimal digits for the build number three digits for the major branch number and three digits for the minor branch number For example if you use build 1 22 1 of the compiler _ BUILD __ ex
163. ed is the name of the deepest nested group Section The name and id of the section The number between uniquely identifies the section Names within square brackets will be copied during initialization from ROM to the corresponding section name in RAM Size MAU The size of the section in minimum addressable units 6 6 List File Formats Space addr The absolute address of the section in the address space Chip addr The absolute offset of the section from the start of a memory chip Locate Result Symbols This part of the map file lists all external symbols per address space name both sorted on address and sorted on symbol name Name The name of the symbol Address The absolute address of the symbol in the address space Space The names of the address spaces as defined in the linker script file 1s1 The names are constructed of the derivative name followed by a colon the core name another colon and the space name Memory Usage This part of the map file shows the memory usage in totals and percentages for spaces and chips The largest free block of memory per space and per chip is also shown Processor and Memory This part of the map file shows the processor and memory information of the linker script file By default this part is not shown in the map file You have to turn this part on manually with linker option ms processor and memory info You can print this information to a separat
164. ed out or just some pseudo code Instead the following heuristics are used to detect possible C code inside a comment a line ends with or a line starts with possibly preceded by white space 11 R Identifiers shall not rely on significance of more than 31 characters 9 1 ARM Embedded Tools Reference 9 2 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 BEDBEES SB SDADSFLAADA gt a a a a a ee ao Co mS J 2 2 2 2 i ip ig a ipl ig eft its Rata The same identifier shall not be used in multiple name spaces Specific length typedefs should be used instead of the basic types Use unsigned char or signed char instead of plain char Floating point implementations should comply with a standard The bit representation of floating point numbers shall not be used A violation is reported when a pointer to a floating point type is converted to a pointer to an integer type typedef names shall not be reused Numeric constants should be suffixed to indicate type A violation is reported when the value of the constant is outside the range indicated by the suffixes if any Octal constants other than zero shall not be used All object and function identifiers shall be declared before use Identifiers shall not hide identifiers in an outer scope Declarations should be at function scope wher
165. efault all data lines from the source bus are mapped on the data lines of the destination bus starting with line 0 From space to space If you map an address space to another address space nesting you can do this by mapping the subspace to the containing larger space In this example a small space of 64k is mapped on a large space of 16M space small id 2 mau 4 map src_offset 0 dest_offset 0 dest space large size 64k From space to bus All spaces that are not mapped to another space must map to a bus in the architecture space large id 1 mau 4 map src_offset 0 dest_offset 0 dest bus bus_name size 16M 8 24 Linker Script Language From bus to bus The next example maps an external bus called e_bus to an internal bus called i_bus This internal bus resides on a core called mycore The source bus has 16 data lines whereas the destination bus has only 8 data lines Therefore the keywords src_dbits and dest_dbits specify which source data lines are mapped on which destination data lines architecture mycore bus i_bus mau 4 space i_space map dest bus i bus size 256 bus e_bus mau 16 width 16 map dest bus mycore i_ bus sre_dbits 0 7 dest_dbits 0 7 It is not possible to map an internal bus to an external bus 8 25 ARM Embedded Tools Reference 8 6 Semantics of the Derivative Definition Keywords i
166. elative to each other and what the absolute run and load addresses of each section will be You can define one or more section definitions Each section definition arranges the sections in one address space You can precede the address space name with a processor name and or core name separated by colons You can omit the processor name and or the core name if only one processor is defined and or only one core is present in the processor A reference to a space in the only core of the only processor in the system would look like my_space A reference to a space of the only core on a specific processor in the system could be my_chip my_space The next example shows a section definition for sections in the my_space address space of the processor called my_chip section_layout my chip my_ space locate direction section statements With the optional keyword direction you specify whether the linker starts locating sections from low_to_high default or from high_to_1low In the second case the linker starts locating sections at the highest addresses in the address space but preserves the order of sections when necessary one processor and core in this example section_layout my_ space direction high_to_low section statements LN If you do not explicitly tell the linker how to locate a section the linker decides on the basis of the section attributes in the object file and the information in the arc
167. ement e Aspace_def contains at most one align statement e Aspace_def contains at most one page_size statement 8 10 Linker Script Language e Aspace_def contains at least one mapping stack_def stack stack_name stack_heap descr lt stack_heap descr gt gt e Astack_def defines a stack with the stack_name as a unique name heap_def heap heap _name stack_heap_ descr lt stack_heap descr gt gt e A heap_def defines a heap with the heap_name as a unique name stack_heap_descr min_size expr grows direction align expr fixed e The min_size statement must be present e You can specify at most one align statement and one grows statement direction low_to_high e f you do not specify the grows statement the stack and grow low to high copy_table def copytable lt copy table descr lt copy_table_descr gt gt 9 gt 0 1 e Aspace_def contains at most one copytable statement e If the architecture definition contains more than one address space exactly one copy table must be defined in one of the spaces If the architecture definition contains only one address space a copy table definition is optional it will be generated in the space copy_table descr aes expr copy_unit expr dest lt space_name gt 1 space_name page e The copy_unit is defined by the size in MAUs in which the startup code moves data e The dest statement is only required when the s
168. emented fabs fabsl fabsf fabs Returns the absolute value of x x abs labs llabs div ldiv lldiv are defined in stdlib h fma fmal fmaf fma Floating point multiply add Returns x y z Not implemented hypot hypotl hypotf hypot Returns the square root of x2 y2 pow powl powf power Returns x raised to the power y xy sqrt sqrtl sqrtf sqrt Returns the non negative square root of x x0 Manipulation functions copysign nan nextafter nexttoward Math h Tgmath h Description copysign copysignl copysign Returns the value of x with the sign of y copysignf nan nanl nanf Returns a quiet NaN if available with content ind cated through tagp Not implemented nextafter nextafterl nextafter Returns the next representable value in the specified nextafterf format after x in the direction of y Returns y is x y Not implemented nexttoward nexttowardl nexttoward Same as nextafter except that the second argu nexttowardf ment in all three variants is of type long double Returns y if x y Not implemented Libraries Positive difference maximum minimum Math h Tgmath h Description fdim fdiml fdimf fdim Returns the positive difference between x y Not implemented fmax fmaxl fmaxf fmax Returns the maximum value of their arguments Not implemented fmin fminl fminf fmin Returns the minimum value of their arguments Error and gamma Not implemented Not implemented Math h Tgmath h Description erf erfl
169. er of the user s manual 5 109 ARM Embedded Tools Reference Linker Isl dump Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Scrip File 3 Enable the option Dump processor and memory info from LSL file Command line syntax Isl dump file Description With this option you tell the linker to dump the LSL part of the map file in a separate file independent of the option M generate map file If you do not specify a filename the file Lktarget 1df is used Related information d Linker option m Map file formatting 5 110 Tool Options Linker Linker M map file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Map File 3 Enable the option Generate a map file map 4 Inthe Map file format section enable or disable the information you want to be included in the map file Command line syntax M file map file file Description With this option you tell the linker to generate a linker map file If you do not specify a filename and you specfied the o option the linker uses the same basename as the output file with the extension map If you did not specify the o option the linker uses the file task1 map EDE names the map file after the project A linker map file is a text file that shows h
170. ere the two most significant bytes are the upper_address and the two least significant bytes are zero offset is the 16 bit offset from the Data Record index is the index of the data byte within the Data Record 0 for the first byte Example 0200000400FFFB _ checksum _ upper_address _ type _ offset _ length Data Record The Data Record specifies the actual program code and data length offset 00 data Ea The length byte specifies the number of data bytes The linker has an option that controls the length of the output buffer for generating Data records The default buffer length is 32 bytes The offset is the 16 bit starting load offset Together with the address specified in the Extended Address Record it specifies an absolute address in memory where the data is to be located when loaded by a tool 7 6 Object File Formats Example 0F00200000232222754E00754F04AF4FAE4E22C3 _ checksum _ data _ type _ offset _ length Start Linear Address Record The Start Linear Address Record contains the 32 bit program execution start address Layout address checksum Example 0400000500FF0003F5 _ checksum _ address _ type _ offset _ length End of File Record The hexadecimal file always ends with the following end of file record 00000001FF checksum _ type _ offset _ length 7 7 ARM Embedded Tools
171. erff erf Computes the error function of x Not implemented erfc erfcl erfcf erc Computes the complementary error function of x Not implemented lgamma lgammal lgammaf lgamma Computes the loge T x tgamma tgammal tgammaf tgamma Comparison macros Not implemented Computes T x Not implemented The next are implemented as macros For any ordered pair of numeric values exactly one of the relationships less greater and equal is true These macros are type generic and therefor do not have a parallel function in tgmath h All arguments must be expressions of real floating type Math h Tgmath h Description isgreater Returns the value of x gt y isgreaterequal Returns the value of x gt y isless Returns the value of x lt y islessequal Returns the value of x lt y islessgreater Returns the value of x lt y x gt y isunordered Returns 1 if its arguments are unordered O otherwise 2 11 ARM Embedded Tools Reference Classification macros The next are implemented as macros These macros are type generic and therefor do not have a parallel function in tgmath h All arguments must be expressions of real floating type Math h Tgmath h Description fpclassify Returns the class of its argument FP_INFINITE FP_NAN FP_NORMAL FP_SUBNOR MAL or FP_ZERO isfinite Returns a nonzero value if and only if its argument has a finite value isinf Returns a nonzero v
172. es a PC relative LDR instruction that loads the value from the literal pool Instruction Replacement Description LDRcond Rd expr MOVcond Rad expr If expr can be encoded MVNcond Rd LSW expr If expr can be encoded LDRcond Rd ltpool If expr is external or code PC relative or cannot be Itpool encoded DW expr The PC relative offset from the LDR instruction to the value in the literal pool must be positive and less than 4 kB By default the assembler will place a literal pool at the end of each code section If the default literal pool is out of range you will have to ensure that there is another literal pool within range by means of the LTORG directive 3 46 Assembly Language NOP ARM generic No operation Instruction Replacement NOP MOV RO RO ARM generic DPR inversions for immediate operands For data processing instructions DPR which operate on an immediate operand the operand value must be encoded as an 8 bit value plus a 4 bit even rotation value If a value does not fit in such an encoding it could be possible that the negated value value or the bitwise negated value value does fit in such an encoding In that case the assembler will replcace the DPR instruction by its inverse DPR instruction operating on the negated value Instruction Replacement if imm32 or imm32 can be encoded ADDcond Rd Rn imm32 SUBcond Rd Rn imm32 ADD
173. ess to the address which is mapped at address 0x00000000 Your initialization code re maps this address during startup Note that the reset handler in the run time library is immune to this re mapping because the first instruction in the startup code sets the program counter to the actual ROM address 4 3 ARM Embedded Tools Reference e When the reset handler is called from the vector table with a branch instruction B _ START and the linker has located the reset handler at an address that is out of range of the branch instruction When you specify a fixed ROM address you can make sure that the reset handler can be called from the vector table Note however that you can prevent out of range branches by using a position independent vector table which loads the handler addresses into the program counter by means of a PC relative load from a literal pool To set a fixed ROM address in EDE 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Script File 3 Enable the option Generated Linker Script File based on EDE settings 4 Expand the Script File entry and select Startup Vectors ARM Project Options DEMO PJT x Processor Definition m Startup Vectors C Compiler Force reset handler at ROM address l E C Compiler ch Assembler Vector table ROM address 0x00000000 E Linker Vector type Position independent Output Format P
174. f the group s sections It is not possible to set the address of a group that has a not unrestricted parent group The properties of the load time and run time start address are 8 38 At run time before using an element in an overlay group the application copies the sections from their load location to their run time location but only if these two addresses are different For non overlay sections this happens at program start up The start addresses cannot be set to absolute values for unrestricted groups For non overlay groups that do not have an overlay parent the load time start address equals the run time start address For any group if the run time start address is not set the linker selects an appropriate address Linker Script Language For overlays the linker reserves memory at the run time start address as large as the largest element in the overlay group e The page keyword tells the linker to place the group in one page Instead of specifying a run time address you can specify a page and optional a page number Page numbers start from zero If you omit the page number the linker chooses a page The page keyword refers to pages in the address space as defined in the architecture definition e With the page_size keyword you can override the page alignment and size set on the address space See also the page_size keyword in section 8 5 3 Defining Address Spaces group page group page 3 8 9
175. fied the linker uses the size given by the min_size argument as defined for the heap in the architecture definition Normally the linker automatically tries to maximize the size unless you specified the keyword fixed 8 39 ARM Embedded Tools Reference group heap myheap size 2k The linker creates two labels to mark the begin and end of the heap _1c_ub heap name for the begin of the heap and _1e_ue_heap_name for the end of the heap The linker allocates space for the heap when a reference to either of the section labels exists in one of the input object files Reserved section The keyword reserved tells the linker to create an area or section of a given size The linker will not locate any other sections in the memory occupied by a reserved section with some exceptions Optionally you can assign a name to a reserved section With the keyword size you can specify a size for a given reserved area or section group reserved myreserved size 2k The optional 111 field contains a bit pattern that the linker writes to all memory addresses that remain unoccupied during the locate process The result of the expression or list of expressions is used as values to write to memory each in MAU The first MAU of the fill pattern is always the first MAU in the section By default no sections can overlap with a reserved section With alloc_allowed absolute sections that are located at an ab
176. file is coded in LSL and contains the following types of information e the architecture definition describes the core s hardware architecture e the memory definition describes the physical memory available in the system e the section layout definition describes how to locate sections in memory With this option you specify a linker script file to the linker If you do not specify this option the linker uses a default script file You can specify the existing file arm 1s1 or the name of a manually written linker script file You can use this option multiple times The linker processes the LSL files in the order in which they appear on the command line Related information d Linker option Isl check Check LSL file s and exit Section 8 7 Controlling the Linker with a Script in chapter Using the Linker of the user s manual 5 93 ARM Embedded Tools Reference Linker diag Menu entry 1 Inthe Help menu enable the option Show Help on Tool Errors 2 Inthe Build tab of the Output window double click on an error or warning message A description of the selected message appears Command line syntax diag format all nr Description With this option you can ask for an extended description of error messages in the format you choose The output is directed to stdout normally your screen and in the format you specify You can specify the following formats html rtf or text default To create a file
177. files path 5 22 5 32 5 69 5 101 Bus definition 8 2 Buses 8 20 C C style comments 5 4 Call graph 3 13 5 10 calloc 2 24 calls 3 13 cbrt functions 2 10 ceil functions 2 9 chdir 2 31 Check source code 5 11 5 57 5 131 clearerr 2 22 clock 2 28 clock_t 2 28 CLOCKS_PER_SEC 2 28 close 2 31 ent 3 2 Code compaction 5 24 code16 3 14 code32 3 14 Command file 5 178 Comments 8 4 Compiler options 5 1 help 5 3 align composites 5 6 call info 5 10 check 5 11 diag 5 14 error file 5 16 inline 5 24 inline max incr 5 25 inline max size 5 25 interwork 5 26 misrac 5 28 misrac advisory warnings 5 29 misrac required warnings 5 29 nostdinc 5 32 signed bitfields 5 43 static 5 44 thumb 5 46 warnings as errors 5 51 A language 5 4 B big endian 5 7 C cpu 5 8 c iso 5 9 D define 5 12 E preprocess 5 15 F no double 5 17 f option file 5 18 g debug info 5 20 H include file 5 21 I include directory 5 22 k keep output files 5 27 n stdout 5 31 O optimize 5 33 o output 5 36 p profile 5 37 R rename sections 5 39 r runtime 5 40 s source 5 42 t tradeoff 5 45 u uchar 5 48 U undefine 5 47 V version 5 49 w no warnings 5 50 debug information 5 20 diagnostics 5 50 5 51 language 5 4
178. files path field If you enter multiple paths separate them with a semicolon Command line syntax lpath include directory paih Description With this option you can specify the path where your include files are located A relative path will be relative to the current directory The order in which the assembler searches for include files is 1 The pathname in the assembly file and the directory of the assembly source 2 The path that is specified with this option 3 The path that is specified in the environment variable ASARMINC when the product was installed 4 The default include directory relative to the installation directory Example Suppose that your assembly source file test src contains the following line INCLUDE myinc inc You can call the assembler as follows asarm Ic proj include test srce asarm include directory c proj include test sre First the assembler looks in the directory where test src is located for the file myinc inc If it does not find the file it looks in the directory c proj include for the file myinc inc this option If the file is still not found the assembler searches in the environment variable and then in the default include directory Related information Gb Assembler option H include file Include file before source 5 69 ARM Embedded Tools Reference Assembler i symbol scope Menu entry 1 From the Project menu
179. fines type fpos_t as an unsigned long 2 14 Libraries Macros Stdio h Description BUFSIZ 512 Size of the buffer used by the setbuf setvbuf function 512 EOF 1 End of file indicator WEOF UINTMAX End of file indicator NOTE WEOF need not to be a negative number as long as its value does not correspond to a member of the wide character set Defined in wchar h FOPEN_MAX Number of files that can be opened simultaneously 4 FILENAME MAX 100 _IOFBF _IOLBF _IONBF L_tmpnam TMP_MAX 0x8000 stderr stdin stdout NOTE According to ISO IEC 9899 this value must be at least 8 Maximum length of a filename 100 Expand to an integer expression suitable for use as argument to the setv buf function Size of the string used to hold temporary file names 8 tmpxxxxx Maximum number of unique temporary filenames that can be generated 0x8000 Expressions of type pointer to FILE that point to the FILE objects associated with standard error input and output streams Low level file access functions Stdio h Description _close fd _lseek fd offset whence _open fd flags _read fd buff cnt _unlink name _write fd buffer cnt Used by the functions close and fclose FSS implementation Used by all file positioning functions fgetpos fseek fsetpos ftell rewind FSS implementation Used by the functions fopen and freopen FSS implementation Reads a sequence of characters from
180. first argument specifies the signal the second argument points to the signal handler function or has one of the following values SIG_DFL Default behaviour is used SIG_IGN The signal is ignored The function returns the previous value of signalfunction for the specific signal or STG_ERR if an error occurs 2 2 16 stdarg h The facilities in this header file gives you a portable way to access variable arguments lists such as needed for as fprintf and vfprintf This header file contains the following macros va_arg ap type Returns the value of the next argument in the variable argument list It s return type has the type of the given argument type A next call to this macro will return the value of the next argument va_end va_list ap This macro must be called after the arguments have been processed It should be called before the function using the macro va_start is termi nated ANSI specification va_start va_list ap This macro initializes ap After this call each call to va_arg will return lastarg the value of the next argument In our implementation va_list can not contain any bit type variables Also the given argument lastarg must be the last non bit type argument in the list 2 13 ARM Embedded Tools Reference 2 2 17 stdbool h This header file contains the following macro definitions These names for boolean type and values are consisten with C You are allowed to undef ine or redefine the macros be
181. formation i 5 142 Tool Options Control Program Control Program g debug info Command line syntax g debug info Description With this option you tell the control program to include debug information in the generated object file Related information 5 143 ARM Embedded Tools Reference Control Program I include directory Command line syntax Ipath include directory path Description With this option you can specify the path where your include files are located A relative path will be relative to the current directory Example Suppose that the C source file test c contains the following lines include lt stdio h gt include myinc h You can call the control program as follows ccarm Imyinclude test c First the compiler looks for the file stdio h in the directory myinclude relative to the current directory If it was not found the compiler searches in the environment variable and then in the default include directory The compiler now looks for the file myinc h in the directory where test c is located If the file is not there the compiler searches in the directory myinclude If it was still not found the compiler searches in the environment variable and then in the default include directory Related information Compiler option I Add directory to include file search path Compiler option H Include file at the start of a compilation Section
182. from the file you supplied as input With this option you tell the control program to stop after a certain number of phases cs create assembly Stop after C files are compiled to assembly src co create object Stop after the files are assembled to objects obj cl create relocatable Stop after the files are linked to a linker object file out Related information dE Linker option link only Link only no locating 5 130 Tool Options Control Program Control Program check Command line syntax check Description With this option you can check the source code for syntax errors without generating code This saves time in developing your application The compiler assembler reports any warnings and or errors Related information Gb Compiler option check Check syntax Assembler option check Check syntax 5 131 ARM Embedded Tools Reference Control Program D define Command line syntax Dmacro_name macro_definition define macro_name macro_definition Description With this option you can define a macro and specify it to the preprocessor If you only specify a macro name no macro definition the macro expands as 1 You can specify as many macros as you like On the command line use the option D multiple times If the command line exceeds the length limit of the operating system you can define the macros in an option file which you then must
183. g the files even in case of errors Related information Gb Control Program option w Suppress all warnings 5 163 ARM Embedded Tools Reference 5 5 Make Utility Options When you build a project in EDE EDE generates a makefile and uses the make utility mkarm to build all your files However you can also use the make utility directly from the command line to build your project The invocation syntax is mkarm option target macro def This section describes all options for the make utility The make utility is a command line tool so there are no equivalent options in EDE 5 164 Tool Options Make Utility Defining Macros Command line syntax macro definition Description With this argument you can define a macro and specify it to the make utility A macro definition remains in existence during the execution of the makefile even when the makefile recursively calls the make utility again In the recursive call the macro acts as an environment variable This means that it is overruled by definitions in the recursive call Use the option e to prevent this You can specify as many macros as you like If the command line exceeds the limit of the operating system you can define the macros in an option file which you then must specify to the make utility with the option m file Defining macros on the command line is for example useful in combination with conditional processing as shown in the example
184. given stream Returns the number of ele ments succesfully written FSS implementation Random access Stdio h Description fseek stream offset Sets the position indicator for stream FSS implementation origin When repositioning a binary file the new position origin is given by the following macros SEEK_SET 0 offset characters from the beginning of the file SEEK_CUR 1 offset characters from the current position in the file SEEK_END 2 offset characters from the end of the file 2 21 ARM Embedded Tools Reference ftell stream rewind stream fgetpos stream pos fsetpos stream pos Operations on files Stdio h Returns the current file position for stream or 1L on error FSS implementation Sets the file position indicator for the stream to the beginning of the file This function is equivalent to void fseek stream OL SEEK _SET clearerr stream FSS implementation Stores the current value of the file position indicator for stream in the object pointed to by pos FSS implementation Positions stream at the position recorded by getpos in pos FSS implementation Description remove file rename old new tmpfile tmpnam buffer Error handling Stdio h Removes the named file so that a subsequent attempt to open it fails Returns a non zero value if not succesful Changes the name of the file from old name to new name Re turns a non zero value if not succesful
185. h the linker searches for LSL include files is 1 The pathname in the LSL file and the directory where the LSL file is located only for include files that are enclosed in 2 The path that is specified with this option 3 The default directory PRODDIR include 1s1l Example Suppose that your linker script file myl1s1 1s1 contains the following line include myinc inc You can call the linker as follows lkarm Ic proj include dmylsl 1lsl test obj lkarm include directory c proj include lsl file mylsl 1lsl test obj First the linker looks in the directory where my1s1 1s1 is located for the file myinc inc If it does not find the file it looks in the directory c proj include for the file myinc inc this option Finally it looks in the directory PRODDIR include 1sl Related information d 5 101 ARM Embedded Tools Reference Linker i user provided initialization code Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Disable the option Use standard copy table for initialization Command line syntax i user provided initialization code Description It is possible to use your own initialization code for example to save ROM space With this option you tell the linker not to generate a copy table for initialize clear sections Use linker labels in your source code to
186. hat are uninitialized on some execution paths 9 2 R Braces shall be used to indicate and match the structure in the non zero initialization of arrays and structures 9 3 R In an enumerator list the construct shall not be used to explicitly initialize members other than the first unless all items are explicitly initialized 9 8 MISRA C Rules Arithmetic type conversions 10 1 10 2 10 3 10 4 10 5 R The value of an expression of integer type shall not be implicitly converted to a different underlying type if a it is not a conversion to a wider integer type of the same signedness or b the expression is complex or c the expression is not constant and is a function argument or d the expression is not constant and is a return expression The value of an expression of floating type shall not be implicitly converted to a different type if a it is not a conversion to a wider floating type or b the expression is complex or c the expression is a function argument or d the expression is a return expression The value of a complex expression of integer type may only be cast to a type that is narrower and of the same signedness as the underlying type of the expression The value of a complex expression of floating type may only be cast to a narrower floating type If the bitwise operators and lt lt are applied to an operand of underlying type unsigned char or unsigned short the re
187. he derivative you want to connect it to 8 31 ARM Embedded Tools Reference 8 8 Semantics of the Section Setup Definition Keywords in the section setup definition section_setup vector _ table vector_size size id_symbol_ prefix run_addr template template symbol vector prefix fill no_inline vector id 111 loop 8 8 1 Setting up a Vector Table With the keyword section_setup you can define vector tables outside their address space definition section_setup my_space vector table statements See the subsection Vector table in section 8 5 3 Defining Address Spaces for details on the vector_table keyword 8 32 Linker Script Language 8 9 Semantics of the Section Layout Definition Keywords in the section layout definition section_layout direction group align attributes firl ordered contiguous clustered overlay low_to_high high_to_low YT wx bis allow_cross_ references load_addr mem run_addr mem page page _size select stack size heap size reserved size attributes 211 rwx alloc_allowed absolute copytable section if size blocksize attributes 211 overflow else rwx 8 33 ARM Embedded Tools Reference 8 9 1 Defining a Section Layout With the keyword section_layout you define a section layout for exactly one address space In the section layout you can specify how input sections are placed in the address space r
188. he following gcc languages extensions e The identifier _FUNCTION_ expands to the current function name e Alternative syntax for variadic macros e Alternative syntax for designated initializers e Allow zero sized arrays e Allow empty struct union 5 4 Tool Options Compiler Allow empty initializer list Allow initialization of static objects by compound literals The middle operand of a operator may be omitted Allow a compound statement inside braces as expression Allow arithmetic on void pointers and function pointers Allow a range of values after a single case label Additional preprocessor directive warning Allow comma operator conditional operator and cast as Ivalue An inline function without static or extern will be global An extern inline function will not be compiled on its own For an exact description of these gcc extensions please refer to the gcc info pages info gcc Example carm AGPx c90 test c carm language ggc comments strings iso 90 test c d gt Compiler option c ISO C standard 5 5 ARM Embedded Tools Reference Compiler align composites Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Code Generation 3 Select the Alignment of composite types natural or optimal Command line syntax align composites alignment You can specify the following align
189. his option you tell the control program not to specify the standard C libraries and run time library to the linker In this case you must specify the libraries you want to link to the linker with the option ibrary_name The control program recognizes the option I as an option for the linker and passes it as such Example ccarm no default libraries test c The control program does not specify any libraries to the linker In normal cases this would result in unresoved externals To specify your own libraries libmy a and avoid unresolved externals ccarm no default libraries lmy test c Related information d Linker option I library Add library 5 151 ARM Embedded Tools Reference Control Program no map file Command line syntax no map file Description By default the control program tells the linker to generate a linker map file A linker map file is a text file that shows how the linker has mapped the sections and symbols from the various object files obj to the linked object file A locate part shows the absolute position of each section External symbols are listed per space with their absolute address both sorted on symbol and sorted on address With this option you prevent the generation of a map file Related information f 5 152 Tool Options Control Program Control Program o output Command line syntax 0 file output file Description By def
190. hitecture definition and memory parts where to locate the section 8 9 2 Creating and Locating Groups of Sections Sections are located per group A group can contain one or more sets of input sections as well as other groups Per group you can assign a mutual order to the sets of sections and locate them into a specific memory part group group specifications section_statements With the section_statements you generally select sets of sections to form the group This is described in subsection Selecting sections for a group Instead of selecting sections you can also modify special sections like stack and heap or create a reserved section This is described in section 8 9 3 Creating or Modifying Special Sections 8 34 Linker Script Language With the group_specifications you actually locate the sections in the group This is described in subsection Locating a group Selecting sections for a group With the select keyword you can select one or more sections for the group You can select a section by name or by attributes If you select a section by name you can use a wildcard pattern me matches with all section names 2 matches with a single character in the section name a takes the next character literally abc matches with a single a b or c character a z matches with any single character in the range a to 2 group select mysection select
191. hm of 1 x x lt gt 1 Not implemented log2 log2 1log21 log2 Returns the base 2 logarithm of x x gt 0 Not implemented ilogb ilogbf ilogbl ilogb Returns the signed exponent of x as an integer x gt 0 Not implemented logb logb logbl logb Returns the exponent of x as a signed integer in value in 2 8 floating point notation x gt 0 Not implemented Libraries Rounding functions Math h Tgmath h Description ceil ceilf ceill ceil Returns the smallest integer not less than x as a double floor floorf floorl floor Returns the largest integer not greater than x asa double rint rintl rintf rint Returns the rounded integer value as an int accord ing to the current rounding direction See fenv h Not implemented lrint Ilrintf lrintl lrint Returns the rounded integer value as a long int according to the current rounding direction See fenv h Not implemented llrint lrintf lrintl llrint Returns the rounded integer value as a Long long int according to the current rounding direction See fenv h Not implemented nearbyint nearbyintf nearbyint Returns the rounded integer value as a floating point nearbyintl according to the current rounding direction See fenv h Not implemented round roundl roundf round Returns the nearest integer value of x as int Not implemented lround lroundl lroundf lround Returns the nearest integer value of x as long int Not implemented llround1llroundlllroundf llrou
192. ialized sections scratch sections blanked cleared sections one ke EK group_load_address load_addr lt load_or_run_addr gt group page page lt expr gt 9 1 page_size expr lt range lt range gt gt 9 gt 0 1 group_run address run_addr lt load or run addr gt 1 group_type clustered contiguous ordered overlay e For non contiguous groups you can only specify group_alignment and attributes 8 15 ARM Embedded Tools Reference e The overlay keyword also sets the contiguous property e The clustered property cannot be set together with contiguous or ordered on a single group load_or_run_addr addr_absolute addr_range lt addr_range gt addr_absolute 2 expr memory reference expr e An absolute address can only be set on ordered groups addr_range expr expr memory_reference memory reference expr expr e The parent of a group with an addr_range or page restriction cannot be ordered contiguous or clustered memory reference mem lt proc_name gt 1 lt core name gt 0 1 mem_name e Aproc_name refers to a defined processor e Acore_name refers to a defined core e Amem_name refers to a defined memory if_statement if expr section_statement lt else section _statement gt 1 section_creation_statement section section_name section_specs lt section_statement2 gt gt section_specs sect
193. ibraries Contains overviews of all library functions you can use in your C source First libraries are listed per header file that contains the prototypes These tables also show the level of implementation per function Second all library functions are listed and discussed into detail Chapter 3 Assembly Language Contains an overview of all assembly functions and directives that you can use in your assembly source code Chapter 5 Tool Options Contains a description of all tool options e Compiler options e Assembler options e Linker options e Control program options e Make utility options e Librarian options Chapter 6 List File Formats Contains a description of the following list file formats e Assembler List File Format e Linker Map File Format Chapter 7 Object File Formats Contains a description of the following object file formats e ELF DWARF 2 Object Format e Motorola S Record Format e Intel Hex Record Format viii Manual Purpose and Structure Chapter 8 Linker Script Language Contains a description of the linker script language LSL Chapter 9 MISRA C Rules Contains a description the supported and unsupported MISRA C code checking rules ARM Embedded Tools Reference Conventions Used in this Manual Notation for syntax The following notation is used to describe the syntax of command line input bold Type this part of the syntax literally italics Substitute the italic word by an ins
194. icle Based Software MIRA limited 1998 See also http www misra org uk e MISRA C 2004 Guidelines for the use of the C Language in critical systems MIRA limited 2004 See also http www misra c com TASKING Tools e Using the ARM Embedded Tools Altium MA101 024 00 00 e ARM CrossView Pro Debugger User s Manual Altium MA101 043 00 00 ARM e ARM Architecture Reference Manual second edition 2000 ARM Limited xii 1 C Language Summary This chapter contains a complete overview of the C language extensions of the TASKING C compiler 1 1 Introduction The TASKING C compiler fully supports the ISO C standard but adds possibilities to program the special functions of the ARM This chapter contains complete overviews of the following C language extensions of the TASKING C compiler e Data types e Keywords Function qualifiers e Register usage e Intrinsic functions e Pragmas e Predefined macros 1 1 ARM Embedded Tools Reference 1 2 Data Types Size Align ret Type C Type bit bit Limits Boolean _Bool 8 8 Oori h t h nec ie 8 8 27 27 1 signed char unsigned char 8 8 0 28 1 Int hort negra B 16 16 215 215 4 signed short unsigned short 16 16 o 216 1 enum 32 32 231 2314 int ee 32 32 231 231 1 long signed long DA 32 32 0 232 4 unsigned long A 64 64 263 963_ signed long long unsigned long long 64 64 o 264
195. ield select a level between fully optimize for size or fully optimize for speed Command line syntax Offiags optimize flags Use the following options for predefined sets of flags O0 optimize 0 No optimization Alias for OABCEFGIKLOPSUWY 01 optimize 1 Few optimizations suitable for debugging Alias for OabcefgIKLOPSUWy 02 optimize 2 Medium optimization default Alias for OabcefglklopsUwy 03 optimize 3 Full optimization Alias for Oabcefgiklopsuwy You can enable the following individual optimizations 5 33 ARM Embedded Tools Reference a A coalesce Coalescer remove unnecessary moves b B ipro Interprocedural Register Optimization c C cse Common subexpression elimination CSE e E expression Expression simplification f F flow Control flow simplification optimization and code reordering g G glo Generic assembly code optimizations il inline Function inlining k K_ schedule Instruction scheduler IL loop Loop transformations 0 O forward Forward store p P propagate Constant propagation s S subscript Subscript strength reduction u U unroll Unroll small loops w W pipeline Software pipelining y Y peephole Peephole optimizations For an extensive description of these optimizations please refer to section 5 3 Compiler Optimizations in chapter Using the Compiler of the user s manual Description The
196. ifferent characters N Disabling the option Assemble case sensitive in EDE is the same as specifying the option c on the command line Assembly source files that are generated by the compiler must always be assembled case sensitive When you are writing your own assembly code you may want to specify the case insensitive mode Example When assembling case insensitive the label LabelName is the same label as labelname Related information dh 5 56 Tool Options Assembler Assembler check Menu entry 1 Inthe Project window select the file you want to check 2 From the Build menu select Check Syntax Command line syntax check Description With this option you can check the source code for syntax errors without generating code This saves time in developing your application The assembler reports any warnings and or errors Related information Gb Compiler option check Check syntax 5 57 ARM Embedded Tools Reference Assembler D define Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Preprocessing 3 Click on an empty Macro field and enter a macro name Then click outside the cell to confirm 4 Optionally click in the Definition field and enter a definition Then click outside the cell to confirm Command line syntax Dmacro_name macro_definition define macro_name
197. inker Example To generate block count information for the module test c during execution compile as follows ccarm pb test c ccarm profile block test c In this case the library pbarm lib is linked Related information d Chapter 6 Profiling in the user s manual 5 155 ARM Embedded Tools Reference Control Program static Command line syntax static Description This option is directly passed to the compiler With this option the compiler treats external definitions at file scope except for main as if they were declared static As a result unused functions will be eliminated and the alias checking algorithm assumes that objects with static storage cannot be referenced from functions outside the current module This option only makes sense when you specify all modules of an application on the command line Example ccarm static modulel c module2 c module3 c Related information f 5 156 Tool Options Control Program Control Program t keep temporary files Menu Entry 1 From the Build menu select Options The Build Options dialog box appears 2 Enable the option Keep temporary files that are generated during a build Command line syntax t keep temporary files Description By default the control program removes intermediate files like the src file result of the compiler phase and the obj file result of the assembler phase With this option y
198. interrupts enabled __APPLICATION_MODE Contains the processor mode and the IRQ FIQ interrupts mode __PIC_VECTORS Defined if position independent vectors are used __FIQ_HANDLER_INLINE Defined if you do not generate reserve the FIQ vector VECTOR_TABLE_ROM_ADDR ROM address of the vector table 4 6 Run time Environment Define Description VECTOR_TABLE RAM SPACE Defined if space must be reserved for a copy of the vector table in RAM VECTOR_TABLE RAM ADDR RAM address of the copy of the vector table VECTOR_TABLE RAM COPY Defined if the linker should copy the vector table to RAM Table 4 4 Defines used in arm lsl 4 3 Stack and Heap The stack is used for local automatic variables and function parameters The following diagram shows the structure of a stack frame high memory stack grows down low memory incoming parameters saved registers local variables outgoing parameters lt sp on entry lt sp Figure 4 1 Stack diagram during execution The ARM hardware has separate stack pointers for each processor mode These stack pointers should be initialized at run time This is taken care of by the startup code in the run time library by means of linker generated symbols defined in the LSL file See section 4 1 Startup Code for a list of these symbols You can define the values of these symbols in EDE as follows 1
199. ion tsk2 data size 4k attributes rw f1i11 0 overflow overflow_data select data tsk2 section overflow data size 4k attributes rx i11 0 With the keyword blocksize the size of the output section will adapt to the size of its content For example group flash_area run_addr 0x10000 section flash_code blocksize 4k attributes rx fill 0 select flash If the content of the section is 1 mau the size will be 4k if the content is 11k the section will be 12k etc If you use size in combination with blocksize the size value is used as default minimal size for this section If it is omitted the default size will be of blocksize It is not allowed to omit both size and blocksize from the section definition The linker creates two labels to mark the begin and end of the section _1c_ub_name for the start and _1c_ue_name for the end of the output section Copy table The keyword copytable tells the linker to select a section that is used as copy table The content of the copy table is created by the linker It contains the start address and length of all sections that should be initialized by the startup code The linker creates two labels to mark the begin and end of the section 1c _ub_table for the start and _1c_ue_tabl1e for the end of the copy table The linker generates a copy table when a reference to either of the section labels exists in one of the input obj
200. ion _spec lt section_spec gt 0 attributes section_spec fill_spec size expr blocksize expr overflow section_name section_statement2 select_section_statement group_descr2 lt section_statement2 gt gt group_descr2 group lt group_name gt 9 1 group_specs2 section_statement2 group_specs2 group _spec2 lt group_spec2 gt gt 0 group_spec2 group_alignment attributes load_addr Linker Script Language section_setup section_setup space_ref lt section_setup_item gt gt section_setup_item vector_table_statement 8 4 Expression Evaluation Only constant expressions are allowed including sizes but not addresses of sections in object files All expressions are evaluated with 64 bit precision integer arithmetic The result of an expression can be absolute or relocatable A symbol you assign is created as an absolute symbol 8 17 ARM Embedded Tools Reference 8 5 Semantics of the Architecture Definition Keywords in the architecture definition architecture extends endianness big little bus mau width map space id mau align page_size page direction low_to_high high_to_low stack min_size grows low_to_high high _to_low align fixed heap min_size grows low_to_high high _to_low align fixed copytable align copy_unit dest page vector table vector size size id_symbol_ prefix run_addr template template_symbol vector_prefix fill no_in
201. ions Control Program Control Program W pass Command line syntax Wcoption pass c option Pass option directly to the C compiler Waoption pass assembler option Pass option directly to the assembler Wloption pass linker option Pass option directly to the linker Description With this option you tell the control program to call a tool with the specified option The control program does not use or interpret the option itself but specifies it directly to the tool which it calls Related information f 5 161 ARM Embedded Tools Reference Control Program w no warnings Command line syntax w nr no warnings n Description With this option you can suppress all warning messages or specific C compiler warning messages e f you do not specify this option all warnings are reported e f you specify this option but without numbers all warnings are suppressed e f you specify this option with a number only the specified warning is suppressed You can specify the option w multiple times Related information i 5 162 Tool Options Control Program Control Program warnings as errors Command line syntax warnings as errors Description With this option you tell the control program to treat warnings as errors If one of the tools encounters an error it stops processing the file s With this option the tools treat warnings as errors and therefor will continue processin
202. iption With the ALIGN directive you tell the assembler to align the location counter When the assembler encounters the ALIGN directive it moves the location counter forwards to an address that is aligned as specified by expression and places the next instruction or directive on that address The alignment is in minimal addressable units MAUs The assembler fills the gap with NOP instructions If the location counter is already aligned on the specified alignment it remains unchanged The location of absolute sections will not be changed The expression must be a power of two 2 4 8 16 If you specify another value the assembler changes the alignment to the next higher power of two and issues a warning Examples SECTION text ALIGN 16 the assembler aligns instruction this instruction at 16 MAUs and fills the gap with NOP instructions SECTION text ALIGN 12 WRONG not a power of two the instruction assembler aligns this instruction at 16 MAUs and issues a warning 3 9 ARM Embedded Tools Reference BREAK Syntax BREAK Description The BREAK directive causes immediate termination of a macro expansion a FOR loop exansion or a REPEAT loop expansion In case of nested loops or macros the BREAK directive returns to the previous level of expansion The BREAK directive is for example useful in combination with the IF directive to terminate expansion when error conditions
203. is option the basename of the C source file is used with extension src Example To create the file output src instead of test src enter carm o output srce test c carm output output sre test c Related information i 5 36 Tool Options Compiler Compiler p profile Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Profiling 3 Enable one or more of the following options to select which profiles should be obtained e Block counters not in combination with with Call graph or Function timers e Call graph e Function counters e Function timers AN Note that the more detailled information you request the larger the overhead in terms of execution time code size and heap space needed The option Generate Debug information g or debug does not affect profiling execution time or code size Command line syntax piflags profile flags Use the following option for a predefined set of flags pg profile g profiling with call graph and function timers Alias for pBcFt You can set the following flags when you specify p without flags the default is pBCfT b B block block counters c C callgraph call graph f F function function counters t T time function timers Description Profiling is the process of collecting statistical data about a running application With thes
204. ith the macro WCHAR_SUPPORT_ENABLED and keep this macro also defined when compiling your own sources See compiler option D define in section 5 1 Compiler Options in Chapter 5 Tool options 2 2 1 assert h assert expr Prints a diagnostic message if NDEBUG is not defined Implemented as macro 2 2 2 complex h The ARM does not support complex numbers 2 2 3 ctype h and wctype h The header file ct ype h declares the following functions which take a character c as an integer type argument The header file wctype h declares parallel wide character functions which take a character c of the wchar_t type as argument Ctype h Wctype h Description isalnum iswalnum Returns a non zero value when c is an alphabetic character or a number A Z a z 0 9 isalpha iswalpha Returns a non zero value when c is an alphabetic character A Z a z isblank iswblank Returns a non zero value when c is a blank character tab space isentrl iswentrl Returns a non zero value when c is a control character isdigit iswditit Returns a non zero value when c is a numeric character O 9 isgraph iswgraph Returns a non zero value when c is printable but not a space islower iswlower Returns a non zero value when c is a lowercase character a z isprint iswprint Returns a non zero value when c is printable including spaces ispunct iswpunct Returns a non zero value when c is a punctuation character such as P isspace i
205. ject menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select List File 3 Enable Generate list file 4 Inthe List file format section enable or disable the types of information to be included Command line syntax Liflags list format flags You can set the following flags 0 Same as LDEGIMNPQRSVWXYZ all options disabled 1 Same as Ldegimnpqrsvwxyz all options enabled d D section Section directives SECTION e E symbol Symbol definition directives g G generic expansion Generic instruction expansion i l generic Generic instructions m M macro Macro dup definitions e g MACRO n N empty line Empty source lines newline p P conditional Conditional assembly IF ELSE ENDIF q Q equate Assembler EQU and SET directives r R relocations Relocation characters r s S hll HLL symbolic debug information SYMB v V equate values Assembler EQU and SET values w W wrap lines Wrapped source lines x X macro expansion Macro expansions y Y cycle count Cycle counts z Z macro expansion Define expansions Default LdEGiMnPqrsVWXyZ Description With this option you specify which information you want to include in the list file aN On the command line you must use this option in combination with the option I list file 5 72 Tool Options Assembler Related inf
206. ke all target files precious This means that dependency files are never removed Example mkarm p The make utility never removes target dependency files Related information d 5 181 ARM Embedded Tools Reference Make Utility q Command line syntax q Description With this option the make utility does not perform any tasks but only returns an exit code A zero status indicates that all target files are up to date a non zero status indicates that some or all target files are out of date Example mkarm q The make utility only returns an exit code that indicates whether all target files are up to date or not It does not rebuild any files Related information f 5 182 Tool Options Make Utility Make Utility r Command line syntax f Description When you call the make utility it first reads the implicit rules from the file mkarm mk then it reads the makefile with the rules to build your files The file mkarm mk is located in the etc directory of the toolchain With this option you tell the make utility not to read mkarm mk and to rely fully on the make rules in the makefile Example mkarm r The make utility does not read the implicit make rules in mkarm mk Related information J 5 183 ARM Embedded Tools Reference Make Utility S Command line syntax S Description With this option you cancel the effect of the option k This is only necessary in a recursive m
207. l The function prototype of the declaration shall match the definition Identifiers shall be given for all prototype parameters or for none Parameter identifiers shall be identical for declaration definition Every function shall have an explicit return type Functions with no parameters shall have a void parameter list An actual parameter type shall be compatible with the prototype The number of actual parameters shall match the prototype The values returned by void functions shall not be used Void expressions shall not be passed as function parameters const should be used for reference parameters not modified A function should have a single point of exit Every exit point shall have a return of the declared return type For void functions return shall not have an expression Function calls with no parameters should have empty parentheses If a function returns error information it should be tested A violation is reported when the return value of a function is ignored include shall only be preceded by other directives or comments Non standard characters shall not occur in include directives include shall be followed by either lt filename gt or filename Plain macros shall only be used for constants qualifiers specifiers Macros shall not be define d and undefd within a block undef should not be used A function should be used in preference to a function like macro A function like macro shall not be used
208. le a non zero value is returned that can be used as an argument in the towctrans function Transforms wide character wc into another wide character described by desc Function Equivalent to locale specific transformation towlower wc towctrans wc wctrans tolower towupper wc towctrans wc wctrans toupper 2 33 ARM Embedded Tools Reference 2 34 3 Assembly Language Summary This chapter contains a detailed description of all built in assembly functions and assembler directives For a description of the assembly instruction set refer to the core reference manual of the relevant target 3 1 Built in Assembly Functions 3 1 1 Overview of Built in Assembly Functions The following table provides an overview of all built in assembly functions Next all functions are described into more detail expr can be any assembly expression resulting in an integer value Expressions are explained in section 4 6 Assembly Expressions in the user s manual Overview of assembly functions Function Description ALUPCREL expr group check PC relative ADD SUB with operand split ARG symbol expr Test whether macro argument is present BIGENDIAN Test if assembler generates code for big endian mode CNT Return number of macro arguments cpu string Test if current CPU matches string DEFINED symbol symbol Test whether symbol exists LSB expr Least significant byte of the expression
209. ler does not generate any debug information Description With this option you tell the assembler which kind of debug information to emit in the object file Related information 5 67 ARM Embedded Tools Reference Assembler H include file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Preprocessing 3 Enter the name of the file in the Include this file before source field or click the Browse button and select a file Command line syntax Hfile include file file Description With this option set at project level you include one extra file at the beginning of the assembly source file The specified include file is included before all other includes This is the same as specifying INCLUDE file at the beginning of your assembly source Example asarm Hmyinc inc testl src asarm include file myinc inc testl src The file myinc inc is included at the beginning of test 1 src before it is assembled Related information Gb Assembler option I Include files path Section 7 5 How the Assembler Searches Include Files in chapter Using the Assembler of the user s manual 5 68 Tool Options Assembler Assembler I include directory Menu entry 1 From the Project menu select Directories The Directories dialog box appears 2 Adda pathname in the Include
210. less than 1 kB By default the assembler will place a literal pool at the end of each code section If the default literal pool is out of range you will have to ensure that there is another literal pool within range by means of the LTORG directive 3 48 Assembly Language NOP Thumb generic No operation Instruction Replacement NOP MOV R8 R8 MOV low to low Thumb generic The hardware MOV instruction only supports moves between two high registers r8 r15 or between a high register and a low register rO r7 The MOV pseudo instruction supports a move between two low registers Instruction Replacement Description MOV Rd Rn ADD Rd Rn 0 If both registers are low Bcond inversion Thumb generic The PC relative conditional branch instruction has a range of 256 255 bytes The unconditional version has a range of 2048 2047 bytes If the conditional branch target is out of range the assembler will rewrite the conditional branch instruction with an inversed conditional branch and an unconditional branch Instruction Replacement Description Bcond label Binv_cond 1 B label If target abe out of range 3 49 ARM Embedded Tools Reference 3 50 4 Run time Environment Summary This chapter describes the startup code used by the TASKING ARM C Compiler the vector table the stack layout and the heap 4 1 Startu
211. line vector id fill loop Linker Script Language start_address run_addr symbol map map dest bus space dest_dbits dest_offset size src_dbits sro offset 8 5 1 Defining an Architecture With the keyword architecture you define an architecture and assign a unique name to it The name is used to refer to it at other places in the LSL file architecture name definitions If you are defining multiple core architectures that show great resemblance you can define the common features in a parent core architecture and extend this with a child core architecture that contains specific features The child inherits all features of the parent With the keyword extends you create a child core architecture architecture name_child_arch extends name_parent_arch definitions A core architecture can have any number of parameters These are identifiers which get values assigned on instantiation or extension of the architecture You can use them in any expression within the core architecture Parameters can have default values which are used when the core architecture is instantiated with less arguments than there are parameters defined for it When you extend a core architecture you can pass arguments to the parent architecture Arguments are expressions that set the value of the parameters of the sub architecture architecture name_child_arch parm1 parm2 1 extends name_parent_arch arguments definitions 8 19 ARM
212. locate the sections in the group in a number of contiguous blocks It tries to keep the number of these blocks to a minimum If enough memory is available the group will be located as if it was specified as contiguous Otherwise it gets split into two or more blocks If a contiguous or clustered group contains alignment gaps the linker can locate sections that are not part of the group in these gaps To prevent this you can use the i11 keyword If the group is located in RAM the gaps are treated as reserved scratch space If the group is located in ROM the alignment gaps are filled with zeros by default You can however change the fill pattern by specifying a bit pattern The result of the expression or list of expressions is used as values to write to memory each in MAU e The overlay keyword tells the linker to overlay the sections in the group The linker places all sections in the address space using a contiguous range of addresses Thus an overlay group is automatically also a contiguous group To overlay the sections all sections in the overlay group share the same run time address For each input section within the overlay the linker automatically defines two symbols The symbol _1c_cb_section_name is defined as the load time start address of the section The symbol _1e_ce_section_name is defined as the load time end address of the section C or assembly code may be used to copy the overlaid sections If sections in the overl
213. log box appears 2 Expand the Linker entry and select Miscellaneous 3 Disable the option Include symbolic debug information Command line syntax S strip debug Description With this option you specify not to include symbolic debug information in the resulting output file Related information d 5 121 ARM Embedded Tools Reference Linker V version Menu entry Command line syntax V version Description Display version information The linker ignores all other options or input files Related information J 5 122 Tool Options Linker Linker v vv verbose extra verbose Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Enable the option Print the name of each file as it is processed The verbose output is displayed in the Build tab of the Output window Command line syntax v vv verbose extra verbose Description With this option you put the linker in verbose mode The linker prints the link phases while it processes the files In the extra verbose mode the linker also prints the filenames and it shows which objects are extracted from libraries With this option you can monitor the current status of the linker Related information J 5 123 ARM Embedded Tools Reference Linker w no warnings Menu entry 1 From the
214. looks in the directory that is set with the environment variable LIBARM Then the linker looks in the default directory PRODDIR carm 1ib for libraries Related information db Linker option l Link system library 5 147 ARM Embedded Tools Reference Control Program l library Command line syntax Iname library name Description With this option you tell the linker via the control program to use system library name Lib where name is a string The linker first searches for system libraries in any directories specified with Lpath then in the directories specified with the environment variable LIBARM unless you used the option L without a directory Example To search in the system library carm 1ib C library ccarm test obj mylib lib lcarm ccarm test obj mylib lib library carm The linker links the file test obj and first looks in mylib 1ib in the current directory only then in the system library carm 1ib to resolve unresolved symbols Related information db Linker option L Additional search path for system libraries Section 8 4 Linking with Libraries in chapter Using the Linker of the user s manual 5 148 Tool Options Control Program Control Program list files Command line syntax list files name Description With this option you tell the assembler via the control programma to generate a list file for each specified input file A list file shows
215. low define bool _Bool define true 1 define false 0 define bool true false are defined 1 2 2 18 stddef h This header file defines the types for common use ptrdiff _t signed integer type of the result of subtracting two pointers size_t unsigned integral type of the result of the sizeof operator wchar_t integer type to represent character codes in large character sets Besides these types the following macros are defined NULL expands to the null pointer constant offsetof _type _member expands to an integer constant expression with type size_t that is the offset in bytes of _member within structure type _type 2 2 19 stdint h lb See Section 2 2 9 inttypes h and stdint h 2 2 20 stdio h and wchar h Types The header file stdio h contains for performing input and output A number of also have a parallel wide character function or macro defined in wchar h The header file wchar h also stdio h In the C language many I O facilities are based on the concept of streams The stdio h header file defines the data type FILE which holds the information about a stream An FILE object is created with the function fopen The pointer to this object is used as an argument in many of the in this header file The FILE object can contain the following information e the current position within the stream e pointers to any associated buffers e indications of for read write errors e end of file indication The header file also de
216. lumn is the number of instruction cycles needed to execute the instruction s as generated in the CODE field The second number is the accumulated cycle count of this section This column contains the line number This is a decimal number indicating each input line starting from 1 and incrementing with each source line This column contains the source text This is a copy of the source line from the assembly source file aN For the SET and EQU directives the ADDR and CODE columns do not apply The symbol value is listed instead Related information See section 7 6 Generating a List File in Chapter Using the Assembler of the user s manual for more information on how to generate a list file and specify the amount of list file information 6 2 List File Formats 6 2 Linker Map File Format The linker map file is an additional output file of the linker that shows how the linker has mapped the sections and symbols from the various object files obj to output sections The locate part shows the absolute position of each section External symbols are listed per space with their absolute address both sorted on symbol and sorted on address With the linker option m map file formatting you can specify which parts of the map file you want to see Example part of linker map file FEI IIIS kk kkk kkk kkk Drocessed Files 4 KA kk ki kk kk k k k i A k A kK KK
217. macro_definition define macro_name macro_definition Description With this option you can define a macro and specify it to the preprocessor If you only specify a macro name no macro definition the macro expands as 1 You can specify as many macros as you like On the command line you can use the option D multiple times If the command line exceeds the length limit of the operating system you can define the macros in an option file which you then must specify to the compiler with the option f file Defining macros with this option instead of in the C source is for example useful to compile conditional C source as shown in the example below Example Consider the following C program with conditional code to compile a demo program and a real program void main void if DEMO demo_func compile for the demo program else real_func compile for the real program endif You can now use a macro definition to set the DEMO flag Macro Value DEMO 1 or empty 5 12 Tool Options Compiler On the command line use the option D as follows carm DDEMO test c carm DDEMO 1 test c carm define DEMO test c carm define DEMO 1 test c Note that all four invocations have the same effect The next example shows how to specify a macro with arguments Macro definitions follow exactly the same rules as the define statement in the C language Macro Value MAX A B A gt B A
218. makefile and other files are stored With the option G you can call the make utility from within another directory The path is the path to the directory where your makefile and other files are stored and can be absolute or relative to your current directory Example Suppose your makefile and other files are stored in the directory myfiles You can call the make utility for example as follows mkarm G myfiles Related information f 5 174 Tool Options Make Utility Make Utility i Command line syntax i Description When an error occurs during the make process the make utility exits with a certain exit code With the option i the make utility exits without an error code even when errors occurred Example mkarm i The make utility exits without an error code even when an error occurs Related information J 5 175 ARM Embedded Tools Reference Make Utility K Command line syntax K Description With this option the make utility keeps temporary files it creates during the make process The make utility stores temporary files in the directory that you have specified with the environment variable TMPDIR or in the default temp directory of your system when the TMPDIR environment variable is not specified Example mkarm K The make utility preserves all temporary files Related information f 5 176 Tool Options Make Utility Make Utility k Command line
219. matically from ROM to RAM but only if position independent vectors are used e In EDE in the Startup Vectors page enable the option Reserve space for copy in RAM and fill in the RAM address Optionally enable the option Copy vector table to RAM Refer to the run time library implementation of the init _vector_table routine in lib src initvectortable asmor initvectortable_thumb asm for more information Processor mode In EDE you can define the processor mode in which the processor should run when your application s main program is called together with the interrupt status FIQ interrupts enabled disabled IRQ interrupts enabled disabled Based on these settings the linker will generate a symbol _APPLICATION_MODE_ which value is used in the startup code in the run time library to set the value of the CPSR status register before calling your main function e In EDE in the Startup Vectors page select the Main application execution mode Optionally enable or disable the options Enabled IRQ interrupts and Enable FIQ interrupts Preprocessor macros in arm IsI The options you select in EDE result in preprocessor macros that are used in the LSL file Instead of using EDE you can also define the macros by using the linker option define Define Description __ START Reset handler ROM address __PROCESSOR_MODE Main application execution mode __IRQ BIT Is 0 if IRQ interrupts enabled _ FIQ BIT Is 0 if FIQ
220. mbler prints the filenames and the assembly passes while it processes the files so you can monitor the current status of the assembler Related information de 5 82 Tool Options Assembler Assembler w no warnings Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Diagnostics 3 Select one of the following options e Report all warnings e Suppress all warnings e Suppress specific warnings If you select Suppress specific warnings 4 Enter the numbers separated by commas of the warnings you want to suppress Command line syntax w nr no warnings nr Description With this option you can suppresses all warning messages or specific warning messages e If you do not specify this option all warnings are reported e If you specify this option but without numbers all warnings are suppressed e If you specify this option with a number only the specified warning is suppressed You can specify the option w multiple times Example To suppress warnings 135 and 136 enter 135 136 in the Suppress specific warnings field or enter the following on the command line asarm test sre w135 w136 asarm test srce no warnings 135 no warnings 136 Related information d Assembler option warnings as errors Treat warnings as errors 5 83 ARM Embedded Tools Reference Assembler warnings as err
221. me no macro definition the macro expands as 1 You can specify as many macros as you like just use the option D multiple times If the command line exceeds the limit of the operating system you can define the macros in an option file which you then must specify to the linker with the option ffile The definition can be tested by the preprocessor with if ifdef and ifndef for conditional locating Example To define the stack size and start address which are used in the linker script file arm 1s1 enter lkarm test obj otest abs darm 1sl D__STACK 32k D__START 0x00000000 or using the long option names lkarm otest abs lsl file arm 1sl define _ STACK 32k define __ START 0x00000000 Related information Gs Linker option f Read options from file 5 92 Tool Options Linker Linker d IsI file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Script File 3 Enable one of the options Default Linker Script File Generated Linker Script File based on EDE settings or User defined Linker Script File 4 If you selected User defined Linker Script File type a name or click the Browse button and select an LSL file Command line syntax dfile IsI file file Description A linker script file contains vital information about the core for the locating phase of the linker A linker script
222. ment that ignores all floating point exceptions fesetenv Restores a previously saved fegetenv or feholdexcept floating point environ ment feupdateenv Saves the currently raised floating point exceptions restores a previousely saved floating point environment and finally raises the saved exceptions feclearexcept Clears the current exception status flags corresponding to the flags specified in the argument fegetexceptflag Stores the current setting of the floating point status flags feraiseexcept Raises the exceptions represented in the argument As a result other excep tions may be raised as well fesetexceptflag Sets the current floating point status flags fetestexcept Returns the bitwise OR of the exception macros corresponding to the excep tion flags which are currently set and are specified in the argument For each supported exception a macro is defined The following exceptions are defined 2 4 Libraries FE_DIVBYZERO FE_INEXACT FE INVALID FE_OVERFLOW FE_UNDERFLOW FE ALL EXCEPT fegetround Returns the current rounding direction represented as one of the values of the rounding direction macros fesetround Sets the current rounding directions Currently no rounding mode macros are implemented 2 2 7 float h The header file float h defines the characteristics of the real floating point types float double and long double CAN Float h used to contain prototypes for the functions copysign f isinf f
223. ments o Optimal alignment n Natural alignment default Description With this option you can set the alignment for composite types structs unions and arrays Optimal alignment 0 sets the alignment to 8 16 or 32 bits depending on the size of the composite type Natural alignment n uses the natural alignment of the most aligned member of the composite type Related information p 5 6 Tool Options Compiler Compiler B big endian Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Select Processor Definition 3 Enable the option Big endian mode Command line syntax B big endian Description By default the compiler generates code for a little endian target least significant byte of a word at lowest byte address With this option enabled the compiler to generate code for a big endian target most significant byte of a word at lowest byte address Related information f 5 7 ARM Embedded Tools Reference Compiler C cpu Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Select Processor Definition 3 Select a processor from the Target processor box If you select Other select an Architecture Command line syntax C ARMv4 ARMv4T ARMv5 ARMv5T ARMv5TE XS cpu ARMv4 ARMv4T ARMv5 ARMv5T ARMV5TE XS Description With this option you specify
224. n choose which C source lines must be listed as comments in assembly output Gls See also compiler option s source tradeoff level Specify tradeoff between speed 0 and size 4 db See also compiler option t tradeoff warning number With this pragma you can disable warning messages If you do not specify a warning number all warnings will be suppressed d gt See also compiler option w no warnings C Language weak symbol Mark a symbol as weak weak assembler directive The symbol must have external linkage which means a global or external object or function A static symbol cannot be declared weak A weak external reference is resolved by the linker when a global or weak definition is found in one of the object files However a weak reference will not cause the extraction of a module from a library to resolve the reference When a weak external reference cannot be resolved the null pointer is substituted A weak definition can be overruled by a normal global definition The linker will not complain about the duplicate definition and ignore the weak definition See assembler directive WEAK in Section 3 2 Assembler Directives in Chapter Assembly Language 1 13 ARM Embedded Tools Reference 1 7 Predefined Macros In addition to the predefined macros required by the ISO C standard such as DATE ___ and __FILE__ the TASKING C compiler supports the predefined macros as defin
225. n the command line this option works as follows e If you do not specify this option all warnings are reported e f you specify this option but without numbers all warnings are suppressed e If you specify this option with a number only the specified warning is suppressed You can specify the option w multiple times Example To suppress warnings 135 and 136 enter 135 136 in the Suppress specific warnings field or enter the following on the command line carm test c w135 w136 carm test c no warnings 135 no warnings 136 Related information d gt Compiler option warnings as errors Treat warnings as errors 5 50 Tool Options Compiler Compiler warnings as errors Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Diagnostics 3 Enable the option Treat warnings as errors Command line syntax warnings as errors Description If the compiler encounters an error it stops compiling With this option you tell the compiler to treat warnings as errors As a consequence the compiler now also stops after encountering a warning Related information Gb Compiler option w Suppress some or all warnings 5 51 ARM Embedded Tools Reference 5 2 Assembler Options EDE uses a makefile to build your entire project This means that in EDE you cannot run the assembler separately If you want assembly result
226. n the default directory PRODDIR carm 1ib for libraries 5 104 Tool Options Linker Related information Gb Linker option l Link system library Section 8 4 1 How the linker searches libraries in chapter Using the Linker of the user s manual 5 105 ARM Embedded Tools Reference Linker I library Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Libraries 3 Enable the option Link default C libraries Command line syntax Iname library name Description With this option you tell the linker to use system library name 1ib where name is a string The linker first searches for system libraries in any directories specified with Lpath then in the directories specified with the environment variable LIBARM unless you used the option L without a directory Example To search in the system library carm lib C library lkarm test obj mylib lib lcarm lkarm test obj mylib lib library carm The linker links the file test obj and first looks in mylib 1ib in the current directory only then in the system library carm 1ib to resolve unresolved symbols Related information Gls Linker option L Additional search path for system libraries Section 8 4 Linking with Libraries in chapter Using the Linker of the user s manual 5 106 Tool Options Linker Linker link only Me
227. n the derivative definition derivative extends core architecture bus mau width map memory type reserved rom ram nvram mau size speed map map dest bus space dest_dbits dest_offset size sre_dbits src offset 8 6 1 Defining a Derivative With the keyword derivative you define a derivative and assign a unique name to it The name is used to refer to it at other places in the LSL file derivative name definitions If you are defining multiple derivatives that show great resemblance you can define the common features in a parent derivative and extend this with a child derivative that contains specific features The child inherits all features of the parent cores and memories With the keyword extends you create a child derivative derivative name_child_deriv extends name_parent_deriv definitions 8 26 Linker Script Language As with a core architecture a derivative can have any number of parameters These are identifiers which get values assigned on instantiation or extension of the derivative You can use them in any expression within the derivative definition derivative name_child_deriv parm1 parm2 1 extends name_parent_derivh arguments definitions 8 6 2 Instantiating Core Architectures With the keyword core you instantiate a core architecture in a derivative e With the keyword architecture you tell the linker that the given core has a certain architecture The architecture name
228. nctions Math h Tgmath h Description sin sinf sinl sin Returns the sine of x cos cosf cosl cos Returns the cosine of x tan tanf tanl tan Returns the tangent of x asin asinf asinl asin Returns the arc sine sin x of x acos acosf acosl acos Returns the arc cosine cos x of x atan atanf atanl atan Returns the arc tangent tan x of x atan2 atan2f atan2l atan2 Returns the result of tan y x sinh sinhf sinhl sinh Returns the hyperbolic sine of x 2 7 ARM Embedded Tools Reference Math h Tgmath h Description cosh coshf coshl cosh Returns the hyperbolic cosine of x tanh tanhf tanhl tanh Returns the hyperbolic tangent of x asinh asinhf asinhl asinh Returns the arc hyperbolic sinus of x acosh acoshf acoshl acosh Returns the non negative arc hyperbolic cosinus of x atanh atanhf atanhl atanh Returns the arc hyperbolic tangent of x Exponential and logarithmic functions All of these functions are new in C99 except for exp log and 10g10 Math h Tgmath h Description exp expf expl exp Returns the result of the exponential function ex exp2 exp2f exp2l1 exp2 Returns the result of the exponential function 2 Not implemented expml expmlf expmll expml Returns the result of the exponential function ex 1 Not implemented log logf logl log Returns the natural logarithm 1n x x gt 0 log10 1logl0f 1log101 10g10 Returns the base 10 logarithm of x x gt 0 loglp loglpf loglpl loglp Returns the base e logarit
229. nd Returns the nearest integer value of x as long long int Not implemented trunc truncl truncf trunc Returns the truncated integer value x Not implemented Remainder after devision Math h Tgmath h Description fmod fmod1 fmodf fmod Returns the remainder r of x ny n is chosen as trunc x y r has the same sign as x remainder remainderl remainder Returns the remainder r of x ny n is chosen as remainderf trunc x y r may not have the same sign as x Not implemented remquo remquol remquof remquo Same as remainder In addition the argument quo is given a specific value see ISO Not implemented 2 9 ARM Embedded Tools Reference frexp Idexp modf scalbn scalbiIn Math h Tgmath h Description frexp frexpl frexpf frexp Splits a float x into fraction fand exponent n so that f 0 0 or 0 5 lt f lt 1 0 and 2 x Returns f stores n ldexp ldexpl ildexpf ldexp Inverse of frexp Returns the result of x 2 x and n are both arguments modf modf1 modff Splits a float x into fraction f and integer n so that f lt 1 0 and f n x Returns f stores n scalbn scalbnl scalbnf scalbn Computes the result of x FLT_RADIX efficiently not normally by computing FLT_RADIX explicitly scalblnscalblnlscalblnf scalbln Same as scalbn but with argument n as long int Power and absolute value functions Math h Tgmath h Description cbrt cbrtl cbrtf ebrt Returns the real cube root of x x1 3 Not impl
230. nd libraries in the order in which they appear on the command line If you specify the option first library first the linker always tries to take the symbol definition from the library that appears first on the command line before scanning subsequent libraries This is for example useful when you are working with a newer version of a library that partially overlaps the older version Because they do not contain exactly the same functions you have to link them both However when a function is present in both libraries you may want the linker to extract the most recent function Example Consider the following example lkarm first library first a lib test obj b lib If the file test obj calls a function which is both present in a 1ib and b 1ib normally the function in b 1ib would be extracted With this option the linker first tries to extract the symbol from the first library a lib Note that routines in b 1ib that call other routines that are present in both a lib and b 1ib are now also resolved from a lib Related information db Linker option no rescan Rescan libraries to solve unresolved externals 5 100 Tool Options Linker Linker I include directory Menu entry Command line syntax lpath include directory paih Description With this option you can specify the path where your LSL include files are located A relative path will be relative to the current directory The order in whic
231. nder time pointed to by timer to local time in the form of a string This is equivalent to asctime localtime timer Converts the calender time pointed to by timer to the broken down time expressed as UTC Returns a pointer to the broken down time Converts the calendar time pointed to by timer to the broken down time expressed as local time Returns a pointer to the broken down time 2 29 ARM Embedded Tools Reference Formatted time The next function has a parallel function defined in wchar h Stdio h Wchar h strftime s smax fmt tm tp wstrftime s smax fmt tm tp Formats date and time information from struct tm tp into s according to the specified format fmt No more than smax characters are placed into s The formatting of strftime is locale specific using the LC_TIME category see section 2 2 12 ocale h You can use the next conversion specifiers a abbreviated weekday name A full weekday name b abbreviated month name B full month name c local date and time representation d day of the month 01 31 H hour 24 hour clock 00 23 l hour 12 hour clock 01 12 j day of the year 001 366 m month 01 12 M minute 00 59 p local equivalent of AM or PM S second 00 59 U week number of the year Sunday as first day of the week 00 53 w weekday 0 6 Sunday is 0 W week number of the year Monday as first day of the week 00 53 x local date representation X localtime rep
232. ne 1 NOLIST source line 2 LIST source line 3 END The assembler generates a list file with the following lines SECTION text source line 1 LIST source line 3 END Related information Gb Assembler option l Generate list file in Section 5 2 Assembler Options of Chapter Tool Options 3 30 Assembly Language LTORG Syntax LTORG Description With this directive you force the assembler to generate a literal pool data pocket at the current location All literals from the LDR pseudo instructions except those which could be translated to MOV or MVN instructions between the previous literal pool and the current location will be assembled in a new literal pool using DW directives By default the assembler generates a literal pool at the end of a code section i e the ENDSEC directive at the end of a code section causes an implicit LTORG directive However the default literal pool may be out of reach of one or more LDR pseudo instructions in the section In that case the assembler issues an error message and you should insert LTORG directives at proper locations in the section Example section text 7 LDR r1 0x12345678 code ltorg literal pool contains the literal amp 0x12345678 endsec default literal pool is empty Related information d gt LDR ARM generic LDR Thumb generic 3 31 ARM Embedded Tools Reference MACRO ENDM Syntax macro_name
233. ne three things 1 assign properties to the group like alignment and read write attributes 2 define the mutual order in the address space for sections in the group and 3 restrict the possible addresses for the sections in a group The linker creates labels that allow you to refer to the begin and end address of a group from within the application software Labels _1c_gb_group_name and_1c_ge_group_name mark the begin and end of the group respectively where the begin is the lowest address used within this group and the end is the highest address used Notice that a group not necessarily occupies all memory between begin and end address The given label refers to where the section is located at run time versus load time 1 Assign properties to the group like alignment and read write attributes These properties are assigned to all sections in the group and subgroups and override the attributes of the input sections The align field tells the linker to align all sections in the group and the group as a whole according to the align value By default the linker uses the largest alignment constraint of either the input sections or the alignment of the address space The attributes field tells the linker to assign one or more attributes to all sections in the group This overrules the default attributes By default the linker uses the attributes of the input sections You can set the r wor rw attributes and you can switch between the b and s attrib
234. ngs are possible space gt space space gt bus 8 23 ARM Embedded Tools Reference e bus gt bus e memory gt bus With a mapping you specify a range of source addresses you want to map specified by a source offset and a size the destination to which you want to map them a bus or another address space and the offset address in the destination e The dest argument specifies the destination This can be a bus or another address space only for a space to space mapping This argument is required e The src_offset argument specifies the offset of the source addresses In combination with size this specifies the range of address that are mapped By default the source offset is Ox0000 e The size argument specifies the number of addresses that are mapped This argument is required e The dest_offset argument specifies the position in the destination to which the specified range of addresses is mapped By default the destination offset is Ox0000 If you are mapping a bus to another bus the number of data lines of each bus may differ In this case you have to specify a range of source data lines you want to map src_dbits begin end and the range of destination data lines you want to map them to dest_dbits first last e The srce_dbits argument specifies a range of data lines of the source bus By default all data lines are mapped e The dest_dbits argument specifies a range of data lines of the destination bus By d
235. nking multiple files either relocatable object files obj or libraries 1ib itis important to specify the files in the right order Short and long option names Options can have both short and long names Short option names always begin with a single minus character long option names always begin with double minus characters You can abbreviate long option names as long as the name is unique You can mix short and long option names on the command line Options can have flags or sub options To switch a flag on use a lowercase letter or a ongflag To switch a flag off use an uppercase letter or a ongflag Separate longflags with commas The following two invocations are equivalent lkarm mfk test obj lkarm map file format files link test obj When you do not specify an option a default value may become active 5 85 ARM Embedded Tools Reference Linker help Menu entry Command line syntax help options Description Displays an overview of all command line options When you specify the argument options you can list detailed option descriptions Example The following invocations all display a list of the available command line options lkarm lkarm help lkarm To see a detailed description of the available options enter lkarm help options 5 86 Tool Options Linker Linker B big endian Menu entry 1 From the Project menu sel
236. not specify a filename the error file will be named after the input file with extension ers Example To write errors to errors err instead of stderr enter asarm error file errors err test sre Related information J 5 63 ARM Embedded Tools Reference Assembler error limit Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Add the option error limit to the Additional assembler options field Command line syntax error limit number Description With this option you tell the assembler to only emit the specified maximum number of errors Without this option same as 0 the assembler emits all errors Related information i 5 64 Tool Options Assembler Assembler f option file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Add the option f to the Additional assembler options field Be aware that when you specify the option f in the Additional assembler options field the options are added to the assembler options you have set in the other dialogs Only in extraordinary cases you may want to use them in combination Command line syntax f file option file file Description This option is primarily intended for command line use Instead of t
237. ns PC relative load instructions of the PC The handler addresses are in a literal pool data pocket following the vector table There are no range restrictions The size of the table and pool together is 64 bytes A position independent table is recommended if the table is copied from ROM to RAM at run time or if the ROM table is re mapped to address 0x00000000 after startup e In EDE in the Startup Vectors page select the Vector type position dependent or position independent If you selected a position dependent vector table it is possible to locate the FIQ handler directly at the FIQ vector since the FIQ vector is the last vector in the table Doing so saves a branch instruction when servicing a fast interrupt The generated vector table or the space reserved for the table will be 28 bytes instead of 32 This option is not available for a position independent vector table Note that you need to use the __at attribute to specify the actual position of the FIQ handler e In EDE in the Startup Vectors page enable or disable the option Do not use FIQ vector The linker can generate a vector table for you e In EDE in the Startup Vectors page enable the option Generate vector table in ROM The linker will look for specific symbols designating the start of a handler function These symbols are generated by the compiler when one of the following function qualifiers is used Function type qualifier Vector symbol __interr
238. nu entry Command line syntax link only Description With this option you suppress the locating phase The linker stops after linking and informs you about unresolved references Related information db Control program option cl Stop after linking 5 107 ARM Embedded Tools Reference Linker long branch veneers Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Enable the option Generate long branch veneers Command line syntax long branch veneers Description With this option you enable the linker to generate a long branch veneer if the target of a B ARM only not for Thumb BL or BLX instruction is out of range The locating process of the linker may become less efficient if this option is switched on even if no long branch veneers are required after all Related information ie 5 108 Tool Options Linker Linker Isl check Menu entry Command line syntax Isl check Description With this option the linker just checks the syntax of the LSL file s and exits No linking or locating is performed Use the option dfile to specify the name of the Linker Script File you want to test Related information Gb Linker option d Linker script file Linker option IsI dump Dump LSL info Section 8 7 Controlling the Linker with a Script in chapter Using the Link
239. o definitions they may overrule the settings of the environment variables With the option e the settings of the environment variables are used even if macros define otherwise Example mkarm e The make utility uses the settings of the environment variables regardless of macro definitions Related information J 5 171 ARM Embedded Tools Reference Make Utility err Command line syntax err file Description With this option the make utility redirects error messages and verbose messages to a specified file With the option s the make utility only displays error messages Example mkarm err error txt The make utility writes messages to the file error txt Related information d Make utility option s Do not print commands before execution 5 172 Tool Options Make Utility Make Utility f Command line syntax f my_makefile Description Default the make utility uses the file makefile to build your files With this option you tell the make utility to use the specified file instead of the file makefile Multiple f options act as if all the makefiles were concatenated in a left to right order Example mkarm f mymake The make utility uses the file mymake to build your files Related information J 5 173 ARM Embedded Tools Reference Make Utility G Command line syntax G path Description Normally you must call the make utility mkarm from the directory where your
240. oat rO 32 bit pointer rO 32 bit struct rO long long rOr1 double rOr1 64 bit struct rOr1 Table 1 4 Register usage for function return types 1 7 ARM Embedded Tools Reference 1 5 Intrinsic Functions Intrinsic functions are predefined functions that are recognized by the compiler The compiler then generates the most efficient assembly code for these functions The compiler always inlines the corresponding assembly instructions in the assembly source rather than calling the function The TASKING ARM C compiler recognizes the following intrinsic functions __alloc void volatile _alloc _ size_t size Allocate memory Same as library function malloc Returns a pointer to space in external memory of size bytes length NULL if there is not enough space left __free void volatile _ free void p Deallocates the memory pointed to by p p must point to memory earlier allocated by a call to __alloc Same as library function free Returns nothing __nop void _nop void Generate NOP instructions Returns nothing Example __nop generate NOP instruction __get_return_address __codeptr volatile _ get_return_address void Used by the compiler for profiling when you compile with the p profile option Returns return address of a function __getspsr unsigned int volatile _ getspsr void Get the value of the SPSR status register Returns the value of the status register SPSR
241. ode is located When a processor is reset it initializes its program counter to a certain start address sometimes called the reset vector In the architecture definition you must specify this start address in the correct address space in combination with the name of the label in the application code which must be located here The run_addr argument specifies the start address reset vector If the core starts executing using an entry from a vector table and directly jumps to the start label you should omit this argument The symbol argument specifies the name of the label in the application code that should be located at the specified start address The symbol argument is required The linker will resolve the start symbol and use its value after locating for the start address field in IEEE 695 files and Intel Hex files If you also specified the run_addr argument the start symbol label must point to a section The linker locates this section such that the start symbol ends up on the start address space space_name id 1 mau 8 align 8 page_size 1 stack name min_size 1k grows low_to_high start_address run_addr 0x0000 symbol start label map map_description 8 5 4 Mappings You can use a mapping when you define a space bus or memory With the map field you specify how addresses from the source space bus or memory are translated to addresses of a destination space bus The following mappi
242. ollowed by a jump from b to c is replaced by a jump from atoc Optimize instruction size With this optimization the assembler tries to find the shortest possible operand encoding for instructions Related information db Section 7 3 Assembler Optimizations in chapter Using the Assembler of the user s manual 5 76 Tool Options Assembler Assembler o output Menu entry EDE names the output file always after the source file Command line syntax 0 file output file Description With this option you can specify another filename for the output file of the assembler Without this option the basename of the assembly source file is used with extension obj Example To create the file relobj obj instead of asm obj enter asarm o relobj obj asm src asarm output relobj obj asm src Related information i 5 77 ARM Embedded Tools Reference Assembler relaxed Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Enable the option Allow 2 operand form for 3 operand instructions Command line syntax relaxed Description With this option you tell the assembler that a relaxed 2 operand syntax is allowed on 3 operand instructions If the first two register operands are equal you can replace the two registers by one Example Instead of add r1 r1 4 you can w
243. ommand line syntax time Description With this option you tell the make utility to display the current date and time on standard output Example mkarm time The make utility displays the current date and time and updates out of date files Related information J 5 187 ARM Embedded Tools Reference Make Utility V Command line syntax V Description Display version information The make utility ignores all other options or input files Example mkarm V The make utility displays the version information but does not perform any tasks Related information J 5 188 Tool Options Make Utility Make Utility W Command line syntax W target Description With this option the make utility considers the specified target file always as up to date and will not rebuild it Example mkarm W test abs The make utility rebuilds out of date targets in the makefile except the file test abs which is considered now as up to date Related information d 5 189 ARM Embedded Tools Reference Make Utility w Command line syntax W Description With this option the make utility sends error messages and verbose messages to standard output Without this option the make utility sends these messages to standard error Example mkarm w The make utility sends messages to standard output instead of standard error Related information f 5 190 Tool Options Make Utility Make Utility
244. ompiler adds the extra code to your application that takes care of the profiling process You can obtain the following profiling data see flags above Block counters not in combination with Call graph or Time This will instrument the code to perform basic block counting As the program runs it counts the number of executions of each branch in an if statement each iteration of a for loop and so on Note that though you can combine Block counters with Function counters this has no effect because Function counters is only a subset of Block counters Call graph not in combination with Block counters This will instrument the code to reconstruct the run time call graph As the program runs it associates the caller with the gathered profiling data Function counters This will instrument the code to perform function call counting This is a subset of the basic Block counters Time not in combination with Block counters This will instrument the code to measure the time spent in a function This includes the time spent in all sub functions callees 5 154 Tool Options Control Program AN Note that the more detailled information you request the larger the overhead in terms of execution time code size and heap space needed The option Generate Debug information g or debug does not affect profiling execution time or code size The control program automatically specifies the corresponding profiling libraries to the l
245. one processor is present the proc_name must be given for a global section layout e If the section layout refers to a processor that has more than one core the core_name must be given in the space_ref e A proc_name refers to a defined processor e Acore_name refers to a defined core e Aspace_name refers to a defined address space locate_direction direction direction direction low_to_high high_to_low e A section layout contains at most one direction statement 8 13 ARM Embedded Tools Reference e If you do not specify the direction statement the locate direction of the section layout is low to high section_statement simple_section_statement aggregate_section_ statement simple_section_statement assignment select_section_statement special _section_statement assignment symbol name assign _op expr assign _op select_section_statement select lt section_name gt 1 lt section_selections gt 1 e Either a section_name or at least one section_selection must be defined section_selections section_selection lt section_selection gt section_selection attributes lt lt gt attribute gt e attribute means select all sections that have this attribute e attribute means select all sections that do not have this attribute special _section_statement heap stack_name lt size_spec gt 1 stack stack _name lt size_spec gt 1 copytable
246. ools Reference Compiler s source Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Miscellaneous 3 Enable the option Merge C source code with assembly in output file src Command line syntax S source Description With this option you tell the compiler to merge C source code with generated assembly code in the output file The C source lines are included as comments Related information d 5 42 Tool Options Compiler Compiler signed bitfields Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Language 3 Enable the option Treat int bit fields as signed Command line syntax signed bitfields Description For bit fields it depends on the implementation whether a plain int is treated as signed int or unsigned int By default an int bit field is treated as unsigned int This offers the best performance With this option you tell the compiler to treat int bit fields as signed int In this case you can still add the keyword unsigned to treat a particular int bit field as unsigned Related information f 5 43 ARM Embedded Tools Reference Compiler static Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Com
247. ormation Gb Assembler option l Generate list file Assembler option tl Display section information in list file 5 73 ARM Embedded Tools Reference Assembler I list file Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select List File 3 Enable Generate list file 4 Inthe List file format section enable or disable the types of information to be included Command line syntax I file list file file Description With this option you tell the assembler to generate a list file A list file shows the generated object code and the relative addresses Note that the assembler generates a relocatable object file with relative addresses With the optional file you can specify an alternative name for the list file By default the name of the list file is the basename of the source file with the extension 1st Related information On the command line you can use the option L list format to specify which types of information should be included in the list file 5 74 Tool Options Assembler Assembler m preprocessor type Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Preprocessing 3 Enable or disable the option Enable the assembler preprocessor Command line syntax m n t Default mt pre
248. ormation on creating and placing stack sections Copy tables The copytable keyword defines a copy table in the address space The content of the copy table is created by the linker and contains the start address and size of all sections that should be initialized by the startup code You must define exactly one copy table in one of the address spaces for a core Optionally you can specify an alignment for the copy table with the argument align This alignment must be equal or larger than the alignment that you specify for the address space itself If smaller the alignment for the address space is used The copy_unit argument specifies the size in MAUs of information chunks that are copied If you do not specify the copy unit the MAU size of the address space itself is used The dest argument specifies the destination address space that the code uses for the copy table The linker uses this information to generate the correct addresses in the copy table The memory into where the sections must be copied at run time must be accessible from this destination space Sections generated for the copy table may get a page restriction with the address space s page size by adding the page argument 8 21 ARM Embedded Tools Reference Vector table e The vector_table keyword defines a vector table with n vectors of size m This is an internal LSL object similar to an LSL group The run_addr argument specifies the location of the first ve
249. ors Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Diagnostics 3 Enable the option Treat warnings as errors Command line syntax warnings as errors Description If the assembler encounters an error it stops assembling With this option you tell the assembler to treat warnings as errors As a consequence the assembler now also stops after encountering a warning Related information db Assembler option w Suppress some or all warnings 5 84 Tool Options Linker 5 3 Linker Options EDE uses a makefile to build your entire project This means that you cannot run the linker separately However you can set options specific for the linker Options in EDE versus options on the command line Most command line options have an equivalent option in EDE but some options are only available on the command line for example in a Windows Command Prompt If there is no equivalent option in EDE you can specify a command line option in EDE as follows 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Enter one or more command line options in the Additional linker options field Invocation syntax on the command line Windows Command Prompt The invocation syntax on the command line is lkarm option file When you are li
250. osition dependent Libraries Donotuse AG vector Script File IV Generate vector table in ROM Startup Vectors I Reserve space for copy in RAM Stacks Heap i Memory RAM address may needialias Optimization D Copy vector table to RAM Map File Diagnostics Main application execution mode Jusr mode 7 Miscellaneous CrossView Pro IV Enable FIQ interrupts IV Enable IRQ interrupts Options string 0 abs WIL PRODDIR Mib d _ demo Isl WIOcLTXY WIiM Wi metkIMoOrSU CARMv4T id cmos vo 5 Enter an address in the Force reset handler at ROM address field 4 4 Run time Environment Vector table The ROM address of the vector table is usually address Ox00000000 You have to specify an address if the vector table will be copied from ROM to RAM address 0x00000000 is mapped to RAM or if the hardware uses high vectors at address OxFFFFOOOO If you forced the reset handler on address 0x00000000 then you also have to specify a vector table ROM address to prevent overlapping address ranges e Inthe dialog as described above enter an address in the Vector table ROM address field You can select between two versions of the vector table position dependent or position independent The position dependent table contains branch instructions to the handlers The handlers must be located in range of the branch instructions The size of the table is 32 bytes The position independent table contai
251. ou tell the control program to keep temporary files it generates during the creation of the absolute object file Related information f 5 157 ARM Embedded Tools Reference Control Program U undefine Command line syntax Umacro_name undefine macro_name Description With this option you can undefine an earlier defined macro as with undef This option is for example useful to undefine predefined macros However you cannot undefine predefined ISO C standard macros The control program passes the option U undefine to the compiler Example To undefine the predefined macro _ TASKING_ ccarm U__TASKING_ test c ccarm undefine _ TASKING test c Related information Gls Control Pogram option D Define preprocessor macro 5 158 Tool Options Control Program Control Program V version Command line syntax V version Description Display version information The control program ignores all other options or input files Related information 5 159 ARM Embedded Tools Reference Control Program v verbose Command line syntax V verbose Description With this option you put the control program in verbose mode With the option v the control program performs it tasks while it prints the steps it performs to stdout Related information d Control Program option n dry run Verbose output and suppress execution 5 160 Tool Opt
252. ow the linker has mapped the sections and symbols from the various object files obj to the linked object file A locate part shows the absolute position of each section External symbols are listed per space with their absolute address both sorted on symbol and sorted on address Related information With the option m map file formatting you can specify which parts you want to place in the map file Section 6 2 Linker Map File Format in Chapter List File Formats 5 111 ARM Embedded Tools Reference Linker m map file format Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Map File 3 Enable the option Generate a map file map 4 Inthe Map file format section enable or disable the information you want to be included in the map file Command line syntax milags map file format flags You can specify the following formats 0 1 2 c C callgraph f F files k K link I L_ locate m M memory 0 O overlay q Q statics r R crossref s S 4 Isl u U rules Description Same as mefkLMoQrSU link information Same as mCfKIMoQRSU locate information Same as mefklmoQrSu most information Call graph information Processed files information Link result information Locate result information Memory usage information Overlay information Modul
253. owed Example COUNT SET 0 Initialize count Later on you can assign other values to the symbol Related information d EQU Set a permanent value to a symbol 3 39 ARM Embedded Tools Reference SIZE Syntax SIZE symbol expression Description With the SIZE directive you set the size of the specified symbol to the value represented by expression The SIZE directive may occur anywhere in the source file unless the specified symbol is a function In this case the SIZE directive must occur after the function has been defined Example section text global main code32 align 4 Function main main type func r SIZE main main endsec Related information d gt TYPE Set Symbol Type 3 40 Assembly Language SOURCE Syntax SOURCE string Description With the SOURCE directive you specify the name of the original C source module This directive is generated by the C compiler You do not need this directive in hand written assembly Example SOURCE test c Related information f 3 41 ARM Embedded Tools Reference TITLE Syntax TITLE title Description If you generate a list file see assembler option I you can use the TITLE directive to specify the program title which is printed at the top of each page in the assembler list file If you use the TITLE directive without the argument the title becomes empty This is also the default The
254. p Code You need the run time startup code to build an executable application The default startup code consists of the following components e Initialization code This code is executed when the program is initiated and before the function main is called e Exit code This controls the closedown of the application after the program s main function terminates The startup code is part of the run time library rtarm 1ib and the source is present in the file cstart asm in the directory 1ib src This code is generic code It uses linker generated symbols which you can give target specific or application specific values These symbols are defined in the linker script file include 1s1 arm 1s1 and you can specify their values in EDE or on the command line with linker option define If the default run time startup code does not match your configuration you need to modify the startup code accordingly The entry point of the startup code reset handler is label START This global label should not be removed since the linker uses it in the linker script file It is also used as the default start address of the application Initialization code The following initialization actions are executed before the application starts 1 Load the real program address This assures that the reset handler is immune for any ROM RAM re mapping 2 Initialize the stack pointers for each processor mode The stack pointers are loaded in memory by the s
255. pands to 1022001 If there is no branch number the branch digits expand to zero For example build 127 results in 127000000 Table 1 5 Predefined macros 2 Libraries Summary This chapter lists all library functions that you can call in your C source 2 1 Introduction This chapter contains an overview of all library functions that you can call in your C source This includes all functions of the standard C library ISO C99 and some functions of the floating point library Section 2 2 Library Functions gives an overview of all library functions you can use grouped per header file A number of functions declared in wchar h are parallel to functions in other header files These are discussed together Libraries Description carm lib C library for ARM and Thumb instructions repectively cthumb lib some functions also need the floating point library carms lib Single precision C library cthumbs lib some functions also need the floating point library fparm lib Floating point library non trapping fpthumb lib fparmt lib Floating point library trapping fpthumbt lib rtarm lib Run time library Table 2 1 Overview of libraries 2 1 ARM Embedded Tools Reference 2 2 Library Functions A number of wide character functions are available as C source code but have not been compiled with the C library To use complete wide character functionality you must recompile the libraries w
256. pecify label it gets the value of the location counter at the start of the directive processing Multiple arguments are stored in sets of eight bytes If an argument is NULL its corresponding address locations are flled with zeros Double word arguments are stored as is Floating point values are not allowed If the evaluated argument is too large to be represented in a double word the assembler issues an error and truncates the value In case of character strings each character is stored in the most significant byte of a word which represents the ASCII value of the character DD AB D gt 0x4100000000000000 0x4200000000000000 0x0000000000000000 second argument is empty 0x4400000000000000 Example TABLE DD 14 253 0x62 ABCD CHARS DD A B C D Related information db BS Block Storage DS Define Storage DB_ Define Byte DH Define Half Word DW Define Word Assembly Language DEFINE Syntax DEFINE symbol string Description With the DEFINE directive you define a substitution string that you can use on all following source lines The assembler searches all succeeding lines for an occurrence of symbol and replaces it with string f the symbol occurs in a double quoted string it is also replaced Strings between single quotes are not expanded This directive is useful for providing better documentation in the source program A symbol can consist of letters digits and
257. piler entry and select Miscellaneous 3 Add the option static to the Additional C compiler options field Command line syntax static Description With this option the compiler treats external definitions at file scope except for main as if they were declared static As a result unused functions will be eliminated and the alias checking algorithm assumes that objects with static storage cannot be referenced from functions outside the current module AN On the command line this option only makes sense when you specify all modules of an application on the command line Example carm static modulel c module2 c module3 c Related information J 5 44 Tool Options Compiler Compiler t tradeoff Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Optimization 3 In the Size speed trade off field select a level between fully optimize for size or fully optimize for speed Command line syntax t 0 1 2 3 4 tradeoff 0 1 2 3 4 Description If the compiler uses certain optimizations option O you can use this option to specify whether the used optimizations should optimize for more speed regardless of code size or for smaller code size regardless of speed Default the compiler optimizes for more speed tO LAN If you have not used the option O the compiler uses default medium optimi
258. ple In the following example the loop is repeated 4 times there are four arguments With the DB directive you allocate and initialize a byte of memory for each repetition of the loop a word for the DW directive Effectively the preprocessor duplicates the DB and Dw directives four times in the assembly source FOR VAR1 IN 1 2 3 4 12 DB VAR1 DW VAR1 VAR1 ENDFOR In the following example the loop is repeated 16 times With the DW directive you allocate and initialize four bytes of memory for each repetition of the loop Effectively the preprocessor duplicates the DW directive16 times in the assembled file and substitutes VAR2 with the subsequent numbers FOR VAR2 IN 1 to 0x10 DW VAR1 VAR1 ENDFOR 3 24 Assembly Language Related information Gb REPEAT ENDREP Repeat sequence of source lines 3 25 ARM Embedded Tools Reference GLOBAL Syntax GLOBAL symbol symbol Description All symbols or labels defined in the current section or module are local to the module by default You can change this default behavior with assembler option ig With the GLOBAL directive you declare one of more symbols as global It means that the specified symbols are defined within the current section or module and that those definitions should be accessible by all modules To access a symbol defined with GLOBAL from another module use the EXTERN directive Only program labels and symbols define
259. processor type none tasking Description With this option you select the preprocessor that the assembler will use By default the assembler uses the TASKING preprocessor When the assembly source file does not contain any preprocessor symbols you can specify to the assembler not to use a preprocessor Related information J 5 75 ARM Embedded Tools Reference Assembler O optimize Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Optimization 3 Enable or disable the optimization options e Generic instructions e Jump chains e Instruction size Command line syntax Oflags optimize flags You can set the following flags g G generics Allow generic instructions j J jumpchains Jump chains s S_ instr size Optimize instruction size Default OgJs Description Allow generic instructions If you use generic instructions in your assembly source the assembler can optimize them by replacing it with the fastest or shortest possible variant of that instruction By default this option is enabled If you turn off this optimization the assembler generates an error on generic instructions Be aware that the compiler also generates generic instructions Jump chains With this optimization the assembler replaces chained jumps by a single jump instruction For example a jump from a to b immediately f
260. ption If you generate a list file see assembler option I you can use the PAGE directive to format the generated list file width Number of characters on a line 1 255 Default is 132 length Number of lines per page 10 255 Default is 66 blanktop Number of blank lines at the top of the page Default 0 Specify a value so that blanktop blankbtm lt length 10 blankbtm Number of blank lines at the bottom of the page Default 0 Specify a value so that blanktop blankbtm lt length 10 blankleft Number of blank columns at the left of the page Default 0 Specify a value smaller than width If you use the PAGE directive without arguments it causes a formfeed the next source line is printed on the next page in the list file You can omit an argument by using two adjacent commas If the remaining arguments after an argument are all empty you can omit them A label is not allowed with this directive Example PAGE formfeed the next source line is printed on the next page in the list file PAGE 96 set pagewidth to 96 Note that you can omit the last four arguments PAGE 5 insert five blank lines at the top Note that you can omit the last two arguments Related information d gt TITLE Set program title in header of assembler list file Assembler option l Generate list file in Section 5 2 Assembler Options of Chapter Tool Options 3 36 Assembly Language REPEAT END
261. r realloc ptr size Returns a pseudo random integer in the range 0 to RAND_MAX Same as rand but uses seed for a new sequence of pseudo random numbers Allocates space for an object with size size The allocated space is not initialized Returns a pointer to the allocated space Allocates space for n objects with size size The allocated space is ini tialized with zeros Returns a pointer to the allocated space Deallocates the memory space pointed to by pir which should be a point er earlier returned by the malloc or calloc function Deallocates the old object pointed to by ptr and returns a pointer to a niew object with size size The new object cannot have a size larger than the previous object Environment communication abort atexit func exit status _Exit status getenv s system s 2 24 Causes abnormal program termination If the signal SIGABRTis caught the signal handler may take over control See section 2 2 15 signal h Func points to a function that is called without arguments when the program normally terminates Causes normal program termination Acts as if main returns with sta tus as the return value Status can also be specified with the predefined macros EXIT_SUCCES or EXIT_FAILURE Same as exit but no registered by the atexit function or signal han dlers registerd by the signal function are called Searches an environment list for a string s Returns a pointer to the
262. r Directives in Chapter Assembly Language and Section 5 2 Assembler Options in Chapter Tools Options The fourth line contains the headings of the columns for the source listing 6 1 ARM Embedded Tools Reference Source listing The following is a sample part of a listing An explanation of the different columns follows below ADDR CODE 0000 0004 0008 000C 0000 0001 08009FE5 001090E5 04009FE5 rrrrrrEA RESERVED CYCLES LINE SOURCE LINE 1 Module start 1 i 16 ldr r0 L2 1 2 17 ldr rl r0 0 1 3 18 ldr r0 L2 4 3 6 19 b printf 38 ds 2 The meaning of the different columns is ADDR CODE CYCLES LINE SOURCE LINE This column contains the memory address The address is a hexadecimal number that represents the offset from the beginning of a relocatable section or the absolute address for an absolute section The address only appears on lines that generate object code This is the object code generated by the assembler for this source line displayed in hexadecimal format The displayed code need not be the same as the generated code that is entered in the object module The code can also be relocatable code In this case the letter r is printed for the relocatable code part in the listing For lines that allocate space the code field contains the text RESERVED For lines that initialize a buffer the code field lists one value followed by the word REPEATS The first number in this co
263. rchitecture definition must contain at least one stack definition Each stack of a core architecture must have a unique name See also the stack keyword in section 8 9 3 Creating or Modifying Special Sections The stack is described in terms of a minimum size min_size and the direction in which the stack grows grows This can be either from low_to_high addresses stack grows upwards this is the default or from high_to_low addresses stack grows downwards The min_size is required By default the linker tries to maximize the size of the stacks and heaps After locating all sections the largest remaining gap in the space is used completely for the stacks and heaps If you specify the keyword fixed you can disable this so called balloon behavior The size is also fixed if you used a stack or heap in the software layout definition in a restricted way For example when you override a stack with another size or select a stack in an ordered group with other sections Optionally you can specify an alignment for the stack with the argument align This alignment must be equal or larger than the alignment that you specify for the address space itself The heap keyword defines a heap in the address space and assigns a name to it The definition of a heap is similar to the definition of a stack See also the heap keyword in section 8 9 3 Creating or Modifying Special Sections See section 8 9 Semantics of the Section Layout Definition for inf
264. rdinal number of the argument in the macro formal argument list If you use this function when macro expansion is not active the assembler issues a warning Example IF ARG TWIDDLE is argument twiddle present IF ARG 1 is first argument present BIGENDIAN Returns 1 if the assembler generates code for big endian mode returns 0 if the assembler generates code for little endian mode this is the default CNT Returns the number of macro arguments of the current macro expansion as an integer If you use this function when macro expansion is not active the assembler issues a warning Example ARGCOUNT SET CNT reserve argument count 3 2 Assembly Language CPU processor_type With the cPu function you can check whether the source code is being assembled for a certain processor type The function evaluates to TRUE when the specified processor_type matches the processor type that was specified with the option Ccpu This function is useful to create conditional code for several targets as shown in the example Example IF CPU armv4 true if you specified option CARMv4 code for the ARMv4 ELIF CPU armv5 true if you specified option CARMv5 code for the ARMv5 ELSE code for other architectures ENDIF Compiler option C Select architecture in section 5 1 Compiler Options of Chapter Tool Options DEFINED symbol symbol Returns 1 if symbol ha
265. rect With this option you keep the generated output file src when an error occurs By default the compiler removes the generated output file src when an error occurs This is useful when you use the make utility If the erroneous files are not removed the make utility may process corrupt files on a subsequent invocation Use this option when you still want to inspect the generated assembly source Even if it is incomplete or incorrect Related information J 5 27 ARM Embedded Tools Reference Compiler misrac Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select MISRA C 3 Select a MISRA C Standard If you select Custom MISRA C configuration 4 Inthe left pane expand the MISRA C entry and select MISRA C Rules 5 Enable or disable the individual rules Command line syntax misrac all number number Description With this option you specify to the compiler which MISRA C rules must be checked With the option misrac all the compiler checks for all supported MISRA C rules Example carm misrac 9 13 test c The compiler generates an error for each MISRA C rule 9 10 11 12 or 13 violation in file test c Related information Compiler option misrac advisory warnings Compiler option misrac required warnings Linker option misrac report 5 28 Tool Options Compiler Compiler mi
266. reprocessing When the linker loads an LSL file the linker processes it with a C style prepocessor As such it strips C and C comments You can use the standard ISO C preprocessor directives such as include define if else endif For example include arch 1sl Preprocess and include the file arch 1s1 at this point in the LSL file 8 3 2 Lexical Syntax The following lexicon is used to describe the syntax of the Linker Script Language A B A is defined as B A BC A is defined as B and C B is followed by C A B c A is defined as B or C lt B gt 0 1 zero or one occurrence of B lt B gt gt 0 zero of more occurrences of B lt B gt gt 1 one of more occurrences of B IDENTIFIER a character sequence starting with a z A Z or Following characters may also be digits and dots STRING sequence of characters not starting with n r or t DOSTRING STRING double quoted string OCT_NUM octal number starting with a zero 06 045 DEC_NUM decimal number not starting with a zero 14 1024 HEX _ NUM hexadecimal number starting with Ox 0x0023 OxFFOO OCT_NUM DEC_NUM and HEX_NUM can be followed by a k kilo M mega or G giga Characters in bold are characters that occur literally Words in italics are higher order terms that are defined in the same or in one of the other sections To write comments in LSL file you can use the C style or
267. resentation y year without century 00 99 Y year with century Z time zone name if any 2 30 Libraries 2 2 24 unistd h The file unistd h contains standard UNIX I O functions These functions are all implemented using the debugger s file system simulation This header file is not defined in ISO IEC9899 access name mode chdir path close fd getcwd buf size lseek fd offset whence read fd buff cnt stat name buff unlink name write fd buff cnt Use the file system simulation of the debugger to check the permissions of a file on the host mode specifies the type of access and is a bit pattern constructed by a logical OR of the following values R_OK Checks read permission W_OK Checks write permission X_OK Checks execute Search permission F_OK Checks to see if the file exists FSS implementation Use the file system simulation feature of the debugger to change the current directory on the host to the directory indicated by path FSS implementation File close function The given file descriptor should be properly closed This function calls _close FSS implementation Use the file system simulation feature of the debugger to retrieve the current directory on the host Returns the directory name FSS implementation Moves read write file offset Calls _1seek FSS implementation Reads a sequence of characters from a file This function calls _read F
268. ring You must enclose siring1 and string2 either with single quotes or with double quotes Example DEFINE ID STRCAT TAS KING ID TASKING STRCMP string 1 string2 Compares string1 with string2 by comparing the characters in the string The function returns the difference between the characters at the first position where they disagree or zero when the strings are equal lt 0 if string lt string2 0 if string1 string2 gt 0 if string1 gt string2 Example IF STRCMP STR MAIN 0 does STR equal MAIN STRLEWN string Returns the length of string as an integer Example SLEN SET STRLEN string SLEN 6 STRPOS siring1 string2 start Returns the position of string2 in string1 as an integer If string2 does not occur in string7 the last string postition 1 is returned With start you can specify the starting position of the search If you do not specify start the search is started from the beginning of string7 3 4 Assembly Language Example ID set STRPOS TASKING ASK ID 1 ID set STRPOS TASKING BUG ID 7 THUMB Returns1 if the assembler runs in Thumb mode or 0 if the assembler runs in ARM mode default You can tell the assembler to treat the input as Thumb instructions with option thumb or with the CODE16 directive 3 5 ARM Embedded Tools Reference 3 2 3 2 1 Assembler Directives O
269. rite add r1 4 and instead of add rl1 r1 r2 you can write add r1 r2 Related information f 5 78 Tool Options Assembler Assembler T thumb Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Enable the option Assemble Thumb instructions by default Command line syntax T thumb Description With this option you tell the assembler that the input file contains Thumb code By default the assembler assumes that the input file contains ARM code The assembler will complain if T is used in combination with CARMv4 or CARMv5 Note that the input may still contain mixed Thumb and ARM code because the CODE16 and CODE32 directives overrule the T option Assembly code can check the assembler mode by means of the built in assembly function THUMB Related information Gb Assembly function THUMB Assembler directives CODE16 CODE32 5 79 ARM Embedded Tools Reference Assembler t section info Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select List File 3 Enable Generate list file 4 Enable the option Display section information Command line syntax tflags section info flags You can set the following flags c C console Display section information on st
270. rmation about the core for the locating phase of the linker A linker script file is coded in LSL and contains the following types of information e the architecture and derivative definition describe the core s hardware architecture and its internal memory e the board specification describes the physical memory available in the system e the section layout definition describes how to locate sections in memory With this option you specify a linker script file via the control program to the linker If you do not specify this option the linker does not use a script file You can specify the existing file arm 1s1 or the name of a manually written linker script file You can use this option multiple times The linker processes the LSL files in the order in which they appear on the command line Related information Section 8 7 Controlling the Linker with a Script in chapter Using the Linker of the user s manual 5 134 Tool Options Control Program Control Program diag Command line syntax diag format all nr Description With this option you can ask for an extended description of error messages in the format you choose The output is directed to stdout normally your screen and in the format you specify You can specify the following formats html rtf or text default To create a file with the descriptions you must redirect the output With the suboption all the descriptions of all error messages
271. run time checks to detect errors during program execution Some of these checks require additional code to be inserted in the original application code and may therefore slow down the program execution The following checks are available Bounds checking Every pointer update and dereference will be checked to detect out of bounds accesses null pointers and uninitialized automatic pointer variables This check will increase the code size and slow down the program considerably In addition some heap memory is allocated to store the bounds information You may enable bounds checking for individual modules or even parts of modules only see pragma runtime Report unhandled case in a switch Report an unhandled case value in a switch without a default part This check will add one function call to every switch without a default part but it will have little impact on the excution speed 5 40 Tool Options Compiler Malloc consistency checks This option enables the use of wrappers around the functions malloc realloc free that will check for common dynamic memory allocation errors like e buffer overflow e write to freed memory e multiple calls to free e passing invalid pointer to free Enabling this check will extract some additional code fromc the library but it will not enlarge your application code The dynamic memory usage will increase by a couple of bytes per allocation Related information J 5 41 ARM Embedded T
272. s you must compile a single C source file from within EDE the file is then also assembled However you can set options specific for the assembler Options in EDE versus options on the command line Most command line options have an equivalent option in EDE but some options are only available on the command line for example in a Windows Command Prompt If there is no equivalent option in EDE you can specify a command line option in EDE as follows 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Enter one or more command line options in the Additional assembler options field Invocation syntax on the command line Windows Command Prompt To call the assembler from the command line use the following syntax asarm option file The input file must be an assembly source file asm or src Short and long option names Options can have both short and long names Short option names always begin with a single minus character long option names always begin with double minus characters You can abbreviate long option names as long as the name is unique You can mix short and long option names on the command line Options can have flags or sub options To switch a flag on use a lowercase letter or a ongflag To switch a flag off use an uppercase letter or a longflag Separate longflags with commas The
273. s been defined O otherwise If symbol is quoted it is looked up as a DEFINE symbol if it is not quoted it is looked up as an ordinary symbol macro or label Example IF DEFINED ANGLE is symbol ANGLE defined IF DEFINED ANGLE does label ANGLE exist LSB expression Returns the east significant byte of the result of the expression The result of the expression is calculated as 16 bits LSH expression Returns the east significant half word bits 0 15 of the result of the absolute expression The result of the expression is calculated as a word 82 bits LSW expression Returns the east significant word bits 0 31 of the result of the expression The result of the expression is calculated as a double word 64 bits MSB expression Returns the most significant byte of the result of the expression The result of the expression is calculated as16 bits 3 3 ARM Embedded Tools Reference MSH expression Returns the most significant half word bits 16 31 of the result of the absolute expression The result of the expression is calculated as a word 32 bits MSH expression is equivalent to expression gt gt 16 amp Oxffff MSW expression Returns the most significant word bits 32 63 of the result of the expression The result of the expression is calculated as a double word 64 bits STRCAT siring1 string2 Concatenates string1 and string2 and returns them as a single st
274. s it is enough to specify the derivative in the LSL file See section 8 7 Semantics of the Board Specification for a detailed description of LSL in the processor definition The memory and bus definitions optional Memory and bus definition are used within the context of a derivative definition to specify internal memory and on chip buses In the context of a board specification the memory and bus definitions are used to define external off chip memory and buses Given the above definitions the linker can convert a logical address into an offset into an on chip or off chip memory device See section 8 7 3 Defining External Memory and Buses for more information on how to specify the external physical memory layout nternal memory for a processor should be defined in the derivative definition for that processor 8 2 Linker Script Language The board specification The processor definition and memory and bus definitions together form a board specification LSL provides language constructs to easily describe single core and heterogeneous or homogeneous multi core systems The board specification describes all characteristics of your target board s system buses memory devices I O sub systems and cores that are of interest to the linker Based on the information provided in the board specification the linker can for each core e convert a logical address to an offset within a memory device e locate sections in physical memory
275. s or Motorola S records 4 Optional Specify an alternative record size Command line syntax c basename format addr_size chip output basename format adar_size You can specify the following formats IHEX Intel Hex SREC Motorola S records The adar_size specifies the size of the addresses in bytes record length For Intel Hex you can use the values 1 2 or 4 bytes default For Motorola S you can specify 2 S1 records 3 S2 records or 4 bytes S3 records default Description With this option you specify the Intel Hex or Motorola S record output format for loading into a PROM programmer The linker generates a file for each ROM memory defined in the LSL file where sections are located memory memname type rom The name of the file is the name of the EDE project or on the command line the name of the memory device that was emitted with extension hex or sre Optionally you can specify a basename which prepends the generated file name Example To generate Intel Hex output files for each defined memory enter the following on the command line lkarm cmyfile IHEX testl obj lkarm chip output myfile IHEX testl obj In this case this generates the file myfile_memname hex Related information d gt Linker option o Output file 5 89 ARM Embedded Tools Reference Section 7 2 Motorola S Record Format Section 7 3 Inte Hex Record Format in Chapter Object File Formats 5 90
276. s usually defined in the scope of a derivative definition With the keyword memory you define physical memory that is present on the target board The memory name is used to identify the memory and does not conflict with other identifiers If you define memory parts in the LSL file only the memory defined in these parts is used for placing sections If no external memory is defined in the LSL file and if the linker option to allocate memory on demand is set then the linker will assume that all virtual addresses are mapped on physical memory You can override this behavior by specifying one or more memory definitions memory mem_name type rom mau 8 size 64k speed 2 map map_description 8 30 Linker Script Language d For a description of the keywords see section 8 6 3 Defining Internal Memory and Buses With the keyword bus you define a bus the combination of data and corresponding address bus The bus name is used to identify a bus and does not conflict with other identifiers Bus descriptions at the global scope outside any definition define external buses These are buses that are present on the target board bus bus_name mau 8 width 8 map map description d For a description of the keywords see section 8 5 2 Defining Internal Buses You can connect off chip memory to any derivative you need to map the off chip memory to a bus and map that bus on the internal bus of t
277. scription __HEAP Size of heap __HEAP_ FIXED Defined if you do not expand the heap if space is left __HEAPADDR Heap start address Table 4 6 Heap macros used in arm lsl 4 9 ARM Embedded Tools Reference 5 Tool Options Summary This chapter provides a detailed description of the options for the compiler assembler linker control program make program and the librarian 5 1 Compiler Options EDE uses a makefile to build your entire project This means that in EDE you cannot run the compiler separately If you compile a single C source file from within EDE the file is also assembled However you can set options specific for the compiler Options in EDE versus options on the command line Most command line options have an equivalent option in EDE but some options are only available on the command line for example in a Windows Command Prompt If there is no equivalent option in EDE you can specify a command line option in EDE as follows 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Miscellaneous 3 Enter one or more command line options in the Additional C compiler options field Invocation syntax on the command line Windows Command Prompt To call the compiler from the command line use the following syntax carm option file The input file must be a C source file c or ic 5 1 ARM Embedded Tools
278. select Project Options The Project Options dialog box appears 2 Expand the Assembler entry and select Miscellaneous 3 Select the default label mode Local or Global Command line syntax i g l Default il symbol scope global local Description With this option you tell the assembler how to treat symbols that you have not specified explicitly as global or local By default the assembler treats all symbols as local symbols unless you have defined them explicitly as global Related information f 5 70 Tool Options Assembler Assembler k keep output files Menu entry EDE always removes the object file when errors occur during assembling Command line syntax k keep output files Description If an error occurs during assembling the resulting object file obj may be incomplete or incorrect With this option you keep the generated object file when an error occurs By default the assembler removes the generated object file when an error occurs This is useful when you use the make utility If the erroneous files are not removed the make utility may process corrupt files on a subsequent invocation Use this option when you still want to use the generated object For example when you know that a particular error does not result in a corrupt object file Related information J 5 71 ARM Embedded Tools Reference Assembler L list format Menu entry 1 From the Pro
279. set Returns the length of the first sequence found Same as strspn wesspn but returns a pointer to the first character in s that also is specified in set Searches for a substring sub in s Returns a pointer to the first occurence of sub in s A sequence of calls to this function breaks the string s into a sequence of tokens delimited by a character specified in delim The token found in s is terminated with a null character The function returns a pointer to the first position in s of the token Description memset s c n strerror errno strlen s wmemset s cC N weslen s Fills the first n bytes of s with character c and returns s Typically the values for errno come from int errno This function returns a pointer to the associated error message See also section 2 2 4 errno h Returns the length of string s 2 27 ARM Embedded Tools Reference 2 2 23 time h and wehar h The header file time h provides facilities to retrieve and use the calendar date and time and the process time Time can be represented as an integer value or can be broken down in components Two arithmetic data types are defined which are capable of holding the integer representation of times clock_t time_t unsigned long long unsigned long The type struct tm below is defined according to ISO IEC9899 with one exception this implementation does not support leap seconds The struct tm type is defines
280. set in the other dialogs Only in extraordinary cases you may want to use them in combination EDE automatically saves the options with your project Command line syntax f file option file file Description This option is primarily intended for command line use Instead of typing all options on the command line you can create an option file which contains all options and flags you want to specify With this option you specify the option file to the compiler Use an option file when the command line would exceed the limits of the operating system or just to store options and save typing You can specify the option f multiple times Format of an option file e Multiple arguments on one line in the option file are allowed e To include whitespace in an argument surround the argument with single or double quotes e If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded e When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels 5 18 Tool Options Compiler Example Suppose the file myoptions contains the follo
281. shall match the number of parameters A pointer parameter in a function prototype should be declared as pointer to const if the pointer is not used to modify the addressed object All exit paths from a function with non void return type shall have an explicit return statement with an expression A function identifier shall only be used with either a preceding amp or witha parenthesized parameter list which may be empty If a function returns error information then that error information shall be tested A violation is reported when the return value of a function is ignored Pointers and arrays x 17 1 x 17 2 17 3 17 4 17 5 17 6 R R R R Pointer arithmetic shall only be applied to pointers that address an array or array element Pointer subtraction shall only be applied to pointers that address elements of the same array gt gt lt lt shall not be applied to pointer types except where they point to the same array In general checking whether two pointers point to the same object is impossible The compiler will only report a violation for a relational operation with incompatible pointer types Array indexing shall be the only allowed form of pointer arithmetic The declaration of objects should contain no more than 2 levels of pointer indirection A violation is reported when a pointer with three or more levels of indirection is declared The address of an object with automatic
282. sing directives A violation is reported when the first token of an actual macro argument is In the definition of a function like macro each instance of a parameter shall be enclosed in parentheses unless it is used as the operand of or All macro identifiers in preprocessor directives shall be defined before use except in ifdef and ifndef preprocessor directives and the defined operator There shall be at most one occurrence of the or preprocessor operators in a single macro definition The and preprocessor operators should not be used The defined preprocessor operator shall only be used in one of the two standard forms Precautions shall be taken in order to prevent the contents of a header file being included twice Preprocessing directives shall be syntactically meaningful even when excluded by the preprocessor All else elif and endif preprocessor directives shall reside in the same file as the if or ifdef directive to which they are related Reserved identifiers macros and functions in the standard library shall not be defined redefined or undefined The names of standard library macros objects and functions shall not be reused The validity of values passed to library functions shall be checked 9 13 ARM Embedded Tools Reference Run time failures 20 4 20 5 20 6 20 7 20 8 20 9 20 10 20 11 20 12 x 21 1 9 14 R R BS R R R R R R
283. solute address due to an absolute group restriction can overlap a reserved section With the attributes field you can set the access type of the reserved section The linker locates the reserved section in its space with the restrictions that follow from the used attributes r w or x or a valid combination of them The allowed attributes are shown in the following table A value between lt and gt in the table means this value is set automatically by the linker Properties set in LSL Resulting section properties attributes filled access memory content x yes lt rom gt executable r yes r lt rom gt data r no r lt rom gt scratch rx yes r lt rom gt executable rw yes rw lt ram gt data rw no rw lt ram gt scratch rwx yes rw lt ram gt executable 8 40 Linker Script Language group reserved myreserved size 2k attributes rw fill Oxaa If you do not specify any attributes the linker will reserve the given number of maus no matter what type of memory lies beneath If you do not specify a fill pattern no section is generated The linker creates two labels to mark the begin and end of the section le _ub_name for the start and _1c_ue_name for the end of the reserved section Output sections The keyword section tells the linker to accumulate sections obtained from object files input sections into an output section of a fixed size in the lo
284. specified title is valid until the assembler encouters a new TITLE directive Example TITLE The best program In the header of each page in the assembler list file the title of the progam is printed In this case The best program Related information db PAGE Format the assembler list file Assembler option l Generate list file in Section 5 2 Assembler Options of Chapter Tool Options 3 42 Assembly Language TYPE Syntax symbol TYPE typeid Description With the TYPE directive you set a symbol s type to the specified value in the ELF symbol table Valid symbol types are FUNC The symbol is associated with a function or other executable code OBJECT The symbol is associated with an object such as a variable an array or a structure FILE The symbol name represents the filename of the compilation unit Labels in code sections have the default type FUNC Labels in data sections have the default type OBJECT Example Afunc TYPE FUNC Related information Gb SIZE Set Symbol Size 3 43 ARM Embedded Tools Reference UNDEF Syntax UNDEF symbol Description With the UNDEF directive you can undefine a substitution string that was previously defined with the DEFINE directive The substitution string associated with symbol is released and symbol will no longer represent a valid DEFINE substitution The assembler issues a warning if you redefine an existing symbol Example UNDE
285. srac advisory warnings misrac required warnings Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select MISRA C 3 Enable one or both options Turn advisory rule violation into warning and Turn required rule violation into warning Command line syntax misrac advisory warnings misrac required warnings Description Normally if an advisory rule or required rule is violated the compiler generates an error As a consequence no output file is generated With this option the compiler generates a warning instead of an error Related information d Compiler option misrac Linker option misrac report 5 29 ARM Embedded Tools Reference Compiler misrac version Menu entry 1 From the Project menu select Project Options The Project Options dialog appears 2 Expand the C Compiler entry and select MISRA C 3 Select the MISRA C standard MISRA C 1998 or MISRA C 2004 Command line syntax misrac version 1998 2004 Description MISRA C rules exist in two versions MISRA C 1998 and MISRA C 2004 By default the C source is checked against the MISRA C 2004 rules With this option you can specify to check against the MISRA C 1998 rules Related information db See Chapter 9 MISRA C Rules for a list of all supported MISRA C rules Compiler option misrac 5 30 Tool Options Compiler Compiler n
286. ssors that all have a unique derivative you may omit the processor definitions In this case the linker assumes that for each derivative definition in the LSL file there is one processor The linker uses the derivative name also for the processor With the keyword processor you define a processor You can freely choose the processor name The name is used to refer to it at other places in the LSL file processor proc_name processor definition 8 29 ARM Embedded Tools Reference 8 7 2 Instantiating Derivatives With the keyword derivative you tell the linker that the given processor has a certain derivative The derivative name refers to an existing derivative definition in the same LSL file For examples if you have two processors on your target board called myproc_1 and myproc_2 that have the same derivative called myderiv you must instantiate both processors as follows processor myproc_1 derivative myderiv processor myproc 2 derivative myderiv If the derivative definition has parameters you must specify the arguments that correspond with the parameters For example myderiv1 expects two parameters which are used in the derivative definition processor myproc derivative myderivl 2 4 8 7 3 Defining External Memory and Buses It is common to define external memory off chip and external buses at the global scope outside any enclosing definition Internal memory on chip memory i
287. storage shall not be assigned to another object that may persist after the first object has ceased to exist Structures and unions 18 1 18 2 x 18 3 9 12 18 4 2333393 2 All structure or union types shall be complete at the end of a translation unit An object shall not be assigned to an overlapping object An area of memory shall not be reused for unrelated purposes Unions shall not be used MISRA C Rules Preprocessing directives 19 1 A 19 2 A x 19 3 R 19 4 R 19 5 R 19 6 R 19 7 A 19 8 R 19 9 R 19 10 R 19 11 R 19 12 R 19 13 A 19 14 R 19 15 R 19 16 R 19 17 R Standard libraries 20 1 R 20 2 R x 20 3 R include statements in a file should only be preceded by other preprocessor directives or comments Non standard characters should not occur in header file names in include directives The include directive shall be followed by either a lt filename gt or filename sequence C macros shall only expand to a braced initializer a constant a parenthesized expression a type qualifier a storage class specifier or a do while zero construct Macros shall not be define d or undef d within a block undef shall not be used A function should be used in preference to a function like macro A function like macro shall not be invoked without all of its arguments Arguments to a function like macro shall not contain tokens that look like preproces
288. structions as 16 bit Thumb instructions until it encounters a CODE32 directive or till it reaches the end of the active section This directive causes an implicit alignment of two bytes The assembler issues an error message if CODE16 is used in combination with options CARMv4 or CARMv5 With the CODE32 directive you instruct the assembler to interpret subsequent instructions as 32 bit ARM instructions until it encounters a CODE16 directive or till it reaches the end of the active section This directive causes an implicit alignment of four bytes These directives are useful when you have files that contain both ARM and Thumb instructions The directive must appear before the instruction change and between a SECTION ENDSEC The default instruction set at the start of a section depends on the use of assembler option T Example section text code32 following instructions are ARM instructions r endsec Related information dE Assembler option T Treat input as Thumb instructions in Section 5 2 Assembler Options of Chapter Tool Options 3 14 Assembly Language DB Syntax label DB argument argument Description With the DB directive Define Byte the assembler allocates and initializes one byte of memory for each argument An argument can be e asingle or multiple character string constant e aninteger expression e NULL indicated by two adjacent commas If you specify label it gets th
289. sult shall be immediately cast to the underlying type of the operand A U suffix shall be applied to all constants of unsigned type Pointer type conversions 11 3 11 4 11 5 Expressions 12 1 12 2 12 3 R Conversions shall not be performed between a pointer to a function and any type other than an integral type Conversions shall not be performed between a pointer to object and any type other than an integral type another pointer to object type or a pointer to void A cast should not be performed between a pointer type and an integral type A cast should not be performed between a pointer to object type and a different pointer to object type A cast shall not be performed that removes any const or volatile qualification from the type addressed by a pointer Limited dependence should be placed on C s operator precedence rules in expressions The value of an expression shall be the same under any order of evaluation that the standard permits This rule is checked using worst case assumptions This means that a violation will be reported when a possible alias may cause the result of an expression to be evaluation order dependent The sizeof operator shall not be used on expressions that contain side effects 9 9 ARM Embedded Tools Reference 12 4 12 5 12 6 12 7 12 8 12 9 12 10 12 11 12 12 12 13 A The right hand operand of a logical amp amp or operator shall no
290. swspace Returns a non zero value when c is a space type character space tab vertical tab formfeed linefeed carriage return isupper iswupper Returns a non zero value when c is an uppercase character A Z isxdigit iswxdigit Returns a non zero value when c is a hexadecimal digit 0 9 A F a f 2 2 Libraries Ctype h Wctype h Description tolower towlower Returns c converted to a lowercase character if it is an uppercase character otherwise c is returned toupper towupper Returns c converted to an uppercase character if it is a lowercase character otherwise c is returned _tolower Converts c to a lowercase character does not check if c really is an uppercase character Implemented as macro This macro function is not defined in ISO IEC 9899 _toupper Converts c to an uppercase character does not check if c really is a lowercase character Implemented as macro This macro function is not defined in ISO IEC 9899 isascii Returns a non zero value when c is in the range of 0 and 127 This function is not defined in ISO IEC 9899 toascii Converts c to an ASCII value strip highest bit This function is not defined in ISO IEC 9899 2 2 4 errno h int errno External variable that holds implementation defined error codes The following error codes are defined as macros in errno h EZERO EPERM ENOENT EINTR EIO EBADF EAGAIN ENOMEM EACCES EFAULT EEXIST ENOTDIR EISDIR EINVAL ENFILE EMFILE ETXTBSY EN
291. syntax k Description When during the make process the make utility encounters an error it stops rebuilding your files With the option k the make utility only stops building the target that produced the error All other targets defined in the makefile are built Example mkarm k If the make utility encounters an error it stops building the current target but proceeds with the other targets that are defined in the makefile Related information db Make utility option S Undo the effect of k 5 177 ARM Embedded Tools Reference Make Utility m Command line syntax m file Description Instead of typing all options on the command line you can create an option file which contains all options and flags you want to specify With this option you specify the option file to the make utility Use an option file when the command line would exceed the limits of the operating system or just to store options and save typing You can specify the option m multiple times Format of an option file e Multiple arguments on one line in the option file are allowed e To include whitespace in an argument surround the argument with single or double quotes e If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedde
292. t 25 4 Set the option Maximum size for functions to always inline to a value default 25 Command line syntax inline max incr percentage Default 25 inline max size threshold Default 25 Description With these options you can control the function inlining optimization process of the compiler These options have only effect when you have enabled the inlining optimization option Oi AN Regardless of the optimization process the compiler always inlines all functions that have the function qualifier inline With the option inline max size you can specify the maximum size of functions that the compiler inlines as part of the optimization process The compiler always inlines all functions that are smaller than the specified threshold The threshold is measured in compiler internal units and the compiler uses this measure to decide which functions are small enough to inline The default threshold is 25 After the compiler has inlined all functions that have the function qualifier inline and all functions that are smaller than the specified threshold the compiler looks whether it can inline more functions without increasing the code size too much With the option inline max iner you can specify how much the code size is allowed to increase Default this is 25 which means that the compiler continues inlining functions until the resulting code size is 25 larger than the original size Example carm inline max
293. t c carm iso 90 test c Related information Gs Compiler option A Language extensions 5 9 ARM Embedded Tools Reference Compiler call info Menu entry Command line only Command line syntax call info Description With this option the compiler generates CALLS directives for all function calls This enables the linker to generate a call graph in the linker map file Related information Gb Assembler directive CALLS Tool Options Compiler Compiler check Menu entry 1 Inthe Project window select the file you want to check 2 From the Build menu select Check Syntax Command line syntax check Description With this option you can check the source code for syntax errors without generating code This saves time in developing your application because the code will not actually be compiled The compiler reports any warnings and or errors Related information d gt Assembler option check Check syntax 5 11 ARM Embedded Tools Reference Compiler D define Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Preprocessing 3 Click on an empty Macro field and enter a macro name Then click an empty cell to confirm 4 Optionally click in the Definition field and enter a definition Then click an empty cell to confirm Command line syntax Dmacro_name
294. t contain side effects The operands of a logical amp amp or shall be primary expressions The operands of logical operators amp amp and should be effectively Boolean Expressions that are effectively Boolean should not be used as operands to operators other than amp amp and Bitwise operators shall not be applied to operands whose underlying type is signed The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left hand operand This violation will only be checked when the shift count evaluates to a constant value at compile time The unary minus operator shall not be applied to an expression whose underlying type is unsigned The comma operator shall not be used Evaluation of constant unsigned integer expressions should not lead to wrap around The underlying bit representations of floating point values shall not be used A violation is reported when a pointer to a floating point type is converted to a pointer to an integer type The increment and decrement operators should not be mixed with other operators in an expression Control statement expressions 13 1 13 2 13 3 13 4 13 5 13 6 13 7 Assignment operators shall not be used in expressions that yield a Boolean value Tests of a value against zero should be made explicit unless the operand is effectively Boolean Floating point
295. t file or when you want to inspect the output file or send it to Altium support Related information f 5 146 Tool Options Control Program Control Program L library directory ignore default library path Command line syntax Ldir library directory dir L ignore default library path Description With this option you can specify the path s where your system libraries specified with the I option are located If you want to specify multiple paths use the option L for each separate path By default path this is PRODDIR carm 1ib directory If you specify only L without a pathname or the long option ignore default library path the linker will not search the default path and also not in the paths specified in the environment variable LIBARM So the linker ignores steps 2 and 3 as listed below The priority order in which the linker searches for system libraries specified with the I option is 1 The path that is specified with the L option 2 The path that is specified in the environment variable LIBARM 3 The default directory PRODDIR carm 1lib or a processor specific sub directory Example Suppose you call the control program as follows ccarm test c Lc mylibs lcarm ccarm test c library directory c mylibs library carm First the linker looks in the directory c mylibs for library carm lib this option If it does not find the requested libraries it
296. t generate a ROM copy for data sections A copy table is generated and contains entries to clear BSS section However no entries to copy data sections from ROM to RAM are placed in the copy table The data sections are initialized when the application is downloaded The data sections are not re initialized when the application is restarted Related information f 5 114 Tool Options Linker Linker no rescan Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Linker entry and select Libraries 3 Disable the option Rescan libraries to solve unresolved externals Command line syntax no rescan Description When the linker processes a library it searches for symbol definitions that are referenced by the objects and libraries processed so far If the library contains a definition for an unresolved reference the linker extracts the object that contains the definition from the library The linker processes object files and libraries in the order in which they appear on the command line When all objects and libraries are processed the linker checks if there are unresolved symbols left If so the default behavior of the linker is to rescan all libraries in the order given at the command line The linker stops rescanning the libraries when all symbols are resolved or when the linker could not resolve any symbol s during the rescan of all libraries Notic
297. t_char C_expression 1 3 ARM Embedded Tools Reference amp Says that an output operand is written to before the inputs are read so this output must not be the same register as any input constraint _char Constraint character the type of register to be used for the C_expression C_expression Any C expression For output parameters it must be an value that is something that is legal to have on the left side of an assignment register_save_list register_name register_name q Name of the register you want to reserve Constraint Type Operand Remark character R general purpose r0 r11 Thumb mode r0 r7 register 64 bits Based on the specified register a register pair is formed 64 bit For example rOr1 r general purpose r0 r11 Ir Thumb mode rO r7 register i immediate value value l label label m memory label variable stack or memory operand a fixed address number other operand same as number used when in and output operands must be the same Use number 0 and number 1 to indicate the first and second half of a register pair when used in combination with R Table 1 2 Available input output operand constraints for the ARM Gb Section 3 4 Using Assembly in the C Source in Chapter C Language of the user s manual at With the attribute at you can place an object at an absolute address int myvar __at 0x100 Section 3
298. tack address located at a linker generate symbol for example _1c_ub_ stack These symbols are defined in the linker script file See section Stack Usage for detailed information on the stack 4 1 ARM Embedded Tools Reference 3 Call a user function which initializes hardware The startup code calls the function ___init_hardware This function has an empty implementation in the run time library which you should change if certain hardware initializations such as ROM RAM re mapping or MMU configuration are required before calling the main application 4 Copy initialized sections from ROM to RAM using a linker generated table also known as the copy table and clear uninitialized data sections in RAM 5 Initialize or copy the vector table The startup code calls the function init vector table This function has a default implementation in the run time library which copies the vector table from ROM to RAM if necessary You should only change it in very specific situations For example in case position dependent vectors are used B instructions instead of LDR PC and the vector table must be generated in RAM or copied from ROM to RAM with patched offsets in the B instructions 6 Switch to the user defined application mode as defined through the symbol _APPLICATION MODE_ inthe LSL file This symbol is used to set the value of the CPSR status register before calling the function main 7 Load register r10 with the end of the user
299. tance For example filename Type the name of a file in place of the word filename Encloses a list from which you must choose an item Encloses items that are optional For example carm Both carm and carm are valid commands Separates items in a list Read it as OR You can repeat the preceding item zero or more times Example carm option filename You can read this line as follows enter the command carm with or without an option follow this by zero or more options and specify a filename The following input lines are all valid carm test c carm g test c carm g s test c Not valid is carm g According to the syntax description you have to specify a filename Manual Purpose and Structure Icons The following illustrations are used in this manual LAN Note notes give you extra information Warning read the information carefully It prevents you from making serious mistakes or from loosing information This illustration indicates actions you can perform with the mouse Such as EDE menu entries and dialogs E Command line type your input on the command line d Reference follow this reference to find related topics xi ARM Embedded Tools Reference Related Publications C Standards e ISO IEC 9899 1999 E Programming languages C ISO IEC More information on the standards can be found at http www ansi org MISRA C e Guidelines for the Use of the C Language in Veh
300. tartup code initializes memory used by another processor that has no access to ROM e Aspace_name refers to a defined address space start_addr start_address start_addr_descr lt start_addr_descr gt start_addr_ descr run_addr expr symbol symbol_name e A symbol_name refers to the section that contains the startup code vector table statement vector_table section_name vecttab_spec lt vecttab_spec gt lt vector_def gt 8 11 ARM Embedded Tools Reference vecttab_spec vector def vector_spec vector _id_ spec vector value endianness_ def endianness_type vector size expr size expr id_symbol_prefix symbol_name run_addr expr template section_name template_symbol symbol _name vector prefix section_name fill vector_value no_inline vector vector_spec lt vector _spec gt id vector_id_spec fill vector_value number range lt range gt 9 symbol_name number lt number gt gt loop endianness lt endianness_type gt 1 big little 8 3 9 Derivative Definition derivative _definition derivative derivative_name lt parameter list gt 9 1 lt extends derivative_name lt argument_list gt 1 gt 0 1 lt derivative_spec gt e Aderivative_definition defines a derivative with the given derivative_name as a unique name derivative_spec core_def core_def bus_def mem_def s
301. th static storage duration not extern or automatic See assembler directive EQU in Section 3 2 Assembler Directives in Chapter Assembly Language extension isuffix Enables a language extension to specify imaginary floating point constants With this extension you can use an i suffix on a floating point constant to make the type Imaginary extern symbol Force an external reference extern assembler directive even when the symbol is not used in the module See assember directive EXTERN in Section 3 2 Assembler Directives in Chapter Assembly Language inline noinline smartinline Instead of the inline qualifier you can also use pragma inline and pragma noinline to inline a function body int w X Y Z C Language pragma inline int add int a int b int i 4 return a b pragma noinline void main void add 1 2 add x y N toll If a function has an inline or _noinline function qualifier then this qualifier will overrule the current pragma setting smartinline By default small fuctions that are not too often called are inlined This reduces execution speed at the cost of code size compiler option Oi With the pragma noinline pragma smartinline you can temporarily disable this optimization With the compiler options inline max iner and inline max size you have more control over the function inlining process of the compiler See
302. that can be used in the exit function Maximum number of bytes in a multibyte character for the extended character set specified by the current locale category LC_CTYPE see section 2 2 12 locale h Numeric conversions Next convert the intial portion of a string s to a double int long int and long long int value respectively double atof s int atoi s long atol s long long atoll s Next convert the initial portion of the string s to a float double and long double value respectively endp will point to the first character not used by the conversion Stdlib h float strtof s endp double strtod s endp long double strtold s endp Wchar h float westof s endp double westod s endp long double wcestold s endp Next convert the initial portion of the string s toa long long long unsigned long and unsigned long long respectively Base specifies the radix endp will point to the first character not used by the conversion Stdlib h long strtol s endp base long long strtoll s endp base unsigned long strtoul s endp base unsigned long long strtoull s endp base Wcehar h long westol s endp base long long westoll s endp base unsigned long wcstoul s endp base unsigned long long westoull s endp base 2 23 ARM Embedded Tools Reference Random number generation rand srand seed Memory management malloc size calloc nobj size free pt
303. the generated object code and the relative addresses Note that the assembler generates a relocatable object file with relative addresses With name you can specify a name for the list file This is only possible if you specify only one input file to the control program If you do not specify name or you specify more than one input files the control program names the generated list file s after the specified input file s with extension 1st Example This example generates the list files 1 1st and 2 1st for 1 c and 2 c If in this example also a name had been specified it would be ignored because two input files are specified ccarm l c 2 c list files Related information Gb Assembler option l Generate list file Assembler option L List file formatting options 5 149 ARM Embedded Tools Reference Control Program n dry run Command line syntax n dry run Description With this option you put the control program verbose mode The control program prints the invocations of the tools it would use to process the files without actually performing the steps Related information d Control Program option v verbose Verbose output 5 150 Tool Options Control Program Control Program no default libraries Command line syntax no default libraries Description By default the control program specifies the standard C libraries C99 and run time library to the linker With t
304. the smallest value To get the lowest value of two symbols min sym1l sym2 8 7 ARM Embedded Tools Reference sizeof int sizeof size_id Returns the size of the object group section or memory the identifier refers to To get the size of the section asection sizeof sect asection LAN The group and sect arguments only works in assignments The mem argument can be used anywhere in section layouts 8 3 6 LSL Definitions in the Linker Script File description lt definition gt 1 definition architecture_definition derivative definition board_spec section_definition section_setup e Atleast one architecture_definition must be present in the LSL file 8 3 7 Memory and Bus Definitions mem_def memory mem name lt mem_descr gt e Amem def defines a memory with the mem_name as a unique name mem_descr type lt reserved gt 1 mem type mau expr size expr speed number mapping e Amem def contains exactly one type statement e Amem def contains exactly one mau statement non zero size e Amem def contains exactly one size statement e Amem def contains zero or one speed statement default value is 1 e Amem def contains at least one mapping mem_type rom attrs rx ram attrs rw nvram attrs rwx bus_def bus bus_name lt bus_descr gt gt 0 e Abus_def statement defines a bus with the given bus_name as a uniq
305. thout the __novector function qualifier the compiler generates the vector_n symbol multiple times one for each interrupt_xxx qualifier which results in a link error void _ interrupt_irq _ novector another_handler void used __novector to prevent multiple _vector_6 symbols With the function type qualifier frame you can specify which registers and SFRs must be saved for a particular interrupt function void _ interrupt_xxx __frame reg reg isr void lb For more information see section 3 7 5 nterrupt Functions Exception Handlers in Chapter C Language of the user s manual 1 6 C Language 1 4 Register Usage Parameter passing Function parameters are first passed via registers If no more registers are available for a parameter the compiler pushes parameters on the stack Parameter Type Parameter Number 1 2 3 4 _ Bool rO ri r2 r3 char rO r1 r2 r3 short rO r1 r2 r3 int long rO ri r2 r3 float rO r r2 r3 32 bit pointer rO r r2 r3 32 bit struct rO r1 r2 r3 long long rOr1 rir2 r2r3 r3 double rOr1 rir2 r2r3 64 bit struct rOr1 rir2 r2r3 Table 1 3 Register usage for parameter passing Function return types The C compiler uses registers to store C function return values depending on the function return types Return Type Register _Bool rO char rO short rO int long rO fl
306. ting output section name and id out Size The size of the output section Module Local Symbols This part of the map file shows a table for each local scope within an object file Each table has three columns 1 the symbol name 2 the address of the symbol and 3 the space where the symbol resides in The table is sorted on symbol name within each space By default this part is not shown in the map file You have to turn this part on manually with linker option mq module local symbols Cross References This part of the map file lists all symbols defined in the object modules and for each symbol the object modules that contain a reference to the symbol are shown Also symbols that remain undefined are shown Locate Result Sections This part of the map file shows the absolute position of each section in the absolute object file It is organized per address space memory chip and group and sorted on space address Space The names of the address spaces as defined in the linker script file 1s1 The names are constructed of the derivative name followed by a colon the core name another colon and the space name Chip The names of the memory chips as defined in the linker script file 1s1 in the memory definitions Group Sections can be ordered in groups These are the names of the groups as defined in the linker script file 1s1 with the keyword group in the section_layout definition The name that is display
307. tions Append or move new modules after existing module name a name Append or move new modules before existing module name b name Create library without notification if library does not exist C Preserve last modified date from the library 0 Print symbols in library modules s 0 1 Replace only newer modules u Verbose V Miscellaneous Display options Display version header V Read options from file f file Suppress warnings above level n wn Table 5 1 Overview of librarian options and suboptions 5 192 Tool Options Librarian Librarian Command line syntax Description Displays an overview of all command line options Example The following invocations display a list of the available command line options ararm ararm Related information J 5 193 ARM Embedded Tools Reference Librarian d Command line syntax d v Description Delete the specified object modules from a library With the suboption v the librarian shows which files are removed v Verbose the librarian shows which files are removed Example ararm d mylib lib obj1l obj obj2 obj The librarian deletes obj1 obj and obj2 obj from the library mylib lib ararm d v mylib lib objl obj obj2 obj The librarian deletes obj1 obj and obj2 obj from the library mylib 1ib and displays which files are removed Related information i 5 194 Tool Options Librarian Librarian f Comman
308. trings each character is stored in the most significant byte of a half word which represents the ASCII value of the character The standard C escape sequences are allowed DH AB D gt 0x4100 0x4200 0x0000 second argument is empty 0x4400 Example TABLE DH 14 253 0x62 ABCD CHARS DH A Bpr G pD Related information d gt BS Block Storage DS Define Storage DB_ Define Byte DW_ Define Word DD Define Double Word annann Assembly Language DS DSB DSH DSW DSD Syntax label DS expression label DSB expression label DSH expression label DSW expression label DSD expression Description With the Ds directive Define Storage the assembler reserves a block of memory The reserved block of memory is not initialized to any value With the expression you specify the number of minimum addressable units MAUs that you want to reserve The expression must evaluate to an integer larger than zero and cannot contain references to symbols that are not yet defined in the assembly source If you specify label it gets the value of the location counter at the start of the directive processing AN You cannot use the Ds directive in sections with attribute init If you need to reserve initialized space in an init section use the BS directive instead The DSB DSH DSW and DSD directives are variants of the DS directive DSB The expression argument specifies the n
309. type at the location of the BX instruction Instruction Replacement Description BXcond Rm MOVcond PC Rm Only if architecture is ARMv4 3 3 2 Thumb Generic Instructions The ARM assembler recognizes the following generic instructions in Thumb mode ADR Thumb generic Load a PC relative address into a low register The address is specified as a target label The PC relative offset must be less than 1 kB The target label must be defined locally must be word aligned and must be in the same code section as the instruction The assembler will not emit a relocation type for the target label If the offset is out of range or the target label is external or in another section then the assembler generates an error message Instruction Replacement ADR Rad label ADD Rad PC offset LDR Thumb generic Load an address or a 32 bit constant value into a low register If the constant is in the range 0 255 the assembler will generate a MOV instruction Otherwise the assembler places the constant or the address in a literal pool and generates a PC relative LDR instruction that loads the value from the literal pool Instruction Replacement Description LDR Rd expr MOV Rad expr If expr is in range LDR Rad ltpool If expr is external or code PC relative or not in range Itpool DW expr The PC relative offset from the LDR instruction to the value in the literal pool must be positive and
310. ue name within a core architecture 8 8 Linker Script Language bus_descr 235 width expr bus width nr of data bits mapping legal destination bus only e The mau and width statements appear exactly once ina bus_descr The default value for width is the mau size e The bus width must be an integer times the bus MAU size e The MAU size must be non zero e Abus can only have a mapping on a destination bus through dest bus mapping map map _ descr lt map _descr gt map_descr dest destination dest_dbits range dest_offset expr size expr sre_dbits range src_offset expr e A mapping requires at least the size and dest statements e Each map_descr can occur only once e You can define multiple mappings from a single source e Overlap between source ranges or destination ranges is not allowed e Ifthe src_dbits or dest_dbits statement is not present its value defaults to the width value if the source destination is a bus and to the mau size otherwise destination space space _name bus lt proc_name core name gt l bus _name e Aspace_name refers to a defined address space e A proc_name refers to a defined processor e Acore_name refers to a defined core e A bus_name refers to a defined bus e The following mappings are allowed source to destination space gt space space gt bus bus gt bus memory gt bus
311. umber of bytes to reserve DSH The expression argument specifies the number of half words to reserve one half word is16 bits DSW The expression argument specifies the number of words to reserve one word is 32 bits DSD The expression argument specifies the number of double words to reserve one double word is 64 bits Example RES DS 5 3 allocate 8 bytes Related information d BS Block Storage DB_ Define Byte DH_ Define Half Word DW Define Word DD_ Define Double Word 3 19 ARM Embedded Tools Reference DW Syntax label DW argument argumeni Description With the Dw directive Define Word you allocate and initialize one word of memory for each argument One word is 32 bits An argument is e asingle or multiple character string constant e an expression e NULL indicated by two adjacent commas If you specify label it gets the value of the location counter at the start of the directive processing Multiple arguments are stored in sets of four bytes If an argument is NULL its corresponding address locations are flled with zeros Word arguments are stored as is Floating point values are not allowed If the evaluated argument is too large to be represented in a word the assembler issues an error and truncates the value In case of character strings each character is stored in the most significant byte of a word which represents the ASCII value of the character DW
312. unction This includes the time spent in all sub functions callees LN If you use the profiling option you must link the corresponding libraries too Refer to Section 8 4 Linking with Libraries in Chapter Linker of the user s manual for an overview of the profiling libraries When you use EDE automatically the correct libraries are linked Example carm pb test c carm profile block test c In this case you must link the library pbarm lib Related information d Chapter 6 Profiling in the user s manual 5 38 Tool Options Compiler Compiler R rename sections Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Miscellaneous 3 Add the option R to the Additional C compiler options field Command line syntax R name suffix f m fm rename sections name suffix f m fm Description In case a module must be loaded at a fixed address or a data section needs a special place in memory you can use this option to generate different section names You can then use this unique section name in the linker script file for locating Because sections have reserved names the compiler will not actually change the section name but will add a suffix to the name With the section name you select which sections are renamed With suffix you specify the suffix part which will be attached to the existing name
313. underscore characters _ and the first character cannot be a digit The assembler issues a warning if you redefine an existing symbol Example Suppose you defined the symbol LEN with the substitution string 32 DEFINE LEN 32 Then you can use the symbol LEN for example as follows DS LEN MESSAGE I The length is LEN The assembler preprocessor replaces LEN with 32 and assembles the following lines DS 32 MESSAGE I The length is 32 Related information UNDEF Undefine a DEFINE symbol or macro MACRO ENDM Define a macro 3 17 ARM Embedded Tools Reference DH Syntax label DH argument argument Description With the DH directive Define Half Word you allocate and initialize a half word of memory for each argument A half word is 16 bits An argument is e asingle or multiple character string constant e an expression e NULL indicated by two adjacent commas If you specify label it gets the value of the location counter at the start of the directive processing Multiple arguments are stored in successive half word address locations If an argument is NULL its corresponding address location is filled with zeros Half word arguments are stored as is Floating point values are not allowed If the evaluated argument is too large to be represented in a half word the assembler issues an error and truncates the value In case of single and multiple character s
314. up 8 13 8 4 Expression Evaluation 0 0 cece eects 8 17 8 5 Semantics of the Architecture Definition 8 18 8 5 1 Defining an Architecture 0 cece ee ee 8 19 8 5 2 Defining Internal Buses 0 eee cee es 8 20 8 5 3 Defining Address Spaces 0 cece eee eee 8 20 8 5 4 MAPPINGS a4 na cintec a N gd a Sahay eae ne be 8 23 8 6 Semantics of the Derivative Definition 8 26 8 6 1 Defining a Derivative cece eee 8 26 8 6 2 Instantiating Core Architectures 0 cee eee 8 27 8 6 3 Defining Internal Memory and Buses 0 a 8 27 8 7 Semantics of the Board Specification 000 8 29 8 7 1 Defining a Processor sic cea eee es Sew ee ee ee ee ee 8 29 8 7 2 Instantiating Derivatives 0 ccc ee 8 30 8 7 3 Defining External Memory and Buses 00 eee eee 8 30 8 8 Semantics of the Section Setup Definition 8 32 8 8 1 Setting up a Vector Table 1 tees 8 32 8 9 Semantics of the Section Layout Definition 8 33 8 9 1 Defining a Section Layout 0 eee ee 8 34 8 9 2 Creating and Locating Groups of Sections 8 34 8 9 3 Creating or Modifying Special Sections 04 8 39 8 9 4 Creating Symbols 0 cece ete eee 8 43 8 9 5 Conditional Group Statements 0 eee eee 8 43 MISRA C
315. upt_und _vector_1 __interrupt_swi _vector_2 __interrupt_iabt _vector_3 __interrupt_dabt _vector_4 __interrupt_irg _vector_6 __interrupt_fig _vector_7 Table 4 3 Function qualifiers and vector symbols 4 5 ARM Embedded Tools Reference Note that the reset handler is designated by the symbol START instead of vector_0 The fifth vector with symbol _vector_5 is reserved You should use the same vector symbols in hand coded assembly handlers You may first want to generate an idle handler in C with the compiler and than use the result as a starting point for your assembly implementation If the linker does not find the symbol for a handler it will generate a loop for the corresponding vector i e a jump to itself Note that if you have more than one handler for the same exception for example for different IRQ s or for different run time phases of your application and you are using the interrupt_type function qualifier of the compiler you will need to specify the novector attribute in order to prevent the compiler from generating the vector _nr symbol multiple times as this would lead to a link error You can ask the linker to reserve space in RAM memory for a copy of the vector table at run time at a certain address in memory Typically this would be the address which will be the mapping of address 0x00000000 after ROM RAM re mapping If you reserve space for a copy you can also let the startup code copy the table auto
316. urn hex Substitutes the symbol sequence with a character string that value of symbol represents the hexadecimal value of the symbol Macro string Allows the use of macro arguments as literal strings delimiter Macro local label Prevents name mangling on labels in macros override 3 32 Assembly Language Example The macro definition macro_a MACRO argl arg2 header db argl body dw argl arg2 ENDM terminator The macro call section data macro_a 2 3 The macro expands as follows db 2 dw 2 3 Related information Gb DEFINE Define a substitution string Section 4 9 Macro Operations in Chapter Assembly Language of the user s manual 3 33 ARM Embedded Tools Reference MESSAGE Syntax MESSAGE type str exp symbo str exp symbo Description With the MESSAGE directive you tell the assembler to print a message to stdout during the assembling process With type you can specify the following types of messages I Information message Error and warning counts are not affected and the assembler continues the assembling process W Warning message Increments the warning count and the assembler continues the assembling process E Error message Increments the error count and the assembler continues the assembling process F Fatal error message The assembler immediately aborts the assembling process and generates no object file or list file The MESSA
317. utes 2 Define the mutual order of the sections in the group By default a group is unrestricted which means that the linker has total freedom to place the sections of the group in the address space 8 36 The ordered keyword tells the linker to locate the sections in the same order in the address space as they appear in the group but not necessarily adjacent Suppose you have an ordered group that contains the sections A B and C By default the linker places the sections in the address space like A B C where section A gets the lowest possible address With direction high_to_lowin the section_layout space properties the linker places the sections in the address space like C B A where section A gets the highest possible address The contiguous keyword tells the linker to locate the sections in the group in a single address range Within a contiguous group the input sections are located in arbitrary order however the group occupies one contigous range of memory Due to alignment of sections there can be alignment gaps between the sections When you define a group that is both ordered and contiguous this is called a sequential group In a sequential group the linker places sections in the same order in the address space as they appear in the group and it occupies a contiguous range of memory Linker Script Language e The clustered keyword tells the linker to
318. utomatic address may not be assigned to a longer lived object The null pointer shall not be de referenced A violation is reported for every pointer dereference that is not guarded by a NULL pointer test All struct union members shall be fully specified Overlapping variable storage shall not be used A violation is reported for every union declaration Unions shall not be used to access the sub parts of larger types A violation is reported for a union containing a struct member bit fields shall have type unsigned int or signed int bit fields of type signed int shall be at least 2 bits long All struct union members shall be named Reserved and standard library names shall not be redefined Standard library function names shall not be reused Production libraries shall comply with the MISRA C restrictions The validity of library function parameters shall be checked Dynamic heap memory allocation shall not be used The error indicator errno shall not be used The macro offsetof shall not be used lt locale h gt and the setlocale function shall not be used The setjmp and longjmp functions shall not be used The signal handling facilities of lt signal n gt shall not be used The lt stdio h gt library shall not be used in production code The functions atof atoi atol shall not be used The functions abort exit getenv system shall not be used The time handling functions of library
319. value also may be specified the value is then taken from the next argument which is assumed to be of type int A period This separates the minimum field width from the precision A number specifying the maximum length of a string to be printed Or the number of digits printed after the decimal point only for floating point conversions Or the minimum number of digits to be printed for an integer conversion Instead of a numeric value also may be specified the value is then taken from the next argument which is assumed to be of type int A length modifier h P I or L h indicates that the argument is to be treated as a short or unsigned short number P should be used if the argument is a long integer I for a long long L indicates that the argument is a long double Flags length specifier period precision and length modifier are optional the conversion character is not The conversion character must be one of the following if a character following is not in the list the behavior is undefined 2 17 ARM Embedded Tools Reference Character Printed as d i int signed decimal o int unsigned octal x X int unsigned hexadecimal in lowercase or uppercase respectively u int unsigned decimal c int single character converted to unsigned char S char the characters from the string are printed until a NULL character is found When the given precision is met before printing will
320. verview of Assembler Directives Assembler directives are grouped in the following categories Assembly control directives Symbol definition directives Data definition Storage allocation directives Macro and conditional assembly directives Listing control and options directives HLL directives The following tables provide an overview of all assembler directives Overview of assembly control directives Directive Description END Indicates the end of an assembly module INCLUDE Include file MESSAGE Programmer generated message Overview of symbol definition directives SECTION ENDSEC SET SIZE SOURCE TYPE WEAK Directive Description EQU Set permanent value to a symbol EXTERN Import global section symbol GLOBAL Declare global section symbol Start a new section Set temporary value to a symbol Set size of symbol in the ELF symbol table Specify name of original C source file Set symbol type in the ELF symbol table Mark a symbol as weak 3 6 Assembly Language Overview of data definition storage allocation directives Directive Description ALIGN Align location counter BS BSB BSH Define block storage initialized BSW BSD DB Define byte DH Define half word DW Define word zDD Define double word DS DSB DSH Define storage DSW DSD OFFSET Move location counter forwards Overview of macro and
321. wing lines g DDEMO 1 test c Specify the option file to the compiler carm f myoptions carm option file myoptions This is equivalent to the following command line carm g DDEMO 1 test c Related information J 5 19 ARM Embedded Tools Reference Compiler g debug info Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Debugging 3 Enable the option Generate symbolic debug information 4 Select one of the suboptions Command line syntax g cla debug info suboption You can set the following suboptions when you specify g without suboption the default is ga c call frame Generate call frame information only a all Generate all debug information Description With this option you tell the compiler to add directives to the output file for including symbolic information This facilitates high level debugging but increases the size of the resulting assembler file and thus the size of the object file For the final application compile your C files without debug information When you specify a high optimization level debug comfort may decrease Therefore the compiler issues a warning if the chosen optimizations expect to affect ease of debugging call frame information With this suboption only call frame information is generated This enables you to inspect parameters of nested functions
322. without all arguments Macro arguments shall not contain pre preprocessing directives A violation is reported when the first token of an actual macro argument is Macro definitions parameters should be enclosed in parentheses Don t use undefined identifiers in pre processing directives A macro definition shall contain at most one or operator All uses of the pragma directive shall be documented This rule is really a documentation issue The compiler will flag all pragma directives as violations MISRA C Rules 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 R A A R R 222223232232 ee ee ee eee DDVDIDII ITD DD Se SS fc oS Ss 2c 2c Cc See Se Se Ss Se 3 defined shall only be used in one of the two standard forms Pointer arithmetic should not be used No more than 2 levels of pointer indirection should be used A violation is reported when a pointer with three or more levels of indirection is declared No relational operators between pointers to different objects In general checking whether two pointers point to the same object is impossible The compiler will only report a violation for a relational operation with incompatible pointer types Non constant pointers to functions shall not be used Functions assigned to the same pointer shall be of identical type A
323. xtensible locale specific wide character classification wctype property iswctype wc desc Constructs a value of type wctype_t that describes a class of wide characters identified by the string property If property identifies a valid class of wide characters according to the LC_TYPE category see sec tion 2 2 12 locale h of the current locale a non zero value is returned that can be used as an argument in the iswctype function Tests whether the wide character wc is a member of the class repre sented by wctype_t desc Returns a non zero value if tested true Function Equivalent to locale specific test iswalnum wc iswctype wc wctype alnum iswalpha wc iswctype wc wctype alpha iswentrl wc iswctype wc wctype cntr1 iswdigit wc iswctype wc wctype digit iswgraph wc iswctype wc wctype graph iswlower wc iswctype wc wctype lower iswprint wc iswctype wc wctype print iswpunct wc iswctype wc wctype punct iswspace wc iswctype wc wctype space iswupper wc iswctype wc wctype upper iswxditig wc iswctype wc wctype xdigit wctrans property towctrans wc desc Constructs a value of type wctype_t that describes a mapping between wide characters identified by the string property If property identifies a valid mapping of wide characters according to the LC_TYPE category see section 2 2 12 locale h of the current loca
324. yping all options on the command line you can create an option file which contains all options and flags you want to specify With this option you specify the option file to the assembler Use an option file when the command line would exceed the limits of the operating system or just to store options and save typing Option files can also be generated on the fly for example by the make utility You can specify the option f multiple times Format of an option file e Multiple arguments on one line in the option file are allowed e To include whitespace in an argument surround the argument with single or double quotes e If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded e When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line e Itis possible to nest command line files up to 25 levels 5 65 ARM Embedded Tools Reference Example Suppose the file myoptions contains the following lines gaL test src Specify the option file to the assembler asarm f myoptions asarm option file myoptions This is equivalent to the following command line asarm gaL test src Related
325. zation so you can still specify the option t Related information d Compiler option O Specify optimization level 5 45 ARM Embedded Tools Reference Compiler thumb Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Code Generation 3 Enable the option Use Thumb instruction set Command line syntax thumb Description With this option you tell the compiler to generate 16 bit thumb instructions Related information ab Compiler option interwork Generate interworking code 5 46 Tool Options Compiler Compiler U undefine Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compiler entry and select Miscellaneous 3 Add the option U to the Additional C compiler options field Command line syntax Umacro_name undefine macro_name Description With this option you can undefine an earlier defined macro as with undef This option is for example useful to undefine predefined macros However the following predefined ISO C standard macros cannot be undefined _ FILE current source filename _ LINE __ current source line number int type _ TIME hh mm ss _ DATE__ mmmddyyyy __STDC___level of ANSI standard Example To undefine the predefined macro _ TASKING carm U_ TASKING test c carm undefine TASKING test c
Download Pdf Manuals
Related Search
Related Contents
R333 - Tucano Urbano Operating instructions Betriebsanleitung Mode d'emploi Manual de AC-Safe AC-302 Instructions / Assembly Oscilloscopi Agilent InfiniiVision serie 6000 X Guida all`uso Quick Setup Guide Garage遭 Garage0 Instructions de Montage et d`Utilisation VS EN 1004-3-85 Superchips Model 1815 flashpaq Tuner Copyright © All rights reserved.