Home
TR0109 TSK3000 Embedded Tools Reference
Contents
1. 7 16 7 5 Semantics of the Architecture Definition 7 17 7 5 1 Defining an Architecture 7 18 7 5 2 Defining Internal Buses 7 18 7 5 3 Defining Address Spaces 7 19 7 5 4 Mappiligs 9 Lhe p eR Ce e EE MERI REDDE 7 21 7 6 Semantics of the Derivative Definition 7 24 7 6 1 Defining a Derivative 7 24 7 6 2 Instantiating Core Architectures 7 25 7 6 3 Defining Internal Memory and Buses 7 25 7 7 Semantics of the Board Specification 7 27 7 7 1 Defining a Processor 7 27 7 7 2 Instantiating Derivatives 7 28 7 7 3 Defining External Memory and Buses 7 28 7 8 Semantics of the Section Layout Definition 7 30 7 8 1 Defining a Section Layout 7 30 7 8 2 Creating and Locating Groups of Sections 7 31 7 8 3 Creating or Modifying Special Sections 7 36 7 8 4 Creating 5 7 39 7 8 5 Conditional Group Statements 7 39 MISRA C Rules 8 1 Index TSK3000 Embedded Tools Reference
2. 1 2 output param list input param list register save list C Language instruction template 9eparm nr regnum output param list input param list amp constraint char C expression register save list register name q Assembly instructions that may contain parameters from the input list or output list in the form parm_nr Parameter number the range 0 9 With the optional regnum you can access an individual register from a register pair 2 amp constraint char C expression constraint char C expression 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 character the type of register to be used for the 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 name Name of the register you want to reserve Constraint Operand Remark character R general purpose v0 v1 a0 a3 Based on the specified register a register 64 bits ktO kt1 tO t9 register pair is formed 64 bit For s0 s8 example v0 v1 r general purpose v0 v1 a0 a3 register 32 bits ktO kt1 tO t9 s0 s8 i immediate value value label label m memory label variable stack or memory oper
3. 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 tlk tlk help tlk To see a detailed description of the available options enter tlk help options 4 76 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 options Intel HEX records and or Motorola S records Command line syntax c basename format adar chip output basename format addr 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 In Altium Designer you cannot specify the address size because Altium Designer always uses the default values 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
4. 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 151 delivered with the product in the directory Program Files Altium2004 System Tasking 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 qo RESUME Resume a previously defined section 3 35 TSK3000 Embedded Tools Reference SET Syntax symbol 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 allowed Example COUNT SET 0 Initialize count Later on you can assign other values to the symbol Related information 4 EQU Set permanent value to symbol 3 36 Assembly Language SIZ
5. 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 string Example ID set GSTRPOS TASKING ASK 1 ID set 8STRPOS TASKING BUG ID 3 4 Assembly Language 3 2 Assembler Directives 3 2 1 Overview of Assembler Directives Assembler directives are grouped in the following categories e Assembly control directives e Symbol definition directives e Data definition Storage allocation directives e Macro and conditional assembly directives e Listing control and options directives e 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 Directive Description EQU Set permanent value to a symbol EXTERN Import global section symbol GLOBAL Declare global section symbol RESUME Resume a previously defined section SECTION ENDSEC Start a new section SET Set temporary value to a symbol SIZE Set size of symbol in the ELF symbol table SOURCE Specify name of original C source file TYPE Set symbol typ
6. 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 min int min expr expr Returns the value of the expression hat has the smallest value To get the lowest value of two symbols min syml sym2 7 7 TSK3000 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 t The group and sect arguments only works in assignments The mem argument can be used anywhere in section layouts 7 3 6 LSL Definitions in the Linker Script File description lt definition gt 1 definition architecture definition derivative definition board spec section definition e Atleast one architecture definition must be present in the LSL file 7 39 7 Memory and Bus Definitions mem def memory mem name mem descr gt gt
7. as3000 Ic NprojNinclude test src as3000 include directory c proj include test src 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 qo Assembler option H include file Include file before source 4 59 TSK3000 Embedded Tools Reference Assembler i symbol scope 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 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 de 4 60 Tool Options Assembler Assembler k keep output files Menu entry Altium Designer 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
8. 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 1oad 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 1oad 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 of 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 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
9. 7 23 TSK3000 Embedded Tools Reference 7 6 Semantics of the Derivative Definition Keywords in 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 src dbits src offset 7 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 7 24 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 parml parm2 1 extends name parent derivh arguments definitions 7 6 2 Instantiating Core Architectures With the keyword core you instantiate a core architecture in a derivative e With the keyw
10. Isl check Check LSL file s and exit Section 7 7 Controlling the Linker with a Script in chapter Using the Linker of the user s manual 4 81 TSK3000 Embedded Tools Reference Linker diag Menu entry 1 From the View menu select Workspace Panels System Messages The Messages panel appears 2 In the Messages panel right click on the message you want more information on A popup menu appears 3 Select More Info A Message Info box appears with additional information 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 linker does not link locate any files Example To display an explanation of message number 106 enter tlk diag 106 This results in the following message and explanation E106 unresolved external message The linker could not resolve all external symbols This is an error when the incremental linking option is disable
11. Syntax NOPINSERTION assembly source lines NONOPINSERTION Description You can instruct the assembler to automatically fill the delay slots of jump and branch instructions with a NOP instruction see assembler option nop insertion With the NOPINSERTION and NONOPINSERTION directives you have more control over te NOP insertion Example Section text nopinsertion jr 2 a nop is added after each instruction jalr 2 3 nonopinsertion jr 2 no extra nop instruction is added jalr 2 3 Related information 4 Assembler option nop insertion in Section 4 2 Assembler Options of Chapter Tool Options 3 30 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 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 lo
12. TSK3000 Embedded Tools Reference See section 7 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 called 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 in a derivative definition since the linker automatically instantiates only a single core for an unused architecture See section 7 6 Semantics of the Derivative Definition for a detailed description of LSL in the derivative
13. vi Manual Purpose and Structure Manual Purpose and Structure Windows Users The documentation explains and describes how to use the TASKING TSK3000 toolchain to program a TSK3000 processor You can use the tools either with the graphical Altium Designer or from the command line in a command prompt window Structure The toolchain documentation consists of a user s manual Using the TSK3000 Embedded Tools which includes a Getting Started section and a separate reference manual this manual Start by reading the Getting Started in Chapter 1 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 TSK3000 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 Libraries 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
14. 3 6 Assembly Language 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 7 TSK3000 Embedded Tools Reference ALIGN Syntax ALIGN expression Description 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
15. Description The TASKING C compilers offer four optimization levels and a custom level at each level a specific set of optimizations is enabled e Level 0 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 e Level 1 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 e Level 2 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 e Level 3 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 e Custom level Ox X you can enable disable specific optimizations With these options you can control th
16. TSK3000 Embedded Tools Reference TRO109 June 08 2005 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 Altium Designer CAMtastic Design Explorer DXP LiveDesign NanoBoard NanoTalk Nexar nVisage CircuitStudio P CAD Protel Situs TASKING and Topological Autorouting 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 2 1 8 1 4 1 5 1 6 1 7 Libraries 2 1 2 2 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9
17. 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 tcc T3000 DDEMO test c tcc T3000 DDEMO 1 test c tcc T3000 define DEMO test c tcc T3000 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 tcc T3000 D MAX A B A B A B test c 4 117 TSK3000 Embedded Tools Reference Related information Control Program option U Undefine preprocessor macro Control Program option f Read options from file 4 118 Tool Options Control Program Control Program d Isl file Command line syntax dfile sl file file Description A linker script file contains vital information 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
18. To suppress warnings 135 and 136 enter 135 136 in the Specific warnings to suppress field or enter the following on the command line c3000 test c w135 w136 c3000 test c no warnings 135 no warnings 136 Related information q Compiler option warnings as errors Treat warnings as errors 4 43 TSK3000 Embedded Tools Reference 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 qo Compiler option w Suppress some or all warnings 4 44 Tool Options Assembler 4 2 Assembler Options Altium Designer uses a makefile to build your entire project This means that in Altium Designer you cannot run the assembler separately If you want assembly results you must compile a single C source file from within Altium Designer the file is then also assembled However you can set options specific for the assembler Options in Altium Designer versus options on the command line Most command line options have an equivalent option in Altium Designer but som
19. 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 do 4 61 TSK3000 Embedded Tools Reference Assembler L list format 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 Lflags 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 il 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
20. stdio h 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 time h shall not be used See also section 4 7 C Code Checking MISRA C in Chapter Using the Compiler of the User s manual 8 5 TSK3000 Embedded Tools Reference 8 6 Index Index Symbols asm 1 2 __at 1 4 BUILD 1 12 C3000 1 12 CPU 1 12 DOUBLE FP 1 12 interrupt 1 5 noinline 1 4 REVISION 1 12 SINGLE FP 1 12 TASKING 1 12 VERSION __ 1 12 close 2 15 Exit 2 24 fss break 2 5 fss init 2 5 _IOFBF 2 16 _IOLBF 2 16 _IONBF 2 16 _lseek 2 15 _open 2 15 _read 2 15 _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 7 Address spaces 7 19 alias 1 8 align 3 8 Alignment gaps 7 34 Architecture definition 7 1 7 17 arg 3 2 asctime 2 29 asin functions 2 7 asinh functions 2 7 Assembler directives align 3 8 break 3 9 bs 3 10 bsb 3 10 bsh 3 10 bsw 3 10 calls 3 11 db 3 12 define 3 13 dh 3 14 ds 3 15 dsb 3 15 dsh 3 15 dsw 3 15 dw 3 16 end 3 17 equ 3 18 extern 3 19 for endfor 3 20 global 3 22 If elit else endif 3 23 include 3 25 list nolist 3 26 macro endm 3 27 message 3 29 nopins
21. 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 Suboptions 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 4 1 Overview of librarian options and suboptions 4 177 TSK3000 Embedded Tools Reference 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 tlb tlb Related information do 4 178 Tool Options Librarian 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 vV Verbose the librarian shows which files are removed Example tlb d mylib lib objl obj obj2 obj The librarian deletes obj1 0ob j and obj2 0bj from the library mylib lib tlb d v mylib lib objl obj obj2 0b
22. 1 group type clustered contiguous ordered overlay e For non contiguous groups you can only specify group alignment and attributes 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 attribute oY readable sections w writable sections x executable code sections i initialized sections s scratch sections b blanked cleared sections load or run addr addr absolute addr range addr gt gt 0 addr absolute 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 range or page restriction cannot be ordered contiguous or clustered memory reference mem proc name gt 011 core name gt 011 mem name Aproc name refers to a defined processor Acore name refers to a defined core e name refers to a defined memory if statement if expr section statement else section statement 0 l 7 15 TSK3000 Embedded Tools Reference section_creation_statement section section name lt section_spec gt l select section statement gt gt 0 attributes fill spec size expr section_spec 7 4 Expression Evaluation Only constant expressions are allowed
23. 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 qo Section 7 4 Linking with Libraries in chapter Using the Linker of the user s manual 4 83 TSK3000 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 1k3000 e1k Example To write errors to errors elk instead of stderr enter tlk error file errors elk test obj Related information do 4 84 Tool Options Linker 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 Altium Designer 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 a
24. 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 a file FSS implementation Used by the function remove FSS implementation Writes a sequence of characters to a file FSS implementation 2 15 TSK3000 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 r read open text file for reading 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 ac 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 buff
25. gt s2 Compares the first n characters of s7 to the first n characters of s2 Returns lt 0 if s1 lt s2 O if s1 s2 or gt O if s7 gt 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 52 0 if s1 s2 or gt O if s1 gt s2 See section 2 2 12 locale h Libraries Stdio h Wchar h Description strxfrm sl s2 n Search functions Stdio h wcsxfrm sl s2 n Wchar h Transforms a local string s2 so that a comparison between transformed strings with strcmp gives the same result as a comparison between non transformed strings with strcoll Returns the transformed string s7 Description memchr s c n strchr s c strrchr s c strspn s set strcospn s set strpbrk s set strstr s sub strtok s delim wmemchr s c n wcschr s c wcsrchr s c wcsspn s set wcscspn s set wcspbrk s set wcsstr s sub wcstok s delim Checks the first n characters of s on the occurence of character c Returns a pointer to the found character Returns a pointer to the first occurence of character c in string s or the null pointer if not found Returns a pointer to the last occurence of character c in string s or the null pointer if not found Searches s for a sequence of characters specified in set Returns th
26. 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 cbrt Returns the real cube root of x 2x1 3 Not implemented 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 2 2 pow powl powf power Returns x raised to the power y xY sqrt sqrtl sqrtf sqrt Returns the non negative square root of x x 0 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 indcated 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 nexttowardf argument 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
27. 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 6 Related publications xx remainder functions 2 9 remove 2 22 remquo functions 2 9 rename 2 22 repeat endrep 3 33 Reset vector 7 20 resume 3 34 rewind 2 22 rint functions 2 9 round functions 2 9 runtime 1 10 S scalbln functions 2 10 scalbn functions 2 10 scanf 2 18 2 20 conversion characters 2 19 sdata 1 10 Section 3 35 section endsection 1 10 Section attributes 3 35 Section information 4 69 Section layout definition 7 3 7 30 Sections 3 35 grouping 7 31 SEEK CUR 2 21 SEEK END 2 21 SEEK SET 2 21 set 3 36 setbuf 2 16 setjmp 2 12 setlocale 2 6 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 37 size t 2 14 smartinline 1 9 snprintf 2 21 source 3 38 source nosource 1 10 sprintf 2 21 sqrt functions 2 10 srand 2 24 sscanf 2 20 Index 9 TSK3000 Embedded Tools Reference Stack 7 19 Start address 7 20 stat 2 31 stderr 2 15 stdin 2 15 stdout 2 15 strcat 2 26 3 3 strchr 2 27 strcmp 2 26 3 4 strcoll 2 26 strcpy 2 26 strcspn 2 27 strerror 2 28 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 strto
28. record for S3 records Layout S 7 length byte address checksum byte 6 3 TSK3000 Embedded Tools Reference Example 70500000000FA 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 address lt checksum_byte gt Example S804FF0003F9 checksum _ address length The checksum calculation of S8 records is identical 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 address checksum byte Example 9030210EA checksum _ address length The checksum calculation of S9 records is identical to SO 6 4 Object File Formats 6 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 Addre
29. s endp base 2 23 TSK3000 Embedded Tools Reference Random number generation rand srand seed Memory management malloc size calloc nobj size free ptr 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 initialized with zeros Returns a pointer to the allocated space Deallocates the memory space pointed to by ptr which should be a pointer 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 status as the return value Status can also be specified with the predefined macros EXIT SUCCES or EXIT FAILURE Same as exit but no r
30. the default is zero If you specify label it gets the value of the location counter at the start of the directive processing AN 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 and BSW directives are variants of the BS directive BSB The expression argument specifies the number of bytes 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 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 Related information d gt DS Define Storage 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 The
31. 0 Amem def defines a memory with the mem name as a unique name mem descr type reserved 0 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 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 bus descr gt gt 0 Abus def statement defines a bus with the given bus name as a unique name within a core architecture 7 8 Linker Script Language bus descr mau expr width expr bus width nr of data bits mapping legal destination bus only e The mau and width statements appear exactly once in a 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 gt gt 0 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 Eachmap descr can occur only once e You can define multiple mappings from a
32. 00 53 w weekday 0 6 Sunday is 0 96eW week number of the year Monday as first day of the week 00 53 9ex date representation X local time representation y year without century 00 99 Y year with century Z time zone name if any 9696 96 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 c1ose FSS implementation Use the file system simulation feature of the debugger to retrieve the current directory on the host Returns the directory name FSS
33. 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 1 1 Introduction ose exa dtes asc o EX RR a widen RR 1 1 Data TYPES ce erro oet boe ecubb pota ede ibd iis 1 2 KeyWord S s riscia setai ai peru Hae hea aap Paya ea eager ERES 1 2 Register Usage sciet e RIVE E edna ees 1 6 Intrinsic FUNCOMS e e Yu RUE RR RR RP 1 7 cuc 1 8 Predefined 1 12 2 1 HATO GU eto PR 2 1 Library Functions isses eie me keen ERR ee ES 2 2 assen Di iis pep RR HO nd Ed testi dri e rots 2 2 complex s ead ye te NHAC PG E eee 2 2 ctype h and 2 2 erro iua vaed pees aida d edie RR NU ERA E Red uod 2 3 TOD e e or atu eb dic 2 4 TOAV a PDT 2 4 2 5 2 5 inttypes h and stdinth 2 5 160646 u T EC 2 6 lifts b i tbe bare aM 2 6 locale hi e d 2 6 math h and tgmath h 2 7 SEYMP 2 12 Signal Ii 2 13 xb eene x RU eed 2 13 stdbooll dead Ead EY eed us 2
34. 3 lo 3 3 sb 3 3 Ish 3 3 msb 3 3 msh 3 3 strcat 3 3 strcmp 3 4 strlen 3 4 strpos 3 4 detailed description 3 2 overview 3 1 atan functions 2 7 atan2 functions 2 7 atanh functions 2 7 atexit 2 24 atof 2 23 atoi 2 23 atol 2 23 atoll 2 23 B bigendian 3 2 Board specification 7 3 7 27 break 3 9 bs 3 10 bsb 3 10 bsearch 2 25 bsh 3 10 bsw 3 10 btowc 2 32 BUFSIZ 2 15 Build options 4 91 include files path 4 17 4 59 4 88 Bus definition 7 2 Buses 7 18 C C style comments 4 4 call 1 8 Call graph 3 11 calloc 2 24 calls 3 11 cbrt functions 2 10 ceil functions 2 9 Index chdir 2 31 Check source code 4 6 4 48 4 116 clearerr 2 22 clock 2 29 clock t 2 28 CLOCKS PER SEC 2 29 close 2 31 cnt 3 2 Code compaction 4 19 Command file 4 164 Comments 7 4 Compiler options 4 1 help 4 3 check 4 6 diag 4 9 error file 4 11 inline 4 19 inline max incr 4 20 inline max size 4 20 misrac 4 23 misrac advisory warnings 4 24 misrac required warnings 4 24 sdata 4 35 signed bitfields 4 36 static 4 37 use hardware 4 41 warnings as errors 4 44 A language 4 4 c iso 4 5 D define 4 7 E preprocess 4 10 F no double 4 12 f option file 4 13 g debug info 4 15 H include file 4 16 I include directory 4 17 k keep output files 4 21 m call 4 22 n stdout 4
35. 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 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 MISRA C Rules 44 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 70 71 72 R R 222 22222222222222222 2222 R R 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 t
36. 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 and the address space to be emitted option space Example To generate an Motorola S record output file tcc T3000 format SREC testl c test2 c output test sre Related information Control program option address size Set address size for linker IHEX SREC files Control program option space Set linker output space name Linker option o Output format Linker option c Generate hex file 4 126 Tool Options Control Program Control Program fp trap Command line syntax fp trap Description By default the control program uses the non trapping floating point library p3000 Lib With this option you tell the control program to use the trapping floating point library p3000t lib 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 information 4 127 TSK3000 Embedded Tools Reference Control Program g debug info Command line synt
37. Language Contains an overview of all assembly functions and directives that you can use in your assembly source code Chapter 4 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 5 List File Formats Contains a description of the following list file formats e Assembler List File Format e Linker Map File Format Chapter 6 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 7 Linker Script Language Contains a description of the linker script language LSL Chapter 8 MISRA C Rules Contains a description the supported and unsupported MISRA C code checking rules TSK3000 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 instance 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 c3000 Both c3000 and c3000 are valid commands Separates items in a list Read it as OR You can r
38. MAUs and issues a warning 3 8 Assembly Language 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 are detected Example FOR MYVAR IN 10 TO 20 assembly source lines hess IF MYVAR gt 15 BREAK ENDIF ENDREP TSK3000 Embedded Tools Reference BS BSB BSH BSW Syntax label BS expression expression2 label BSB expression expression2 label BSH expression1 expression2 label BSW 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
39. 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 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 109 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 y isgreaterequal Returns the value of x gt y isless Returns the value of x y islessequal Returns the value of x y islessgreater Returns the value of x y x gt y isunordered Returns 1 if its arguments are unordered 0 otherwise 2 11 TSK3000 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
40. Object File Formats Example 0F00200000232222754E00754F04AFAFAE4E22C3 _ 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 6 7 TSK3000 Embedded Tools Reference 6 8 7 Linker Script Language Summary This chapter describes the syntax of the linker script language LSL 7 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 me
41. 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 locate sections in physical memory 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
42. 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 C90 or C99 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 c3000 c90 test c c3000 iso 90 test c Related information qo Compiler option A Language extensions 4 5 TSK3000 Embedded Tools Reference Compiler check 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 check to the Additional C compiler options field 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 4 Assembler option check Check syntax 4 6 Tool Options Compiler Compiler D
43. best program Related information qo PAGE Format the assembler list file Assembler option l Generate list file in Section 4 2 Assembler Options of Chapter Tool Options 3 39 TSK3000 Embedded Tools Reference 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 4 SIZE Set Symbol Size 3 40 Assembly Language 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 UNDEF LEN Undefines the LEN substitution string that was previously defined with the DEFINE directive Related information qo DEFINE Define substitution string 3 41 TSK3000 Embedded Tools Reference WEAK
44. 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 the derivative you want to connect it to 7 29 TSK3000 Embedded Tools Reference 7 8 Semantics of the Section Layout Definition Keywords in the section layout definition section layout direction low to high high to low group align attributes rwxbis fill ordered clustered contiguous overlay allow cross references load addr mem run addr mem page select heap size Stack size reserved size attributes rwx 111 alloc allowed absolute copytable section size attributes rwx fill if else 7 8 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 relative to each other and what the absolute run and load addresses of each section will be 7 30 Linker Script Language 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 t
45. d gt SECTION Start a new section 3 34 First First Second Second Resume Resume Resume text section data section text section data section in the second text section in the first data section in the second data section Assembly Language 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 To resume a previously defined section use the RESUME directive 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 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
46. 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 Next to User macro click on the down arrow in the right pane to expand macro input 4 Click on an empty Macro field and enter a macro name Then click an empty cell to confirm 5 Optionally click in the Value field and enter a definition Then click an empty cell to confirm Command line syntax Dmacro name smacro definition name zmacro 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 definit
47. 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 applications it is enough to specify the derivative in the LSL file See section 7 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 7 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 7 2 Linker
48. detected Function prototypes shall be visible at the definition and call The function prototype of the declaration shall match the definition 8 3 TSK3000 Embedded Tools Reference 73 R Identifiers shall be given for all prototype parameters or for none 74 R Parameter identifiers shall be identical for declaration definition 75 R Every function shall have an explicit return type 76 R Functions with no parameters shall have a void parameter list 77 R Anactual parameter type shall be compatible with the prototype 78 number of actual parameters shall match the prototype 79 R values returned by void functions shall not be used 80 R Void expressions shall not be passed as function parameters 81 A const should be used for reference parameters not modified 82 A A function should have a single point of exit 83 R Every exit point shall have a return of the declared return type 84 R For void functions return shall not have an expression 85 A Function calls with no parameters should have empty parentheses 86 A If a function returns error information it should be tested A violation is reported when the return value of a function is ignored 87 R include shall only be preceded by other directives or comments 88 R Non standard characters shall not occur in include directives 89 R amp include shall be followed by either filename or filename 90 Plain macros
49. dialog box appears 2 Expand the Linker entry and select Miscellaneous 3 Add the option user provided initialization code to the Additional linker options field 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 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 do 4 89 TSK3000 Embedded Tools Reference Linker k keep output files Menu entry Altium Designer 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
50. is a null then the loop is repeated with each occurrence of the symbol var removed 2 In the 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 abel it gets the value of the location counter at the start of the directive processing Example 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 20 Assembly Language Related information qo REPEAT ENDREP Repeat sequence of source lines 3 21 TSK3000 Embedded Tools Reference GLOBAL Syntax GLOBAL symbol symbol Description All symbols or labels defined in the current section or module are local to the m
51. 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 isspace iswspace 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 tolower towlower Returns c converted to a lowercase character if it is an uppercase character otherwise c is returned 2 2 Libraries Ctype h Wctype h Description 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 2 2 4 errno h int errno External variable that h
52. lines x mylib lib objl obj w5 Specify the option file to the librarian tlb f myoptions This is equivalent to the following command line tlb x mylib lib objl obj w5 4 180 Tool Options Librarian Librarian m Command line syntax 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 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 0bjl1 obj 0bj2 0bj 0bj3 0obj To move obj1 0bj to the end of mylib lib tlb m mylib lib objl obj To move obj3 obj just before obj2 0bj tlb m b obj3 obj mylib lib obj2 obj The library mylib 1ib after these two invocations now looks like 0bj3 0obj 0bj2 0bj 0bjl obj Related information qo Librarian option t Print library contents 4 181 TSK3000 Embedded Tools Reference Librarian p Command line syntax Description Print the specified object module s in the library to standard output This option is only useful
53. locating the section See section 7 8 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 7 3 TSK3000 Embedded Tools Reference section_layout space_name section placement statements 7 3 Syntax of the Linker Script Language 7 39 1 Preprocessing 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 lsl Preprocess and include the file arch 1s1 at this point in the LSL file 7 3 2 Lexical Syntax The following lexicon is used to describe the syntax of the Linker Script Language Ais defined as BC Ais defined as B and C B is followed by Ais defined as B or C lt B gt 0 1 zero or one occurrence of B B 0 zero of more occurrences of B lt gt gt 1 one of more occurrences of IDENTIFIER a character sequence starting with a z A Z or Following characters may also be digits
54. 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 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 96 denom The intmax t denom result is stored in the quot and rem components of the imaxdiv t structure type 2 5 TSK3000 Embedded Tools Reference 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 strtoul endptr int base intmax t wcstoimax const wchar t Convert wide string to maximum sized integer restrict nptr wchar t Compare wctol restrict endptr int base uintmax t wcstoumax const wchar t Convert wide string to maximem sized unsigned integer restrict nptr wchar t Compare wctoul restrict 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 define xor_e
55. of the previous bytes from length 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 where 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 LE The ength 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 6 6
56. only global symbols are emitted Having local symbols in the object file can be useful for debugging Related information db 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 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 as3000 error file errors err test src Related information 4 53 TSK3000 Embedded Tools Reference 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 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 assembler Use an
57. 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 atext line reaches its length limit use a continue the line Whitespace between quotes is preserved This is a continuation line This is a continuation line It is possible to nest command line files up to 25 levels 4 54 Tool Options Assembler Example Suppose the file myopt ions contains the following lines gaL test src Specify the option file to the assembler as3000 f myoptions as3000 option file myoptions This is equivalent to the following command line as3000 gaL test src Related information do 4 55 TSK3000 Embedded Tools Reference Assembler gp relative Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand t
58. 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 parml parm2 1 extends name parent arch arguments definitions 7 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 7 5 4 Mappings Lin
59. pointer to a 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 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 96 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 is entered or hexadecimal leading Ox or OX or just decimal o int unsigned octal u int unsigned decimal int unsigned hexadecimal 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 character f float float g G float n int the number of characters written so far is written into the argument No scanning 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 o
60. real floating type Math h Tgmath h Description fpclassify Returns the class of its argument FP INFINITE FP NORMAL FP SUBNORMAL OrFP ZERO isfinite Returns a nonzero value if and only if its argument has a finite value isinf Returns a nonzero value 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 1ongjmp 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 void longjmp jmp buf env int status 2 12 Records its caller s environment in env and returns 0 Restores the environment previously saved with a call to setjmp 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 Atermination request sent to the progra
61. 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 C3000INC when the product was installed 4 The default include directory relative to the installation directory 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 c3000 Imyinclude test c c3000 include directory myinclude 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 4 17 TSK3000 Embedded Tools Reference Related information qo Compiler option H Include file at the start of a compilation Tool Options Compiler Compiler inline Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the C Compil
62. single source Overlap between source ranges or destination ranges is not allowed e fthe 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 proc name core name gt 0 1 bus name Aspace name refers to a defined address space Aproc name refers to a defined processor Acore name refers to a defined core Abus name refers to a defined bus e The following mappings are allowed source to destination Space space Space bus bus gt bus memory gt bus range number ee number 7 9 TSK3000 Embedded Tools Reference 7 3 8 Architecture Definition architecture_definition architecture arch_name lt parameter list gt 011 lt extends arch_name argument list gt 011 0 1 arch 0 e Anarchitecture definition defines a core architecture with the given arch name as a unique name e Atleast one space def and at least one bus def have to be present in an architecture definition e Anarchitecture definitionthat 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 argument list arch spec space def Aspace def defines an archit
63. smartinline you can temporarily disable this optimization With the compiler options inline max incr and inline max size you have more control over the function inlining process of the compiler See for more information of the options inline max incr and inline max size section 4 1 Compiler Options in Chapter Tool Options 1 9 TSK3000 Embedded Tools Reference 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 4 3 Compiler Optimizations in Chapter Using the Compiler in the user s manual See compiler option O in section 4 1 Compiler Options in Chapter Tool Options runtime flag Check for runtime errors The pragma works the same as compiler option r runtime See compiler option r runtime in section 4 1 Compiler Options in Chapter Tool Options of the reference manual sdata size With this pragma you tell the compiler to place all data objects smaller than the specified size bytes in sdata or sbss sections You can still overrule this option with the keywords no sdata and sdata for individiual data objects in your source See compiler option sdata in section 4 1 Compiler Options i
64. space is assumed t 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 4 104 Tool Options Linker Example To create the output file my ile hex of the address space named code tlk test obj omyfile hex IHEX code tlk test obj output myfile hex IHEX code To create the output file myfile hex ofthe default address space tlk test obj omyfile hex IHEX tlk test obj output myfile hex IHEX If they exist any other address spaces are emitted as well and are named myfile spacename hex Related information 4 Linker option c Generate an output file for each chip 4 105 TSK3000 Embedded Tools Reference Linker r incremental 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 Link incrementally 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 ou
65. swscanf s format vfwscanf stream format arg vwscanf format arg vswscanf s format arg fputwc c stream putwc c stream putwchar c stdout fputws s stream fwprintf stream format Returns 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 succesfully FSS implementation Performs a formatted read from the string s Returns 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 implemented as a macro FSS implementation Put character c onto the stdout stream Returns EOF WEOF on error Impleme
66. 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 environment that ignores all floating point exceptions fesetenv Restores a previously saved fegetenv or feholdexcept floating point environment 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 exceptions 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 exception flags which are currently set and are specified in the argument For each supported exception a macro is defined The following exceptions are defined FE DIVBYZERO FE INEXACT FE INVALID FE OVERFLOW FE UNDERFLOW FE ALL EXCEPT 2 4 Libraries fegetround Returns the current rounding direction represented as one of the values of the rounding direction macros fesetround Sets the c
67. the run time start address is not set the linker selects an appropriate address 7 35 TSK3000 Embedded Tools Reference 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 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 See also the page size keyword in section 7 5 3 Defining Address Spaces group page group page 3 7 8 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 stack keyword 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 No
68. use build 1 22 1 of the compiler _BUILD__ expands to 1022001 If there is no branch number the branch digits expand to zero For example build 127 results in 127000000 Table 1 6 Predefined macros Summary 2 Libraries 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 The following table lists all available libraries Libraries Description c3000 lib C library some functions also need the floating point library c3000md lib C library with support for hardware multiply divide c3000s lib Single precision C library c3000mds lib some functions also need the floating point library fp3000 lib Floating point library non trapping fp3000md lib fp3000t lib Floating point library trapping fp3000mdt lib pb3000 lib Profiling libraries pb block function counter pc3000 lib pc call graph pct3000 lib pct call graph and timing pd3000 lib pd dummy pt3000 lib pt function timing p 3000md li
69. 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 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 demo obj main obj tlk demo obj main obj 43000 151 1c3000 1fp3000 else real abs real obj main obj tlk real obj main obj d3000 1s1 1c3000 1fp3000 endif You can now use a macro definition to set the DEMO flag tmk real abs DEMO 1 In both cases the absolute object file xeal abs is created but depending on the DEMO flag it is linked with demo obj or with real obj Related information qo Make utility option e Environment variables override macro definitions Make utility option m Name of invocation file 4 151 TSK3000 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 a
70. 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 tlb p mylib lib objl obj file obj The librarian prints the file obj1 0bj 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 nam Related information 4 182 Tool Options Librarian Librarian r Command line syntax r a posname b posname c u v Description You can use the option 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 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 checki
71. 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 4 Linker option M Generate map file 4 98 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 mcr is used Related information qo Compiler option misrac 4 99 TSK3000 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 not 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 section
72. 00 Embedded Tools Reference 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 LN 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 tcc T3000 iso 90 test c Related information qo Compiler option c ISO C standard 4 130 Tool Options Control Program 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 corrupt file or when you want to inspect the output file or send it to Altium support Related information do
73. 000 in the core reference manual CRO0121 TSK3000A 32 bit RISC Processor 3 43 TSK3000 Embedded Tools Reference 3 44 4 Tool Options Summary This chapter provides a detailed description of the options for the compiler assembler linker control program make program and the librarian 4 34 Compiler Options Altium Designer uses a makefile to build your entire project This means that in Altium Designer you cannot run the compiler separately If you compile a single C source file from within Altium Designer the file is also assembled However you can set options specific for the compiler Options in Altium Designer versus options on the command line Most command line options have an equivalent option in Altium Designer but some options are only available on the command line for example in a Windows Command Prompt If there is no equivalent option in Altium Designer you can specify a command line option in Altium Designer 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 c3000 option file The input file must be a C source file c or ic 4 1 TSK3000 Embedded Tools Refe
74. 1 11 3 42 WEOF 2 15 wmemchr 2 27 wmemcmp 2 26 wmemopy 2 26 wmemmove 2 26 wmemset 2 28 wprintf 2 21 write 2 31 wscanf 2 20 wstrftime 2 30 Index 11 TSK3000 Embedded Tools Reference Index 12
75. 14 Siddef h co i o Edad 2 14 Stdiritihi DERE E PES 2 14 stdio h and wchar h 2 14 stdlib h and wcharh 2 22 string h and wcharh 2 26 time h and wchar h sisslssssseseee n 2 28 UH E 2 31 jeg 2 32 WGlype Di es Pac Ree ix eRe ws 2 33 TSK3000 Embedded Tools Reference Assembly Language 3 1 3 1 Built in Assembly Functions 3 1 3 1 1 Overview of Built in Assembly Functions 3 1 3 1 2 Detailed Description of Built in Assembly Functions 3 2 3 2 Assembler Directives 4 3 5 3 2 1 Overview of Assembler 3 5 3 2 2 Detailed Description of Assembler Directives 3 7 3 3 Generic 1 5 5 3 43 Tool Options 4 1 4 1 Compiler Options eect n 4 1 4 2 Assembler Options 4 45 4 3 Linker OPtiONS ead ci vi be br e RR Ro wae nen reek EES 4 75 4 4 Control Program Options 4 112 4 5 Make Utility 5 4 150 4 6 Librarian Options term REI r
76. 16 bits An argument is e asingle or multiple character string constant e anexpression 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 strings each character is stored in the least significant byte of a half word whose lower seven bits represent the ASCII value of the character The standard C escape sequences are allowed DH AB D gt 0x0041 0x0042 0x0000 second argument is empty 0x0044 Example TABLE DH 14 253 0x62 ABCD CHARS DH A B C D Related information Block Storage db ss DS DB DW Define Storage Define Byte Define Word anan 3 14 Assembly Language DS DSB DSH DSW Syntax label DS expression label DSB expression label DSH expression label DSW 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 numbe
77. 172 time 4 173 V 4 174 W 4 175 x 4 176 defining a macro 4 151 malloc 2 24 Manual conventions xviii Index 8 Manual purpose and structure xv Map file generation 4 97 Mappings 7 21 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 2 26 memopy 2 26 memmove 2 26 Memory definition 7 2 memset 2 28 Merging source code 4 34 message 1 10 3 29 MISRA C 4 23 4 24 MISRA C report 4 99 supported rules 8 1 mktime 2 29 modf functions 2 10 Motorola S record format 6 2 msb 3 3 msh 3 3 N nan functions 2 10 nearbyint functions 2 9 nextafter functions 2 10 nexttoward functions 2 10 NOP insertion 4 66 nopinsertion nonopinsertion 3 30 NULL 2 14 offset 3 31 offsetof 2 14 Optimization 4 26 4 67 4 103 code compaction 4 19 inlining 4 20 Index optimize for speed size 4 38 optimize endoptimize 1 10 Option file 4 13 4 85 4 124 4 164 Options saving restoring 4 13 4 85 P page 3 32 Parameter passing 1 6 Passing options 4 147 perror 2 22 pow functions 2 10 Pragmas 1 8 Predefined macros 1 12 Preprocessing 4 49 4 121 7 4 storing output 4 10 printf 2 17 2 21 conversion characters 2 18 Processor definition 7 2 7 27 Profiling 4 30 4 139 ptrdiff_t 2 14 putc 2 20 putchar 2 20 puts 2 20
78. 1sl1 D STACK 32k D START 0x00000000 or using the long option names tlk otest abs lsl file 3000 1s1 define STACK 32k define START 0x00000000 Related information qo Linker option f Read options from file 4 80 Tool Options Linker Linker d Isl 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 Enable the option Use project specific LSL file 4 Inthe LSL file field type a name or click and select an LSL file Command line syntax dfile sl file file Description A linker script file contains vital information 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 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 3000 151 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 4 Linker option
79. 25 O optimize 4 26 o output 4 29 p profile 4 30 r runtime 4 32 s source 4 34 t tradeoff 4 38 u uchar 4 40 U undefine 4 39 V version 4 42 w no warnings 4 43 debug information 4 15 diagnostics 4 43 4 44 language 4 4 4 5 4 36 4 40 MISRA C 4 23 optimization 4 26 4 38 preprocessing 4 7 4 10 4 16 4 39 Conditional make rules 4 151 Control program passing options 4 147 Control program options 4 112 help 4 113 adress size 4 114 4 116 diag 4 120 error file 4 122 format 4 126 fp trap 4 127 iso 4 130 no default libraries 4 136 no map file 4 137 static 4 141 warnings as errors 4 149 cs co cl create 4 115 D define 4 117 d Isl file 4 119 E preprocess 4 121 F no double 4 123 f option file 4 124 g debug info 4 128 I include directory 4 129 k keep output files 4 131 L ignore default library path 4 132 I library 4 133 4 134 L library directory 4 132 n dry run 4 135 o output file 4 138 p profile 4 139 t keep temporary files 4 143 T target 4 142 U undefine 4 144 v verbose 4 146 V version 4 145 w no warnings 4 148 W pass 4 147 Index 3 TSK3000 Embedded Tools Reference preprocessing 4 117 Copy table 7 20 7 38 copysign functions 2 10 cos
80. 3000 Embedded Tools Reference Assembler check 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 check to the Additional assembler options field 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 qo Compiler option check Check syntax 4 48 Tool Options Assembler 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 User macro click on the down arrow in the right pane to expand macro input 4 Click on an empty Macro field and enter a macro name Then click outside the cell to confirm 5 Optionally click in the Value field and enter a definition Then click outside the cell to confirm Command line syntax Dmacro name smacro definition name smacro 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
81. 3000 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 tmk K The make utility preserves all temporary files Related information db 4 162 Tool Options Make Utility Make Utility k Command line 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 tmk 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 qo Make utility option S Undo the effect of k 4 163 TSK3000 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 exce
82. 4 7 28 dest 7 20 7 21 dest_dbits 7 21 dest_offset 7 21 direction 7 31 7 33 else 7 39 extends 7 18 7 24 fill 7 34 7 37 7 38 fixed 7 19 7 36 group 7 31 7 33 grows 7 19 heap 7 20 7 36 high_to_low 7 19 7 31 id 7 19 if 7 39 load adar 7 35 low to high 7 19 7 31 map 7 18 7 19 7 21 7 26 mau 7 18 7 19 7 26 7 28 mem 7 35 memory 7 25 7 28 min size 7 19 7 36 nvram 7 25 ordered 7 33 overlay 7 34 page 7 36 page size 7 19 processor 7 27 ram 7 25 reserved 7 26 7 37 rom 7 25 run adar 7 20 7 35 section 7 38 section layout 7 30 select 7 32 size 7 21 7 26 7 28 7 36 7 37 7 38 space 7 19 7 21 speed 7 26 7 28 src dbits 7 21 src Offset 7 21 stack 7 19 7 36 start address 7 20 symbol 7 20 type 7 25 7 28 Index 7 TSK3000 Embedded Tools Reference width 7 18 LSL syntax 7 4 architecture definition 7 10 board specification 7 12 bus definition 7 8 derivative definition 7 12 memory definition 7 8 processor definition 7 12 section layout definition 7 13 M macro nomacro 1 10 Macro definition 4 7 4 49 4 117 macro endm 3 27 Macros 1 12 make utility 4 151 Make utility options 2 4 152 a 4 153 C 4 154 D 4 155 d 4 156 DD 4 155 dd 4 156 e 4 157 err 4 158 f 4 159 G 4 160 i 4 161 K 4 162 k 4 163 m 4 164 4 170 n 4 166 p 4 167 q 4 168 r 4 169 S 4 171 t 4
83. 4 131 TSK3000 Embedded Tools Reference Control Program L library directory ignore default library path Command line syntax Loir library directoryzdir 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 c3000 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 LIBTSK3000 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 LIBTSK3000 3 The default directory PRODDIR c3000 1ib or a processor specific sub directory Example Suppose you call the control program as follows tcc T3000 test c Lc WMnylibs 1c3000 tcc T3000 test c library directory c Mmylibs library c3000 First the linker looks in the directory Nmylibs for library c3000 1ib this option If it does not find the requested libraries it looks in the directory that is set with the environment variable LIBTSK3000 Then the li
84. 4 3 TSK3000 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 Allow C style comments in C source code only available when ISO C 90 is selected e Relax const check for string literals Command line syntax A flags language f ags You can set the following flags p P comments X Allow C style comments in C source code X X strings Relaxed const check for string literals language is the equivalent of APX which disables all language extensions The default is Apx 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 c90 In ISO C99 mode this style of comments is always accepted With Relax 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 Example c3000 APx c90 test c c3000 language comments t strings iso 90 test c qo Compiler option ISO C standard 4 4
85. 7 m map file format 4 98 N no rom copy 4 100 O optimize 4 103 o output 4 104 r incremental 4 106 S strip debug 4 107 v verbose 4 109 V version 4 108 vv extra verbose 4 109 w no warnings 4 110 diagnostics 4 110 4 111 libraries 4 93 4 101 Map File 4 97 miscellaneous 4 79 4 80 4 81 4 83 4 96 optimization 4 103 output format 4 77 Linker script file 4 95 4 96 architecture definition 7 1 board specification 7 3 Index bus definition 7 2 derivative definition 7 2 memory definition 7 2 preprocessing 7 4 processor definition 7 2 section layout definition 7 3 specifying 4 81 4 119 structure 7 1 List file 4 62 4 64 list nolist 3 26 llabs 2 25 IIdiv 2 25 llrint functions 2 9 llround functions 2 9 lo 3 3 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 longjmp 2 12 Irint functions 2 9 Iround functions 2 9 Isb 3 3 Iseek 2 31 Ish 3 3 LSL expression evaluation 7 16 LSL functions absolute 7 7 adaressof 7 7 exists 7 7 max 7 7 min 7 7 sizeof 7 8 LSL keywords align 7 19 7 20 7 33 alloc_allowed 7 37 allow_cross_references 7 34 architecture 7 18 7 25 attributes 7 32 7 33 bus 7 18 7 21 7 28 clustered 7 34 contiguous 7 33 copy_unit 7 20 copytable 7 20 7 38 core 7 25 derivative 7 2
86. Assembler EQU and SET directives r R relocations Relocation characters r s S hll HLL symbolic debug information SYMB vN 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 On the command line you must use this option in combination with the option I list file 4 62 Tool Options Assembler Related information qo Assembler option I Generate list file Assembler option tl Display section information in list file 4 63 TSK3000 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 na
87. E 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 align 4 global main Function main main func 512 main main endsec Related information qo TYPE Set Symbol Type 3 37 TSK3000 Embedded Tools Reference 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 qb 3 38 Assembly Language TITLE Syntax TITLE title Description If you generate a list file see assembler option 1 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 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
88. Options Linker Linker first library first Menu entry Command line syntax tirst 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 and 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 tlk first library first a lib test obj b lib If the file test ob calls a function which is both present in a 1ib and b lib 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 res
89. P instruction get return address Ccodeptr _ get return address void Used by the compiler for profiling when you compile with the p profile option Returns return address of a function 1 7 TSK3000 Embedded Tools Reference __mfco volatile int _ mfcO int spr Get the value from coprocessor 0 special function register spr Returns the value of the spr register of coprocessor __mtco volatile void _ mtcO int val int spr Put a value val into special purpose register spr of coprocessor Returns nothing 1 6 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 symbol should be defined with static storage duration not extern or automatic See the EQU directive directive in Section 3 2 Assembler Directives and Controls in Chapter Assembly Language call near far Default functions are called with 28 bit PC region calls This near call is directly coded into the instruction resulting in higher execution speed and smaller code size The othe
90. QU 0x4000 You cannot redefine the used symbols Related information qo SET Set temporary value to a symbol 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 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 qo GLOBAL Declare global section symbol 3 19 TSK3000 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 In the 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
91. Section 3 2 Assembler Directives and Controls in Chapter Assembly Language TSK3000 Embedded Tools Reference 1 7 Predefined Macros In addition to the predefined macros required by the ISO C standard such as DATA FILE the TASKING C compiler supports the predefined macros as defined in the table below The macros are useful to create conditional C code Macro Description C3000 __ Expands to 1 for the TSK3000 toolchain otherwise unrecognized as macro CPU Expands to the CPU core name option Copu 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 0 2 of the compiler VERSION expands 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
92. 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 GLOBAL LOOPA LOOPA Related information definition of symbol LOOPA LOOPA will be globally accessible by other modules mark symbol LOOPA as weak 4 EXTERN Import global section symbol GLOBAL Declare global section symbol 3 42 Assembly Language 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 situation in which a generic instruction is used the assembler replaces the generic instruction with appropriate real assembly instruction s You can find a complete list of generic instructions for the TSK3
93. This will instrument the code to measure the time spent in a function This includes the time spend in all sub functions callees LAN If you use the profiling option you must link the corresponding libraries too Refer to Section 7 4 Linking with Libraries in Chapter Linker of the user s manual for an overview of the profiling libraries When you use Altium Designer automatically the correct libraries are linked Example To generate block count information for the module test c during execution compile as follows c3000 pb test c c3000 profile 4block test c In this case you must link the library pb3000 1ib Related information qo Chapter 5 Profiling in the user s manual 4 31 TSK3000 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 Miscellaneous Add the option runtime to the Additional C compiler options field Command line syntax r flags runtime flags You can set the following flags when you specify r without flags the default is rbcm bounds checking c C report unhandled case in a switch m M malloc consistency checks Description This option controls a number of run time checks to detect errors during program execution Some of these checks require additional code to be inse
94. U IT ERE ea 4 177 List File Formats 5 1 5 1 Assembler List File 5 1 5 2 Linker Map File Format 5 3 Object File Formats 6 1 6 1 ELF DWARF Object 6 1 6 2 Motorola S Record Format 6 2 6 3 Intel Hex Record Format 6 5 Linker Script Language 7 1 7 1 INMOGUCTION quasi edo rati e aden Rc 7 1 7 2 Structure of a Linker Script File 7 1 7 3 Syntax of the Linker Script Language 7 4 7 3 1 Preprocessing isis aoe ada e ed ee E i ques 7 4 7 3 2 Lexical Syntax nen 7 4 7 3 3 Identifiers ue rie de ae en s peat ie UR aaa waded 7 5 7 3 4 EXpressiOlS peepee a Rc pend 7 5 7 3 5 Built in 5 7 6 7 3 6 LSL Definitions in the Linker Script File 7 8 7 3 7 Memory and Bus Definitions 7 8 7 3 8 Architecture Definition 7 10 7 3 9 Derivative Definition s 225 7 12 7 3 10 Processor Definition and Board Specification 7 12 7 3 11 Section Layout Definition 7 13 Table of Contents 7 4 Expression Evaluation
95. ads the makefile with the rules to build your files The file tmk mk is located in the etc directory of the toolchain With this option you tell the make utility not to read tmk mk and to rely fully on the make rules in the makefile Example tmk r The make utility does not read the implicit make rules in tmk mk Related information 4 169 TSK3000 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 make 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 tmk 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 in this example may have been set with the environment variable MAKEFLAGS or in a recursive call to tmk in the makefile Related information 4 Make utility option On error abandon the work for the current target only 4 170 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 tmk s The make utility rebuilds your files but does not print the commands it executes during the make p
96. ample To display an explanation of message number 103 enter tcc diag 103 This results in message 103 with explanation Note that the suboption T3000 is not necessary here because the control program is not supposed to invoke any of the tools from the toolchain To write an explanation of all errors and warnings in HTML format to file ccerrors html enter tcc diag html all ccerrors html Related information 4 120 Tool Options Control Program Control Program E preprocess Command line syntax E flags preprocess flags You can set the following flags when you specify E without flags the default is ECP c C comments Keep comments p P noline Strip line source position info 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 e With Ec you tell the preprocessor to keep the comments from the C source file in the preprocessed output e With Ep you tell the preprocessor to strip the line source position information lines starting with 1 These lines are normally processed by the assembler and not needed in the preprocessed output When you leave these lines out the output is more orderly to read Example tcc T3000 EcP test c o test pre tcc T3000 preprocess comments noline test c output tes
97. an 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 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 1c 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 overlay 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 pl select my ovl p2 group b select my_ovl_ql 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 Lin
98. and a fixed address H multiply and hi devide register higher result L multiply and lo devide register lower result number other operand same as number used when in and output operands must be the same Table 1 2 Available input output operand constraints for the TSK3000 4 Section 2 4 Using Assembly in the C Source in Chapter C Language of the user s manual 1 3 TSK3000 Embedded Tools Reference at With the attribute at you can place an object at an absolute address int myvar _ at 0x100 Section 2 3 1 Placing an Object at an Absolute Address in Chapter C Language of the user s manual Memory type qualifiers In the C language you can specify that a variable must lie in a specific part of memory You can do this with a memory type qualifier You can specify the following memory types Qualifier Description no sdata Direct addressable RAM __sdata Direct short addressable RAM Small data 32kB offset from global pointer register gp Table 1 3 Memory Type Qualifiers for the TSK3000 qo Section 2 3 Memory Qualifiers of the user s manual 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 1 inline this function noinline int func2
99. and dots STRING sequence of characters not starting with V or X 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 C style 7 4 Linker Script Language 7 3 3 Identifiers arch name IDENTIFIER bus name IDENTIFIER core name IDENTIFIER derivative name IDENTIFIER file name DOSTRING group name IDENTIFIER mem name IDENTIFIER proc name IDENTIFIER section name DOSTRING space name IDENTIFIER stack name section symbol name DOSTRING 7 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 TSK3000 Embedded Tools Reference binary op S exclusive OR multiplication division
100. ap descr min size expr grows direction align expr fixed e Themin size statement must be present e You can specify at most one align statement and one grows statement direction low to high high to low e f you do not specify the grows statement the stack and grow 1ow to high copy table descr align expr copy unit expr dest space gt 011 space name 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 startup code initializes memory used by another processor that has no access to ROM Aspace name refers to a defined address space start addr start address start addr descr lt start addr gt gt 0 start addr descr run addr expr symbol symbol name e Asymbol name refers to the section that contains the startup code endianness def endianness lt endianness_type gt 1 endianness type big little 7 11 TSK3000 Embedded Tools Reference 7 3 9 Derivative Definition derivative_definition derivative derivative name lt parameter list gt 011 extends derivative name argument list gt 011 0 1 derivative gt gt 0 Aderivative definition defines a derivative with the given derivative name as a unique name e Atleast one core def must be present a derivative definition derivative spec core def bus def mem de
101. 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 defines type pos 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 setvbuf 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
102. art obj JE OIC ISI IG Locate Part Task entry address symbol START absolute address 0x00000000 Section translation Chip Group Section Size MAU Space addr Chip addr irom text cstart 0x000000a0 0x00000000 0x00000000 rodata 0x0000000c 0x000000b4 Ox000000b4 data 0x000000c8 0x00001978 0x00001978 sdata 0x00000004 0 00001 40 0 00001 40 table 0x00000034 0x00001a44 Ox00001a44 iram sda sdata 0x00000004 0x00010000 0x00000000 Symbol translation sorted on name EXCEPTION BASE Edit 0x00000098 START 0x00000000 main 0x000000d8 List File Formats Symbol translation sorted on address Address Name Space 0x00000000 START TSK3000 TSK3000 main 0x00000098 Exit 0x000000d8 main 0x00000100 EXCEPTION BASE _ JES ICIS CCI IOC IOC IA Memory Part IOI III Address range usage at space level D M Name Total U
103. ated information d gt BS Block Storage DS Define Storage DH_ Define Half Word DW Define Word 3 12 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 If 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 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 13 TSK3000 Embedded Tools Reference DH Syntax label DH argument argument Description With the DH directive Define Half Word you allocate and initialize half word of memory for each argument A half word is
104. ave 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 nore s scratch sections not cleared and not initialized To select all read only sections group select attributes r w t Keep in mind that all section selections are restricted to the address space of the section layout in which this group definition occurs 7 32 Linker Script Language 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 define 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 __1ec_gb_group_name lc 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 be
105. ax g debug info Description With this option you tell the control program to include debug information in the generated object file Related information db 4 128 Tool Options Control Program Control Program I include directory 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 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 tcc T3000 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 4 5 How the Compiler Searches Include Files in chapter Using the Compiler of the user s manual 4 129 TSK30
106. b Table 2 1 Overview of libraries 2 1 TSK3000 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 with the macro WCHAR SUPPORT ENABLED and keep this macro also defined when compiling your own sources See compiler option D define in Chapter 4 Tool options 2 2 4 assert h assert expr Prints a diagnostic message if NDEBUG is not defined Implemented as macro 2 2 2 complex h The TSK3000 does not support complex numbers 2 2 3 ctype h and wctype h The header file ctype 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 IA Z a z isblank iswblank Returns a non zero value when c is a blank character tab space iscntrl iswcntrl Returns a non zero value when c is a control character isdigit iswditit Returns a non zero value when c is a numeric character 0 9 isgraph iswgraph Returns a non zero value when c is printable but not a space
107. 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 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 de 4 36 Tool Options Compiler Compiler static 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 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
108. cation counter is 0x0C 3 31 TSK3000 Embedded Tools Reference PAGE Syntax PAGE width length blanktop blankbim blankleft Description 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 4 TITLE Set program title in header of assembler list file Assemb
109. ccording to the LC TYPE category see 2 2 12 locale h of the current locale 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 TSK3000 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 4 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 3 6 Assembly Expressions in the user s manual Overview of assembly functions Function Description eARG symbol expr Test whether macro argument is present BIGENDIAN Test if assembler generates code for big endian mode CNT Return number of macro arguments DEFINED symbol symbol Test whether symbol exists GPREL symbol Offset of symbol from the global pointer R28 HI expr Most significant half word of the ex
110. 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 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 wcstof s endp double wcstod s endp long double wcstold s endp Next convert the initial portion of the string s to a 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 Wchar h long wcstol s endp base long long wcstoll s endp base unsigned long wcstoul s endp base unsigned long long wcstoull
111. cords The default buffer length is 32 code bytes The checksum calculation of S1 records is identical to SO 6 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 Jength byte address code bytes checksum byte This record is used for 3 byte addresses Example 213FF002000232222754E00754F04AFAFAE4E22BF _ 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 calculation 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 8 Jength byte address code bytes checksum byte The linker generates 4 byte addresses by default Example 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
112. ction section_layout lc bs 1 ub stack when the symbol _ lc bs occurs as an undefined reference in an object file the linker allocates space for the stack 7 8 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 e1se keyword is followed by a section statement which is executed in case the if condition evaluates to FALSE 0 group if exists mysection select mysection else reserved myreserved size 2k 7 39 TSK3000 Embedded Tools Reference 8 MISRA C Rules Summary This chapter contains an overview of the supported and unsupported MISRA C rules Supported and unsupported MISRA C rules 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 appropria
113. d 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 4 6 4 48 4 116 system 2 24 T tan functions 2 7 tanh functions 2 7 tgamma functions 2 11 time 2 29 time t 2 28 Index 10 title 3 39 tm struct 2 28 TMP MAX 2 15 tmpfile 2 22 tmpnam 2 22 tolower 2 2 toupper 2 3 towctrans 2 33 towlower 2 2 2 33 towupper 2 3 2 33 tradeoff 1 11 trunc functions 2 9 type 3 40 U undef 3 41 ungetc 2 20 ungetwc 2 20 unlink 2 31 V va arg 2 13 va end 2 13 va start 2 13 Version information 4 174 4 186 viprintf 2 21 vfscanf 2 20 viwprintf 2 21 viwscanf 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 warning 1 11 Warnings suppressing 4 43 4 73 4 110 4 148 treat as errors 4 74 wchar t 2 14 Index wcrtomb 2 32 wcscat 2 26 wcschr 2 27 wcscmp 2 26 wcscoll 2 26 wcsopy 2 26 wcscspn 2 27 wcsncat 2 26 wcsncmp 2 26 wesncpy 2 26 wcspbrk 2 27 wcsrchr 2 27 wcsrtombs 2 32 wcsspn 2 27 wcsstr 2 27 wcstod 2 23 wcstof 2 23 wcstoimax 2 6 wcstok 2 27 wcstol 2 23 wcstold 2 23 wcstoll 2 23 wcstombs 2 25 wcstoul 2 23 wcstoull 2 23 wcstoumax 2 6 wcsxfrm 2 27 wctob 2 32 wctomb 2 25 wctrans 2 33 wctype 2 33 weak
114. d The message indicates the symbol that is unresolved To write an explanation of all errors and warnings in HTML format to file Lerrors html enter tlk diag html all gt lerrors html Related information do 4 82 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 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 tlk mylib lib Nothing is linked and no output file will be produced because there are no unresolved symbols when the linker searches through mylib lib tlk e _ START mylib lib tlk extern START mylib lib In this case the linker searches for the symbol START in the library and if found extracts the object that contains
115. d 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 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 4 4 34 Tool Options Compiler Compiler sdata Menu entry Command line only Command line syntax sdata size Default 4 bytes Description Without this option all data objects of 4 bytes and smaller are placed into the small data sections and small bss sections With this option you tell the compiler to place all global and static data objects smaller than the specified size bytes into the small data section sdata or small bss section sbss This results in smaller and faster code In total 64kB is available for this kind of addressing You can still overrule this option with the keywords sdataand no sdata for individiual data objects in your source AN If you use this option you must use this option with the same value for all modules in your application Example To put all global and static data objects with a size of 8 bytes or smaller into the sdata section c3000 sdata 8 test c Related information qo Section 2 3 Memory Qualifiers of the user s manual 4 35 TSK3000 Embedded Tools Reference Compiler signed
116. e begin and end of the section 1c ub name for the start and 1 ue name for the end of the output section Copy table The copytable keyword 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 table 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 object files 7 38 Linker Script Language 7 8 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 se
117. e in the ELF symbol table WEAK Mark a symbol as weak 3 5 TSK3000 Embedded Tools Reference Overview of data definition storage allocation directives Directive Description ALIGN BS BSB BSH BSW DB DH DW DS DSB DSH DSW OFFSET Align location counter Define block storage initialized Define byte Define half word Define word Define storage Move location counter forwards Overview of macro and 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 TSK3000 specific directive Directive Description NOPINSERTION Insert a NOP instruction after jump and branch instructions NONOPINSERTION No extra NOP instruction after jump and branch instructions
118. e length of the first sequence found Searches s for a sequence of characters not specified in set Returns the length of the first sequence found Same as strspn wcsspn 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 2 27 TSK3000 Embedded Tools Reference Miscellaneous functions Stdio h Wchar h Description memset s c n strerror errno strlen s wmemset s c n wcslen s 2 2 23 time h and wchar 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 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 Thetype st
119. e level of optimization The default optimization level is Medium optimization option O2 or O or OabcefglkloprsUy You can overrule these settings in your C source file with the pragma pair Zpragma optimize flag and pragma endoptimize 4 27 TSK3000 Embedded Tools Reference amp 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 c3000 c3000 c3000 c3000 c3000 c3000 c3000 test c 02 test c optimize 2 test c O test c optimize test c OabcefgIkloprsuy test c optimize coalesce ipro cse expression flow glo inline schedule loop forward propagate compact subscript unroll peephole test c Related information d gt Section 4 3 Compiler Optimizations in chapter Using the Compiler of the user s manual Compiler option t Trade off between speed t0 and size t4 4 28 Tool Options Compiler Compiler o output Menu entry Altium Designer names the output file always after the C source file Command line syntax o file output file Description With this option you can specify another filename for the output file of the compiler Without this option the ba
120. e of data lines of the destination bus By default all data lines from the source bus are mapped on the data lines of the destination bus starting with line O 7 21 TSK3000 Embedded Tools Reference 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 1 mau 4 map src offset 0 dest offset 0 dest bus bus name size 16M 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 1 bus i bus mau 4 space i space map dest bus i bus size 256 7 22 Linker Script Language bus e bus mau 16 width 16 map dest bus mycore i bus src dbits 0 7 dest_dbits 0 7 AN It is not possible to map an internal bus to an external bus
121. e options are only available on the command line for example in a Windows Command Prompt If there is no equivalent option in Altium Designer you can specify a command line option in Altium Designer 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 as3000 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 ongflag Separate longflags with commas The following two invocations are equivalent as3000 Ogs test src as3000 optimize generics instr size test src When you do not specify an option a default value may become active 4 45 TSK3000 Embedded Tools Reference Assemb
122. e or extra verbose to the Additional linker options field 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 do 4 109 TSK3000 Embedded Tools Reference Linker w no warnings 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 Set Error reporting to one of the following values e Report all warnings Suppress all warnings 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 Speci
123. e system library c3000 1ib C library tlk test obj mylib lib 1c3000 tlk test obj mylib lib library 2c3000 The linker links the file test ob and first looks in mylib lib in the current directory only then in the system library c3000 1ib to resolve unresolved symbols Related information qo Linker option L Additional search path for system libraries Section 7 4 Linking with Libraries in chapter Using the Linker of the user s manual 4 93 TSK3000 Embedded Tools Reference Linker link only Menu 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 qo Control program option cl Stop after linking 4 94 Tool Options Linker Linker Isl check Menu entry Command line syntax sl 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 qo Linker option d Linker script file Linker option Isl dump Dump LSL info Section 7 7 Controlling the Linker with a Script in chapter Using the Linker of the user s manual 4 95 TSK3000 Embedded Tools Reference Linker Isl dump Menu entry 1 From the Project menu select Project Option
124. ebug information HLL l L local Assembler local symbols debug information default 5 5 smart Smart debug information default If you do not use this option or if you specify g without any flags the default is gsl 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 assembler 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 do 4 57 TSK3000 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 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 specify
125. ection 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 Aproc name refers to a defined processor Acore name refers to a defined core 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 e f 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 ii select section statement select section name 0 l section selections 0ll e Eithera section name or at least one section selection must be defined section selections section selection lt section selection 0 7 13 TSK3000 Embedded Tools Reference 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 size gt 011 stack stack name size gt 011 copytable reserved section gt 0 1 reserved gt 011 e Special sectio
126. ecture space descr space property parameter lt parameter gt 9 IDENTIFIER lt expr gt 1 expr lt gt gt 0 bus def space def endianness def space space name space gt gt 0 address space with the given space name as a unique name within an space property section definition no space ref id number as used in object mau expr align expr page_size expr stack_def heap_def copy table def start address mapping Aspace def contains exactly one id and one mau statement Aspace def contains at most one align statement Aspace def contains at most one page size statement Aspace def contains at least one mapping Linker Script Language stack def stack stack name stack heap descr stack heap descr 22 0 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 Aheap def defines a heap with the heap name as a unique name copy table def copytable copy table descr lt copy table gt gt 0 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 the architecture definition contains only one address space a copy table definition is optional it will be generated in the space stack he
127. ed 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 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 Whenatext line reaches its length limit use V to continue the line Whitespace between quotes is preserved This is a continuation line This is a continuation line e Itis possible to nest command line files up to 25 levels Example Suppose the file myopt ions contains the following lines k err errors txt test abs Specify the option file to the make utility tmk m myoptions This is equivalent to the following command line tmk k err errors txt test abs 4 164 Tool Options Make Utility Related information 4 165 TSK3000 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 y
128. ed to by ptr Returns the number of elements 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 given stream Returns the number of elements 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 TSK3000 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
129. eep temporary files Menu Entry 4 From the Project menu select Project Options The Project Options dialog box appears 5 Select Build Options 6 Enable the option Keep temporary files that are generated during a compile 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 you tell the control program to keep temporary files it generates during the creation of the absolute object file Related information do 4 143 TSK3000 Embedded Tools Reference Control Program U undefine Command line syntax Umacro name undefinezmacro name Description With this option you can undefine an earlier defined macro as with Zundef 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 tcc T3000 U TASKING test c tcc T3000 undefine TASKING test c Related information qe Control Pogram option D Define preprocessor macro 4 144 Tool Options Control Program Control Program V version Command line syntax V version Description Display version information The control program ignores all ot
130. egistered by the atexit function or signal handlers registerd by the signal function are called Searches an environment list for a string s Returns a pointer to the contents 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 ascending order according to the results of the function pointed to by cmp Returns 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 re
131. emory are translated to addresses of a destination space bus The following mappings are possible space gt space e space gt bus 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 Thesrc 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 0x0000 e The size argument specifies the number of addresses that are mapped This argument is required e Thedest offset argument specifies the position in the destination to which the specified range of addresses is mapped By default the destination offset is 0x0000 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 Thesrc 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 rang
132. epeat the preceding item zero or more times Example c3000 option filename You can read this line as follows enter the command c3000 with or without an option follow this by zero or more options and specify a filename The following input lines are all valid c3000 test c c3000 g test c c3000 g s test c Not valid is c3000 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 Altium Designer menu entries and dialogs Es Command line type your input on the command line qo Reference follow this reference to find related topics xi TSK3000 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 e DSP C An Extension to ISO IEC 9899 1999 E Programming languages C TASKING TK0071 14 TASKING Tools e Using the TSK3000 Embedded Tools Altium GU0111 e TSK3000A 32 bit RISC Processor Core Reference Altium CRO121 xii 1 C Language Summary This chapter contains a complete overview of the C language extensions o
133. er 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 Zpragma inline atthe start of the source file This option can be useful to increase the possibilities for code compaction compiler option Or Related information qo Compiler option Or Code compaction 4 19 TSK3000 Embedded Tools Reference 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 default 25 4 Setthe 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 t 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 maxi
134. er 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 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 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 characte
135. ertion nonopinsertion 3 30 Offset 3 31 page 3 32 epeat endrep 3 33 resume 3 34 section 3 35 set 3 36 Size 3 37 3 38 3 39 3 40 undef 3 41 assembly control overview 3 5 conditional assembly overview 3 6 data definition overview 3 6 detailed description 3 7 Index 1 TSK3000 Embedded Tools Reference HLL overview 3 6 listing control overview 3 6 macros overview 3 6 overview 3 5 storage allocation overview 3 6 symbol definitions overview 3 5 TSK3000 specific overview 3 6 weak 3 42 Assembler options 4 45 help 4 46 check 4 48 diag 4 51 emit locals 4 52 error file 4 53 gp relative 4 56 nop insertion 4 66 use hardware 4 70 warnings as errors 4 74 c case insensitive 4 47 D define 4 49 f option file 4 54 g debug info 4 57 H include file 4 58 I include directory 4 59 i symbol scope 4 60 k keep output files 4 61 I list file 4 64 L list format 4 62 m preprocessor type 4 65 O optimize 4 67 o output 4 68 t section info 4 69 v verbose 4 72 V version 4 71 w no warnings 4 73 debug information 4 52 4 57 diagnostics 4 73 4 74 list file 4 62 4 64 4 69 optimization 4 67 preprocessing 4 49 4 58 4 65 Assembly functions arg 3 2 bigendian 3 2 ent 3 2 defined 3 2 gprel 3 2 Index 2 chi 3
136. es 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 length byte lt 2 bytes 0 comment checksum byte A linker generated S record file starts with a SO record with the following contents length byte 06 comment tlk checksum tlk 0060000746C6BAE 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 binary 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 51 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 length byte address code bytes checksum byte This record is used for 2 byte addresses Example 1130250F03EF04DF0ACE8A408A2A013EDFCDBOOE6 _ checksum _ code _ address length The linker has an option that controls the length of the output buffer for generating S1 re
137. ested 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 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 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
138. f section definition no processor name core def 2 core core name core descr gt gt 0 Acore def defines a core with the given core name as a unique name core descr architecture arch name argument list gt 011 endianness endianness type lt endianness gt gt 0 e Anarch name refers to a defined core architecture e Exactly one architecture statement must be present a core def 7 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 argument list gt 011 e def defines a processor with the proc name as a unique name e f 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 Aproc def contains exactly one derivative statement 7 12 Linker Script Language 7 3 11 Section Layout Definition section definition section layout space gt 011 locate direction 0l section statement 0 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 proc gt 011 core gt 011 space name e f more than one processor is present the proc name must be given for a global s
139. f 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 926 Literal no assignment is done Table 2 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 getc fgetwc except that is implemented as a macro FSS implementation NOTE Currently Zdefined as getchar 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 TSK3000 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 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
140. f 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 TSK3000 This chapter contains complete overviews of the following C language extensions of the TASKING C compiler e Data types e Keywords Memory type qualifiers Function qualifiers e Register usage e Intrinsic functions e Pragmas e Predefined macros 1 1 TSK3000 Embedded Tools Reference 1 2 Data Types The TASKING C compiler for the TSK3000 architecture 3000 supports the following fundamental data types Size Align nen Type C Type bit bit Limits Boolean _Bool 8 8 0 or 1 h t h e 8 8 27 27 4 signed char unsigned char 8 8 0 28 1 Int hort ind 16 16 g18 915 4 signed short unsigned short 16 16 o 216 4 enum 32 32 231 231 1 int HM ER 32 32 231 931_4 long signed long 32 32 0 282 4 unsigned long RE ead 64 32 963 963 4 signed long long unsigned long long 64 32 Q 264 1 Pointer pointer to function or data 32 32 0 232 1 Floating Point 3 402e38 1 175 38 PME Be 1 175 38 3 402638 double 32 1 798e308 _2 225 308 long double 2 225e 308 1 798308 Table 1 1 Data Types for the TSK3000 1 3 Keywords asm With the asm keyword you can use assembly instructions in the C source asm instruction template
141. fic warnings to suppress field or enter the following on the command line tlk w135 136 test obj tlk no warnings 135 136 test obj Related information qo Linker option warnings as errors Treat warnings as errors 4 110 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 Description With this option you tell the linker to treat warnings as errors When the linker detects an error or warning it tries to continue the link process and reports other errors and warnings With this option the linker will exit with an exit status not equal zero 0 for both errors and warnings and will not produce any output files Related information qo Linker option w Suppress some or all warnings 4 111 TSK3000 Embedded Tools Reference 4 4 Control Program Options The control program is a tool to facilitate use of the toolchain from the command line Therefor you can only call the control program from the command line The invocation syntax is tcc T3000 option file The option T3000 must always be specified to tell the control program to invoke the tools for the TSK3000 Options The control program processes command line options either by itself or when
142. functions 2 7 cosh functions 2 7 ctime 2 29 D Data types 1 2 db 3 12 Debug info 4 128 Debug information 4 52 define 3 13 defined 3 2 Derivative definition 7 2 7 24 dh 3 14 difftime 2 29 Directives See Assembler directives div 2 25 Double as float 4 123 ds 3 15 dsb 3 15 dsh 3 15 dsw 3 15 dw 3 16 E ELF DWARF object format 6 1 end 3 17 EOF 2 15 equ 3 18 erf functions 2 11 erfc functions 2 11 errno 2 3 exit 2 24 EXIT_FAILURE 2 23 EXIT SUCCES 2 23 exp functions 2 8 exp2 functions 2 8 expm1 functions 2 8 extern 1 9 3 19 F fabs functions 2 10 fclose 2 16 Index 4 fdim functions 2 11 FE ALL EXCEPT 2 4 FE DIVBYZERO 2 4 FE INEXACT 2 4 FE INVALID 2 4 FE OVERFLOW 2 4 FE UNDERFLOW 2 4 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 20 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 Index ftell 2 22 fwprintf 2 20 fwr
143. g 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 exists One method is code instrumentation which adds code to your application that takes care of the profiling process when the application is executed 4 For an extensive description of profiling refer to Chapter 5 Profiling the user s manual 4 30 Tool Options Compiler 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 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 if statement is executed 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
144. h derivative and enables the linker to distinguish between the present processors If you use processors 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 7 27 TSK3000 Embedded Tools Reference 7 7 2 nstantiating 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 myproc_2 that have the same derivative called myderiv you must instantiate both processors as follows processor myproc 1 1 derivative myderiv processor myproc 2 1 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 7 7 3 Defining External Memory and Buses It is common to define external memory off chi
145. h memories using an absolute address or range restriction see subsection Locating a group in section 7 8 2 Creating and Locating Groups of Sections 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 7 5 4 Mappings memory name 1 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 7 5 2 Defining Internal Buses 7 26 Linker Script Language 7 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 src offset 7 7 4 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 whic
146. h 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 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 atext line reaches its length limit use a continue the line Whitespace between quotes is preserved This is a continuation line This is a continuation line e tis possible to nest command line files up to 25 levels Example Suppose the file myopt ions contains the following lines T3000 DDEMO 1 test c Specify the option file to the control program tcc f myoptions tcc option file myoptions This is equivalent to the following command line tcc T3000 DDEMO 1 test c 4 124 Tool Options Control Program Related information 4 125 TSK3000 Embedded Tools Reference Control Program format Command line syntax format format You can specify the following formats IEEE IEEE 695 ELF ELF DWARF
147. 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 3000 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 7 7 Controlling the Linker with a Script in chapter Using the Linker of the user s manual 4 119 TSK3000 Embedded Tools Reference 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 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 Ex
148. he Assembler entry and select Miscellaneous 3 Enable the option Automatically generate GP relative offsets Command line syntax gp relative Description When this option is enabled the assembler automatically emits a GP relative relocation for symbolic offsets in load and store instructions if the base register is the GP register 28 When this option is disabled default you must use the built in assembly function GPREL on the symbolic offset in order to force the assembler to emit a GP relative relocation Assembly code generated by the compiler always uses the GPREL function Related information qo Assembly function GPREL 4 56 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 giflag debug info flag you can set the following flags asm Assembly source line information h H hll Pass high level language d
149. he library to standard out With the suboption s you the librarian displays all symbols per object file s0 Displays per object the library in which it resides the name of the object itself and all symbols in the object s1 Displays only the symbols of all object files in the library Example tlb t mylib lib The librarian prints a list of all object modules in the libary mylib lib tlb t s0 mylib lib The librarian prints per object all symbols in the library This looks like prolog obj symbols mylib lib prolog obj Oabi callee save mylib lib prolog obj callee restore div16 0bj symbols mylib lib divl16 0bj 16 mylib lib divl16 0bj 16 mylib lib divl16 0bj ureml6 mylib lib divl16 0bj reml6 Related information do 4 185 TSK3000 Embedded Tools Reference Librarian V Command line syntax V Description Display version information The librarian ignores all other options or input files Example tlb V The librarian displays version information but does not perform any tasks Related information 4 186 Tool Options Librarian Librarian w Command line syntax wlevel 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 wa
150. he 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 low n 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 t 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 architecture definition and memory parts where to locate the section 7 8 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 y
151. he option w multiple times Example To suppress warnings 135 and 136 enter 135 136 in the Specific warnings to suppress field or enter the following on the command line as3000 test src w135 w136 as3000 test src no warnings 135 no warnings 136 Related information qo Assembler option warnings as errors Treat warnings as errors 4 73 TSK3000 Embedded Tools Reference Assembler warnings as errors 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 qo Assembler option w Suppress some or all warnings 4 74 Tool Options Linker 4 3 Linker Options Altium Designer 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 Altium Designer versus options on the command line Most command line options have an equivalent option in Altium Designer but some options are only available on the command line for example in a Windows Command Prompt If there is
152. he 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 calender 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 TSK3000 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 str time is locale specific using the LC TIME category see section 2 2 12 locale h You can use the next conversion specifiers a X abbreviated weekday name 96A full weekday name b abbreviated month name B full month name c local date and time representation d day of the month 01 31 96H 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
153. her options or input files Related information db 4 145 TSK3000 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 4 146 Tool Options Control Program Control Program W pass Command line syntax Wcoption pass c option Pass option directly to the C compiler Waoption pass assemblerzoption Pass option directly to the assembler Wloption pass linkerzoption 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 db 4 147 TSK3000 Embedded Tools Reference Control Program w no warnings Command line syntax w nr no warnings nr Description With this option you can suppress all warning messages or specific C compiler 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 f you specify this option with a number o
154. ibraries 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 library name The control program recognizes the option I as an option for the linker and passes it as such Example tcc T3000 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 tcc T3000 no default libraries lmy test c Related information 4 Linker option I library library 4 136 Tool Options Control Program 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 do 4 137 TSK3000 Embedded Tools Reference Control Program o output file Command line syntax o file output file file Description Default the control program generates a file with the same base
155. implementation Moves read write file offset Calls 1seek FSS implementation Reads a sequence of characters from a file This function calls read FSS 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 TSK3000 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 stdio h 2 2 21 stdlib h 2 2 22 strings h and 2 2 23 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 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 so
156. 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 Linker Script Language 7 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 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 start address run addr symbol map map dest bus space dest dbits dest offset size src dbits src offset 7 17 TSK3000 Embedded Tools Reference 7 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
157. ing INCLUDE file atthe beginning of your assembly source Example as3000 Hmyinc inc testl src as3000 option file myoptions The file myinc inc is included at the beginning of test1 src before it is assembled Related information qo Assembler option I Include files path Section 6 5 How the Assembler Searches Include Files in chapter Using the Assembler of the user s manual 4 58 Tool Options Assembler Assembler I include directory Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Select Build Options 3 Add a pathname in the Include Files Path field If you enter multiple paths separate them with a semicolon Command line syntax l path 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 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 AS3000INC 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
158. inthe 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 e 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 7 33 TSK3000 Embedded Tools Reference 7 34 The clustered keyword tells the linker to 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 c
159. ion 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 tmk f mymake The make utility uses the file mymake to build your files Related information amp 4 159 TSK3000 Embedded Tools Reference Make Utility G Command line syntax G path Description Normally you must call the make utility tmk from the directory where your 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 tmk G myfiles Related information do 4 160 Tool Options Make Utility Make Utility 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 tmk i The make utility exits without an error code even when an error occurs Related information 4 161 TSK
160. ion to set the DEMO flag Macro Value DEMO 1 or empty 4 7 TSK3000 Embedded Tools Reference On the command line use the option D as follows c3000 DDEMO test c c3000 DDEMO 1 test c c3000 define DEMO test c c3000 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 B On the command line use the option D as follows c3000 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 4 8 Tool Options Compiler Compiler diag Menu entry 1 From the View menu select Workspace Panels System Messages The Message pannel appears 2 In the Message panel right click on the message you want more information on A popup menu appears 3 Select More Info A Message Info box appears with additional information 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 fo
161. irection 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 llroundllroundlllroundf llround 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 fmodl 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 TSK3000 Embedded Tools Reference frexp Idexp scalbn scalbin Math h Tgmath h Description frexp frexpl frexpf frexp Splits a float x into fraction f and exponent n so that f 0 0 or 0 5 lt f lt 1 0 and f 2 x Returns f stores n ldexp ldexpl ldexpf ldexp Inverse of rexp Returns the result of x 2n x and n are both arguments modf modfl 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
162. 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 mmm dd yyyy STDC level of ANSI standard Example To undefine the predefined macro _ TASKING c3000 U TASKING test c c3000 undefine TASKING test c Related information 4 Compiler option D Define preprocessor macro 4 39 TSK3000 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 Description By default char is the same as specifying signed char With this option char is the same as unsigned char Related information qo 4 40 Tool Options Compiler Compiler use hardware Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Processor entry and select Processor Definition 3 Enable one or more of the options e Multiply Divide unit present Command line syntax use hardware flag You can set the following flags d D divide Divide instructions m M multiply Multiply instructions Default dm Description With this option you te
163. it type argument in the list 2 13 TSK3000 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 undefine or redefine the macros below 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 qo 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 1 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
164. ite 2 21 fwscanf 2 20 G Generic instructions 3 43 getc 2 19 getchar 2 19 getcwd 2 31 getenv 2 24 gets 2 20 getwc 2 19 getwchar 2 19 global 3 22 gmtime 2 29 gprel 3 2 H Header files 2 2 alert h 2 2 complex h 2 2 ctype h 2 2 errno h 2 3 fcntl h 2 4 fenv h 2 4 float h 2 5 fss h 2 5 inttypes h 2 5 iso646 h 2 6 limits h 2 6 locale h 2 6 math h 2 7 setjmp h 2 12 signal h 2 13 stdarg h 2 13 stdbool h 2 14 stddef h 2 14 stdint h 2 5 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 7 20 hi 3 3 hypot functions 2 10 if elif else endif 3 23 ilogb functions 2 8 imaxabs 2 5 imaxdiv 2 5 include 3 25 Include directory 4 17 4 59 4 88 4 129 Include file 4 16 4 58 inline 1 4 inline noinline smartinline 1 9 Inlining 4 19 Instructions generic 3 43 Intel hex record type 6 5 Intel Hex record format 6 5 Intrinsic functions 1 7 isalnum 2 2 isalpha 2 2 isblank 2 2 iscntrl 2 2 isdigit 2 2 isfinite 2 12 isgraph 2 2 isgreater 2 11 isgreaterequal 2 11 isinf 2 12 isless 2 11 islessequal 2 11 islessgreater 2 11 islower 2 2 isnan 2 12 isnormal 2 12 ISO C standard selecting 4 5 4 130 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 Index 5 TSK3000 Embedded Tools Reference i
165. ith near calls t If you compile your C source with near calls but the called address cannot be reached with a near call the inker will generate an error It is recommended to use near addressing mode unless your application needs calls to addresses that fall outside a 256 MB region Related information do 4 22 Tool Options Compiler 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 misraczall the compiler checks for all supported MISRA C rules Example c3000 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 misra c report 4 23 TSK3000 Embedded Tools Reference Compiler misrac advisory warnings misrac required warnings Menu entry 1 From the Project menu select Project Options The Project Options dialog box ap
166. j The librarian deletes obj1 obj and obj2 0bj from the library mylib lib and displays which files are removed Related information do 4 179 TSK3000 Embedded Tools Reference Librarian f Command 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 tlb 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 continue the line Whitespace between quotes is preserved This is a continuation line This is a continuation line e tis possible to nest command line files up to 25 levels Example Suppose the file myopt ions contains the following
167. ker Script Language 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 the 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
168. ker Script Language bus bus name mau 8 width 8 map map_description 7 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 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 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 The mau field specifies the MAU size Minimum Addressable Unit of the space This field is required 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 The page size field sets the page size in MAUs for the address space It must be a power of 2 The default page size is 1 See also the page keyword in subsection Locating a group in section 7 8 2 Creating and Locating Groups of Sections The map keyword specifies how this address space maps onto an internal bus or onto another address space Mappings are described in sectio
169. la S records Description 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 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 addr 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 81 records 3 S2 records or 4 bytes S3 records default With the argument space name you can specify the name of the address space The name of the output file will be filename with the extension hex or sre and contains the code and data allocated in the specified space The other address spaces are also emitted whereas their output files are named filename spacename hex sre If you do not specify space name or you specify a non existing space the default address
170. ler 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 as3000 as3000 help as3000 To see a detailed description of the available options enter as3000 help options 4 46 Tool Options Assembler 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 different characters AN Disabling the option Assemble case sensitive in Altium Designer 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 Labe1Name is the same label as labelname Related information do 4 47 TSK
171. ler option I Generate list file in Section 4 2 Assembler Options of Chapter Tool Options 3 32 Assembly Language REPEAT ENDREP 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 qo FOR ENDFOR Repeat sequence of source lines n times 3 33 TSK3000 Embedded Tools Reference RESUME Syntax RESUME name attribute Description With the SECTION directive you always start a new section With the RESUME directive you can reactivate a previously defined section See the SECTION directive for a list of available section attributes If you omit the attribute the previously defined section with the same name is reactivated ignoring the attribute s If you specify an attribute you reactivate the section with that same attribute Example SECTION text SECTION data SECTION text SECTION data at 0x0 RESUME text RESUME data RESUME data at 0x0 Related information
172. lf expmll expml Returns the result of the exponential function eX 1 Not implemented log logf logl log Returns the natural logarithm 1n x x 0 log10 10910 109101 10910 Returns the base 10 logarithm of x x gt 0 loglp loglpf loglpl 1091 Returns the base e logarithm of 1 x x lt gt 1 Not implemented log2 log2f 10921 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 logbf 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 asa double floor floorf floorl floor Returns the largest integer not greater than x as a double rint rintl rintf rint Returns the rounded integer value as an int according to the current rounding direction See fenv h Not implemented lrint lrintf lrintl lrint Returns the rounded integer value as along int according to the current rounding direction See fenv h Not implemented llrint lrintf lrintl llrint Returns the rounded integer value as a 1ong 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 d
173. line Example c3000 static modulel c module2 c module3 c Related information 4 37 TSK3000 Embedded Tools Reference 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 Inthe 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 34 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 t0 amp If you have not used the option O the compiler uses default medium optimization so you can still specify the option t Related information 4 Compiler option O Specify optimization level 4 38 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
174. 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 LAN 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 ETE instructions for demo application ELSE m instructions for the real application ENDIF You can now use a macro definition to set the DEMO flag Macro Value DEMO 1 or empty 4 49 TSK3000 Embedded Tools Reference as3000 DDEMO test src as3000 DDEMO 1 test src as3000 define DEMO test src as3000 define DEMO 1 test src Note that all four invocations have the same effect Related information dE Assembler option f Read options from file 4 50 Tool Options Assembler Assembler diag Menu entry 1 From the View menu select Workspace Panels System Messages The Messages panel appears 2 In the Messages panel right click on the message you want more information on A po
175. linker uses the CALLS information to build a call graph Example CALLS main nfunc Indicates that the function main calls the function nfunc 3 11 TSK3000 Embedded Tools Reference DB Syntax label DB argument argumenr 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 abel it gets the 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 0 52 DB AB D 0x41420043 second argument is empty Example TABLE DB 14 253 0x62 ABCD CHARS DB A B C D Rel
176. ll the compiler that the TSK3000 target has a hardware multiply divide unit This way the compiler can use the optional divide and multiply instructions Related information 4 41 TSK3000 Embedded Tools Reference 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 do 4 42 Tool Options Compiler 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 In the Warnings field select one of the following options e Report all warnings 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 wi nr no warnings nr Description With this option you can suppress all warning messages or specific warning messages On the command line this option works as follows 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 Example
177. lon and the space name Memory Part 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 Linker Script File Part 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 separate file with linker option sl dump Locate Rule Part This part of the map file shows the rules the linker uses to locate sections Address space names ofthe address spaces as defined in the linker script file 181 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
178. m 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 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 SIG 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 terminated 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 cannot contain any bit type variables Also the given argument lastarg must be the last non b
179. m Designer 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 do 4 79 TSK3000 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 szmacro 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 name 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 3000 151 enter tlk test obj otest abs d3000
180. m of struct div t ldiv 11 t which have the same types Multibyte wide character and string conversions mblen s n mbtowc pwc s n wctomb s wc mbstowcs pwcs s n wcstombs 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 mbr1en 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 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 characters 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 wchar h 2 25 TSK3000 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 functi
181. 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 do 4 90 Tool Options Linker Linker L library directory ignore default library path Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Open the Build Options page 3 Adda pathname in the Library files path field If you enter multiple paths separate them with a semicolon Command line syntax Lair library directoryzdir 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 c3000 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 LIBTSK3000 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 i
182. me 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 4 64 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 Miscellaneous 3 Add the option m to the Additional assembler options field Command line syntax m n t Default mt preprocessor 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 do 4 65 TSK3000 Embedded Tools Reference Assembler nop insertion 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 Insert a NOP after all jumps and branches Command line syntax nop insertion Description When this option is enabled the assembler automatically fills the delay slots of jump and branch instructions with a NOP instruc
183. me 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 Automatic 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 locale h and the setlocale function shall not be used The setjmp and longjmp functions shall not be used The signal handling facilities of signal h shall not be used The
184. modulus addition subtraction gt gt vight 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 7 3 5 Built in Functions function_call addr id He size_id Es absolute expr addressof addr id exists section name max expr expr min expr expr sizeof size id sect section name mem mem name group group name group group name mem mem name sect section name e Every space 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 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 7 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 id which is a named section group or memory To get the offset of the section with the name asect addressof sect asect
185. mory that executes one task A complex target board may contain multiple standard processors and DSPs combined with configurable IP 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 7 2 Structure of a Linker Script File A script file consists of several definitions The definitions 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 interrupt 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 7 1
186. mum 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 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 incr you can specify how much the code size is allowed to increase By 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 c3000 inline max 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 qo Compiler option O Specify optimization level Section 2 7 3 Inlining Functions in chapter C Language of the user s manual 4 20 Tool Options Compiler Compiler k keep output files Menu entry Altium Designer always removes the src file when errors occur during compilation Comma
187. n 7 5 4 Mappings Stacks and heaps The stack keyword defines a stack in the address space and assigns a name to it The architecture 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 7 8 3 Creating or Modifying Special Sections The stack is described in terms of a minimum size nin size and the direction in which the stack grows grows This can be either from 1ow 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 7 19 TSK3000 Embedded Tools Reference 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 defini
188. n Chapter Tool Options of the reference manual section name Use this pragma to rename sections All sections are suffixed with the specified name For example pragma section mysection All sections are named text mysection data mysection etc source nosource With these pragmas you can choose which C source lines must be listed as comments in assembly output qo See also compiler option s source 1 10 C Language tradeoff level Specify tradeoff between speed 0 and size 4 qo 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 qo See also compiler option w no warnings 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 the WEAK directive in
189. n 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 filename syntax 2 The path that is specified with the assembler option 1 3 The path that is specified in the environment variable AStargetlNC 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 Mmyincludes 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 qo Assembler option I Add directory to include file search path in Section 4 2 Assembler Options of Chapter Tool Options 3 25 TSK3000 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 lis
190. n 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 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 This is a continuation line e tis possible to nest command line files up to 25 levels 4 85 TSK3000 Embedded Tools Reference Example Suppose the file myopt ions contains the following lines Mmymap generate a map file test obj input file Lc mylibs additional search path for system libraries Specify the option file to the linker tlk f myoptions tlk option file myoptions This is equivalent to the following command line tlk Mmymap test obj Lc mylibs Related information do 4 86 Tool
191. n return values depending on the function return types Return Type Register _Bool vO char vO short vO int long vO float vO 32 bit pointer v0 32 bit struct vO long long vo v1 double vo v1 64 bit struct vo v1 Table 1 5 Register usage for function return types 1 6 C Language 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 TSK3000 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 __ break volatile int _ break int val Generates the assembly break instruction Val is an 20 bit value which will be encoded in the code field of the break instruction Returns nothing 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 __ void Generate NOP instructions Returns nothing Example nop generate NO
192. name as the first specified input file With this option you specify another name for the resulting absolute object file Example tcc T3000 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 tcc T3000 o result abs test c prog c tcc T3000 output file result abs test c prog c Related information de 4 138 Tool Options Control Program Control Program p profile 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 x block block counters c C 4 callgraph call graph function function counters UT 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 exists One method is code instrumentation which adds code to your application that takes care of the profiling process when the application is executed qo For an extensive description of profiling refer to Chapter 5 Profiling in the user s manual With this option the compiler adds the extra code to your applica
193. nd for the final version Within the assembly source you define this code conditionally as follows 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 1 You can also define the symbols in Altium Designer as preprocessor macros in dialog Project Project Options Assembler Preprocessing assembler option D 3 23 TSK3000 Embedded Tools Reference Related information qo Assembler option D Define preprocessor macro in Section 4 2 Assembler Options of Chapter Too Options 3 24 Assembly Language JNCLUDE Syntax INCLUDE filename filename 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 contai
194. nd 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 db 4 71 TSK3000 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 assembler prints the filenames and the assembly passes while it processes the files so you can monitor the current status of the assembler Related information 4 72 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 Enable one of the options e Report all warnings 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 wi nr no warnings nr Description With this option you can suppresses all warning messages or specific 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 t
195. nd line syntax k keep output files Description If an error occurs during compilation the resulting src file may be incomplete or incorrect With this option you keep the generated output file sxc 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 do 4 21 TSK3000 Embedded Tools Reference Compiler m call 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 Setthe option Select call mode to Use 28 bit PC region calls default or to Use 32 bit absolute calls Command line syntax m f n call far near Description To address the memory of the TSK3000 you can use two different call modes far 32 bit absolute calls Thought you can address the full range of memory the address is first loaded into a register after which the call is executed near 28 bit PC region call The PC region call is directly coded into the JAL instruction This way of calling results in higher execution speed However not the full range of memory can be addressed w
196. ne a substitution string header body terminator Section 3 9 Macro Operations in Chapter Assembly Language of the user s manual 3 28 Assembly Language MESSAGE Syntax MESSAGE type strlexp symbol L str exp symbor 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 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 MESSAGE 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 29 TSK3000 Embedded Tools Reference NOPINSERTION NONOPINSERTION
197. ng 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 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 0bjl1 obj add obj2 0bj to the end of mylib lib tlb r mylib lib obj2 obj To insert obj3 obj just before obj2 0bj tlb r b obj2 obj mylib lib obj3 obj The library mylib 1lib after these two invocations now looks like 0bjl1 obj 0bj3 0bj 0bj2 0bj 4 183 TSK3000 Embedded Tools Reference Creating a new library To create a new library file add an object file and specify a library that does not yet exist tlb r objl obj newlib lib The librarian creates the library newlib lib 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 tlb r c objl obj mylib lib The librarian overwrites the library mylib 1ib and adds the object obj1 obj to it The new library mylib lib only contains obj1 0bj Related information 4 Librarian option t Print library contents 4 184 Tool Options Librarian Librarian t Command line syntax t s0 s1 Description Print a table of contents of t
198. nker looks in the default directory PRODDIR c3000 1ib for libraries Related information qo Linker option I Link system library 4 132 Tool Options Control Program Control Program I library Command line syntax Iname libraryzname 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 LIBTSK3000 unless you used the option L without a directory Example To search in the system library c3000 1ib C library tcc T3000 test obj mylib lib 1c3000 tcc T3000 test obj mylib lib 1 3000 The linker links the file test ob and first looks in mylib 1ib in the current directory only then in the system library c3000 1ib to resolve unresolved symbols Related information qo Linker option L Additional search path for system libraries Section 7 4 Linking with Libraries in chapter Using the Linker of the user s manual 4 133 TSK3000 Embedded Tools Reference 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 the generated object code and the relative addresses Note that the as
199. nly 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 qo Linker option first library first Scan libraries in given order 4 101 TSK3000 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 Add the option non romable to the Additional linker options field 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 do 4 102 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 Select an optimization level in the Optimization level box If you select Custom Optimization 4 Enable the optimizations you want Command line syntax O flags optimize flags Use the following options for predefined sets of flags O0 optimize 0 N
200. nly the specified warning is suppressed You can specify the option w multiple times Related information do 4 148 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 processing the files even in case of errors Related information qo Control Program option w Suppress all warnings 4 149 TSK3000 Embedded Tools Reference 4 5 Utility Options When you build a project in Altium Designer Altium Designer generates a makefile and uses the make utility tmk 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 tmk 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 Altium Designer 4 150 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
201. no equivalent option in Altium Designer you can specify a command line option in Altium Designer 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 tlk option file When you are linking multiple files either relocatable object files obj or libraries lib 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 tlk mfk test obj tlk map file format files t link test obj When you do not specify an option a default value may become active 4 75 TSK3000 Embedded Tools Reference Linker help Menu entry Command line syntax
202. ns cannot be selected in load time groups size spec 7 size expr reserved specs reserved spec lt reserved gt gt 0 reserved spec attributes fill 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 aggregate section statement section statement 0 group descr if statement section creation statement group descr group group name 0 group specs 0l section statement e No two groups for an address space can have the same group name group Specs group spec lt group spec gt 0 group alignment attributes group load address fill lt fill values 0li group page group run address group type allow cross references group spec 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 7 14 Linker Script Language attributes attributes attribute l group load address load addr lt load or run addr 0l fill spec fill fill values fill_values expr expr lt gt gt 0 group_page page lt gt 011 group run address run addr lt load_or_run_addr gt
203. ns 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 functions 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 1 of x acos acosf acosl acos Returns the arc cosine 1 x of x atan atanf atanl atan Returns the arc tangent tan x of x atan2 atan2f atan21 atan2 Returns the result of tan y x sinh sinhf sinhl sinh Returns the hyperbolic sine of x 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 2 7 TSK3000 Embedded Tools Reference Exponential and logarithmic functions All of these functions are new in C99 except for exp log and 10910 Math h Tgmath h Description exp expf expl exp Returns the result of the exponential function exp2 exp2f 21 exp2 Returns the result of the exponential function 2 Not implemented expml expm
204. nted 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 write to the given stream Returns EOF WEOF on error FSS implementation Libraries Stdio h Wchar h Description printf format wprintf format Performs a formatted write to the stream stdout Returns EOF WEOF on error FSS implementation sprintf s 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 format format maximum number of characters including the terminating null character to be written vfprintf stream vfwprintf stream Same as f printf fwprintf but extra format arg format arg arguments 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 arg arg arguments 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 format arg format arg arguments 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 point
205. nverted 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 where 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
206. o 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 L first fit decreasing Use a first fit decreasing algorithm to locate unrestricted sections in memory UT 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 qo Section 7 2 3 Linker Optimizations in chapter Using the Linker of the user s manual 4 103 TSK3000 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 or more output formats Command line syntax o filename format adar size space name output filename format addr size space You can specify the following formats IEEE IEEE 695 ELF ELF DWARF IHEX Intel Hex SREC Motoro
207. 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 qe Linker option link only Link only no locating 4 115 TSK3000 Embedded Tools Reference 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 qo Compiler option check Check syntax Assembler option check Check syntax 4 116 Tool Options Control Program Control Program D define Command line syntax Dmacro name smacro definition name smacro 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 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
208. odule 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 defined 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 qo EXTERN Import global section symbol 3 22 Assembly Language JF 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 a
209. olds implementation defined error codes This function is not defined in ISO IEC 9899 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 ENOSPC ESPIPE EROFS EPIPE ELOOP ENAMETOOLONG ON B WN n Oo 10 11 12 13 14 15 16 17 18 19 20 21 22 Floating point errors 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 TSK3000 Embedded Tools Reference EDOM 23 Argument too large ERANGE 24 Result too large Errors returned by prinff scanf ERR FORMAT 25 Illegal format string for printf scanf 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 cnt1 nh contains definitions of flags used by
210. olved from a lib Related information qo Linker option no rescan Rescan libraries to solve unresolved externals 4 87 TSK3000 Embedded Tools Reference Linker I include directory Menu entry Command line syntax Ipath include directory path 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 which 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 1sl Example Suppose that your linker script file my1s1 1s1 contains the following line include myinc inc You can call the linker as follows tlk Ic proj include dmylsl lsl test obj tlk include directory c proj include 1sl file mylsl lsl 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 do 4 88 Tool Options Linker Linker i user provided initialization code Menu entry 1 From the Project menu select Project Options The Project Options
211. ons which take arguments of type wchar t These functions are declared in wchar h Copying and concatenation functions Stdio h Wchar h Description memcpy si s2 n wmemcpy 51 52 memmove sl1 s2 n strcpy sl s2 wcscpy sl s2 strncpy sl s2 n wcsncpy sl s2 n strcat sl s2 wcscat sl s2 strncat sl s2 n wcsncat sl s2 n Comparison functions Stdio h Wchar h wmemmove s1 s2 n Copies n characters from s2 into 57 and returns s1 If s1 and s2 overlap the result is undefined Same as memcpy but overlapping strings are handled correctly Returns s7 Copies s2 into s1 and returns s1 If s and s2 overlap the result is undefined Copies not more than n characters from s2 into s1 and returns s7 If s1 and s2 overlap the result is undefined Appends a copy of s2 to s7 and returns 57 If s1 and s2 overlap the result is undefined Appends not more than n characters from s2 to s1 and returns s7 If s1 and s2 overlap the result is undefined Description memcmp s1l s2 n wmemcmp si s2 n strcmp si s2 wcscmp sl s2 strncmp s1 s2 n wcsncmp si s2 n strcoll sl s2 wcscoll sl s2 2 26 Compares the first n characters of s1 to the first n characters of s2 Returns lt 0 if s1 lt s2 O if s1 s2 or gt O if s1 gt s2 Compares string s7 to string s2 Returns lt 0 if s1 lt s2 0 if s1 s2 or gt O if 57
212. or uppercase respectively 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 also stop f double eE 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 96 character Conversion specifications should be built as follows in order meaning that no assignment is done for this field Anumber 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 Il for a pointer to long long The conversion characters f and g may be preceded by if the argument is a pointer to double rather than float and by L for a
213. ord architecture you tell the linker that the given core has a certain architecture The architecture name 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 7 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 7 7 3 Defining External Memory and Buses e The type field specifies a memory type rom read only memory ram random access memory non volatile ram 7 25 TSK3000 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 suc
214. ortest possible operand encoding for instructions Related information 4 Section 6 3 Assembler Optimizations in chapter Using the Assembler of the user s manual 4 67 TSK3000 Embedded Tools Reference Assembler o output Menu entry Altium Designer 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 as3000 o relobj obj asm src as3000 output relobj obj asm src Related information db 4 68 Tool Options Assembler 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 stdout I L 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 c
215. ory 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 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 displayed is the name of the deepest nested group Section The name of 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 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 5 6 List File Formats Locate Part Symbol translation 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 co
216. otes 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 This is a continuation line e tis possible to nest command line files up to 25 levels 4 13 TSK3000 Embedded Tools Reference Example Suppose the file myopt ions contains the following lines g DDEMO 1 test c Specify the option file to the compiler c3000 f myoptions c3000 option file myoptions This is equivalent to the following command line c3000 g DDEMO 1 test c Related information do 4 14 Tool Options Compiler 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 Debug Information 3 Enable the option Generate symbolic debug information 4 Enable or disable 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 call frame Generate call frame information only a all Generate all debug information Description With this option yo
217. ou call the make utility Example tmk n The make utility does not perform any tasks but displays what it would do if called without the option n Related information 4 Make utility option s Do not print commands before execution 4 166 Tool Options Make Utility Make Utility p Command line syntax q 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 make all target files precious This means that dependency files are never removed Example tmk p The make utility never removes target dependency files Related information qb 4 167 TSK3000 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 tmk 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 db 4 168 Tool Options Make Utility Make Utility r Command line syntax r Description When you call the make utility it first reads the implicit rules from the file tmk mk then it re
218. ou can also modify special sections like stack and heap or create a reserved section This is described in section 7 8 3 Creating or Modifying Special Sections With the group_specifications you actually locate the sections in the group This is described in subsection Locating a group 7 31 TSK3000 Embedded Tools Reference 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 matches with all section names matches with a single character in the section name 24 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 to Z group 1 select mysection select 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 do not carry the given attribute With attribute you select sections that h
219. ount 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 as3000 1 tcl test src as3000 1 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 qo Assembler option I generate list file 4 69 TSK3000 Embedded Tools Reference Assembler use hardware Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expand the Processor entry and select Processor Definition 3 Enable one or more of the options e Multiply Divide unit present Command line syntax use hardware f ag You can set the following flags d D divide Divide instructions m M multiply Multiply instructions Default dm Description With this option you tell the assembler that the TSK3000 target has a hardware multiply divide unit This way the assembler can use the optional divide and multiply instructions Related information do 4 70 Tool Options Assembler Assembler V version Menu entry Comma
220. p and external buses at the global scope outside any enclosing definition Internal memory on chip memory is 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 name 1 type rom mau 8 size 64k speed 2 map map_description 7 28 Linker Script Language qo For a description of the keywords see section 7 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 4 For a description of the keywords see section 7 5 2 Defining Internal Buses You can connect off
221. pe 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 do 4 12 Tool Options Compiler 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 set in the other dialogs Only in extraordinary cases you may want to use them in combination Altium Designer 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 an argument surround the argument with single or double qu
222. pears 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 qo Compiler option misrac Linker option misra c report 4 24 Tool Options Compiler Compiler n 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 amp 4 25 TSK3000 Embedded Tools Reference Compiler O optimize Menu entry 1 ao F Oo Command line syntax 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 field select a le
223. pression sign adjusted LO expr Least significant half word of the expression sign adjusted LSB expr Least significant byte of the expression LSH expr Least significant half word of the expression MSB expr Most significant byte of the expression MSH expr Most significant half word of the expression STRCAT strl1 str2 Concatenate 517 and str2 STRCMP strl1 str2 Compare str1 with str2 3 1 TSK3000 Embedded Tools Reference Function Description STRLEN Str Return length of string STRPOS strl str2 start Return position of str1 in str2 3 1 2 Detailed Description of Built in Assembly Functions 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 ordinal 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 this is the default returns 0 if the assembler generates code for little endian mode CNT Returns the number of macro arguments of the current macro expansion as an integer If you use thi
224. pup menu appears 3 Select More Info A Message Info box appears with additional information 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 as3000 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 as3000 diag html all aserrors html Related information do 4 51 TSK3000 Embedded Tools Reference Assembler emit locals Menu entry Command line only Command line syntax emit locals Description With this option the assembler also emits local symbols to the object file Normally
225. q 2 2 11 limits h Contains the sizes of integral types defined as macros 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 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 5 2 6 Libraries struct lconv localeconv void Returns a pointer to type stuct 1conv 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 functiont 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 contai
226. r call mode is a 32 bit absolute call With far calls you can address the full range of memory The address is first loaded into a register after which the call is executed t Near calls are only possible if the destination address of the call is located within the same 256 MB region as the address of the call itself hardware restriction If you need to call a function just outside the 256 MB region from where it is called you must use a far call 1 8 C Language qo See compiler option m call in section 4 1 Compiler Options in Chapter Tool Options extern symbol Force an external reference extern assembler directive even when the symbol is not used in the module See the EXTERN directive directive in Section 3 2 Assembler Directives and Controls 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 Xx y Z 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 ll 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
227. r 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 abel 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 and DSw directives are variants of the DS directive DSB The expression argument specifies the number 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 Example RES DS 5 3 allocate 8 bytes Related information qo BS Block Storage DB Define Byte DH Define Half Word DW Define Word 3 15 TSK3000 Embedded Tools Reference DW Syntax label DW argument argument 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 anexpression e NULL indicated by two adjacent commas If you specify abel it gets the value of the location counter at the start of the directive processing Multiple arguments are
228. re source field or click 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 a document level Project Document 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 c3000 Hstdio h testl c test2 c c3000 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 qo Compiler option 1 Add directory to include file search path Section 4 5 How the Compiler Searches Include Files in chapter Using the Compiler of the user s manual Tool Options Compiler Compiler I include directory Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Open the Build Options tab 3 Adda pathname in the Include files path field If you enter multiple paths separate them with a semicolon Command line syntax l path 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
229. rective 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 96 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 926 Return hex Substitutes the symbo sequence with a character string that value of symbol represents the hexadecimal value of the symbol i Macro string Allows the use of macro arguments as literal strings delimiter b Macro local label Causes local labels in its term to be evaluated at normal scope override rather than at macro scope 3 27 TSK3000 Embedded Tools Reference Example The macro definition macro a MACRO argl arg2 db argl dw argl arg2 ENDM The macro call section data macro_a 2 3 The macro expands as follows db 2 dw 2 3 Related information qo DEFINE Defi
230. rence 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 c3000 Oac test c c3000 optimize coalesce cse test c When you do not specify an option a default value may become active 4 2 Tool Options Compiler Compiler help Menu entry Command line only Command line syntax help zitem 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 c3000 c3000 help c3000 The following invocation displays a list of the available pragmas c3000 help pragmas
231. rmally the linker automatically tries to maximize the size unless you specified the fixed keyword group 1 stack mystack size 2k The linker creates two labels to mark the begin and end of the stack 1e_ub_stack_name for the begin of the stack and 1 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 7 5 3 Defining Address Spaces Heap The heap keyword 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 specified 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 ixed keyword 7 36 Linker Script Language 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 1c 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 reserved keyword tells the linker to create an area or section of a given size The linker will not locate any other section
232. rmat 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 c3000 diag 282 This results in the following message and explanation E282 unterminated comment 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 c3000 diag html all cerrors html Related information 4 9 TSK3000 Embedded Tools Reference 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 Efflags preprocess flags 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 tha
233. rmation for the module test c during execution compile as follows tcc T3000 pb test c tcc T3000 profile block test c In this case you must link the library pb3000 1ib Related information qe Chapter 5 Profiling in the user s manual tcc T3000 format IHEX space code test c 4 140 Tool Options Control Program 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 tcc T3000 static modulel c module2 c module3 c Related information do 4 141 TSK3000 Embedded Tools Reference Control Program T target Command line syntax Ttarget target iarget You must specify the following target 3000 for the TSK3000 Description You must always specify this option With this option you specify the target to the control program Based on this setting the control program invokes the tools for the chosen target Related information do 4 142 Tool Options Control Program Control Program t k
234. rning level is 8 Example To suppresses warnings above level 5 tlb x w5 mylib lib objl obj Related information d 4 187 TSK3000 Embedded Tools Reference Librarian x Command line syntax x 0 v Description Extract an existing module from the library 0 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 tlb x mylib lib objl obj If you do not specify an object module all object modules are extracted tlb x mylib lib Related information 4 188 5 List File Formats Summary This chapter describes the format of the assembler list file and the linker map file 5 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 a
235. rocess Related information qo Make utility option n Perform dry run 4 171 TSK3000 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 tmk 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 do 4 172 Tool Options Make Utility Make Utility time Command line syntax time Description With this option you tell the make utility to display the current date and time on standard output Example tmk time The make utility displays the current date and time and updates out of date files Related information d 4 173 TSK3000 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 tmk V The make utility displays the version information but does not perform any tasks Related information do 4 174 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 tmk W test abs The make utility rebuilds out of date
236. rom The name of the file is the name of the Altium Designer 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 AN The linker always outputs a debugging file in either IEEE 695 or ELF DWARF format and optionally an absolute object file in Intel Hex format and or Motorola S record format Example To generate Intel Hex output files for each defined memory enter the following on the command line tlk cmyfile IHEX testl obj tlk chip output myfile IHEX testl obj In this case this generates the file myfile memname hex 4 77 TSK3000 Embedded Tools Reference Related information qo Linker option o Output file Section 6 2 Motorola S Record Format Section 6 3 Intel Hex Record Format in Chapter Object File Formats 4 78 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 Altiu
237. rs 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 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 Il or L h indicates that the argument is to be treated as a short or unsigned short number 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 TSK3000 Embedded Tools Reference Character Printed as d i int signed decimal o int unsigned octal x X int unsigned hexadecimal in lowercase
238. rted in the original application code and may therefore slow down the program execution The following checks are available bounds 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 case 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 4 32 Tool Options Compiler malloc 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 amp 4 33 TSK3000 Embedded Tools Reference Compiler s source Menu entry 1 From the Project menu select Project Options The Project Options dialog box appears 2 Expan
239. ruct tm below is defined according to ISO IEC9899 with one exception this implementation does not support leap seconds The struct tmtype is defines as follows struct tm int int int int int int int int int 2 28 tm_sec tm_min tm_hour tm_mday tm_mon tm_year tm_wday tm_yday tm_isdst 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 Libraries Time manipulation clock difftime tl t0 mktime tm tp time timer Time conversion asctime tm tp ctime timer gmtime timer localtime timer 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 oftype time t The return value has the same encoding as the return value of the t ime function Returns the current calendar time This value is also assigned to t imer Converts the broken down time in t
240. s The Project Options dialog box appears 2 Expand the Linker entry and select Miscellaneous 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 t1k 1df is used Related information 4 Linker option m file formatting 4 96 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 memory map file map 4 In the Map file format section enable or disable the information you want to be included in the map file Command line syntax Mifile 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 Altium Designer names the map file after the project 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 absol
241. s 4 113 TSK3000 Embedded Tools Reference Control Program address size Command line syntax address size addr size Description If you specify IHEX or SREC with the control option format you can additionally specify the record length and the address space 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 81 records 3 S2 records default or 4 bytes S3 records If you do not specify size the default address size is generated Example To create the SREC file test sre with S1 records type tcc T3000 format SREC address size 2 test c Related information Control program option format Set linker output format Control program option space Set linker output space name Linker option o Specify an output object file 4 114 Tool Options Control Program 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 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
242. s Part k k dek k k k k A kK KK kK File From archive Symbol causing the extraction cstart obj 3000 11 Exit hello obj printf obj c3000 lib printf FEISS III k Bart _ in File in Section in Size out Offset out Section out Size hello obj text 0x00000010 0x00000000 text 0x00000010 printf obj text 0x00000058 0x00000000 0x00000058 GARI cstart obj text cstart 0 000000 0 0x00000000 text cstart 0x000000a0 Hn et Module Local Symbols Part Symbol translation sorted on name Scope hello obj Name Address Space hello c 0x00000000 rodata 0x000000a0 TSK3000 TSK3000 main rodata 0x00000088 sdata 0x00010000 text 0x000000d8 5 3 TSK3000 Embedded Tools Reference KARAKARA Cposs Reference Part Fr nnn Definition file Definition section Symbol Referenced in cstart obj text cstart START hello obj hello obj text main cst
243. s 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 db 4 100 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 Notice that resolving one symbol may introduce new unresolved symbols With this option you tell the linker to scan the object files and libraries o
244. s function when macro expansion is not active the assembler issues a warning Example ARGCOUNT SET CNT reserve argument count DEFINED symbol symbol Returns 1 if symbol has been defined 0 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 GPREL symbol Returns the offset of symbol from the global pointer 28 If you want the assembler to generate GP relative offsets automatically option gp relative enable the option Automatically generate GP relative offsets in the Assembler Miscellaneous page of the Project Options dialog 3 2 Assembly Language Returns the most significant half word of the result of the expression adjusted for signed addition HI expression is equivalent to expression gt gt 16 expression amp 0x8000 1 0 amp OxFFFF expression can be any relocatable or absolute expression Example The instruction lw 2 addr expands to lui at hi addr lw 2 lo addr at LO expression Returns the east significant half word bits 0 15 of the result of the expression adjusted for signed addition expression can be any relocatable or absolute expression LSB expression Returns the east significant byte of the result of the expre
245. s 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 absolute 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 rom scratch rx yes r rom executable rw yes rw lt ram gt data rw no rw lt ram gt scra
246. s specified in the environment variable LIBTSK3000 3 The default directory PRODDIR c3000 1ib or a processor specific sub directory Example Suppose you call the linker as follows tlk test obj Lc Mnylibs 1c3000 tlk test obj library directory c Mnylibs library c3000 First the linker looks in the directory c mylibs for library c3000 1ib this option If it does not find the requested libraries it looks in the directory that is set with the environment variable LIBTSK3000 Then the linker looks in the default directory PRODDIR c3000 1ib for libraries 4 91 TSK3000 Embedded Tools Reference Related information qo Linker option I Link system library Section 7 4 1 How the linker searches libraries in chapter Using the Linker of the user s manual 4 92 Tool Options Linker 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 libraryzname Description With this option you tell the linker 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 LIBTSK3000 unless you used the option L without a directory Example To search in th
247. s that initialize a buffer the code field lists one value followed by the word REPEATS The first number in this column 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 t For the SET and EQU directives the ADDR and CODE columns do not apply The symbol value is listed instead Related information See section 6 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 5 2 List File Formats 5 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 ISIC OCI Processed File
248. sed Free free gap 5 TSK3000 TSK3000 main 0x00080000 0x00080000 100 0x00000000 0 0x00000000 0 Fern nn nf Address range usage at memory level Name Total Used Free free gap iram 0x00080000 0x00080000 100 0x00000000 0 0 00000000 0 irom 0x00010000 0x00001a95 11 0 0000 56 89 0 0000 568 89 xrom 0x00080000 0x00000000 0 0x00080000 100 0x00080000 100 Script File Part kkk kkk kk kk kk kk kk kk kk kkk kkk kk kkk kkk kk Locate Rul e Part kkk kkk kkk kkk kkk kk kkk kkk kkkkkkkkkk Address space Type Properties Sections TSK3000 TSK3000 main absolute 0x00000000 text cstart TSK3000 TSK3000 main contiguous sdata sbss TSK3000 TSK3000 main unrestricted stack TSK3000 TSK3000 main unrestricted bss data xvwbuffer TSK3000 TSK3000 main unrestricted rodata data sdata table TSK3000 TSK3000 main ballooned stack The meaning of the different parts is Processed Files Part This part of the map file shows all proce
249. sembler 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 tcc T3000 1 c 2 c list files Related information 4 Assembler option I Generate list file Assembler option L List file formatting options 4 134 Tool Options Control Program 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 qo Control Program option v verbose Verbose output 4 135 TSK3000 Embedded Tools Reference 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 this option you tell the control program not to specify the standard C l
250. sename of the C source file is used with extension src Example To create the file output src instead of test src enter c3000 o output src test c c3000 output output src test c Related information 4 29 TSK3000 Embedded Tools Reference 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 Debug Information 3 Enable the option Generate profiling information 4 Enable one or more of the following suboptions to select which profiles should be obtained e Block counters not in combination with with Call graph or Function timers Call graph e Function counters e Function timers t 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 7g or debug does not affect profiling execution time or code size Command line syntax plflags profile flags Use the following option for a predefined set of flags pg profile2g 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 UT time function timers Description Profiling is the process of collectin
251. shall only be used for constants qualifiers specifiers 91 HR Macros shall not be define d and undefd within a block 92 A undef should not be used 93 A A function should be used in preference to a function like macro 94 R Afunction like macro shall not be used without all arguments 95 HR Macro arguments shall not contain pre preprocessing directives A violation is reported when the first token of an actual macro argument is 96 R Macro definitions parameters should be enclosed in parentheses 97 A Don t use undefined identifiers in pre processing directives 98 R A macro definition shall contain at most one or operator 99 R Alluses of the pragma directive shall be documented This rule is really a documentation issue The compiler will flag all Zpragma directives as violations 100 R defined shall only be used in one of the two standard forms 101 A Pointer arithmetic should not be used 102 A 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 8 4 MISRA C Rules 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 R X ou n c cm d 2222222222222222222 No relational operators between pointers to different objects In general checking whether two pointers point to the sa
252. shown in the Properties column the second number in that field is the alignment requirement for the address range ballooned After locating all sections the largest remaining gap in the space is used completely for the stack and or heap 5 7 TSK3000 Embedded Tools Reference Properties Sections The contents depends on the Type column The sections to which the rule applies restrictions between sections are shown in this column ordered contiguous clustered For contiguous sections the linker uses the section order as shown here Clustered sections can be located in any relative order Related information Section 7 9 Generating a Map File in Chapter Using the Linker of the user s manual Linker option M Generate map file 5 8 6 Object File Formats Summary This chapter describes the formats of several object files 6 1 ELF DWARF Object Format The TASKING TSK3000 toolchain by default produces objects in the ELF DWARF 2 format The ELF DWARF 2 Object Format for the TSK3000 toolchain follows the convention as described in the System V Application Binary Interface MIPS RISC Processor Supplement 3rd Edition 1990 1996 The Santa Cruz Operation Inc For a complete description of the ELF and DWARF formats please refer to the Tool Interface Standard TIS 6 1 TSK3000 Embedded Tools Reference 6 2 Motorola S Record Format With the linker option ofilename SREC option the linker produc
253. 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 Returns a non zero value if not succesful Creates a temporary file of the mode wb that will be automatically removed when closed or when the program terminates normally 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
254. ss 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 is length 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 lype 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 6 5 TSK3000 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
255. ssed files This also includes object files that are extracted from a library with the symbol that led to the extraction Link Part 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 TSK3000 Embedded Tools Reference in Section A section name from the input object file in Size The size of the input section out Offset The offset relative to the start of the output section out Section Theresulting output section name out Size The size of the output section Module Local Symbols Part 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 Reference Part 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 Part Section translation This part of the map file shows the absolute position of each section in the absolute object file It is organized per address space mem
256. ssembler directives LisT NOLIST and PAGE and with the assembler option Lflag list format you can format the list file See Section 3 2 Assembler Directives in Chapter Assembly Language and Section 4 2 Assembler Options in Chapter Tools Options The fourth line contains the headings of the columns for the source listing 5 1 TSK3000 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 7Frr 0002 7Err 0004 O2rrrr 0000 RESERVED 0001 CYCLES LINE SOURCE LINE 1 Module start 2 2 20 mov R7 f8lsb 1 ini 2 4 21 mov R6 Z8msb 1 ini 4 8 22 gjmp _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 line
257. ssion 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 expression The result of the expression is calculated as a word 32 bits MSB expression Returns the most significant byte of the result of the expression The result of the expression is calculated as16 bits MSH expression Returns the most significant half word bits 16 31 of the result of the expression The result of the expression is calculated as a word 32 bits MSH expression is equivalent to expression gt gt 16 amp Oxffff STRCAT string1 string2 Concatenates string1 and string2 and returns them as a single string You must enclose string and string2 either with single quotes or with double quotes Example DEFINE ID GSTRCAT TAS KING ID TASKING 3 3 TSK3000 Embedded Tools Reference STRCMP string1 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 string1 lt string2 0 if string string2 gt 0 if string1 gt string2 Example IF STRCMP STR MAIN does STR equal MAIN STRLEN string Returns the length of string as an integer Example SLEN SET STRLEN string SLEN 1 STRPOS string1 2 5
258. 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 least significant byte of a word which represents the ASCII value of the character DW AB D gt 0x0000041 0x0000042 0x0000000 second argument is empty 0x0000044 Example TABLE DW 14 253 0x62 ABCD CHARS DW A B C D Related information qb BS Block Storage DS Define Storage DB Define Byte DH Define Half Word 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 code code mov R7 9 mov R6 0 ret END End of assembly module 3 17 TSK3000 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 A D PORT MYSYMBOL E
259. swblank 2 2 iswcntrl 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 7 Idexp functions 2 10 Idiv 2 25 Igamma functions 2 11 Librarian options 4 178 d 4 179 p 4 182 f 4 180 m 4 181 r 4 183 t 4 185 V 4 186 W 4 187 X 4 188 add module 4 183 create library 4 183 delete module 4 179 extract module 4 188 move module 4 181 print list of objects 4 185 print list of symbols 4 185 print module 4 182 replace module 4 183 warning level 4 187 Libraries linking 4 87 4 101 Library specifying 4 91 4 93 4 132 4 133 4 134 Index 6 Linker macro 4 80 Linker options 4 75 help 4 76 case insensitive 4 79 diag 4 82 error file 4 84 first library first 4 87 link only 4 94 Isl check 4 95 Isl dump 4 96 misra c report 4 99 no rescan 4 101 non romable 4 102 warnings as errors 4 111 c chip output 4 77 D define 4 80 d IsI file 4 81 e extern 4 83 f option file 4 85 I include directory 4 88 i user provided initialization code 4 89 k keep output files 4 90 L ignore default library path 4 91 I library 4 93 L library directory 4 91 M map file 4 9
260. t The linker will now locate the file Example In this example the files test1 obj test2 obj and test3 obj are incrementally linked 1 tlk r testl obj test2 0bj otest out testl obj and test2 0bj are linked 2 tlk incremental test3 obj test out test3 obj and test out are linked task1 out is created 3 tlk taskl out taskl out is located Related information qo Section 7 5 Incremental Linking in chapter Using the Linker of the user s manual 4 106 Tool Options Linker Linker S strip debug 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 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 4 107 TSK3000 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 db 4 108 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 Add the option verbos
261. t can be used for the makefile p P noline Strip line source position information 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 Altium Designer 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 amp Tool Options Compiler 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 c3000 error file errors err test c Related information amp 4 11 TSK3000 Embedded Tools Reference 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 ty
262. t 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 E source line 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 E source line 3 END Related information qo Assembler option 1 Generate list file in Section 4 2 Assembler Options of Chapter Tool Options 3 26 Assembly Language MACRO ENDM Syntax macro name MACRO argument argument Iano definition statements DM 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 di
263. t 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 do 4 121 TSK3000 Embedded Tools Reference Control Program error file Command line syntax error file file Description With this option the control program 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 for compiler or ers for assembler Example TO write errors to errors err instead of stderr enter tcc T3000 error file errors err test c Related information qo Control Program option warnings as errors Treat warnings as errors 4 122 Tool Options Control Program 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 4 123 TSK3000 Embedded Tools Reference Control Program f option file Command line syntax f file option 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 Wit
264. tandard output usually your screen Related information db 4 155 TSK3000 Embedded Tools Reference Make Utility d dd Command line syntax d 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 tmk d Shows which files are out of date and rebuilds them Related information do 4 156 Tool Options Make Utility Make Utility e Command line syntax e Description If you use macro 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 tmk e The make utility uses the settings of the environment variables regardless of macro definitions Related information db 4 157 TSK3000 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 tmk err error txt The make utility writes messages to the file error txt Related information qo Make utility option s Do not print commands before execution 4 158 Tool Options Make Utility Make Utility Command line syntax f my_makefile Descript
265. targets in the makefile except the file test abs which is considered now as up to date Related information d 4 175 TSK3000 Embedded Tools Reference Make Utility 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 Altium Designer uses this option for the graphical version of make Example tmk x If errors occur the make utility gives extended information Related information amp 4 176 Tool Options Librarian 4 6 Librarian Options The librarian tlb 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 tlb 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 therefor 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 Altium Designer 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
266. tart address for the position where the C startup code 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 symbo1 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 7 20 Linker Script Language 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 7 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 m
267. tch rwx yes rw lt ram gt executable 7 37 TSK3000 Embedded Tools Reference group reserved myreserved size 2k attributes rw fill 0xaa 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 1c ub name for the start and 1c ue name for the end of the reserved section Output sections The section keyword tells the linker to accumulate sections obtained from object files input sections into an output section of a fixed size in the locate phase You can select the input sections with select statements With the keyword size you specify the size of the output section 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 myinputl select myinput2 The linker creates two labels to mark th
268. te 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 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 11 R Identifiers shall not rely on significance of more than 31 characters 12 A The same identifier shall not be used in multiple name spaces 13 A Specific length typedefs should be used instead of the basic types 14 R Use unsigned char or signed char instead of plain char x 15 A Floating point implementations should comply with a standard 8 1 TSK3000 Embedded Tools Reference 8 2 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 R 23 gt gt GU uH gt gt MM 3 3 d 2 d 222222 2222222232 The bit representation of floating point numbers shall not be used A violation is reported when a pointer to a floating point type is co
269. 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 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 tcc T3000 Wc Oac test c tcc T3000 pass c optimize tcoalescer tcse test c When you do not specify an option a default value may become active 4 112 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 tcc help toc To see a detailed description of the available options enter tcc help option
270. tion NOP insertion can be done with higher granularity by using the nopinsertion and nonopinsertion directives in assembly sources Related information qo Assembler directive nopinsertion 4 66 Tool Options Assembler 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 Jumpchains e Instruction size Command line syntax Oflags optimize flags You can set the following flags g G generics Allow generic instructions jJ jumpchains Jump chains 5 6 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 followed by a jump from b to c is replaced by a jump from ato Optimize instruction size With this optimization the assembler tries to find the sh
271. tion of a stack See also the heap keyword in section 7 8 3 Creating or Modifying Special Sections See section 7 8 Semantics of the Section Layout Definition for information 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 If the architecture definition contains more than one address space you must define exactly one copy table in one of the address spaces If the architecture definition contains only one address space the copy table definition is optional 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 Start address The start address keyword specifies the s
272. tion 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 will count how many time it executed each branch of each 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 spend in all called functions callees 4 139 TSK3000 Embedded Tools Reference 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 t The control program automatically links with the corresponding profiling librabries Example To generate block count info
273. tween 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 e 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 e 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 attributes 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 e 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 low
274. u 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 default debug information This provides all debug information you need to debug your application It meets the debugging requirements in most cases without resulting in over sized assembler object files 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 do 4 15 TSK3000 Embedded Tools Reference 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 befo
275. urce 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 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 stdlib h The initial conversion state is specified by ps The input sequence of multibyte charactersis specified indirectly by src wcsrtombs s src n ps Restartable version of wcstombs See section 2 2 21 stdlib 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 according to conversion state ps See also mbtowc in section 2 2 21 stdlib wcrtomb s wc ps Converts a wide character wc to a multi byte character according to conversion state ps and stores the multi byte character in s btowc c Returns the wide character corresponding to character c Returns WEOF on error wctob 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 characters represent valid multibyte characters relative to the conversion state held in ps 2 32 Libraries 2 2 26 wctype h Most in
276. urrent 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 Float h used to contain prototypes for the functions copysign f isinf f isfinite f isnan f 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 O stdin 1 stdout and 2 stderr and fsp Ad pee 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 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
277. ute 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 5 2 Linker Map File Format in Chapter List File Formats 4 97 TSK3000 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 mflags map file format flags You can specify the following formats 0 1 2 c C callgraph f F files link l 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 mcfklmoQrSu most information Call graph information Processed files information Link result information Locate result information Memory usage information Overlay information Module local symbols Cross references information Processor and memory information Locate rules With this option you specify which information
278. vailable command line options tmk Related information db 4 152 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 files without checking whether they are out of date Example tmk a Rebuilds all your files regardless of whether they are out of date or not Related information 4 153 TSK3000 Embedded Tools Reference Make Utility c Command line syntax c Description Altium Designer 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 tmk c The make utility runs its commands as a child processes Related information 4 154 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 tmk With the option DD not only the lines of the makefile are printed but also the lines of the tmk mk file implicit rules Example tmk D Each line of the makefile that is read by the make utility is printed to s
279. vel between fully optimize for size or fully optimize for speed Offlags optimize lags Use the following options for predefined sets of flags 00 0 01 optimize 1 02 optimize 2 O3 optimize 3 No optimization Alias for OABCEFGIKLOPRSUY Few optimizations suitable for debugging Alias for OabcefgIKLOPRSUy Medium optimization default Alias for OabcefglkloprsUy Full optimization Alias for Oabcefgikloprsuy You can enable the following individual optimizations 4 26 Tool Options Compiler a A b B c C e E f F g G ill k K VL o O p P r R s S u U yY coalesce ipro cse expression flow glo inline schedule loop forward propagate compact subscript unroll peephole Coalescer remove unnecessary moves Interprocedural Register Optimization Common subexpression elimination CSE Expression simplification Control flow simplification optimization and code reordering Generic assembly code optimizations Function inlining Instruction scheduler Loop transformations Forward store Constant propagation Code compaction reverse inlining Subscript strength reduction Unroll small loops Peephole optimizations For an extensive description of these optimizations please refer to section 4 3 Compiler Optimizations in chapter Using the Compiler of the user s manual
280. void 1 do not inline this function qo For more information see section 2 7 3 Inlining Functions inline in Chapter C Language of the user s manual 1 4 C Language interrupt With the function type qualifier interrupt you can declare a function as an interrupt service routine The function type qualifier interrupt takes one or more vector numbers 0 31 as argument s All supplied vector numbers will be initialized to point to the interrupt function Interrupt functions cannot return anything and must have a void argument type list void interrupt vector number vector number isr void 1 5 TSK3000 Embedded Tools Reference 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 al a2 a3 char al a2 a3 short al a2 a3 int long a0 al a2 a3 float a0 al a2 a3 32 bit pointer a0 al a2 a3 32 bit struct a0 al a2 a3 long long a0 a1 al a2 a2 a3 double a1 2 a2 a3 64 bit struct a0 a1 ai a2 a2 Table 1 4 Register usage for parameter passing LN If a register corresponding to a parameter number is already in use the next register is used Function return types The C compiler uses registers to store C functio
281. 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 extensible 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 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 represented 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 iswcntrl wc iswctype wc wctype cntrl 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 a
Download Pdf Manuals
Related Search
Related Contents
Harman FL 8380 Stereo System User Manual DELL Latitude E5440 istruzioni di installazione, uso e manutenzione per 取扱説明書 Copyright © All rights reserved.
Failed to retrieve file