Home

Reference Guide - v2.5 VX

image

Contents

1. Opens a file a file for reading or writing Calls open FSS implementation Contains mechanisms to control the floating point environment The functions in this header file are not implemented fegetenv feholdexept fesetenv feupdateenv feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept Stores the current floating point environment Not implemented Saves the current floating point environment and installs an environment that ignores all floating point exceptions Not implemented Restores a previously saved fegetenv or feholdexcept floating point environment Not implemented Saves the currently raised floating point exceptions restores a previousely saved floating point environment and finally raises the saved exceptions Not implemented Clears the current exception status flags corresponding to the flags specified in the argument Not implemented Stores the current setting of the floating point status flags Not implemented Raises the exceptions represented in the argument As a result other exceptions may be raised as well Not implemented Sets the current floating point status flags Not implemented Returns the bitwise OR of the exception macros corre sponding to the exception flags which are currently set and are specified in the argument Not implemented For each supported exception a macro is defined The following exceptions are defined
2. Example WORD SFRACT 0 1 SFRACT 1 0 SGN expression Returns the sign of expression as an integer 1 if the argument is negative 0 if zero 1 if positive The expression may be relative or absolute Example VAR1 SET SGN 1 2e 92 VAR1 1 VAR2 SET SGN 0 VAR2 0 VAR3 SET SGN 28 382 VAR3 1 SIN expression Returns the sine of expression as a floating point value Example WORD SIN CVF COUNT FREQ compute sine value 3 16 PCP Reference Manual 7 SNH expression Returns the hyperbolic sine of expression as a floating point value Example HSINE EQU SNH VAL hyperbolic sine SQT expression Returns the square root of expression as a floating point value expression must be positive Example SORT1 EQU SQT 3 5 SORTI1 1 870829 SORT2 EQU SQT 16 SORT2 4 SUB string expression 1 expression2 Returns the substring from string as a string Expression is the starting position within string and expression2 is the length of the desired string The assembler issues an error if either expression1 or expression2 exceeds the length of string Note that the first position in a string is position 0 Example DEFINE ID SUB PCP assembler 4 9 ID assembler TAN expression Returns the tangent of expression as a floating point value Example TANGENT SET TAN 1 0 TANGENT 1 5574077 TNH expression Returns the hyperbolic tangent of expressi
3. misrac required warnings 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 Example cpcp misrac all misrac advisory warnings test c The compiler generates an error for each MISRA C rule violation in file test c If one of the advisory rules is violated a warning instead of an error is generated Related information d See Chapter 9 MISRA C Rules for a list of all supported MISRA C rules Compiler option misrac Tool Options Compiler 5 33 misrac version Command line syntax misrac version 1998 2004 Description MISRA C rules exist in two versions MISRA C 1998 and MISRA C 2004 By default the C source is checked against the MISRA C 2004 rules With this option you can specify to check against the MISRA C 1998 rules Related information See Chapter 9 MISRA C Rules for a list of all supported MISRA C rules Compiler option misrac 5 34 PCP Reference Manual n stdout 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 E
4. 2 42 7 2 2 23 UNISTD H PCP Reference Manual The file unistd h contains standard UNIX I O functions These functions are all implemented using CrossView Pro 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 CrossView Pro 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 CrossView Pro to change the current directory on the host to the directory indicated by path FSS implementation File close function The given file descriptor should be properly closed This function calls _close FSS implementation Use the file system simulation feature of CrossView Pro to retrieve the current directory on the host Returns the directory name FSS implementation Moves read write file offset Calls 1lseek FSS implementation Reads a sequence of characters from a file This function calls _read FSS implementation Use the file system simulation feature of CrossView Pr
5. Example word init _r7 start_0 pcp data_0 7 INT expression Returns an integer 1 if expression has an integer result otherwise it returns a 0 The expression may be relative or absolute Example IF INT TERM Test if result is an integer L10 expression Returns the base 10 logarithm of expression as a floating point value expression must be greater than zero Example LOG EQU L10 100 0 LOG 2 3 12 PCP Reference Manual 7 LEN string Returns the length of string as an integer Example SLEN SET LEN string SLEN 6 LNG exprl expr2 Concatenates the 16 bit expr and expr2 into a 32 bit word value such that expr is the high half and expr2 is the low half Example LWORD WORD LNG HI LO build long word LO expression Returns the lower 16 bits of a value LO expression is equivalent to expression amp Oxffff Example mov u d2 LO COUNT lower 16 bits of COUNT addih d2 d2 HI COUNT LOG expression Returns the natural logarithm of expression as a floating point value expression must be greater than zero Example LOG EQU LOG 100 0 LOG 4 605170 LSB expression Returns the least significant byte of the result of the expression expression is interpreted as a half word 16 bit Example VAR1 SET LSB 0x34 VAR1 0x34 VAR2 SET LSB 0x1234 VAR2 0x34 VAR3 SET LSB 0x654321 VAR3 0x21 PCP Assembly Language 3 13 LST Q R
6. output i e Description With this option you can specify another filename for the output file of the compiler Without this option the basename of the C source file is used with extension src Example cpcp o output sre test c cpcp output output sre test c The compiler creates the file output src for the compiled file test c Without the option o the compiler uses the names of the input file and creates test src Related information i Tool Options Compiler 5 43 R rename sections Command line syntax rename sections ype ormat_string type format_string R type format_string type format_string Description In case a module must be loaded at a fixed address or a data section needs a special place in memory you can use this option to generate different section names You can then use this unique section name in the linker script file for locating With the memory type you select which sections are renamed The matching sections will get the specified format_string for the section name The format string can contain characters and may contain the following format specifiers attrib section attributes separated by underscores module module name name object name name of variable or function type section type Instead of this option you can also uses the pragmas section endsection in the C source Example To rename sections of memory type data to pcp_test_variab
7. section_layout le_bs lc _ub stack when the symbol _lc_bs occurs as an undefined reference in an object file the linker allocates space for the stack 8 52 PCP Reference Manual 7 8 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 else 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 MISRA C RULES all TASKING M daLdVH MISRA C Rules 9 3 9 1 MISRA C 1998 This section lists all supported and unsupported MISRA C 1998 rules d See also section 4 7 C Code Checking MISRA C in Chapter Using the Compiler of the User s Manual AN 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 10 11 12 R A A A R R R R R A R A The code shall conform to st
8. Make utility option e Environment variables override macro definitions Make utility option m Name of invocation file Tool Options Make Utility 5 173 2 Command line syntax Description Displays an overview of all command line options Example The following invocation displays a list of the available command line options mkpcp Related information i 5 174 PCP Reference Manual Command line syntax a Description Normally the make utility rebuilds only those files that are out of date With this option you tell the make utility to rebuild all files without checking whether they are out of date Example mkpcp a Rebuilds all your files regardless of whether they are out of date or not Related information d Tool Options Make Utility 5 175 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 mkpcp With the option DD not only the lines of the makefile are printed but also the lines of the mkpcp mk file implicit rules Example mkpcp D Each line of the makefile that is read by the make utility is printed to standard output usually your screen Related information i 5 176 PCP Reference Manual d dd Command line syntax d dd Description With the option d the make utility shows which files are out of date and thus need to be rebuild The option
9. Tool Options Make Utility 5 171 Defining Macros Command line syntax macro definition Description With this argument you can define a macro and specify it to the make utility A macro definition remains in existence during the execution of the makefile even when the makefile recursively calls the make utility again In the recursive call the macro acts as an environment variable This means that it is overruled by definitions in the recursive call Use the option e to prevent this You can specify as many macros as you like If the command line exceeds the limit of the operating system you can define the macros in an option file which you then must specify to the compiler 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 out demo o lpcp demo o main o lc lfp lrt else real out real o lpcp real o main o lc lfp lrt endif real elf real out lpcp FELF oreal elf real out You can now use a macro definition to set the DEMO flag mkpcp real elf DEMO 1 In both cases the absolute obect file real elf is created but depending on the DEMO flag it is linked with demo o or with real o 5 172 PCP Reference Manual 7 Related information
10. include arch 1sl Preprocess and include the file arch 1s1 at this point in the LSL file Linker Script Language 8 7 8 3 2 LEXICAL SYNTAX The following lexicon is used to describe the syntax of the Linker Script Language A B A is defined as B A BC A is defined as B and C B is followed by C A B C_ A is defined as B or C lt B gt 0 1 zero or one occurrence of B lt B gt gt 0 zero of more occurrences of B lt B gt gt 1 one of more occurrences of B IDENTIFIER a character sequence starting with a z A Z or Following characters may also be digits and dots STRING sequence of characters not starting with n r or t DOSTRING STRING double quoted string OCT _NUM octal number starting with a zero 06 045 DEC_NUM decimal number not starting with a zero 14 1024 HEX NUM hexadecimal number starting with 0x 0x0023 OxFF0O 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 8 3 3 IDENTIFIERS arch_name IDENTIFIER bus_name IDENTIFIER core_name IDENTIFIER derivative_name IDENTIFIER file _name DQSTRING group_name IDENT
11. r open text file for update reading and writing w create text file for update previous contents if any is discarded a append open or create text file for update writes at end of file FSS implementation Flushes the data stream and closes the specified file that was previously opened with fopen FSS implementation Libraries 2 23 Stdio h Description fflush name freopen name mode stream setbuf stream buffer setvbuf stream buffer mode size Character input output If stream is an output stream any buffered but unwritten date is written Else the effect is undefined FSS implementation Similar to fopen but rather then generating a new value of type FILE the existing value is associated with a new stream FSS implementation If buffer is NULL buffering is turned off for the stream Otherwise setbuf is equivalent to void setvbuf stream buf _IOFBF BUFSIZ Controls buffering for the stream this function must be called before reading or writing Mode can have the following values _IOFBF 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 The format string of printf related functions can contain plain text mixed with conversion specifiers Each conversion specifier should be prec
12. 0 7 aN It is not possible to map an internal bus to an external bus 8 30 7 PCP Reference Manual 8 6 SEMANTICS OF THE DERIVATIVE DEFINITION Keywords in the derivative definition derivative extends core architecture bus mau width map memory type reserved rom ram mau size speed map map dest bus space dest_dbits dest_offset size src_dbits src_offset 8 6 1 DEFINING A DERIVATIVE nvram 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 Linker Script Language 8 31 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 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 8 6 2 INSTANTIATING CORE ARCHITECTURES
13. 1408 1418 1401 1432 1402 1433 1434 reading file extmem 1s1 reading file default 1s1 activating link phase resolving symbols task1 generating callgraphs task1 executing linker commands taskl finalize linking taskl activating locate phase finalize locating task1 activating file producing phase emitting object files taskl emitting report files taskl Related information ib 5 128 PCP Reference Manual 7 w no warnings Command line syntax wjnr nr no warnings nr 77 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 warnings are suppressed Separate multiple warnings by commas Example To suppress all warnings lpcp w test o lpcp no warnings test o To suppress warnings 113 and 114 lpcp w113 114 test o lpep no warnings 113 114 test o Related information db Linker option warnings as errors Treat warnings as errors Tool Options Linker 5 129 Wwarnings as errors Command line syntax warnings as errors number Description When the linker detects an error or warning it tries to continue the link process and reports other errors and warnings When you use this
14. A proc_def contains exactly one derivative statement SECTION PLACEMENT DEFINITION section definition section_layout lt space ref gt 9 1 lt locate direction gt 0 1 lt section_statement gt gt 0 A section definition inside a space definition does not have a space _ref Linker Script Language 8 17 e All global section definitions have a space_ref space _ref lt proc_name gt ll lt core_name gt 1 space_name e If more than one processor is present the proc_name must be given for a global section layout e If the section layout refers to a processor that has more than one core the core_name must be given in the space_ref e A proc_name refers to a defined processor e A core_name refers to a defined core e A space_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 If you do not specify the direction statement the locate direction of the section layout is low to high section_statement simple_section_statement aggregate_section_ statement simple_section_statement assignment select_section_statement special_section_statement assignment symbol_name assign_op expr assign_op 3 select_section_statement select lt ref_tree gt 1 lt section_name gt 1 lt section_selections gt 9 1 e Either a section_name or at le
15. MB160 025 00 00 Doc ver 1 1 PCP v2 5 C Compiler Assembler Linker Reference Manual A publication of Altium BV Documentation Department Copyright 2002 2006 Altium BV All rights reserved Reproduction in whole or part is prohibited without the written consent of the copyright owner TASKING is a brand name of Altium Limited The following trademarks are acknowledged FLEXIm is a registered trademark of Macrovision Corporation Intel is a trademark of Intel Corporation Motorola is a registered trademark of Motorola Inc MS DOS and Windows are registered trademarks of Microsoft Corporation SUN is a trademark of Sun Microsystems Inc UNIX is a registered trademark of X Open Company Ltd All other trademarks are property of their respective owners Data subject to alteration without notice http www tasking com http www altium com The information in this document has been carefully reviewed and is believed to be accurate and reliable However Altium assumes no liabilities for inaccuracies in this document Furthermore the delivery of this information does not convey to the recipient any license to use or copy the software or documentation except as provided in an executed license agreement covering the software and documentation Altium reserves the right to change specifications embodied in this document without prior notice TABLE OF CONTENTS all TASKING M SLNALNOD Table
16. Or the minimum number of digits to be printed for an integer conversion Instead of a numeric value also x may be specified the value is then taken from the next argument which is assumed to be of type int A length modifier h T or L h indicates that the argument is to be treated as a short or unsigned short number l should be used if the argument is a long integer 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 Character Printed as d i int signed decimal o int unsigned octal x X int unsigned hexadecimal in lowercase or uppercase respectively u int unsigned decimal c int single character converted to unsigned char Libraries 2 25 Character Printed as 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 e E double g G double n int the number of characters written so far is written into the argument This should be a pointer to an integer in default memory No value is printed p pointer hexadecimal 24 bit value No argument is converted a is printed Table 2 2 Printf conversion characters All arg
17. Related information d gt Assembler option C Select CPU Control program option C Use SFR definitions for CPU Section 4 4 Calling the Compiler in Chapter Using the Compiler of the User s Manual Tool Options Compiler 5 9 C iso Command line syntax c 90 99 iso 90 99 Default c99 Description With this option you select the ISO C 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 Example To select the ISO C90 standard on the command line cpcp c90 test c cpcp iso 90 test c Related information d gt Compiler option A Language extensions 5 10 PCP Reference Manual 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 reports any warnings and or errors Example To check for syntax errors without generating code cpcp check test c Related information db Assembler option check Check syntax Tool Options Compiler 5 11 compact max size Command line syntax compact max size value Default 200 Description This option is related to the compiler optimization Or Code compaction or reverse inlining Code compaction is the opposite of inlining functions large sequences of code that occur more than once are trans
18. ccpcp no map file test c Related information d Linker option M Generate map file Tool Options Control Program 5 159 no tasking sfr Command line syntax no tasking sfr Description Normally the compiler and assembler include a special function register SFR file before compiling This file is automatically selected based on the target you select on the Processor definition page of the Processor options compiler option C With this option the compiler and assembler do not automatically include a register file Use this option if you want to use your own set of SFR files Example ccpcp Ctcllib no tasking sfr test c The register file regtcllib sfr is not included Related information d Compiler option C Use SFR definitions for CPU 5 160 PCP Reference Manual o output Command line syntax Ofile output e Description By default the control program generates a file with the same basename as the first specified input file With this option you specify another name for the resulting absolute object file Example ccpcp test c prog c The control program generates an ELF DWARF object file default with the name test elf To generate the file result elf ccpcp oresult elf test c prog c ccpcp output result elf test c prog c Related information J Tool Options Control Program 5 161 space Command line syntax space space_name Description If you
19. language extensions intrinsic functions 1 8 Idexp functions 2 14 Idiv 2 35 len 3 12 Igamma functions 2 16 linear_switch 1 12 linker map file 5 112 linker options 5 90 case insensitive 5 92 chip output 5 91 define 5 93 diag 5 95 error file 5 98 error limit 5 99 extern 5 97 extra verbose 5 127 first library first 5 102 help 5 90 ignore default library path 5 106 include directory 5 103 incremental 5 124 keep output files 5 105 library 5 108 library directory 5 106 link only 5 109 Isl check 5 110 lsl dump 5 111 map file 5 112 map file format 5 113 misra c report 5 115 munch 5 116 no rescan 5 118 no rom copy 5 117 no warnings 5 128 non romable 5 119 optimize 5 120 option file 5 100 output 5 122 strip debug 5 125 user provided initialization code 5 104 verbose 5 127 version 5 126 warnings ds errors 5 129 G 5 91 D 5 93 d 5 94 e 5 97 f 5 100 l 5 103 i 5 104 k 5 105 L 5 106 f 5 108 M 5 112 m 5 113 N 5 117 O 5 120 0 5 122 r 5 124 5 5 125 V 5 126 v 5 127 vv 5 127 W 5 128 linker script file architecture definition 8 3 boad specification 8 5 bus definition 8 5 Index 11 Index 12 7 derivative definition 8 4 memory definition 8 5 preprocessing 8 6 processor definition 8 4 section layout definition 8 5 structure 8 3 list
20. line gt This is a continuation line It is possible to nest command line files up to 25 levels Tool Options Linker 5 101 Example Suppose the file myoptions contains the following lines Mmymap generate a map file test o input file Lc mylibs additional search path for system libraries Specify the option file to the linker lpcp f myoptions lpcp option file myoptions This is equivalent to the following command line lpcp Mmymap test o Lc mylibs Related information db 5 102 7 PCP Reference Manual first library first Command line syntax first library first Description When the linker processes a library it searches for symbols that are referenced by the objects and libraries processed so far If the library contains a definition for an unresolved reference the linker extracts the object that contains the definition from the library By default the linker processes object files 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 i
21. lt length_byte gt lt address gt lt code bytes gt lt checksum_byte gt This record is used for 4 byte addresses 7 6 PCP Reference Manual Example S3070000FFFE6E6825 _ 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 at the end of an S record file the linker generates an S7 record which contains the program start address S7 is the corresponding termination record for S3 records Layout S 7 lt length_byte gt lt address gt lt checksum_byte gt Example S70500006E6824 _ checksum _ address _ length The checksum calculation of S7 records is identical to SO S8 record With the linker option oftlename SREC 3 which is the default at the end of an S record file the linker generates an S8 record which contains the program start address Layout S 8 lt length_byte gt lt address gt lt checksum_byte gt Example S804FF0003F9 _ checksum _ address _ length Object File Formats 7 7 The checksum calculation of S8 records is identical to SO S9 record With the linker option oftlename 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 record
22. text libc 0x00000eae 0xa0004000 0x00004000 Perr nn np Space spe tc abs18 Reet A Chip Group Section Size MAU Space addr Chip addr ext_c zrodata hello 0x00000006 0xa0000008 0x00000008 spe dsram zdata hello 0x00000004 Oxd0000000 0x00000000 Perr nf Symbol translation sorted on name _A8_DATA_ 0x00000000 Exit 0xa0004170 _START 0xa0000000 _lc_gb_int_tab 0x00000000 _1c geint tab 0x00000000 main oxa00000f8 world 0xd0000000 spe tc abs18 NOED EE AE SEE AE TA EA List File Formats Symbol translation sorted on address l l l l 0x00000000 _1c_ge_int_tab spe inear 0x00000000 _1c_gb_int_tab 0x00000000 A8 DATA_ 0xa0000000 _ START Oxa00000f8 main 0xa0004170 _Exit 0xd0000000 world spe tc abs18 CI FEISS I IOI IRE IO KRAAK KKK kkk kxk Memory Part Sidbbnbondiniietioniiationiintioti an iota a aoe Address range usage at space level EREE ETA EEEN Ee a ee ee EE eR EY 2 Free gt free gap 0x00008000 0x00000146 1 0x00007eba 99 0x00004000 50 0x50024000 0x00022820 1 0x500017e0 99 Ox2ffOdf0a 59 0x00006000 0x00001004 17 Ox00004ffc 83 0x00004fc0 83 0x00085000 0x00021788 26 0x00063878 74 0x0004f878 59 spe tc pcp_code 0x00002000 0x00000000 0 0x00002000 100 0x000020
23. 2 10 locale h 2 10 Index 10 7 math h 2 11 seyimp h 2 18 signal h 2 18 stdarg h 2 19 stdbool h 2 19 stddef h 2 20 stdint b 2 9 stdio h 2 20 stdlib h 2 31 string h 2 35 tgmath h 2 11 time h 2 39 unistd h 2 42 wehar h 2 20 2 35 2 39 2 43 wetype h 2 4 2 44 heap 4 4 8 25 begin of 4 4 end of 4 4 hi 3 11 hw_only 3 68 hypot functions 2 15 ident 3 69 if 3 42 ilogb functions 2 12 imaxabs 2 9 imaxdiv 2 9 include 3 44 init_r7 3 11 inline functions 5 28 inline noinline 1 11 int 3 11 Intel hex record type 7 8 intrinsic functions 1 8 __alloc 1 8 __dotdotdotQ 1 8 __ exit 1 9 Index __freeQ 1 8 __get_return_address 1 8 __1d32_fpid 1 8 __nopQ 1 8 _ st32_fpid 1 9 isalnum 2 4 isalpha 2 4 isblank 2 4 iscntrl 2 4 isdigit 2 4 isfinite 2 17 isgraph 2 4 isgreater 2 17 isgreaterequal 2 17 isinf 2 17 isless 2 17 islessequal 2 17 islessgreater 2 17 islower 2 4 isnan 2 17 isnormal 2 17 ISO C standard 5 9 isprint 2 5 ispunct 2 5 isspace 2 5 isunordered 2 17 isupper 2 5 iswalnum 2 4 2 44 iswalpha 2 4 2 44 iswblank 2 4 iswentrl 2 4 2 44 iswctype 2 44 iswdigit 2 4 2 44 iswgraph 2 4 2 44 iswlower 2 4 2 45 iswprint 2 5 2 45 iswpunct 2 5 2 45 iswspace 2 5 2 45 iswupper 2 5 2 45 iswxdigit 2 5 Index iswxditig 2 45 isxdigit 2 5 J jump_switch 1 12 L L_tmpnam 2 21 110 3 11 labs 2 35
24. 2 28 Q qsort 2 34 raise 2 18 rand 2 33 RAND MAX 2 32 read 2 42 realloc 2 33 remainder functions 2 14 remove 2 31 remquo functions 2 14 rename 2 31 rename sections 5 43 reset vector 8 26 rewind 2 30 rint functions 2 13 rnd 3 14 round functions 2 13 rvb 3 15 S scalbln functions 2 14 scalbn functions 2 14 scanf 2 25 2 28 conversion characters 2 26 scp 3 15 sdecl 3 53 sect 3 56 section 1 12 summary 5 85 section activation 3 56 section attributes 3 53 section declaration 3 53 section layout definition 8 5 8 38 section names 3 55 sections grouping 8 40 rename 5 43 SEEK_CUR 2 30 SEEK_END 2 30 SEEK SET 2 30 set 3 57 setbuf 2 23 setjmp 2 18 setlocale 2 10 setvbuf 2 23 sfract 3 15 3 40 sgn 3 15 SIGABRT 2 18 SIGFPE 2 18 SIGFPE signal handler 4 7 SIGILL 2 18 SIGINT 2 18 signal 2 18 signbit 2 17 SIGSEGV 2 18 SIGTERM 2 18 sin 3 15 Index 16 7 sin functions 2 11 sinh functions 2 11 size 3 58 size_t 2 20 smart_switch 1 12 smartinline 1 11 snh 3 16 snprintf 2 29 source nosource 1 12 space 3 59 sprintf 2 29 sqrt functions 2 15 sqt 3 16 srand 2 33 sscanf 2 28 stack 4 3 8 25 start address 8 26 startup code 4 3 stat 2 42 static stack alignment 5 7 stderr 2 21 stdin 2 21 stdinc 1 12 stdout 2 21 stitle 3 78 strcat 2 36 strchr 2 38 strcmp 2 37 strcoll 2 37 strcpy 2 36 strcspn 2 38 strerror
25. 2 42 accum 3 21 acos functions 2 11 acosh functions 2 12 acs 3 7 address spaces 8 24 alias 1 10 3 22 align 3 23 Alignment gaps 8 43 architecture definition 8 3 8 22 archiver options 5 198 d 5 199 f 5 200 m 5 202 p 5 203 r 5 204 t 5 206 V 5 207 w 5 209 x 5 208 ddd module 5 204 create library 5 204 delete module 5 199 extract module 5 208 move module 5 202 print list of objects 5 206 print list of symbols 5 206 print module 5 203 replace module 5 204 arg 3 7 ascii 3 24 asciiz 3 24 asctime 2 40 asin functions 2 11 asinh functions 2 11 asn 3 7 aspcp 3 7 assembler controls debug 3 67 hw_only 3 68 ident 3 69 list 3 72 list on off 3 70 object 3 74 page 3 75 pretl 3 77 stitle 3 78 title 3 79 warning off 3 80 detailed description 3 66 listing controls overview 3 66 miscellaneous overview 3 66 overview 3 66 assembler directives accum 3 21 alias 3 22 align 3 23 ascii 3 24 asciiz 3 24 assembly control overview 3 18 byte 3 25 calls 3 26 comment 5 27 conditional assembly overview 3 20 data definition overview 3 19 debug information overview 3 20 define 3 28 detailed description 3 20 double 3 39 dup endm 3 29 dupa endm 3 30 dupc endm 3 31 dupfiendm 3 32 end 3 34 equ 3 35 exitm 3 36 extern 3 37 fail 3 38 float 3 39 fract 3 40 global 3 41 half 3 04 if 3 42 include 3 44 local 3 45 m
26. 3 72 list file 5 78 assembler 5 76 linker 5 112 list on off 3 70 llabs 2 35 lldiv 2 35 llrint functions 2 13 llround functions 2 13 Ing 3 12 lo 3 12 local 3 45 localeconv 2 11 localtime 2 40 log 3 12 log functions 2 12 log10 functions 2 12 log1p functions 2 12 log2 functions 2 12 logb functions 2 12 longjmp 2 18 lrint functions 2 13 lround functions 2 13 Isb 3 12 Iseek 2 42 LSL expression evaluation 8 21 LSL functions absolute 8 9 addressofQ 8 9 exists 8 10 max Q 8 10 mind 8 10 sizeofQ 8 10 LSL keywords align 8 24 8 25 8 20 8 42 alloc_allowed 8 48 allow_cross_references 8 44 Index architecture 8 23 8 31 attributes 8 41 8 42 blocksize 8 50 bus 8 24 8 27 8 36 clustered 8 43 contiguous 8 43 copy_unit 8 26 copytable 8 206 8 51 core 8 31 derivative 8 30 8 35 dest 8 26 8 27 dest_dbits 8 28 dest_offset 8 28 direction 8 25 8 39 8 43 else 8 52 extends 8 23 8 30 fill 8 43 8 48 8 49 fixed 8 25 8 47 group 8 40 8 42 grows 8 25 heap 8 25 8 47 high_to_low 8 25 8 39 id 8 24 if 8 52 load_addr 8 45 low_to_high 8 25 8 39 map 8 24 8 25 8 27 8 32 mau 8 24 8 32 8 36 mem 8 45 memory 8 32 8 36 min_size 8 25 8 47 nvoram 8 32 ordered 8 43 overflow 8 49 overlay 8 43 page 8 206 8 46 page size 8 25 8 46 processor 8 34 ram 8 32 ref_tree 8 41 reserved 8 32 8 47 rom 8 32 run_addr 8 206 8 45 In
27. 5 52 5 128 wchar_t 2 20 wcrtomb 2 44 wcscat 2 36 weschr 2 38 wescmp 2 37 wescoll 2 37 wescpy 2 36 wescspn 2 38 wesncat 2 36 wesnemp 2 37 wesncpy 2 36 wcspbrk 2 38 wesrchr 2 38 wcsrtombs 2 43 wcsspn 2 38 wesstr 2 38 westod 2 32 westof 2 32 westoimax 2 9 westok 2 38 westol 2 33 westold 2 32 westoll 2 33 wcstombs 2 35 westoul 2 33 westoull 2 33 wcstoumax 2 9 wesxfrm 2 37 wctob 2 44 wctomb 2 35 wctrans 2 45 wctype 2 44 weak 1 13 3 63 WEOF 2 21 wmemchr 2 38 wmemcmp 2 37 wmemcpy 2 36 wmemmove 2 36 wmemset 2 39 word 3 64 wprintf 2 29 write 2 42 Index 18 Index 7 wscanf 2 28 wstrftime 2 41 X xpn 3 17
28. Description With this option you tell the control program to include debug information in the generated object file Example ccpcp g test c ccpcp debug info test c The control program includes symbolic debug information in the generated object file test elf Related information i Tool Options Control Program 5 149 I include directory Command line syntax Ipath include directory path Description With this option you can specify the path where your include files are located A relative path will be relative to the current directory Example Suppose that the C source file test c contains the following lines include lt stdio h gt include myinc h You can call the control program as follows ccpcp Imyinclude test c ccpcp include directory myinclude 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 Gs Compiler option I Add directory to include file search path Compiler option H Include file at the start of a compi
29. Not implemented Description frexp frexpf frexpl ldexp ldexpf Ildexpl modf modff modfl scalbn scalbnf scalbnl scalbln scalblnf scalblnl frexp ldexp scalbn scalbln 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 Inverse of frexp Returns the result of x 2n x and n are both arguments Splits a float x into fraction f and integer n so that f lt 1 0 and f n x Returns f stores n Computes the result of x FLT RADIX efficiently not normally by computing FLT RADIX explicitly Same as scalbn but with argument n as long int Libraries Power and absolute value functions Math h Tgmath h Description cbrt cbrtf cbrtl cbrt Returns the real cube root of x x1 3 Not implemented fabs fabsf fabsl fabs Returns the absolute value of x x abs labs llabs div ldiv lldiv are defined in stdlib h fma fmaf fmal fma Floating point multiply add Re turns x y z Not implemented hypot hypotf hypotl hypot Returns the square root of x2ty2 pow powf powl power Returns x raised to the power y xY sqrt sqrtf sqrtl sqrt Returns the non negative square root of x x 0 Manipulation functions copysign nan nextafter nexttoward Math h Tgmath h Description copysign copysignf copysign Returns the value of x with the copysignl sign of y nan nanf nanl Returns a quiet NaN if availabl
30. The address only appears on lines that generate object code 6 4 CODE CYCLES LINE SOURCE LINE PCP Reference Manual 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 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 AN For the SET and EQU directives the ADDR and CODE columns do not apply The symbol value is listed instead Related information db See section 5 7 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 List File Formats 6 5 6 2 LINKER MAP FILE FORMAT The linker map file is an additional output file of the linker tha
31. The macro offsetof in library lt stddef h gt shall not be used 20 7 R The setjmp macro and the longjmp function shall not be used 20 8 R The signal handling facilities of lt signal h gt shall not be used 20 9 R The input output library lt stdio h gt shall not be used in production code 20 10 R The library functions atof atoi and atol from library lt stdlib h gt shall not be used 20 11 R The library functions abort exit getenv and system from library lt stdlib h gt shall not be used 20 12 R The time handling functions of library lt time h gt shall not be used MISRA C Rules 9 21 Run time failures x 21 1 R Minimization of run time failures shall be ensured by the use of at least one of a static analysis tools techniques b dynamic analysis tools techniques c explicit coding of checks to handle run time faults 9 22 PCP Reference Manual INDEX all TASKING M XAGNI Index Index 3 Symbols define 5 13 5 93 include 5 25 undef 5 49 __BUILD_ 1 14 VERSION 1 15 _close 2 22 _Exit 2 34 _fp_get_exception_mask 4 8 _fp_get_exception_status 4 9 _fp_install_trap_handler 4 9 _fp_set_exception_mask 4 8 _fp_set_exception_status 4 9 _fss_break 2 8 _fss_init 2 8 _IOFBF 2 23 IOLBF 2 23 _IONBF 2 23 _lseek 2 22 _open 2 22 _read 2 22 _tolower 2 5 _unlink 2 22 _write 2 22 A abort 2 34 abs 2 35 3 6 access
32. a line ends with or a line starts with possibly preceded by white space Documentation x 3 1 x 3 2 X 3 3 3 4 3 5 Character sets 4 1 4 2 R R A R R R R R All usage of implementation defined behavior shall be documented The character set and the corresponding encoding shall be documented The implementation of integer division in the chosen compiler should be determined documented and taken into account All uses of the pragma directive shall be documented and explained This rule is really a documentation issue The compiler will flag all pragma directives as violations The implementation defined behavior and packing of bit fields shall be documented if being relied upon All libraries used in production code shall be written to comply with the provisions of this document and shall have been subject to appropriate validation Only those escape sequences that are defined in the ISO C standard shall be used Trigraphs shall not be used 9 12 Identifiers 5 1 R 5 2 R 53 R 54 R x 5 5 A 5 6 A x 57 A Types 61 R x 62 R 6 3 A 6 4 R 6 5 R Constants 71 PCP Reference Manual Identifiers internal and external shall not rely on the significance of more than 31 characters Identifiers in an inner scope shall not use the same name as an identifier in an outer scope and therefore hide that id
33. dd gives more detail than the option d Example mkpcp d Shows which files are out of date and rebuilds them Related information d Tool Options Make Utility 5 177 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 mkpcp e The make utility uses the settings of the environment variables regardless of macro definitions Related information i 5 178 PCP Reference Manual 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 mkpcp err error txt The make utility writes messages to the file error txt Related information db Make utility option s Do not print commands before execution Tool Options Make Utility 5 179 f Command line syntax f my_makefile Description Default the make utility uses the file makefile to build your files With this option you tell the make utility to use the specified file instead of the file makefile Multiple f options act as if all the makefiles were concatenated in a left to right order Example mkpcp mymake The make utility uses the file mymake to build your files R
34. 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 cpcp Both cpcp and cpcp are valid commands Separates items in a list Read it as OR You can repeat the preceding item zero or more times You can repeat the preceding item zero or more times separating each item with a comma cpcp option filename You can read this line as follows enter the command cpcp with or without an option follow this by zero or more options and specify a filename cpcp cpcp cpcp Not valid is cpcp 9 The following input lines are all valid test c g test c E test c According to the syntax description you have to specify a filename Manual Purpose and Structure XIII Icons The following illustrations are used in this manual AN Note notes give you extra information Warning read the information carefully It prevents you from making serious mistakes or from loosing information E Command line type your input on the command line db Reference follow this reference to find related topics XIV PCP Reference Manual RELATED PUBLICATIONS C Standards e CA Reference Manual fifth edition by Samual P Harbison and Guy L Steele Jr 2002 Prentice Hall e The C Programming Language second edition by B Kernighan and D Ritchie 1988 Prentice Hall e ISO IEC 9899 1999 E Programmin
35. gt 1 gt 0 1 arch_spec e An architecture 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 An architecture definition that uses the extends construct defines an architecture that inherits all elements of the architecture defined by the second arch_name The parent architecture must be defined in the LSL file as well parameter list parameter lt parameter gt 9 parameter IDENTIFIER lt expr gt 1 argument_list expr lt expr gt 0 arch_spec space def bus_def endianness_def space def space space name lt space_descr gt e A space def defines an address space with the given space _name as a unique name within an architecture space descr space property section_definition no space ref 8 14 PCP Reference Manual 7 space property id number as used in object mau expr align expr page_size expr lt range lt range gt 9 gt 0 1 page direction direction stack def heap_def copy_table def start_address mapping e A space_def contains exactly one id and one mau statement e A space_def contains at most one align statement e A space_def contains at most one page_size statement e A space def contains at least one mapping stack_def stack stack_name stack_heap_descr lt stack _heap descr
36. inequality The controlling expression of a for statement shall not contain any objects of floating type The three expressions of a for statement shall be concerned only with loop control A violation is reported when the loop initialization or loop update expression modifies an object that is not referenced in the loop test Numeric variables being used within a for loop for iteration counting shall not be modified in the body of the loop Boolean operations whose results are invariant shall not be permitted There shall be no unreachable code All non null statements shall either a have at least one side effect however executed or b cause control flow to change Before preprocessing a null statement shall only occur on a line by itself it may be followed by a comment provided that the first character following the null statement is a white space character The goto statement shall not be used The continue statement shall not be used MISRA C Rules 14 6 R 14 7 R 14 8 R 14 9 R 14 10 R For any iteration statement there shall be at most one break statement used for loop termination A function shall have a single point of exit at the end of the function The statement forming the body of a switch while do while or for statement be a compound statement An if expression construct shall be followed by a compound statement The else keyword shall be followed by either a compound state
37. int tm_year int tm_wday int tm_yday int 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 2 40 7 Time manipulation clock difftime t1 t0 mktime tm tp time timer Time conversion asctime tm tp ctime timer gmtime timer localtime timer PCP Reference Manual Returns the application s best approximation to the processor time used by the program since it was started This low level routine is not implemented because it strongly depends on the hardware To determine the time in seconds the result of clock should be divided by the value defined as CLOCKS PER_SEC 12000000 Returns the difference t1 t0 in seconds Converts the broken down time in the structure pointed to by tp to a value of type time_t The return value has the same encoding as the return value of the time function Returns the current calendar time This value is also assigned to timer Converts the broken down time in the structure pointed to by tp into a string in the form Mon Jan 21 16 15 14 2004 n 0 Returns a pointer to this string Converts the calender time pointed to by timer to local time in the form of a string This is equivalent to as
38. myreserved size 2k attributes rw fill Oxaa If you do not specify any attributes the linker will reserve the given number of maus no matter what type of memory lies beneath If you do not specify a fill pattern no section is generated Linker Script Language 8 49 The linker creates two labels to mark the begin and end of the section _lc_ub_name for the start and _le_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 You can use groups inside output sections but you can only set the align attributes and load_addr attributes The 111 field contains a bit pattern that the linker writes to all unused space in the output section When all input sections have an image code data you must specify a fill pattern If you do not specify a fill pattern all input sections must be scratch sections The fill pattern is aligned at the start of the output section As with a reserved section you can use the attributes field to set the access type of the output section group section myoutput size 4k attributes rw fill Oxaa select myinput1 select myinput2 The available room for input sections is determined by the size blocksize and o
39. nan functions 2 15 nearbyint functions 2 13 nextafter functions 2 15 nexttoward functions 2 15 novector 1 12 NULL 2 20 Oo object 3 74 offsetof 2 20 open 2 7 optimization 5 39 5 81 5 120 optimize endoptimize 1 12 option file 5 20 5 67 5 100 5 144 5 184 5 200 org 3 50 output file 5 42 5 82 5 122 5 160 output format 5 91 5 146 P page 3 75 pass option to tool 5 167 PCP syntax 5 84 Index perror 2 31 pmacro 3 52 pos 3 14 pow 3 14 pow functions 2 15 Pragma extern 1 11 macro 1 11 message 1 11 protect 1 12 tradeoff 1 13 warning 1 13 weak 1 13 Pragmas alias 1 10 clear noclear 1 10 compactmaxmatch 1 10 extension isuffix 1 11 inline noinline 1 11 maxcalldepth 1 11 novector 1 12 optimize endoptimize 1 12 section 1 12 smartiniine 1 11 source nosource 1 12 stdinc 1 12 pragmas 1 10 pretl 3 77 predefined macros 1 14 predefined macros in C __BIGENDIAN__ 1 14 __CORE_ 1 14 __CPCP_ 1 14 __DATE_ 1 14 __DOUBLE_FP_ 1 14 __FILE_ 1 14 __LINE_ 1 14 __ REVISION _ 1 14 __SFRFILE_ 1 15 __SINGLE_FP_ 1 15 STDC 1 15 __STDC_HOSTED _ 1 15 __STDC_VERSION _ 1 15 Index Index 15 __TASKING_ 1 15 __TIME_ 1 15 preprocessing 8 6 preprocessor 5 79 printf 2 23 2 29 conversion characters 2 25 processor definition 8 4 8 34 protect 1 12 ptrdiff t 2 20 putc 2 28 putchar 2 28 puts 2 29 putwc 2 28 putwchar
40. s environment in env and returns 0 void longjmp jmp_buf env Restores the environment previously saved int status with a call to set jmp 2 2 14 SIGNAL H Signals are possible asynchronous events that may require special processing Each signal is named by a number The following signals are defined SIGINT 1 Receipt of an interactive attention signal SIGILL 2 Detection of an invalid function message SIGFPE 3 Anerrouneous arithmetic operation for example zero devide overflow SIGSEGV 4 An invalid access to storage SIGTERM 5 A termination request sent to the program SIGABRT 6 Abnormal terminiation such as is initiated by the abort function The next function sends the signal sig to the program int raise int sig The next function determines how subsequent signals will be handled signalfunction signal int signalfunction The first argument specifies the signal the second argument points to the signal handler function or has one of the following values SIG_DFL Default behavior 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 Libraries 2 2 15 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 va_end va_list ap va_start va_lis
41. s1l s2 strncpy sl s2 n strcat s1l s2 strncat sl s2 n wmemmove sl s2 n wescpy sl1 s2 wesncpy sl s2 n wcscat s1 s2 wcsncat s1 s2 n s1 If s1 and s2 overlap the result is undefined Same as memcpy but overlapping strings are handled correctly Returns s1 Copies s2 into s1 and returns s7 If s7 and s2 overlap the result is undefined Copies not more thann characters from s2 into s1 and returns s7 If s7 and s2 overlap the result is undefined Appends a copy of s2 to s1 and returns s7 If s7 and s2 overlap the result is undefined Appends not more than n characters from s2 to s1 and returns s7 If s7 and s2 overlap the result is undefined Libraries 2 37 Comparison functions Stdio h Wchar h Description memcmp sl s2 n strcemp sl1 s2 strncmp sl s2 n strcoll s1 s2 strxfrm sl1 s2 n wmemcmp sl s2 n wescmp sl1 s2 wesncmp sl s2 n wcscoll s1 s2 wesxfrm sl s2 n Compares the first n characters of s1 to the first n characters of s2 Returns lt 0 if s1 lt s2 0 if s1 s2 or gt 0 if s7 gt s2 Compares string s7 to s2 Returns lt 0 if s7 lt s2 0 if s1 s2 or gt Oif s7 gt s2 Compares the first n characters of s7 to the first n characters of s2 Returns lt Oif s lt s2 Oif s s2 or gt O if s7 gt s2
42. the ability to place sections at a given load address or run time address to place sections in a given order and to overlay code and or data sections Which object files sections constitute the task that will run on a given core is specified on the command line when you invoke the linker The linker will link and locate all sections of all tasks simultaneously From the section layout definition the linker can deduce where a given section may be located in memory form the board specification the linker can deduce which physical memory is still available while locating the section See section 8 8 Semantics of the Section Layout Definition for more information on how to locate a section at a specific place in memory 8 6 PCP Reference Manual e 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 section layout space_name section placement statements 8 3 SYNTAX OF THE LINKER SCRIPT LANGUAGE 8 3 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
43. the DUP directive processing Example Consider the following source input statements COUNT SET 3 DUP COUNT duplicate NOP count times NOP ENDM This is expanded as follows COUNT SET 3 NOP NOP NOP Related information DUPA Duplicate Sequence with Arguments DUPC Duplicate Sequence with Characters DUPF Duplicate Sequence in Loop MACRO Define Macro 3 30 PCP Reference Manual 7 DUPA ENDM Syntax abel DUPA formal arg argument argument ENDM Description With the DUPA and ENDM directives Duplicate Sequence with Arguments you can repeat a block of source statements for each argument For each repetition every occurrence of the formal_arg parameter within the block is replaced with each succeeding argument string If an argument includes an embedded blank or other assembler significant character it must be enclosed with single quotes If you specify label it gets the value of the location counter at the start of the DUPA directive processing Example Consider the following source input statements DUPA VALUE 12 32 34 BYTE VALUE ENDM This is expanded as follows BYTE 12 BYTE VALUE results in a warning BYTE 32 BYTE 34 The second statement results in a warning of the assembler that the local symbol VALUE is not defined in this module and is made external Related information DUP Duplicate Sequence of Source Lines DUPC Duplicate Sequence with Char
44. 2 39 strftime 2 41 strncat 2 36 strncmp 2 37 strncpy 2 36 strpbrk 2 38 strrchr 2 38 strspn 2 38 strstr 2 38 strtod 2 32 strtof 2 32 strtoimax 2 9 Index strtok 2 38 strtol 2 33 strtold 2 32 strtoll 2 33 strtoul 2 33 strtoull 2 33 strtoumax 2 9 strxfrm 2 37 sub 3 16 Switch method 1 12 swprintf 2 29 swscanf 2 28 syntax error checking 5 10 5 12 5 58 5 136 system 2 34 system libraries 5 106 5 108 T tan 3 16 tan functions 2 11 tanh functions 2 11 temporary files 5 163 tgamma functions 2 16 time 2 40 time t 2 39 tm struct 2 39 TMP_MAX 2 21 tmpfile 2 31 tmpnam 2 31 tnh 3 16 tolower 2 5 toupper 2 5 towctrans 2 45 towlower 2 5 towupper 2 5 tradeoff 1 13 trap 4 11 trap handler 4 7 trap handling 5 147 trap handling api 4 8 45 2 2 45 Index Index 17 trunc functions 2 13 type 3 60 U undef 3 61 unf 3 17 ungetc 2 27 ungetwc 2 27 unlink 2 42 vV va_arg 2 19 va_end 2 19 va_start 2 19 verbose 5 127 5 166 version information 5 51 5 86 5 126 5 165 5 194 5 195 5 207 vfprintf 2 29 vfscanf 2 28 vfwprintf 2 29 vfwscanf 2 28 vprintf 2 29 vscanf 2 28 vsprintf 2 29 vsscanf 2 28 vswprintf 2 29 vswscanf 2 28 vwprintf 2 29 vwscanf 2 28 W warning 1 13 3 62 title 3 79 3 80 warnings 5 169 suppress 5 87 warnings as errors 5 53 5 88 5 129 warnings suppress
45. 37 F fabs functions 2 15 fail 3 38 fclose 2 22 fdim functions 2 16 FE_ALL_ EXCEPT 2 8 FE _DIVBYZERO 2 8 FE_INEXACT 2 8 FE INVALID 2 8 FE_OVERFLOW 2 8 FE UNDERFLOW 2 8 Index Index 9 feclearexcept 2 7 fegetenv 2 7 fegetexceptflag 2 7 feholdexept 2 7 feof 2 31 feraiseexcept 2 7 ferror 2 31 fesetenv 2 7 fesetexceptflag 2 7 fetestexcept 2 7 2 8 feupdateenv 2 7 fflush 2 23 fgetc 2 27 fgetpos 2 30 fgets 2 27 fgetwe 2 27 fgetws 2 27 File system simulation 2 4 FILENAME MAX 2 21 fld 3 10 float 3 39 floating point 4 4 libraries 4 6 special values 4 6 trap handler 4 7 trap handling api 4 8 trapping 4 6 floor functions 2 13 flr 3 10 fma functions 2 15 fmax functions 2 16 fmin functions 2 16 fmod functions 2 14 fopen 2 22 FOPEN_ MAX 2 21 fpclassify 2 17 fprintf 2 29 fputc 2 28 fputs 2 28 fputwc 2 28 fputws 2 28 fract 3 11 3 40 fread 2 30 free 2 33 freopen 2 23 frexp functions 2 14 fscanf 2 27 fseek 2 30 fsetpos 2 30 FSS 2 4 ftell 2 30 functions assembly 3 3 fwprintf 2 29 fwrite 2 30 fwscanf 2 27 G getc 2 27 getchar 2 27 getcwd 2 42 getenv 2 34 gets 2 27 getwc 2 27 getwchar 2 27 global 3 41 gmtime 2 40 half 3 64 Header files 2 4 dlert h 2 4 clype h 2 4 errno h 2 5 fentl b 2 7 fenv h 2 7 float h 2 8 fss h 2 8 initypes h 2 9 1s0646 h 2 10 limits b
46. Address The name of the symbol The absolute address of the symbol in the address space 6 10 PCP Reference Manual Space The names of the address spaces as defined in the linker script file tc 1s1 The names are constructed of the derivative name followed by a colon the core name another colon and the space name For example spe tc linear 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 By default this part is not shown in the map file You have to turn this part on manually with linker option mm memory usage info 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 Isl dump Locate Rule Part This part of the map file shows the rules the linker uses to locate sections 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 For example spe tc linear Type The rule type ordered contiguous clustered unrestricted Spec
47. CALLS main nfunc Indicates that the function main calls the function nfunc Related information i PCP Assembly Language 3 27 COMMENT Syntax COMMENT delimiter delimiter Description With the COMMENT directive Start Comment Lines you can define one or more lines as comments The first non blank character after the COMMENT directive is the comment delimiter The two delimiters are used to define the comment text The line containing the second comment delimiter will be considered the last line of the comment The comment text can include any printable characters and the comment text will be produced in the source listing as it appears in the source file A label is not allowed before this directive Example COMMENT This is a one line comment COMMENT This is a multiple line comment Any number of lines can be placed between the two delimiters Related information d 3 28 PCP Reference Manual 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 l
48. Chapter Tool Options pragma extension isuffix Enables a language extension to specify imaginary floating point 99999 constants With this extension you can use an i suffix on a floating point constant to make the type _Imaginary float 0 5i pragma extern symbol Normally when you use the C keyword extern the compiler generates an EXTERN directive in the generated assembly source However if the compiler does not find any references to the extern symbol in the C module it optimizes the assembly source by leaving the EXTERN directive out With this pragma you force the compiler to generate the EXTERN directive creating an external symbol in the generated assembly source even when the symbol is not used in the C module See the EXTERN directive directive in Section 3 3 Assembler Directives and Controls in Chapter Assembly Language pragma inline pragma noinline pragma smartinline d See section 2 9 1 Inlining Functions of the User s Manual pragma macro pragma nomacro Turns macro expansion on or off Default macro expansion is turned on pragma maxcalldepth value Control the maximum size of a match Gls See compiler option max call depth in section Compiler Options in Chapter Tool Options pragma message string Print the message string s on standard output 1 12 n PCP Reference Manual pragma novector Do not generate channel vectors and channel context Same
49. Command line syntax P Description Normally if a command in a target rule in a makefile returns an error or when the target construction is interrupted the make utility removes that target file With this option you tell the make utility to make all target files precious This means that all dependency files are never removed Example mkpcp p The make utility never removes target dependency files Related information Special target PRECIOUS in section 7 3 2 Writing a Makefile in Chapter Using the Utilities of the Reference Manual 5 188 PCP Reference Manual Command line syntax q Description With this option the make utility does not perform any tasks but only returns an error 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 mkpcp q The make utility only returns an error code that indicates whether all target files are up to date or not It does not rebuild any files Related information i Tool Options Make Utility 5 189 F Command line syntax f Description When you call the make utility it first reads the implicit rules from the file mkpcp mk then it reads the makefile with the rules to build your files The file mkpep mk is located in the etc directory of the PCP toolchain With this option you tell the make utility not to read mkpcp mk and to rely fully on the make rules in the make
50. DWARF format with the name taskl elf With this option you can specify an alternative filename and an alternative output format The default output format is the format of the first input file You can use the o option multiple times This is useful to generate multiple output formats With the first occurrence of the o option you specify the basename the filename without extension which is used for subsequent o options with no filename specified If you do not specify a filename or you do not specify the o option at all the linker uses the default basename taskn IHEX and SREC formats If you specify the Intel Hex format or the Motorola S records format you can use the argument 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 S1 records 3 S2 records default or 4 bytes S3 records 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 there output files are named filename _spacename with the extension hex or sre Tool Options Linker 5 123 If you do not specify space_name or you specify a non existing space the default address space is filed in AN Use option c chip output
51. Do the IF on error assembler generates no error IF 3 0 assembler generates an error FLD base value width start Shift and mask value into base for width bits beginning at bit start If start is omitted zero least significant bit is assumed All arguments must be positive integers and none may be greater than the target word size Returns the shifted and masked value Example VAR1 EQU FLD 0 1 1 turn bit 0 on VAR1 1 VAR2 EQU FLD 0 3 1 turn bit 0 on VAR2 1 VAR3 EQU FLD 0 3 2 turn bits 0 and 1 on VAR3 3 VAR4 EQU FLD 0 3 2 1 turn bits 1 and 2 on VAR4 6 VAR5 EQU FLD 0 1 1 7 turn eighth bit on VAR5 0x80 FLR expression Returns a floating point value which represents the largest integer less than or equal to expression Example FLOOR SET FLR 2 5 FLOOR 2 0 PCP Assembly Language 3 11 FRACT expression This function returns the 32 bit fractional representation of the floating point expression The expression must be in the range 1 1 gt Example WORD FRACT 0 1 FRACT 1 0 HI expression Returns the upper 16 bits of a value HI expression is equivalent to expression gt gt 16 amp Oxffff Example mov u d2 LO COUNT addih d2 d2 HI COUNT upper 16 bits of COUNT INIT_R7 start dptr flags Returns the 32 bit value needed to initialize R7 This is equivalent to start lt lt 16 dptr amp 0x3fff gt gt 6 lt lt 8 flags amp Oxff
52. Expression check INT expr Integer check LST LIST control flag value 3 2 2 DETAILED DESCRIPTION OF BUILT IN ASSEMBLY FUNCTIONS ABS expression Returns the absolute value of expression as an integer value Example AVAL SET ABS 2 1 AVAL 2 PCP Assembly Language 3 7 ACS expression Returns the arc cosine of expression as a floating point value in the range zero to pi The result of expression must be between 1 and 1 Example ACOS SET ACS 1 0 ACOS 3 1415926535897931 ARG symbol expression Returns an integer 1 if the macro argument represented by symbol or expression is present 0 otherwise If the argument is a symbol it must be single quoted and refer to a formal argument name If the argument is an expression it refers to the ordinal position of the argument in the macro formal argument list The assembler issues a warning if this function is used when no macro expansion is active Example IF ARG TWIDDLE twiddle factor provided IF ARG 1 is first argument present ASN expression Returns the arc sine of expression as a floating point value in the range pi 2 to pi 2 The result of expression must be between 1 and 1 Example ARCSINE SET ASN 1 0 ARCSINE 1 570796 ASPCPQ Returns the name of the PCP assembler executable This is aspcp for the PCP assembler Example ANAME byte ASPCP ANAME aspcp AT2 expr
53. 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 2 22 7 Low level file access functions Stdio h PCP Reference Manual Description _close fd _lseek fd offset whence _open fd flags _read fd buff cnt _unlink name _write fd buffer cnt File access Stdio h 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 Description fopen name mode fclose name Opens a file for a given mode Available modes are r read open text file for reading yg w write create text file for writing if the file already exists its contents is discarded va a append open existing text file or create new text file for writing at end of file Po
54. With the keyword core you instantiate a core architecture in a derivative e With the keyword architecture you tell the linker that the given core has a certain architecture The architecture name 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 8 32 PCP Reference Manual If the architecture definition has parameters you must specify the arguments that correspond with the parameters For example mycorearch1 expects two parameters which are used in the architecture definition core mycore architecture mycorearchl 1 2 8 6 3 DEFINING INTERNAL MEMORY AND BUSES With the memory keyword you define physical memory that is present on the target board The memory name is used to identify the memory and does not conflict with other identifiers It is common to define internal memory on chip in the derivative definition External memory off chip memory is usually defined in the board specification See section 8 7 3 Defining External Memory and Buses The type field specifies a memory type rom read only memory ram random access memory mvram non volatile ram The optional reserved qualifier before the memory type tells the linke
55. absolute object file The default output format is ELF DWARF which can directly be used by the CrossView Pro 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 Intel Hex output file ccpcp format IHEX testl c test2 c output test hex Related information Control program option address size For linker IHEX SREC files Control program option space Set linker output space name Linker option o output file Linker option C generate hex file Section 7 1 ELF DWARF Object Format in Chapter Object File Formats Tool Options Control Program 5 147 fp trap Command line syntax fp trap Description Default the control program uses the non trapping floating point library libfp a With this option you tell the control program to use the trapping floating point library libfpt a 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 Example ccpcp fp trap test c Link the trapping floating point library when generating the object file test elf Related information d 5 148 PCP Reference Manual g debug info Command line syntax 8 debug info
56. 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 dim The token found in s is terminated with a null character Returns a pointer to the first position in s of the token Libraries 2 39 Miscellaneous functions Stdio h Wchar h Description memset s c n strerror errno strlen s wmemset s c Nn weslen s 2 2 22 TIME H AND WCHAR H Fills the first n bytes of s with character c and returns S Typically the values for err no come from int errno This function returns a point er to the associated error message See also section 2 2 3 errno h Returns the length of string x S The header file time h provides facilities to retrieve and use the calendar date and time and the process time Time can be represented as an integer value or can be broken down in components Two arithmetic data types are defined which are capable of holding the integer representation of times clock_t time t unsigned long long unsigned long The type struct tm below is defined according to ISO IEC9899 with one exception this implementation does not support leap seconds The struct tm type is defines as follows struct tm int tm_sec int tm_min int tm_hour int tm_mday int tm_mon
57. and are passed to the linker Files with a out suffix are interpreted as linked object files and are passed to the locating phase of the linker The linker accepts only one out file in the invocation An argument with a 1s1 suffix is interpreted as a linker script file and is passed to the linker Normally the control program tries to compile assemble link and locate all source files to absolute object files There are however options to suppress the assembler link or locate stage Tool Options Control Program 5 131 _ help Command line syntax options help options Description Displays an overview of all command line options When you specify the suboption options you receive extended information Example The following invocations all display a list of the available command line options ccpcp ccpcp Related information J 5 132 PCP Reference Manual 7 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 S1 records 3 S2 records default or 4 bytes S3 records If you do not specify addr_size the defau
58. arithmetic support for the compiler cpcp is included in the software as a separate set of libraries During linking you have to specify the desired floating point library trapping or non trapping after the C library The cpcp compiler only supports single precision floating point arithmetic The single precision floating point complies to the ISO IEC 9899 standard To ensure portability of floating point arithmetic floating point arithmetic for the compiler cpcp has been implemented complying with the IEEE 754 standard for floating point arithmetic See the ZEEE Standard Binary for Floating Point Arithmetic document IEEE Computer Society 1985 for more details on the floating point arithmetic definitions This document is referred to as IEEE 754 in this manual It is possible to intercept floating point exceptional cases and if desired handle them with an application defined exception handler The intercepting of floating point exceptions is referred to as trapping Examples of how to install a trap handler are included Run time Environment 4 5 4 5 1 COMPLIANCE WITH IEEE 754 The level to which the floating point implementation complies with the IEEE 754 standard depends on the choosen configuration All floating point calculations are executed using the round to nearest even rounding mode since this is required by ANSI C 89 This is conform IEEE 754 Because there are no double precision floating point hardw
59. as compiler option novector db See compiler option novector in section Compiler Options in Chapter Tool Options pragma optimize flags pragma endoptimize pragma optimize restore db See section 4 3 Compiler Optimizations in Chapter Using the Compiler of the User s Manual restore returns to the previous pragma level if the same pragma is used more than once pragma protect pragma endprotect Protect sections against linker optimizations This excludes a section from unreferenced section removal and duplicate section removal by the linker pragma section section_type section_name pragma endsection db See section 2 10 Compiler Generated Sections and compiler option rename sections in section Compiler Options in Chapter Tool Options pragma source pragma nosource d See compiler option s in section Compiler Options in Chapter Tool Options pragma stdinc Changes the behaviour of the include directive When set compiler option I and compiler option no stdinc are ignored pragma linear_switch pragma jump_switch pragma binary_switch pragma smart_switch With these pragmas you can overrule the compiler chosen switch method PCP C Language 1 13 linear switch force jump chain code A jump chain is comparable with an if else if else if else construction jump_switch force jump table code A jump table is a table filled with jump instructions for each possible switch value The switch a
60. as interrupt function interrupt service routine This function qualifier takes one argument CN The CN argument Channel Number is an 8 bit channel number in the range 0 255 that defines the channel entry table address and the context address You should not use channel 0 for channel number 0 no channel entry table address and no context address is defined void _ interrupt CN isr void 1 8 PCP Reference Manual t 1 5 INTRINSIC FUNCTIONS The TASKING PCP C compiler recognizes intrinsic functions All intrinsic functions begin with a double underscore character __ You can use intrinsic functions as if they were ordinary C functions You can use 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 __dotdotdot__Q char _ dotdotdot__ void Variable argument operator Used in library function va_start _freeQ void volatile _ free void buffer Deallocates the memory pointed to by buffer buffer must point to memory earlier alloacted by a call to __ alloc Same as library function free nopo void __nop void Inserts a NOP instruction get_return_address __codeptr volatile __get_return_address void Used by the compiler in retjmp _ d32_fpiO unsigned long volatile __1d32_fpi unsi
61. as part of the optimization process The compiler always inlines all functions that are smaller than the specified threshold The threshold is measured in compiler internal units and the compiler uses this measure to decide which functions are small enough to inline The default threshold is 10 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 35 which means that the compiler continues inlining functions until the resulting code size is 35 larger than the original size Example cpcp inline max incr 40 inline max size 15 test c Tool Options Compiler 5 29 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 d gt Compiler option O Specify optimization level Section 2 9 1 Inlining Functions in Chapter PCP C Language of the User s Manual 5 30 PCP Reference Manual 7 k keep output files Command line syntax k keep output files Description If an error occurs during comp
62. at 16 bytes and issues a warning se Ne Ne Related information db 3 24 PCP Reference Manual ASCII ASCHZ Syntax abel ASCIL string string label ASCIIZ string string Description With the ASCII or ASCIIZ directive the assembler allocates and initializes memory for each string argument The ASCITI directive does not add a NULL byte to the end of the string The ASCIIZ directive does add a NULL byte to the end of the string The 07 z in ASCIIZ stands for zero Use commas to separate multiple strings Example STRING ASCII Hello world STRINGZ ASCIIZ Hello world amp With the BYTE directive you can obain exactly the same effect STRING BYTE Hello world without a NULL byte STRINGZ BYTE Hello world 0 with a NULL byte Related information Gs SPACE Define storage BYTE Define a constant byte WORD HALF Define a word halfword PCP Assembly Language 3 25 BYTE Syntax abel BYTE argument argumenil Description With the BYTE directive Define Constant Byte the assembler allocates and initializes a byte of memory for each argument An argument can be e a single or multiple character string constant e an integer expression e NULL indicated by two adjacent commas Multiple arguments are stored in successive byte locations If an argument is NULL its corresponding byte location is filled with zeros If you specify
63. at most one or operator All uses of the pragma directive shall be documented This rule is really a documentation issue The compiler will flag all pragma directives as violations defined shall only be used in one of the two standard forms Pointer arithmetic should not be used No more than 2 levels of pointer indirection should be used A violation is reported when a pointer with three or more levels of indirection is declared No relational operators between pointers to different objects In general checking whether two pointers point to the same object is impossible The compiler will only report a violation for a relational operation with incompatible pointer types Non constant pointers to functions shall not be used Functions assigned to the same pointer shall be of identical type MISRA C Rules 106 107 108 109 110 111 112 113 114 115 x 116 x 117 118 119 120 121 122 123 124 125 126 127 R R R R R R R R R R R R R R R R R R R R R R 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 decl
64. converted float overflows the target integer type the value is saturated to MAX INT or MIN_INT 4 6 E PCP Reference Manual 4 5 2 SPECIAL FLOATING POINT VALUES Below is a list of special IEEE 754 defined floating point values as they can occur during run time Special value Sign Exponent Mantissa 0 0 Positive Zero 0 all zeros all zeros 0 0 Negative Zero 1 all zeros all zeros INF Positive Infinite 0 all ones all zeros INF Negative Infinite 1 all ones all zeros NaN Not a number 0 all ones not all zeros Table 4 1 Special floating point values 4 5 3 TRAPPING FLOATING POINT EXCEPTIONS Four floating point libraries are delivered Library to link Description libfp a Floating point library non trapping This is the default libfpt a Floating point library trapping Control program option fp trap Table 4 2 Floating point libraries The control program cepep automatically selects the appropriate libraries depending on the specified PCP By specifying the fp trap option to the control program cepep the trapping type floating point library is linked into your application If this option is not specified the floating point library without trapping mechanism is used Run time Environment 4 7 IEEE 754 Trap Handler In the IEEE 754 standard a trap handler is defined which is invoked on specified exceptional events passing along
65. converted to double prior to calculation In this C99 version parallel sets of functions are defined for double float and long double They are respectively named function function function All long type functions though declared in math h are implemented as the double type variant which nearly always meets the requirement in embedded applications The header file tgmath h contains parallel type generic math macros whose expansion depends on the used type tgmath h includes math h and the effect of expansion is that the correct math h functions are called The type generic macro if available is listed in the second column of the tables below Trigonometric 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 sin x of x acos acosf acosl acos Returns the arc cosine cos x of x atan atanf atanl atan Returns the arc tangent tan x of x atan2 atan2f 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 2 12 PCP Reference Manual Math h Tgmath h Description acosh acoshf acoshl acosh Returns the non negative arc hyper bolic c
66. disinguish these symbols from symbols generated by the aspep assembler Example The add the prefix _PCP_ to global extenal symbols enter aspcp P_PCP_ test pcp aspcp prefix _PCP_ test pcp Related information J 5 84 PCP Reference Manual e p pcptype Command line syntax ppceptype pcptype pcptype You can specify the following PCP types 1 PCP 1 syntax 2 PCP 2 syntax tc1775 generate code for the PCP on the TC1775 Description PCP assembler only With this option you can choose the syntax for the PCP assembler Example The select to generate code for the PCP on the TC1775 enter aspcp ptc1775 test pcp aspcp pcptype tc1775 test pcp Related information i Tool Options Assembler 5 85 t section info Command line syntax tflags section info lags You can set the following flags c C_ console Display section information on stdout VL 4 list Write section information to the list file Description With this option you tell the assembler to display section information For each section its memory space size total cycle counts and name is listed on stdout and or in the list file The cycle count consists of two parts the total accumulated count for the section and the total accumulated count for all repeated instructions In the case of nested loops it is possible that the total supersedes the section total With tl the assembler writes the section information to t
67. exp Description With the WARNING directive Programmer Generated Warning you tell the assembler to output a warning message during the assembling process The total warning count will be incremented as with any other warning The WARNING directive is for example useful in combination with conditional assembly for exceptional condition checking The assembly process proceeds normally after the warning has been printed Optionally you can specify an arbitrary number of strings and expressions in any order but separated by commas to describe the nature of the generated warning If you use expressions the assembler outputs the result The assembler outputs a space between each argument This directive has no effect on the exit code of the assembler unless you use the assembler option warnings as errors In that case the assembler exits with exit code 1 an error A label is not allowed before this directive Example WARNING parameter too large This results in the warning W144 filename line Parameter out of range Related information Gb FAIL Programmer Generated Error MESSAGE Programmer Generated Message PCP Assembly Language 3 63 WEAK Syntax WEAK symbol symbol Description With the WEAK directive you mark one of 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 exis
68. format all_ number number Optionally you can use one of the following display formats format text The default is plain text html Display explanation in HTML format rtf Display explanation in RTF format Description With this option the compiler displays a description and explanation of the specified error message s on stdout usually the screen The compiler does not compile any files 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 cpcp diag 282 This results in the following message and explanation E282 unterminated comment Make sure that all 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 enter cpcp diag html all gt cerrors html 5 16 PCP Reference Manual 7 Related information db Section 4 8 C Compiler Error Messages in Chapter Using the Compiler of the User s Manual Tool Options Compiler 5 17 E preprocess Command line syntax Ejflags preprocess lags You can set the following flags when you s
69. g G a4 int signed decimal int the integer may be given octal i e a leading 0 is entered or hexadecimal leading 0x or 0X or just decimal int unsigned octal int unsigned decimal int unsigned hexadecimal in lowercase or uppercase single character converted to unsigned char 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 float float float int the number of characters written so far is written into the argument No scanning is done 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 Matches a string of input characters not in the set between the brackets A NULL character is added to terminate the string Specifying includes the character in the set Literal no assignment is done Table 2 3 Scanf conversion characters Libraries 2 27 Stdio h Wchar h Description fgetc stream getc stream getchar stdin fgets s n stream gets s n stdin ungetc c stream fscanf stream format fgetwc stream getwc stream getwchar stdin fgetws s n stream ungetw
70. gt gt 0 e A stack_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 0 e A heap def defines a heap with the heap_name as a unique name min_size expr stack heap descr grows direction align expr fixed e The min_size statement must be present e You can specify at most one align statement and one grows statement direction low_to_high high _to_low e If you do not specify the grows statement the stack and grow low to high copy_table def copytable lt copy table descr lt copy_table_descr gt 9 gt 0 1 e A space_def contains at most one copytable statement Linker Script Language 8 15 e Exactly one copy table must be defined in one of the spaces copy_table descr align expr copy_unit expr dest lt space_name gt 1 space_name page e The copy_unit is defined by the size in MAUs in which the startup code moves data e The dest statement is only required when the startup code initializes memory used by another processor that has no access to ROM e A space_name refers to a defined address space start_addr start_address start_addr_descr lt start_addr_descr gt start_addr_descr run_addr expr symbol symbol name e A symbol_name refers to the section that contains the startup code endianness_def endianness lt endianness_typ
71. in str1 as an integer starting at position start If start is not given the search begins at the beginning of str1 If the start argument is specified it must be a positive integer and cannot exceed the length of the source string Note that the first position in a string is position 0 Example ID EQU POS PCP assembler assembler 7ID i EQU POS ABCDABCD B 2 ID2 5 POW exprLexpr2 Returns expr raised to the power expr2 as a floating point value expr1 and expr2 must be separated by a comma Example BUF EQU CVI POW 2 0 3 0 BUF 8 RND Returns a random value in the range 0 0 to 1 0 Example SEED EQU RND save initial SEED value PCP Assembly Language 3 15 RVB expr1 expr2 Reverse the order of bits in expr1 delimited by the number of bits in expr2 If expr2 is omitted the field is bounded by the target word size Both expressions must be 16 bit integer values Example VARI SET RVB 0x200 reverse all bits VAR1 0x40 VAR2 SET RVB 0xBO02 reverse all bits VAR2 0x40D0 VAR3 SET RVB 0xB02 2 reverse bits 0 and 1 VAR3 0xB01 SCP str1 str2 Returns an integer 1 if the two strings compare 0 otherwise The two strings must be separated by a comma Example IF SCP STR MAIN does STR equal MAIN SFRACT expression This function returns the 16 bit fractional representation of the floating point expression The expression must be in the range 1 1 gt
72. 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 lpcp mylib a Nothing is linked and no output file will be produced because there are no unresolved symbols when the linker searches through mylib a lpcp e _START mylib a lpcp extern START mylib a In this case the linker searches for the symbol _ START in the library and if found extracts the object that contains _START the startup code If this module contains new unresolved symbols the linker looks again in mylib a This process repeats until no new unresolved symbols are found Related information db Section 6 4 1 Specifying Libraries to the Linker in Chapter Using the Linker of the User s Manual 5 98 PCP Reference Manual error file Command line syntax error file i e Description With this option the linker redirects error messages to a file If you do not specify a filename the error file is lpcp e1k Example lpcp error file my elk test o The linker writes error messages to the file my e1k instead of stderr Related information d Linker option warnings as errors Treat warnings as errors Tool Options Linker 5 99 error limit Command line syntax error Limit number Description With this option you tell the linker to only emit t
73. label it gets the value of the location counter at the start of the directive processing 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 0x52 0x41420043 BYTE R BYTE AB D se Ne Example TABLE BYTE two 0 strings 0 CHARS BYTE A B C D Related information d gt SPACE Define storage ASCII ASCIIZ Define ASCII string without with ending NULL WORD HALF Define a word halfword 3 26 PCP Reference Manual CALLS Syntax CALLS caller callee Description Create a flow graph reference between caller and callee With this information the linker can build a call graph and calculate stack size Caller and Callee are names of functions The compiler inserts CALLS directives automatically to pass call tree information Normally it is not necessary to use the CALLS directive in hand coded assembly A label is not allowed before this directive Example
74. 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 archiver creates a new library with the specified name If you add a module to the library without specifying the suboption a or b the specified module is added at the end of the archive Use the suboptions a or b to insert them to a specified place instead a posname Add the specified object module s after the existing module posname b posname Add the specified object module s before the existing module posname c Create a new library without checking whether it already exists If the library already exists it is overwritten u Insert the specified object module only if it is newer than the module in the library V Verbose the archiver shows which files are removed The suboptions a or b have no effect when an object is added to the library Tool Options Archiver 5 205 Examples Suppose the library lib a contains the following objects see option t objl o To add obj2 0 to the end of lib a arpcp r lib a obj2 o To insert obj3 0 just before obj2 0 arpcp r b obj2 o lib a obj3 0 The library lib a after these two invocations now looks like objl o obj3 0 obj2 0 Creating a new library To create a new library file add an object file and specify a library that does not yet exist arpcp r objl o newlib a The archiver creates
75. list file Overview of miscellaneous assembler controls Function Description DEBUG ON OFF Generation of symbolic debug ON OFF DEBUG flags Select debug information HW_ONLY Prevent substitution of assembly instructions by smaller or faster instructions IDENT LOCAL GLOBAL Assembler treats labels by default as local or global OBJECT Alternative name for the generated object file WARNING OFF num Suppress all or some warnings 3 3 4 DETAILED DESCRIPTION OF ASSEMBLER CONTROLS The assembler recognizes both upper and lower case for controls PCP Assembly Language 3 67 DEBUG ON OFF Syntax DEBUG ON DEBUG OFF DEBUG flags Description With the DEBUG ON and SDEBUG OFF controls you turn the generation of debug infomation on or off SDEBUG ON is similar to the assembler option gl If you use DEBUG control with flags you can set the following flags a A assembler source line information h H pass HLL debug information You cannot use these two types of debug information both So SDEBUG ah is not allowed 1 L local symbols debug information s S always debug either AhL or aHl AN Debug information that is generated by the C compiler is always passed to the object file Example begin of source DEBUG ON generate local symbols debug information Related option d Assembler option g Select debug information in section 5 2 Assemble
76. of the section _lc_ub_name for the start and _le_ue_name for the end of the output section Linker Script Language 8 51 Copy table e The keyword copytable tells the linker to select a section that is used as copy table The content of the copy table is created by the linker It contains the start address and length of all sections that should be initialized by the startup code The linker creates two labels to mark the begin and end of the section _lc_ub_table for the start and __le_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 8 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 section
77. option D aspcp DDEMO DTEST 0 test src Related information i 3 44 PCP Reference Manual INCLUDE Syntax INCLUDE filename lt filename gt Description With the INCLUDE directive you include another file at the exact location in the source where the INCLUDE occurs 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 filename specifies the filename of the file to be included The filename must be compatible with the operating system forward backward slashes and can include a directory specification 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 used the filename construction The current directory is not searched if you use the lt filename gt syntax 2 The path that is specified with the assembler option I 3 The path that is specified in the environment variable ASPCPINC when the product was installed 4 The include directory relative to the installation directory A label is not allowed before this directive Example INCLUDE storage mem asm include file INCLUDE lt data asm gt Do not look in cur
78. same So for example the label LabelName is considered the same label as labelname Related information db Assembler option c Assemble case insensitive Tool Options Linker 5 93 D define Command line syntax Dmacro_name macro_definition define macro_name macro_definition Description With this option you can define a macro and specify it to the 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 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 linker with the option ffile Define macro to the preprocessor as in define Any number of symbols can be defined The definition can be tested by the preprocessor with if ifdef and ifndef for conditional locating Example To define the RESET vector interrupt table start address and trap table start address which is used in the linker script file tclv1_3 1s1 enter lpcp test o otest elf dtclvl_3 1sl DRESET 0xa0000000 DINTTAB 0xa00 0000 define TRAPTAB 0xa00 2000 Related information d Linker option f Name of invocation file 5 94 PCP Reference Manual d isl file Command line syntax dfile Isl file ile Description With this option you specify a linker script file to the link
79. space maps onto an internal bus or onto another address space Mappings are described in section 8 5 4 Mappings Stacks and heaps e 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 8 8 3 Creating or Modifying Special Sections The stack is described in terms of a minimum size min_size and the direction in which the stack grows grows This can be either from low_to_high addresses stack grows upwards this is the default or from high_to_low addresses stack grows downwards The min_size is required By default the linker tries to maximize the size of the stacks and heaps After locating all sections the largest remaining gap in the space is used completely for the stacks and heaps If you specify the keyword fixed you can disable this so called balloon behavior The size is also fixed if you used a stack or heap in the software layout definition in a restricted way For example when you override a stack with another size or select a stack in an ordered group with other sections Optionally you can specify an alignment for the stack with the argument align This alignment must be equal or larger than the alignment that you specify for the address space itself e The heap keyword defines a heap in the address space and assigns a
80. tc linear text hello main Oxa00000f8 l zdata hello 0xd0000000 spe tc abs18 zrodata hello 0xa0000008 ee EE S PCP Reference Manual FEC CSCO COCO Cross Reference Part F Aki kki kA KAAKAA AKKA K l l l _doprint_int o libc _printf_int2 printf_int o _doprint_int o text libc _doprint printf o cstart o text libe _start hello o cstart o text libc reset START hello o text hello main main cstart o printf o text libe printf hello o nn JE III IOS kA kkk OSE EEISCCEEEEAG Ca Graph Part 5A A e e A e e K A A e KAKARAKA AKAK KKA KAAKAA kkk Qe ay Part 2AA AAA k k Ak A R AA II II I KA FEI III II III kkk kkk kxk Locate Part hkk k k k e k e k E A k k AK K K Task entry address symbol START absolute address 0xa0000000 Section translation Space spe tc linear Fr np Chip Group Section Size MAU Space addr Chip addr 0x00000008 0xa0000000 0x00000000 data libc 0x000000cc 0xa0000010 0x00000010 zdata hello 0x00000004 Oxa00000dc 0x000000dc rodata hello 0x0000000c 0xa00000e0 0x000000e0 rodata libc 0x0000000c 0xa00000ec 0x000000ec text hello main 0x00000014 Oxa00000f8 0x000000f8 text libc csa_areas 0x00000008 0xa000010c 0x0000010c table 0x00000034 0xa0000114 0x00000114 libraries
81. the library newlib a and adds the object obj1 o0 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 arpcp r c objl o lib a The archiver overwrites the library lib a and adds the object obj1 0 to it The new library lib a only contains objl o Related information db Archiver option t Print library contents 5 206 PCP Reference Manual t Command line syntax t s0 s1 Description Print a table of contents of the library to standard out With the suboption s the archiver 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 arpcp t lib a The archiver prints a list of all object modules in the library lib a arpcp t s0 lib a The archiver prints per object all symbols in the library This looks like prolog o symbols lib a prolog o _Qabi_callee save lib a prolog o _Qabi_callee restore divl6 o symbols lib a divl6 0 _udivl6 lib a divl6 0 __divl6 lib a divl6 o0 _urem16 lib a divl6 o0 _reml16 Related information J Tool Options Archiver 5 207 V Command line syntax V Description Display version information The archiver ignores all other options or input files Example arpcp V The archiver does n
82. 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 8 24 e PCP Reference Manual 8 5 2 DEFINING INTERNAL BUSES With the bus keyword you define a bus the combination of data and corresponding address bus The bus name is used to identify a bus and does not conflict with other identifiers Bus descriptions in an architecture definition or derivative definition define internal buses Some internal buses are used to communicate with the components outside the core or processor Such buses on a processor have physical pins reserved for the number of bits specified with the width statements The mau field specifies the MAU size Minimum Addressable Unit of the data bus This field is required The width field specifies the width number of address lines of the data bus The default value is the MAU size The map keyword specifies how this bus maps onto another bus if so Mappings are described in section 8 5 4 Mappings bus bus_name mau 8 width 8 map map description 8 5 3 DEFINING ADDRESS SPACES With the space keyword you define a logical address space The space name is used to identify the address space and does not conflict with other identifiers The id field defines how the addressing space is identified in object files In gen
83. the value 0x4000 permanently to the symbol A_D_PORT A D PORT EQU 0x4000 You cannot redefine the symbol A_D_PORT after this Related information d SET Set temporary value to a symbol 3 36 PCP Reference Manual EXITM Syntax EXITM Description With the EXITM directive Exit Macro the assembler will immediately terminate a macro expansion It is useful when you use it with the conditional assembly directive IF to terminate macro expansion when for example error conditions are detected A label is not allowed before this directive Example CALC MACRO XVAL YVAL IF XVAL lt 0 FAIL Macro parameter value out of range EXITM Exit macro ENDIF ENDM Related information DUP Duplicate Sequence of Source Lines DUPA Duplicate Sequence with Arguments DUPC Duplicate Sequence with Characters DUPF Duplicate Sequence in Loop MACRO Define Macro PCP Assembly Language 3 37 EXTERN Syntax EXTERN symbol symboll Description With the EXTERN directive External Symbol Declaration you specify that the list of symbols is referenced in the current module but is not defined within the current module These symbols must either have been defined outside of any module or declared as globally accessible within another module with the GLOBAL directive If you do not use the EXTERN directive to specify that a symbol is defined externally and the symbol is not defined within the c
84. to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels Tool Options Compiler 5 21 Example Suppose the file myoptions contains the following lines Ctcl1920b test c Specify the option file to the compiler cpcp f myoptions cpcp option file myoptions This is equivalent to the following command line cpcp Ctc1920b s test c Related information ib 5 22 PCP Reference Manual g debug info Command line syntax g suboption debug info suboption You can set the following suboptions a al Emit full symbolic debug information c call frame Emit DWARF call frame information only d default Emit default symbolic debug information Default debug info same as debug info default Description With this option you tell the compiler to add directives to the output file for including symbolic information This facilitates high level debugging but increases the size of the resulting assembler file and thus the size of the object file For the final application compile your C files without debug information Call frame information only 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
85. token of an actual macro argument is In the definition of a function like macro each instance of a parameter shall be enclosed in parentheses unless it is used as the operand of or All macro identifiers in preprocessor directives shall be defined before use except in ifdef and ifndef preprocessor directives and the defined operator There shall be at most one occurrence of the or preprocessor operators in a single macro definition 9 20 PCP Reference Manual 19 13 A The and preprocessor operators should not be used 19 14 R The defined preprocessor operator shall only be used in one of the two standard forms 19 15 R Precautions shall be taken in order to prevent the contents of a header file being included twice 19 16 R Preprocessing directives shall be syntactically meaningful even when excluded by the preprocessor 19 17 R All else elif and endif preprocessor directives shall reside in the same file as the if or ifdef directive to which they are related Standard libraries 20 1 R Reserved identifiers macros and functions in the standard library shall not be defined redefined or undefined 20 2 R The names of standard library macros objects and functions shall not be reused x 20 3 R The validity of values passed to library functions shall be checked 20 4 R Dynamic heap memory allocation shall not be used 20 5 R The error indicator errno shall not be used 20 6 R
86. 0 INDEX Manual Purpose and Structure IX MANUAL PURPOSE AND STRUCTURE Windows Users The documentation explains and describes how to use the PCP toolchain to program a PCP The documentation is primarily aimed at Windows users You can use the tools from the command line in a command prompt window Unix Users For UNIX the toolchain works the same as it works for the Windows command line Directory paths are specified in the Windows way with back slashes as in cpcep bin Simply replace the back slashes by forward slashes for use with UNIX cpcp bin Structure The PCP documentation consists of a User s Manual which includes a Getting Started section and a separate Reference Manual this manual First you need to install the software This is described in Chapter 1 Software Installation and Configuration of the User s Manual 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 the Reference Manual to lookup specific options and details to make fully use of the PCP toolchain x PCP Reference Manual SHORT TABLE OF CONTENTS Chapter 1 PCP C Language Contains overviews 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 libra
87. 00 100 spe tc pcp_data 0x00000400 0x00000000 0 0x00000400 100 0x00000400 100 fee ee ee eee a ele ee ee ree ee ee ee a eee ee eee Address range usage at memory level iii a ane a f3 gt free gap ext_c 0x00080000 0x00000ff4 ext_c2 0x00080000 0x00000000 ext_d 0x00070000 0x00020784 2 0x0004f87c 71 0x0004f878 71 spe brom 0x00008000 0x00000000 0x00008000 100 0x00008000 100 1 0x0007f00c 99 0x0007b152 96 0 9 0 spe csram 0x00006000 0x00000000 0 0x00006000 100 0x00006000 100 7 0 0 0 0x00080000 100 0x00080000 100 spe dsram 0x00006000 0x00001004 1 0x00004ffc 83 0x00004fc0 83 spe fpidram 0x00004000 0x00000000 0x00004000 100 0x00004000 100 spe pcode 0x00004000 0x00000000 0x00004000 100 0x00004000 100 spe pram 0x00001000 0x00000000 0x00001000 100 0x00001000 100 vecttable 0x00002400 0x000000a4 2 0x0000235c 98 0x00002000 88 Pr nn nf kkkkkkkkkkkikkxkxkxxxxxxkxkxx xx x Linker Script File Part 55a aaa akaki k A k k JERI I IIS kkk kkk kx kxk Locate Rule Part tbr ikk k k k k k k k e A A K K A K K K absolute 0xa0004000 text libc l clustered zdata hello clustered data libe ordered text trapvec 000 lt text trapvec 001 unrestricted zrodata hello unrestricted ustack 6 8 PCP Reference Manual E The meaning of the different parts is Processed Files Part Thi
88. 148 f 5 144 define 5 137 g 5 148 diag 5 140 1 5 149 dry run 5 156 k 5 151 error file 5 142 L 5 152 format 5 146 L 5 154 fptrap 5 147 n 5 156 help 5 131 0 5 160 ignore default library path t 5 163 5 152 U 5 164 include directory 5 149 V 5 105 iso 5 150 v 5 166 keep output files 5 151 W 5 167 keep temporary files 5 163 w 5 168 library 5 154 Wa 5 167 Index 8 7 We 5 167 WI 5 167 controls See also assembler directives detailed description 3 66 copy table 5 117 8 26 8 51 copysign functions 2 15 core type 5 56 cos 3 9 cos functions 2 11 cosh functions 2 11 cpu 3 9 CPU type 5 8 5 56 5 133 cstart asm 4 3 ctime 2 40 cyf 3 9 cvi 3 9 cycle count 5 85 data types 1 4 debug 3 67 debug information 5 22 5 69 5 125 def 3 9 define 3 28 derivative definition 8 4 8 30 difftime 2 40 directives See also assembler directives detailed description 3 20 div 2 35 double 3 39 dptr 3 10 dup 3 29 dupa 3 30 dupc 3 31 dupf 3 32 Index ELF DWARF object format 7 3 elif 3 42 else 3 42 end 3 34 endif 3 42 EOF 2 21 equ 3 35 erf functions 2 16 erfc functions 2 16 errno 2 5 exceptions floating point 4 6 exit 2 34 exit macro 3 36 EXIT_FAILURE 2 32 EXIT SUCCES 2 32 exitm 3 36 exp 3 10 exp functions 2 12 exp2 functions 2 12 expm1 functions 2 12 extension isuffix 1 11 extern 1 11 3
89. 1920b test sre Related information i Tool Options Assembler 5 69 g debug info Command line syntax giflag debug info ag You can set the following flags a A asm Assembly source line information h H hll Pass HLL debug information 1 L local Local symbols debug information s S_ smart Smart debug information Default Description With this option you tell the assembler to generate debug information If you do not use this option or if you specify g without any flags the default is gs You cannot specify gah Either the assembler generates assembly source line information or it passes HLL debug information When you specify gs the assembler selects which flags to use If high level language information is available in the source file the assembler passes this information same as gAhL If not the assembler generates assembly source line information and local symbols debug information same as gaHl With gAHLS the assembler does not generate any debug information Example To disable symbolic debug information turn all flags off aspcp gAHLS test src aspcp debug info asm hll local smart test sre To enable smart debugging enter aspcp gs test src aspcp debug info smart test src 5 70 PCP Reference Manual 7 Related information i Tool Options Assembler 5 71 H include file Command line syntax Hile include file ie
90. 2 20 2 2 20 stdlib h and wchar h 0 2 ee 2 31 2 2 21 string h and wchar h 0 00 00 2 35 2 2 22 time h and wchar h 0 eee 2 39 VI 7 Table of Contents 2 2 23 Unistd h ein Pac educ tears eaten osm vance oases 2 42 2 2 24 E A EE E S E OEE E IEN 2 43 2 2 25 WCLY PCr aa r E E baila A A dh wean 2 44 PCP ASSEMBLY LANGUAGE 3 1 3 1 Introduction niae t a ee Eas 3 3 3 2 Built in Assembly Functions 005 3 3 3 2 1 Overview of Built in Assembly Functions 3 3 3 2 2 Detailed Description of Built in Assembly Functions 3 6 3 3 Assembler Directives and Controls 3 18 3 3 1 Overview of Assembler Directives 3 18 3 3 2 Detailed Description of Assembler Directives 3 20 3 3 3 Overview of Assembler Controls 45 3 66 3 3 4 Detailed Description of Assembler Controls 3 66 RUN TIME ENVIRONMENT 4 1 4 1 TAtPORUCHON seenen ea Ace a A ae 4 3 4 2 Stats GOG esc ain seinen Pcie a Rice ea ater ince Min RaT 4 3 4 3 StackUsage ac AS ponte 20 Dike of AND ee GL ead te 4 3 4 4 Heap Allocation iiaeaa in E AARE AA 4 4 4 5 Floating Point Arithmetic 0 000000000 eee eee 4 4 4 5 1 Compliance with IEEE 754 0 0 00 0 0 eee 4 5 4 5 2 Special Floating Point Values 000005 4 6 4 5 3 Trapping Floating Point Exceptions 4 6 4 5 4 Floating Point Trap Handling API 4 8 TOOL OPTIONS 5 1 Sl Compile
91. 2 8 PCP Reference Manual FE_DIVBYZERO FE_INEXACT FE INVALID FE OVERFLOW FE_UNDERFLOW FE ALL EXCEPT fegetround Returns the current rounding direction represented as one of the values of the rounding direction macros Not implemented fesetround Sets the current rounding directions Not implemented Currently no rounding mode macros are implemented 2 2 6 FLOAT H The header file float h defines the characteristics of the real floating point types float double and long double AN Float h used to contain prototypes for the functions copysign f isinf isfinite f isnan and scalb These functions have accordingly to the ISO IEC9899 standard been moved to the header file math h See also section 2 2 12 Math h and Tgmath h 2 2 7 FSS H The header file ss h contains definitions and prototypes for low level I O functions used for CrossView Pro 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 Stdio h Description Buffer and breakpoint functions for fss_ break vota CrossView Pro Opens file descriptors O stdin 1 stdout and 2 stderr and associates them with terminal window FSS 0 of CrossView Pro _fss_init fd is_close _close fd _lseek fd offset whence _open fd flags See Low Level File Access Functions _read fd buff cnt in section 2 2 19 Stdio h
92. 3 9 def 5 9 dptr 3 10 exp 3 10 fid 3 10 fir 3 10 hi 3 11 init_r7 3 11 int 3 11 110 3 11 len 3 12 Ing 3 12 lo 3 12 log 3 12 lsb 3 12 ist 3 13 lun 3 13 mac 3 13 macros overview 3 5 mathematical overview 3 4 max 3 13 min 3 13 msb 3 14 mxp 3 14 pos 3 14 pow 3 14 rnd 3 14 rub 3 15 scp 3 15 sfract 3 15 sgn 3 15 sin 3 15 snh 3 16 sqt 3 16 strings overview 3 5 sub 3 16 syntax 3 3 tan 3 16 tnh 3 16 unf 3 17 xpn 3 17 at2 3 7 atan functions 2 11 atan2 functions 2 11 atanh functions 2 12 atexit 2 34 atn 3 8 atof 2 32 Index 6 Index atoi 2 32 compiler options atol 2 32 2 5 4 atoll 2 32 align stack 5 7 check 5 10 compact max size 5 11 B core 5 12 cpu 5 8 binary_switch 1 12 debug info 5 22 board specification 8 5 8 34 define 5 13 bsearch 2 34 diag 5 15 btowc 2 44 error file 5 19 BUFSIZ 2 21 help 5 4 bus definition 8 5 include directory 5 25 buses 8 24 include file 5 24 byte 3 25 inline 5 27 inline max incr 5 28 inline max size 5 28 1s0 5 9 Cc keep ouitput files 5 30 language 5 5 calloc 2 33 misrac 5 31 es a misrac advisory warnings 5 32 a y misrac required warnings 5 32 cat 3 8 misrac version 5 33 cbrt functions 2 15 no clear 5 35 ceil functions 2 13 Seno stdni 5 36 cel 3 8 m no k char type treat as unsigned 5 50 2o o
93. 4 45 46 47 48 R R R R A R R R A A R R A R R A A Only the first or all enumeration constants may be initialized The right hand operand of amp amp or shall not contain side effects The operands of a logical amp amp or shall be primary expressions Assignment operators shall not be used in Boolean expressions Logical operators should not be confused with bitwise operators Bitwise operations shall not be performed on signed integers A shift count shall be between 0 and the operand width minus 1 This violation will only be checked when the shift count evaluates to a constant value at compile time The unary minus shall not be applied to an unsigned expression sizeof should not be used on expressions with side effects The implementation of integer division should be documented The comma operator shall only be used in a for condition Don t use implicit conversions which may result in information loss Redundant explicit casts should not be used Type casting from any type to or from pointers shall not be used The value of an expression shall be evaluation order independent This rule is checked using worst case assumptions This means that a violation will be reported when a possible alias may cause the result of an expression to be evaluation order dependent No dependence should be placed on operat
94. 5 125 S strip debug Command line syntax S strip debug Description With this option you specify not to include symbolic debug information in the resulting output file Example lpcp S test o otest elf lpcp strip debug test o output test elf The linker generates the object file test elf without symbolic debug information 5 126 PCP Reference Manual V version Command line syntax V Description Display version information The linker ignores all other options or input files Example lpcp V lpcp version The linker does not link any files but displays the following version information TASKING PCP VX toolset object linker vx yrz Build 000 Copyright years Altium BV Serial 00000000 Related information i Tool Options Linker 5 127 v verbose Command line syntax v v 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 Example lpcp test o dextmem 1sl ddefault 1lsl lc lfp lrt y The linker links the file test o and displays the steps it performs 1pcp 1pep 1pep 1pcp 1pep ipep ipep 4 pep ipep pep ipep 1pep 1437 1437 1400 1403 1404
95. Any C expression For output parameters it must be an lvalue that is something that is legal to have on the left side of an assignment Pregister_name Name of the register you want to reserve 1 6 PCP Reference Manual Constraint Type Operand Remark character w Word register rO r7 number Type of operand it same as Indicates that number and is associated with number number are the same register Table 1 2 Available input output operand constraints d For more information on __asm see section 2 5 Using Assembly in the C Source in Chapter PCP C Language of the User s Manual a0 With the attribute __at you can place an object at an absolute address int myvar __at 0x100 PCP C Language 1 4 FUNCTION QUALIFIERS inline __noinline With the inline keyword you tell the compiler to inline the function body instead of calling the function Use the __ noinline keyword to tell the compiler not to inline the function body These keywords overrule smart inlining strategy that the compiler uses with compiler option optimize tinline Oi inline int funcl void inline this function __noinline int func2 void do not inline this function d gt For more information see section 2 9 1 Inlining Functions inline in Chapter PCP C Language of the User s Manual __interruptQ With the function qualifier _ interrupt you can declare a function
96. CP Reference Manual 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 Example To check for syntax errors without generating code ccpcp check test c Related information db Compiler option check Check syntax Assembler option check Check syntax Tool Options Control Program 5 137 D define Command line syntax Dmacro_name macro_definition define macro_name macro_definition Description With this option you can define a macro and specify it to the preprocessor If you only specify a macro name no macro definition the macro expands as 1 You can specify as many macros as you like On the command line use the option D multiple times If the command line exceeds the length limit of the operating system you can define the macros in an option file which you then must specify to the control program with the option f file Defining macros with this option instead of in the C source is for example useful to compile or assemble conditional source as shown in the example below The control program passes the option D define to the compiler and the assembler Example Consider the following C program with conditional code to compile a demo program and a real program void main
97. Description With this option you include one extra file at the beginning of the assembly source file before other includes This is the same as specifying INCLUDE file at the beginning of your assembly sources Example aspcp Hmyinc inc testl src aspcp include file myinc inc testl srce The file myinc inc is included at the beginning of test1 src before it is assembled Related information d gt Assembler option I Add directory to include file search path Section 5 6 How the Assembler Searches Include Files in Chapter Using the Assembler of the User s Manual 5 72 PCP Reference Manual 7 I include directory Command line syntax Ipath include directory paih Description With this option you can specify the path where your include files are located A relative path will be relative to the current directory The order in which the assembler searches for include files is 1 The absolute pathname if specified in the INCLUDE directive Or if no path or a relative path is specified the same directory as the source file 2 The path that is specified with this option 3 The path that is specified in the environment variable ASPCPINC 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
98. File Formats 6 9 Overlay Part This part is empty for the PCP 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 memory chip and group and sorted on space address Space Chip Group Section Size MAU Space addr Chip addr The names of the address spaces as defined in the linker script file tc 1s1 The names are constructed of the derivative name followed by a colon the core name another colon and the space name For example spe tc linear The names of the memory chips as defined in the linker script file 1s1 in the memory definitions 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 The name of the section Names within square brackets will be copied during initialization from ROM to the corresponding section name in RAM The size of the section in minimum addressable units The absolute address of the section in the address space The absolute offset of the section from the start of a memory chip Locator Part Symbol translation This part of the map file lists all external symbols per address space name both sorted on symbol name and sorted on address Name
99. I string without with ending NULL BYTE Define a constant byte FLOAT DOUBLE Define a 32 bit 64 bit floating point constant WORD HALF Define a word halfword 3 60 PCP Reference Manual 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 d SIZE Set Symbol Size PCP Assembly Language 3 61 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 A label is not allowed before this directive Example UNDEF LEN Undefines the LEN substitution string 7 that was previously defined with the DEFINE directive Related information Gb DEFINE Define Substitution String 3 62 PCP Reference Manual WARNING Syntax WARNING string exp string
100. IFIER mem_name IDENTIFIER proc_name IDENTIFIER section name DOSTRING Space_name IDENTIFIER stack_name section_name symbol_name DQSTRING 8 8 PCP Reference Manual E 8 3 4 EXPRESSIONS The expressions and operators in this section work the same as in ISO C number OCT_NUM DEC_NUM HEX_NUM expr number symbol_name unary_op expr expr binary_op expr expr expr expr expr function_call unary _op logical NOT bitwise complement negative value binary _op exclusive OR X multiplication division modulus addition subtraction gt gt right shift lt lt left shift equal to l not equal to gt greater than lt less than gt greater than or equal to lt less than or equal to bitwise OR logical AND logical OR amp bitwise AND Linker Script Language 8 9 8 3 5 BUILT IN FUNCTIONS function call absolute expr addressof addr_id exists section_name max expr expr min expr expr sizeof size id addr_id sect section_name group group _name size_id sect section_name group group _name mem mem _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 ass
101. JECT FORMAT The PCP toolchain by default produces objects in the ELF DWARF 2 e1 format The ELF DWARF 2 Object Format for the PCP toolchain follows the convention as described in the PCP Embedded Application Binary Interface 2000 Infineon For a complete description of the ELF and DWARF formats please refer to the Tool Interface Standard TIS 7 4 PCP Reference Manual 7 2 MOTOROLA S RECORD FORMAT With the linker option oftlename SREC option the linker produces output in Motorola S record format with three types of S records SO S2 and S8 With the options ofilename SREC 2 or ofilename SREC 4 option you can force other types of S records They have the following layout SO record S 0 lt length_byte gt lt 2 bytes 0 gt lt comment gt lt checksum_byte gt A linker generated S record file starts with a SO record with the following contents length_byte 0x6 comment Ipcp PCP linker checksum 0xB6 lpcp S00700006C70637049 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 re
102. LER OPTIONS This section lists all assembler options Short and long option names Options have both short and long names Short option names always begin with a single minus character long option names always begin with two minus characters You can abbreviate long option names as long as it forms a unique name You can mix short and long option names on the command line Options can have flags or suboptions To switch a flag on use a lowercase letter or a longflag To switch a flag off use an uppercase letter or a longflag Separate longflags with commas The following two invocations are equivalent aspcp Lmx test src aspcp list format macro macro expansion test src When you do not specify an option a default value may become active Tool Options Assembler 5 55 help Command line syntax help options Description Displays an overview of all command line options When you specify the options argument a list with option descriptions is displayed Example The following invocations all display a list of the available command line options aspcp aspcp help aspcp The following invocation displays extended information about all options aspcp help options Related information ib 5 56 PCP Reference Manual C cpu Command line syntax Ccpu cpu cpu Description With this option you define the target processor for which you create your
103. LOCAL Local symbol declaration 3 42 PCP Reference Manual 7 IF 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 absolute 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 ELIF and ENDIF directives always refer to the nearest previous IF directive A label is not allowed before this directive Example Suppose you have an assemble source file with specific code for a test version for a demo version and for the final version Within the assembly source you define this code conditionally as follows IF TEST 3 code for the test version ELIF DEMO 3 code for the demo version ELSE code for the final version ENDIF PCP Assembly Language 3 43 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 on the command line with the
104. ODUCTION To make full use of the linker you can write a script with information about the architecture of the target processor and locating information The language for the script is called the Linker Script Language LSL This chapter first describes the structure of an LSL file The next section contains a summary of the LSL syntax Finally in the remaining sections the semantics of the Linker Script Language is explained The TASKING linker is a target independent linker locator that can simultaneously link and locate all programs for all cores available on a target board The target board may be of arbitrary complexity A simple target board may contain one standard processor with some external memory that executes one task A complex target board may contain multiple standard processors and DSPs combined with configurable 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 8 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 s
105. Performs a local specific comparison between string s1 and string s2 according to the LC_COLLATE category of the current locale Returns lt 0 if s7 lt s2 0 if s1 s2 or gt Q if s1 gt s2 See section 2 2 11 locale 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 strcol1l Returns the transformed string s7 2 38 PCP Reference Manual 7 Search functions Stdio h Wchar h Description memchr s c n strchr s c strrchr s c strspn s set strcspn s set strpbrk s set strstr s sub strtok s dlm wmemchr s c n weschr s Cc wesrchr s c wesspn s set wescspn s set wespbrk s set wesstr s sub westok s dlm 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 s or the null pointer if not found Returns a pointer to the last occurence of character c in s or the null pointer if not found Searches s for a sequence of characters specified in set Returns the 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 wcesspn but returns a pointer to the first character in s that
106. SWARNING OFF Syntax WARNING OFF WARNING OFF number Description With the WARNING OFF control you can suppresses all warning messages or specific warning messages e By default 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 Example SWARNING OFF all warning messages are suppressed SWARNING OFF 135 suppress warning message 135 Related option d Assembler option w Suppress some or all warnings in section 5 2 Assembler Options of Chapter Tool Options Related information ds RUN TIME ENVIRONMENT all TASKING M daLdVH Run time Environment 4 3 4 1 INTRODUCTION This chapter describes the startup code used by the TASKING PCP C compiler the stack layout and the heap and the floating point arithmetic 4 2 STARTUP CODE d Just as the PCP is part of the TriCore processor a PCP application is part of a TriCore application However the PCP application runs as an interrupt service routine which is activated by the TriCore application The PCP C startup code acts as a wrapper which places the PCP main application into an interrupt service routine on interrupt channel 1 When this interrupt is activated it executes in parallel with the TriCore application and returns the exit code of the PCP main application after finishin
107. _unlink name _write fd buffer cnt Libraries 2 9 2 2 8 INTTYPES H AND STDINT H The header files stdint h and inttypes h provide additional declarations for integer types and have various characteristics The stdint h header file contains basic definitions of integer types of certain sizes and corresponding sets of macros This header file clearly refers to the corresponding sections in the ISO IEC 9899 standard The inttypes h header file incldues stdint h and adds portable formatting and conversion functions Below the conversion functions from inttypes h are listed intmax_t imaxabs intmax_t j imaxdiv_t imaxdiv intmax_t numer intmax_t denom intmax_t strtoimax const char restrict nptr char restrict endptr int base uintmax_t strtoumax const char restrict nptr char restrict endptr int base intmax_t westoimax const wchar_t restrict nptr wchar_t restrict endptr int base uintmax_t westoumax const wchar_t restrict nptr wchar_t restrict endptr int base Returns the absolute value of j Computes numer denom and numer denom The result is stored in the quot and rem components of the imaxdiv_t structure type Convert string to maximum sized integer Compare strtol1 Convert string to maximum sized unsigned integer Compare strtoull Convert wide string to maximum sized integer Compare wcstoll Convert wide string to maximem sized unsigned integer Com
108. a S record output format for loading into a PROM programmer The linker generates a file for each ROM memory defined in the LSL file where sections are located memory memname type rom The name of the file is the name of the memory device that was emitted with extension hex or sre Optionally you can specify a basename which prepends the generated file name Examples To generate Intel Hex output files for each defined memory enter the following on the command line p cmyfile IHEX testl o lpcp chip output myfile IHEX testl o This generates the file myfile_memname hex Related information db Linker option o output file Section 7 2 Motorola S Record Format Section 7 3 Intel Hex Record Format in Chapter Object File Formats 5 92 PCP Reference Manual e Case insensitive 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 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 o file case insensitive Example To link case insensitive lpcp case insensitive test o The linker considers upper and lower case characters as being the
109. acro endm 3 46 macros overview 3 20 message 3 48 name 3 49 org 3 50 overview 3 18 pmacro 5 52 Index sdecl 3 53 sect 3 56 set 3 57 sfract 3 40 size 3 58 space 3 59 storage allocation overview 3 19 symbol definitions overview 3 19 type 3 60 undef 3 61 warning 3 62 weak 3 63 word 3 64 assembler list file 5 76 assembler options 5 55 Ccase sensitive 5 57 check 5 58 cpu 5 56 debug info 5 69 define 5 59 diag 5 61 emit locals 5 64 error file 5 65 error limit 5 66 help 5 55 include directory 5 72 include file 5 71 keep output files 5 75 list file 5 78 list format 5 76 no tasking sfr 5 80 no warnings 5 87 optimize 5 81 option file 5 67 output 5 82 pcplype 5 84 prefix 5 83 preprocess 5 63 preprocessor type 5 79 section info 5 85 symbol scope 5 74 version 5 86 Index Index 5 warnings as errors 5 88 C 5 56 C 5 57 D 5 59 f 5 67 g 5 69 H 5 71 I 5 72 1 5 74 k 5 75 L 5 76 l 5 78 m 5 79 O 5 81 0 5 82 P 5 83 p 5 84 f 5 85 V 5 86 w 5 87 assembly functions abs 3 6 acs 3 7 address calculation overview 3 6 arg 3 7 asn 3 7 aspcp 3 7 assembler mode overview 3 6 at2 3 7 atn 3 8 fract 3 8 3 11 cel 3 8 cnt 3 8 coh 3 8 conversions overview 3 5 cos 3 9 cpu 3 9 cuf 3 9 cvi
110. acros 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 _ cpcp U__TASKING_ test c cpcp undefine _ TASKING test c Related information db Compiler option D Define macro Section 2 7 Predefined Macros in Chapter Using the Compiler of the User s Manual 5 50 PCP Reference Manual u uchar Command line syntax u uchar Description Treat character type variables as unsigned character variables By default char is the same as specifying signed char With u char is the same as unsigned char Example With the following command char is treated as unsigned char cpcp u test c cpcp uchar test c Related information i Tool Options Compiler 5 51 V version Command line syntax V version Description Display version information The compiler ignores all other options or input files Example cpcp v cpcp version The compiler does not compile any files but displays the following version information PCP VX toolset C compiler vxx yrz Build 000 Copyright 2006 year Altium BV Serial 00000000 Related information i 5 52 PCP Reference Manual s w no warnings Command line syntax w 777 no warnings 777 Descrip
111. acters DUPF Duplicate Sequence in Loop MACRO Define Macro PCP Assembly Language 3 31 DUPC ENDM Syntax abel DUPC formal _arg string ENDM Description With the DUPC and ENDM directives Duplicate Sequence with Characters you can repeat a block of source statements for each character within string For each character in the string the formal_arg parameter within the block is replaced with that character If the string is empty then the block is skipped If you specify label it gets the value of the location counter at the start of the DUPC directive processing Example Consider the following source input statements DUPC VALUE 123 BYTE VALUE ENDM This is expanded as follows BYTE 1 BYTE 2 BYTE 3 Related information DUP Duplicate Sequence of Source Lines DUPA Duplicate Sequence with Arguments DUPF Duplicate Sequence in Loop MACRO Define Macro 3 32 PCP Reference Manual 7 DUPF ENDM Syntax label DUPF formal_arg start end increment ENDM Description With the DUPF and ENDM directives Duplicate Sequence in Loop you can repeat a block of source statements end start 1 increment times Start is the starting value for the loop index end represents the final value Increment is the increment for the loop index it defaults to 1 if omitted as does the start value The formal_arg parameter holds the loop index value and may be used within th
112. all as possible x X delete duplicate code Delete duplicate code sections from the output file y Y delete duplicate data Delete duplicate constant data sections from the output file Use the following options for predefined sets of flags O0 optimize 0 No optimization Alias for OCLTXY O1 optimize 1 Normal optimization default Alias for OcLtxy O2 optimize 2 All optimizations Alias for Ocltxy Default O1 Description With this option you can control the level of optimization If you do not use this option OcLtxy O1 is the default Tool Options Linker 5 121 Example The following invocations are equivalent and result all in the default optimizations lpcp test o lpcp O test o lpcp 01 test o lpcp OcLtxy test o lpcp optimize test o lpcp optimize 1 test o lpcp optimize delete unreferenced sections first fit decreasing copytable compression delete duplicate code delete duplicate data test o Related information d Section 6 2 3 Linker Optimizations in Chapter Using the Linker of the User s Manual 5 122 PCP Reference Manual 7 O output Command line syntax olfilename format addr_size space_namel output i enamel format addr_size space_name You can specify the following formats ELF ELF DWARF IEEE IEEE 695 THEX Intel Hex SREC Motorola S records Description By default the linker generates an output file in ELF
113. andard C without language extensions Other languages should only be used with an interface standard Inline assembly is only allowed in dedicated C functions Provision should be made for appropriate run time checking Only use characters and escape sequences defined by ISO C Character values shall be restricted to a subset of ISO 106460 1 Trigraphs shall not be used Multibyte characters and wide string literals shall not be used Comments shall not be nested 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 Identifiers shall not rely on significance of more than 31 characters The same identifier shall not be used in multiple name spaces 13 14 15 16 17 18 19 20 21 22 23 24 25 26 21 28 29 30 31 A R A R R A R R R A A R R R A A R R R PCP Reference Manual Specific length typedefs should be used instead of the basic types Use unsigned char or signed char instead of plain char Floating point implementations should comply with a standard The bit representation of floating point
114. ap map description For a description of the keywords see section 8 5 2 Defining Internal Buses Linker Script Language 8 37 You can connect off chip memory to any derivative you need to map the off chip memory to a bus and map that bus on the internal bus of the derivative you want to connect it to 8 38 PCP Reference Manual 7 8 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 page _size select ref _ tree heap size stack size reserved size attributes rwx fill alloc_allowed absolute copytable section size blocksize attributes rwx fill overflow if else Linker Script Language 8 39 8 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 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 pro
115. application It meets the debugging requirements in most cases without resulting in over sized assembler object files Full 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 Tool Options Compiler 5 23 Example To add default symbolic debug information to the output file enter cpcp g test c cpcp debug test c Related information i 5 24 PCP Reference Manual H include file Command line syntax Hile include file ie Description With this option you include one extra file at the beginning of each C source file before other includes This is the same as specifying include file at the beginning of each of your C sources Example cpcp Hstdio h testl c test2 c cpcp include file stdio h testl c test2 c The file stdio h is included at the beginning of both test1 c and test2 c Related information d Compiler option I 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 5 25 I include directory Command line syntax Ipath include directory paih Description With this option you can speci
116. application Make sure you choose a target processor with pcp The assembler automatically includes the register file regcpu def unless you specify assembler option no tasking sfr Example To define this on the command line aspcp Ctcl1920b test src aspcp cpu tc1920b test src The assembler assembles test sre for the TC11IB processor and includes the register file reg1920b def To avoid conflicts make sure you specify the same target processor as you did for the compiler Related information d Assembler option no tasking sfr Do not include def file Compiler option C Use SFR definitions for CPU Control program option C Use SFR definitions for CPU Section 5 4 Calling the Assembler in Chapter Using the Assembler of the User s Manual Tool Options Assembler 5 57 C case insensitive 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 in labels and user defined symbols as different characters Note that instruction mnemonics register names directives and controls are always treated case insensitive 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 To assemble case insensi
117. aration Unions shall not be used to access the sub parts of larger types A violation is reported for a union containing a struct member Bit fields shall have type unsigned int or signed int Bit fields of type signed int shall be at least 2 bits long All struct union members shall be named Reserved and standard library names shall not be redefined Standard library function names shall not be reused Production libraries shall comply with the MISRA C restrictions The validity of library function parameters shall be checked Dynamic heap memory allocation shall not be used The error indicator errno shall not be used The macro offsetof shall not be used lt locale h gt and the setlocale function shall not be used The setjmp and longjmp functions shall not be used The signal handling facilities of lt signal h gt shall not be used The lt stdio h gt library shall not be used in production code The functions atof atoi atol shall not be used The functions abort exit getenv system shall not be used The time handling functions of library lt time h gt shall not be used 9 10 PCP Reference Manual 7 9 2 MISRA C 2004 This section lists all supported and unsupported MISRA C 2004 rules d See also section 4 7 C Code Checking MISRA C in Chapter Using the Compiler of the User s Manual LAN A number of MISRA C rules leave room for interpretation Other rules can only be
118. are instructions an emulating library is always needed for double precision calculation Compliance with IEEE 754 Trapping emulation library The following implementation issues for the trapping floating point library are important subnormals are not supported This is conform the PCP hardware design when converting floats to integers the value is truncated This complies with ANSI C 89 and ISO C 99 but does not comply with IEEE 754 since the current rounding mode is round to nearest even when a converted float overflows the target integer type a predictable value is assigned to the target integer Compliance with IEEE 754 Non trapping emulation library The following implementation issues for the non trapping floating point library are important when calculating with floats rounding is done to the nearest integer rounding towards infinity when equally near there is no distinction between 0 and 0 when an operand of a calculation is a NaN Inf or subnormal the result is undefined when the result of a calculation would be a subnormal the result is 0 whenever a NaN or Inf would be the result of a calculation the result is undefined when converting single precision floats to integers rounding is done to the nearest integer rounding towards infinity when equally near when converting double precision floats to integers the value is truncated This is similar to the trapping emulation library when a
119. argument specifies a range of data lines of the source bus By default all data lines are mapped e The dest_dbits argument specifies a range of data lines of the destination bus By default all data lines from the source bus are mapped on the data lines of the destination bus starting with line 0 From space to space If you map an address space to another address space nesting you can do this by mapping the subspace to the containing larger space In this example a small space of 64k is mapped on a large space of 16M space small id 2 mau 4 map src_offset 0 dest_offset 0 dest space large size 64k Linker Script Language 8 29 From space to bus All spaces that are not mapped to another space must map to a bus in the architecture space large id 1 mau 4 map src_offset 0 dest_offset 0 dest bus bus_ name size 16M 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 sre_dbits and dest_dbits specify which source data lines are mapped on which destination data lines architecture mycore i bus i_bus mau 4 space i_space map dest bus i_bus size 256 bus e_bus mau 16 width 16 map dest bus mycore i_bus src_dbits 0 7 dest_dbits
120. ast one section_selection must be defined section_selections section_selection lt section _selection gt 9 8 18 7 PCP Reference Manual section_selection attributes lt lt gt attribute gt gt e attribute means select all sections that have this attribute e attribute means select all sections that do not have this attribute special _section_statement heap stack name lt size_spec gt 9 1 stack stack name lt size_spec gt 1 copytable reserved section name lt reserved_specs gt 9 1 e Special sections cannot be selected in load time groups size_spec size expr reserved_specs reserved_spec lt reserved _spec gt reserved_spec attributes fill_spec s expr ioe allowed absolute e Ifa reserved section has attributes r rw x rx or rwx and no fill pattern is defined the section is filled with zeros If no attributes are set the section is created as a scratch section attributes ws no image fill_spec fill fill_values fill_values expr expr lt expr gt gt 9 aggregate_section_statement lt section_statement gt gt 0 group_descr if_statement section_creation_statement group_descr group lt group name gt 9 1 lt group_specs gt 1 section_statement e No two groups for an address space can have the same group name group_specs group _ spec lt group spec gt gt 0 Linker S
121. ated option d Assembler option L List file formatting options in section 5 2 Assembler Options of Chapter Tool Options PCP Assembly Language Related information Gs Assembler control LIST ON OFF Assembly list file ON OFF Assembler function LST in section 3 2 Built in Asembly Functions 3 73 3 74 PCP Reference Manual SOBJECT Syntax OBJECT file OBJECT OFF Description With the SOBJECT control you can specify an alternative name for the generated object file With the OBJECT OFF control the assembler does not generate an object file at all Example Begin of source object xl o generate object file xl o Related option d gt Assembler option o Define output filename in section 5 2 Assembler Options of Chapter Tool Options Related information d PCP Assembly Language 3 75 PAGE Syntax PAGE width length blanktop blankbim blankleft Description If you generate a list file with the assembler option 1 you can use the PAGE control 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 As a special case a page length of 0 zero turns off all headers titles subtitles and page breaks blanktop Number of blank lines at the top of the page Default 0 Specify a value so that blankiop blankbim lt length 10 blankbim Number of blank lines at the bo
122. atenate to double word LUN expr Convert long fractional to floating point RVB expr1 expr2 Reverse order of bits in field UNF expr Convert fractional to floating point Overview of string functions POS str1 str2 start SCP sir1 str2 SUB string expr expr Function Description CAT sir1 str2 Concatenate strings LEN string Length of string Position of substring in string Returns 1 if two strings are equal Returns a substring Overview of macro functions Function Description ARG symbol expr Test if macro argument is present CNT Return number of macro arguments MAC symbol Test if macro is defined MXP Test if macro expansion is active 3 5 3 6 E PCP Reference Manual Overview of address calculation functions INIT_R7 start dptr flags LO expr LSB expr MSB expr Function Description DPTR expr PCP only returns bits 6 13 of the pcpdata address HI expr Returns upper 16 bits of expression value PCP only returns the 32 bit value to initialize R7 Returns lower 16 bits of expression value Get least significant byte of a word Get most significant byte of a word Overview of assembler mode functions Function Description ASPCP Returns the name of the PCP assembler executable CPU siring Test if CPU type is selected DEF symbol symbol Returns 1 if symbol has been defined EXP expr
123. ation To write an explanation of all errors and warnings in HTML format to file ccerrors html enter ccpcp diag html all gt ccerrors html Related information i Tool Options Control Program 5 141 E preprocess Command line syntax E lags preprocess ags You can set the following flags 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 With Ec you tell the preprocessor to keep the comments from the C source file in the preprocessed output With Ep you tell the preprocessor to strip the line source position information lines starting with line 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 ccpcp EcP test c o test pre ccpcp preprocess comments noline test c output test pre The compiler preprocesses the file test c and sends the output to the file test pre Comments are included but the line source position information is not stripped from the output file Related information d 5 142 PCP Reference Manual error file Command line syntax error file Description With this option the control
124. ax error file i e 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 cpcp error file errors err test c Related information db Compiler option warnings as errors Treat warnings as errors 5 20 7 PCP Reference Manual f option file Command line syntax f file option file ile Description Instead of typing all options on the command line you can create an option file which contains all options and files you want to specify With this option you specify the option file to the compiler 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 Multiple command line arguments on one line in the option file are allowed To include whitespace in an argument surround the argument with single or double quotes If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded When a text line reaches its length limit use a
125. belonging to the target you select on the Processor definition page of the Processor options compiler option C With this option the compiler does not include the register file regcpu sfr as based on the selected target processor Use this option if you want to use your own set of SFR files Example cpcp Ctcl1920b no tasking sfr test c The register file regtc1920b sfr is not included Related information d Compiler option C Use SFR definitions for CPU 5 38 PCP Reference Manual novector Command line syntax novector Description With this option you tell the compiler not to generate code for channel vectors and channel context Example cpcp novector test c No code for channel vectors and channel context is generated Related information i Tool Options Compiler 5 39 O optimize Command line syntax Offlags optimize lags You can set the following flags a A b B c C e E f F 2 G h H i I 1 L 0 O p P r R s S y Y coalesce ipro cse expression flow glo partition inline loop forward propagate compact subscript peephole Coalescer remove unnecessary moves Interprocedural register optimizations Common subexpression elimination Expression simplification Control flow optimization and code reordering Generic assembly optimizations Automatic memory partition Function inlin
126. bly as shown in the example below This option has the same effect as defining symbols via the 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 C program with conditional code to compile a demo program and a real program IF DEMO 1 ahaa instructions for demo application ELSE seis instructions for the real application ENDIF You can now use a macro definition to set the DEMO flag aspcp DDEMO test src aspcp DDEMO 1 test src aspcp define DEMO test srce aspcp define DEMO 1 test srce Note that all four invocations have the same effect 5 60 PCP Reference Manual 7 Related information db Assembler option f Specify an option file Section 3 10 5 Conditional Assembly in Chapter PCP Assembly Language of the User s Manual Tool Options Assembler 5 61 diag Command line syntax diag format all_ number number Optionally you can use one of the following display formats format text The default is plain text html Display explanation in HTML format rtf Display explanation in RTF format 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 To create a file with the descriptions you must redirect the output W
127. c c stream fwscanf stream format Reads one character from stream Returns the read character or EOF WEOF on error FSS implementation Same as fgetc fgetwe except that is implemented as a macro FSS implementation NOTE Currently defined 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 Reads at most the next n 1 characters from the stream into array s until a newline is found 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 2 28 Stdio h Wchar h PCP Reference Manual Description 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 wscanf format swscanf s format vfwscanf stream format arg vwscanf format arg vswscanf s format arg fpu
128. cessor is defined and or only one core is present in the processor A reference to a space in the only core of the only processor in the system would look like my_space A reference to a space of the only core on a specific processor in the system could be my_chip my_space The next example shows a section definition for sections in the my_space address space of the processor called my_chip section layout my _chip my_ space locate direction section statements With the optional keyword direction you specify whether the linker starts locating sections from low_to_high default or from high_to_low In the second case the linker starts locating sections at the highest addresses in the address space but preserves the order of sections when necessary one processor and core in this example section layout my_space direction high_to_low section statements LN If you do not explicitly tell the linker how to locate a section the linker decides on the basis of the section attributes in the object file and the information in the architecture definition and memory parts where to locate the section 8 40 PCP Reference Manual 7 8 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 grou
129. checked in a limited way In such cases the implementation decisions and possible restrictions for these rules are listed x means that the rule is not supported by the TASKING C compiler R is a required rule A is an advisory rule Environment 1 1 R All code shall conform to ISO 9899 1990 Programming languages C amended and corrected by ISO IEC 9899 COR1 1995 ISO IEC 9899 AMD1 1995 and ISO IEC 9899 COR2 1996 1 2 R No reliance shall be placed on undefined or unspecified behavior x 13 R Multiple compilers and or languages shall only be used if there is a common defined interface standard for object code to which the languages compilers assemblers conform x 1 4 R The compiler linker shall be checked to ensure that 31 character significance and case sensitivity are supported for external identifiers x 15 A Floating point implementations should comply with a defined floating point standard Language extensions 2 1 R Assembly language shall be encapsulated and isolated 2 2 R Source code shall only use style comments MISRA C Rules 2 3 2 4 A R The character sequence shall not be used within a comment Sections of code should not be commented out In general it is not possible to decide whether a piece of comment is C code that is commented out or just some pseudo code Instead the following heuristics are used to detect possible C code inside a comment
130. cript Language group_spec group_alignment attributes group_load_address fill lt fill values gt 1 group_page group_run_address group_type allow_cross_references e The allow cross references property is only allowed for overlay groups e Sub groups inherit all properties from a parent group group_alignment attributes attribute group_load_address group page group_run_address group_type ON rxKX EK align expr attributes lt attribute gt 1 readable sections writable sections executable code sections initialized sections scratch sections blanked cleared sections load_addr lt load_or_run_addr gt 1 page lt expr gt 0 1 page_size expr lt range lt range gt 9 gt 0 1 run_addr lt load or _run_addr gt 1 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 load_or_run_addr addr_absolute addr_range lt addr_range gt 8 20 PCP Reference Manual 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 addr_range or page restrictio
131. cter pointed to by s At most n characters will be examined See also mbrlen in section 2 2 24 wchar h Converts the multi byte character ins toa wide character code and stores it in pwc At most n characters will be examined Converts the wide character wc into a multi byte representation and stores it in the string pointed to by s At most MB_CUR_MAX characters are stored Converts a sequence of multi byte characters in the string pointed to by s into a sequence of wide characters and stores at most n wide characters into the array pointed to by pwcs See also mbsrtowes in section 2 2 24 wchar h Converts a sequence of wide characters in the array pointed to by pwes 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 24 wchar h 2 2 21 STRING H AND WCHAR H This header file provides numerous functions for manipulating strings By convention strings in C are arrays of characters with a terminating null character Most functions therefore take arguments of type char However many functions have also parallel wide character functions which take arguments of type wchar_t These functions are declared in wchar h 2 36 7 Copying and concatenation functions PCP Reference Manual Sidio h Wcehar h Description memcpy sl wmemcpy sl Copies n characters from s2 n s2 n s2 into s1 and returns memmove sl s2 n strcpy
132. ctime 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 Libraries 2 41 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 fp into s according to the specified format fmt No more than smax characters are placed into s The formatting of strftime is locale specific using the LC_TIME category see section 2 2 11 locale hb You can use the next conversion specifiers a abbreviated weekday name A full weekday name b abbreviated month name B full month name c local date and time representation d day of the month 01 31 H hour 24 hour clock 00 23 I hour 12 hour clock 01 12 j day of the year 001 366 m month 01 12 M minute 00 59 p local equivalent of AM or PM S second 00 59 U week number of the year Sunday as first day of the week 00 53 w weekday 0 6 Sunday is 0 W week number of the year Monday as first day of the week 00 53 x local date representation X local time representation y year without century 00 99 Y year with century Z time zone name if any
133. ctory Section 4 5 How the Compiler Searches Include Files in Chapter Using the Compiler of the User s Manual Section 1 3 1 Configuring the Command Line Environment in Chapter Software Installation of the User s Manual Tool Options Compiler 5 27 inline Command line syntax inline Description With this option you instruct the compiler to inline all functions without the function qualifier noinline regardless whether they have the keyword inline or not This option has the same effect as a pragma inline at the beginning of the source file LN This option can be useful to increase the possibilities for code compaction option Or Example To inline all functions cpcp inline test c Related information d gt Compiler option Or Optimization code compaction 5 28 PCP Reference Manual inline max incr inline max size Command line syntax inline max incr percentage inline max size threshold Default inline max incr 25 inline max size 10 Description B 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 O0 i Regardless of the optimization process the compiler always inlines all functions that have the function qualifier inline With the option inline max size you can specify the maximum size of functions that the compiler inlines
134. d line Example ccpcp static modulel c module2 c module3 c Related information i Tool Options Control Program 5 163 t keep temporary files Command line syntax t keep temporary files Description By default the control program removes intermediate files like the sre file result of the compiler phase and the e1n file result of the linking phase With this option you tell the control program to keep temporary files it generates during the creation of the absolute object file Example To keep all temporary files ccpcp t test c ccpcp keep temporary files test c The control program keeps all intermediate files it generates while creating the absolute object file test elf Related information J 5 164 PCP Reference Manual 7 U undefine Command line syntax Umacro_name undefine macro_name Description With this option you can undefine an earlier defined macro as with undef This option is for example useful to undefine predefined macros However the following predefined ISO C standard macros cannot be undefined _FIE__ current source filename _ LINE__ current source line number int type _ TIME hh mm ss _ DATE mmm dd yyyy __STDC__ level of ANSI standard The control program passes the option U undefine to the compiler Example To undefine the predefined macro _ TASKING_ ccpcp U_ TASKING test c ccpcp undefine _ TASKING test c Related in
135. d to stdout normally your screen and in the format you specify 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 any files Example To display an explanation of message number 106 enter lpcp 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 disabled The lt message gt indicates the symbol that is unresolved To write an explanation of all errors and warnings in HTML format to file lerrors html enter lpcp diag html all gt lerrors html 5 96 PCP Reference Manual 7 Related information db Section 6 10 Linker Error Messages in Chapter Using the Linker of the User s Manual Tool Options Linker 5 97 e extern 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
136. dex Index 13 section 8 49 section_layout 8 39 select 8 40 size 8 28 8 32 8 36 8 47 8 49 space 8 24 8 27 speed 8 32 8 36 src_dbits 8 28 src_offset 8 28 stack 8 25 8 46 start_address 8 26 symbol 8 27 type 8 32 8 36 width 8 24 LSL syntax 8 6 Ist 3 13 lun 3 13 mac 3 13 macro 3 46 define 5 137 definition 3 46 undefine 3 52 5 164 macro nomacro 1 11 macros 1 14 make utility 5 171 macros predefined _ DATE _ 5 49 _FIE_ 5 49 __LINE_ 5 49 _ STDC _ 5 49 __TIME_ 5 49 make utility options 5 173 a 5 174 D 5 175 d 5 176 DD 5 175 dd 5 176 e 5 177 err 5 178 f 5 179 G 5 180 4 5 181 K 5 182 k 5 183 m 5 184 5 190 n 5 186 p 5 187 q 5 188 r 5 189 s 5 191 t 5 192 time 5 193 V 5 194 W 5 195 w 5 196 defining a macro 5 171 malloc 2 33 map file control program option 5 158 format 5 113 linker 5 112 mappings 8 27 max 3 13 maxcalldepth 1 11 MB_CUR_ MAX 2 32 2 43 MB LEN MAX 2 43 mblen 2 35 mbrlen 2 44 mbrtowc 2 43 mbsinit 2 43 mbsrtowcs 2 43 mbstate_t 2 43 mbstowcs 2 35 mbtowc 2 35 memchr 2 38 mememp 2 37 memcpy 2 36 memmove 2 36 memory definition 8 5 memset 2 39 Index 14 7 message 1 11 3 48 min 3 13 MISRA C 5 31 5 32 supported rules 1998 9 3 supported rules 2004 9 10 version 5 33 mktime 2 40 modf functions 2 14 msb 3 14 mxp 3 14 name 3 49
137. directive uses the following arguments type A section type code code section data data section debug debug section attribute An optional section attribute Code attibutes init section is copied from ROM to RAM at startup noread section can be executed from but not read cluster group Cluster code sections with companion debug sections Used by the linker during removal of unreferenced sections The name must be unique for this module not for the application protect Tells the linker to exclude a section from unreferenced section removal and duplicate section removal For each grou 3 54 PCP Reference Manual 7 Data attibutes noclear section is not cleared during startup max data overlay with other parts with the same name is implicit a type of noclear rom data section remains in ROM group group Used to group sections for example for placing in the same page cluster name Cluster data sections with companion debug sections Used by the linker during removal of unreferenced sections The name must be unique for this module not for the application protect Tells the linker to exclude a section from unreferenced section removal and duplicate section removal overlay name The linker can overlay sections that have the same pool name Debug attributes cluster name Cluster code sections with companion debug sections Used by the linker during removal of unreferenced sections Th
138. dth map space id mau align page _size page direction low_to_high high_to_low stack min_size grows low_to_high high_to_low align fixed heap min_size grows low_to_high high_to_low align fixed copytable align copy_unit dest page start_address run_addr symbol map map dest bus space dest_dbits dest_offset size src_dbits src_offset Linker Script Language 8 23 8 5 1 DEFINING AN ARCHITECTURE With the keyword architecture you define an architecture and assign a unique name to it The name is used to refer to it at other places in the LSL file architecture name definitions If you are defining multiple core architectures that show great resemblance you can define the common features in a parent core architecture and extend this with a child core architecture that contains specific features The child inherits all features of the parent With the keyword extends you create a child core architecture architecture name_child_arch extends name_parent_arch definitions A core architecture can have any number of parameters These are identifiers which get values assigned on instantiation or extension of the architecture You can use them in any expression within the core architecture Parameters can have default values which are used when the core architecture is instantiated with less arguments than there are parameters defined for it When you extend a core architecture you can pass arguments to
139. e gt endianness_type big little 8 3 9 DERIVATIVE DEFINITION derivative_definition derivative derivative _name lt parameter list gt 0 1 lt extends derivative_name lt argument list gt 0 1 gt 0 1 lt derivative_spec gt 9 e A derivative definition defines a derivative with the given derivative_name as a unique name derivative_spec core def bus_def mem_def section_definition no processor name core_def core core_name lt core_descr gt 7 8 16 PCP Reference Manual A core_def defines a core with the given core_name as a unique name At least one core_def must be present in a derivative definition core_descr architecture arch_name lt argument_list gt l1 endianness endianness_type lt endianness_type gt An arch_name refers to a defined core architecture Exactly one architecture statement must be present in a core def 8 3 10 PROCESSOR DEFINITION AND BOARD SPECIFICATION board_spec proc _def bus def mem_def proc_def processor proc_name proc_descr 8 3 11 proc_descr derivative derivative_name lt argument_list gt l1 A proc_def defines a processor with the proc_name as a unique name If you do not explicitly define a processor for a derivative in an LSL file the linker defines a processor with the same name as that derivative A derivative_name refers to a defined derivative
140. e with content indcated through tagp Not implemented nextafter nextafterf nextafter Returns the next representable nextafterl value in the specified format after x in the direction of y Returns y is x y Not implemented nexttoward nexttowardf nexttoward Same as nextafter except nexttowardl that the second argument in all three variants is of type long double Returns y if x y Not implemented 2 16 7 Positive difference maximum minimum PCP Reference Manual Math h Tgmath h Description fdim fdimf fdiml fdim Returns the positive difference between x y Not implemented fmax fmaxf fmaxl fmax Returns the maximum value of their arguments Not implemented fmin fminf fminl fmin Returns the minimum value of Error and gamma Not implemented their arguments Not implemented Math h Tgmath h Description erf erff erfl erf Computes the error function of x Not implemented erfc erfcf erfcl erc Computes the complementary error function of x Not implemented lgamma lgammaf lgammal lgamma Computes the loge I x Not implemented tgamma tgammaf tgammal tgamma Computes T x Not implemented Libraries Comparison macros 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 ex
141. e an alias of a symbol The C compiler generates this directive when you use the pragma alias Example _malloc ALIAS hmalloc Related information d PCP Assembly Language 3 23 ALIGN Syntax ALIGN expression Description b With the ALIGN directive you instruct the assembler to align the location counter By default the assembler aligns on one byte When the assembler encounters the ALIGN directive it advances the location counter 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 for code sections or with zeros for data sections 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 The assembler aligns sections automatically to the largest alignment value occurring in that secton A label is not allowed before this directive Example ALIGN 16 add r5 r1 cc_uc the assembler aligns this instruction at 16 bytes and fills the gap with NOP instructions se se Ne ALIGN 12 add r5 r1 cc_uc WRONG not a power of two the assembler aligns this instruction
142. e body of instructions If you specify label it gets the value of the location counter at the start of the DUPF directive processing Example Consider the following source input statements DUPF NUM 0 7 BYTE NUM ENDM This is expanded as follows BYTE BYTE BYTE BYTE BYTE BYTE BYTE BYTE yAn BWNE CO PCP Assembly Language Related information DUP Duplicate Sequence of Source Lines DUPA Duplicate Sequence with Arguments DUPC Duplicate Sequence with Characters MACRO Define Macro 3 33 3 34 PCP Reference Manual END Syntax END expression Description With the optional END directive you tell the assembler that the logical end of the source program is reached If the assembler finds assembly source lines beyond the END directive it ignores those lines and issues a warning The expression is only permitted here for compatibility reasons It is ignored during assembly You cannot use the END directive in a macro expansion A label is not allowed before this directive Example END End of source program Related information i PCP Assembly Language 3 35 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 The expression can be relocatable or absolute and forward references are allowed Example To assign
143. e ifi chdir 2 42 s option file 5 20 output 5 42 preprocess 5 17 rename sections 5 43 check source code 5 10 5 58 5 136 clear noclear 1 10 clearerr 2 31 lok signed bitfields 5 46 lock ta source 5 45 CLOCKS PER SEC 2 40 ae 242 static 5 47 a 8 stdout 5 34 ae 3 P tradeoff 5 48 SO uchar 5 50 command file 5 20 5 67 5 100 5 144 5 184 5 200 comment a a warnings as errors 5 53 comments 8 7 A 5 5 compact max size 5 11 C 5 8 compactmaxmatch 1 10 undefine 5 49 version 5 51 Index Index 7 c 5 9 library directory 5 152 D 5 13 list files 5 155 E 5 17 Isl file 5 139 f 5 20 no default libraries 5 157 g 5 22 no double 5 145 H 5 24 no map file 5 158 I 5 25 no tasking sfr 5 159 k 5 30 no warnings 5 168 n 5 34 option file 5 144 optimize 5 39 output 5 160 O 5 39 pass 5 167 0 5 42 pass assembler 5 167 R 5 43 pass c 5 167 S 5 45 pass linker 5 167 t 5 48 preprocess 5 141 U 5 49 space 5 161 u 5 50 static 5 162 V 5 51 undefine 5 104 W 5 52 verbose 5 166 conditional make rules 5 171 version 5 165 control program options warnings as errors 5 169 f edad C 5 153 address size 5 132 cl 5 135 case sensitive 5 134 co 5 155 check 5 136 cs 5 155 cpu 5 133 D 5 137 create 5 135 E 5 141 d 5 139 F 5 143 debug info 5
144. e name must be unique for this module not for the application Sections with attribute noclear are not zeroed at startup This is a default attribute for data sections You can only use this attribute with a data type section This attribute is only useful with BSS sections which are cleared at startup by default The attribute init defines that the code section contains initialization data which is copied from ROM to RAM at program startup Sections with the attribute rom contain data to be placed in ROM This ROM area is not executable When data sections with the same name occur in different object modules with the attribute max the linker generates a section with a size that is the largest of the sizes in the individual object modules The attribute max only applies to data sections PCP Assembly Language 3 55 The name of a section can have a special meaning for locating sections The name of code sections should always start with pcptext the name of data sections should always start with pcpdata Note that the compiler uses the following name convention prefix module name function or object name Examples sdecl pcptext code code sect pceptext code sdecl pcpdata data data sect pcpdata data SECT Activate a declared section ORG Initialize a nameless section ese eo declare code section activate section declare data section activate section 3 56 PCP Refe
145. e size The allocated space is not initialized Returns a pointer to the allocated space calloc nobj size Allocates space for n objects with size size The allocated space is initialized with zeros Returns a pointer to the allocated space free ptr Deallocates the memory space pointed to by pir which should be a pointer earlier returned by the malloc or calloc function realloc ptr size 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 2 34 7 PCP Reference Manual Environment communication abort atexit func exit status _Exit status getenv s system s Searching and sorting bsearch key base n size cmp qsort base n size cmp Causes abnormal program termination If the signal SIGABRTis caught the signal handler may take over control See section 2 2 14 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 not registered 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 funct
146. eded 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 2 24 PCP Reference Manual specifies an alternate output form For o the first digit will be zero For x or X 0x and 0X will be prefixed to the number For e E f g G the output always contains a decimal point trailing zeros are not removed A number specifying a minimum field width The converted argument is printed in a field with at least the length specified here If the converted argument has fewer characters than specified it will be padded at the left side or at the right when the flag was specified with spaces Padding to numeric fields will be done with zeros when the flag 0 is also specified only when padding left Instead of a numeric 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
147. ee also the assembler option C Select CPU Example IF CPU pcp PCP specific part CVF expression Converts the result of expression to a floating point value Example FLOAT SET CVF 5 FLOAT 5 0 CVI expression Converts the result of expression to an integer value This function should be used with caution since the conversions can be inexact e g floating point values are truncated Example INT SET CVI 1 05 INT 1 DEF symbol symbol Returns an integer 1 if symbol has been defined 0 otherwise symbol can be any symbol or label not associated with a MACRO or SDECL directive 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 or label Example IF DEF ANGLE is symbol ANGLE defined IF DEF ANGLE does label ANGLE exist 3 10 7 PCP Reference Manual DPTR expression Returns bits 6 13 of the pcpdata address provided This is equivalent to expression gt gt 6 amp Oxff lt lt 8 Example ldl il r7 DPTR pcp data_a0 EXP expression Returns 0 if the evaluation of expression would normally result in an error Returns 1 if the expression can be evaluated correctly With the EXP function you prevent the assembler of generating an error if expression contains an error No test is made by the assembler for warnings The expression may be relative or absolute Example IF EXP 3 0
148. egral type Conversions shall not be performed between a pointer to object and any type other than an integral type another pointer to object type or a pointer to void A cast should not be performed between a pointer type and an integral type MISRA C Rules 11 4 11 5 A R Expressions 12 1 12 2 12 3 12 4 12 5 12 6 12 9 12 10 12 11 A R R R R A R R R R A A cast should not be performed between a pointer to object type and a different pointer to object type A cast shall not be performed that removes any const or volatile qualification from the type addressed by a pointer Limited dependence should be placed on C s operator precedence rules in expressions The value of an expression shall be the same under any order of evaluation that the standard permits This rule is checked using worst case assumptions This means that a violation will be reported when a possible alias may cause the result of an expression to be evaluation order dependent The sizeof operator shall not be used on expressions that contain side effects The right hand operand of a logical amp amp or operator shall not contain side effects The operands of a logical amp amp or shall be primary expressions The operands of logical operators amp amp and should be effectively Boolean Expressions that are effectively Boolean should not be
149. el Causes local labels in its term to be evaluated override at normal scope rather than at macro scope Example The macro definition CONSTD MACRO reg value ldl iu reg hi value ldl il reg lo value ENDM header body terminator The macro call SDECL pcptext code SECT pcptext CONSTD 1r5 0x12345678 END The macro expands as follows ldl iu ldl il r5 hi 0x12345678 r5 lo 0x12345678 Related information DUP Duplicate Sequence of Source Lines DUPA Duplicate Sequence with Arguments DUPC Duplicate Sequence with Characters DUPF Duplicate Sequence in Loop Section 3 10 Macro Operations in Chapter Assembly Language of the User s Manual 3 47 3 48 PCP Reference Manual MESSAGE Syntax MESSAGE string exp tstring exp Description With the MESSAGE directive Programmer Generated Message you tell the assembler to output an information message durring assembly The error and warning counts will not be affected The MESSAGE directive is for example useful in combination with conditional assembly for informational purposes The assembly proceeds normally after the message has been printed Optionally you can specify an arbitrary number of strings and expressions in any order but separated by commas to describe the nature of the message If you use expressions the assembler outputs the result The assembler outputs a space between each argume
150. elated information ds 5 180 PCP Reference Manual e G Command line syntax G path Description Normally you must call the make utility mkpcp 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 currdir myfiles When your current directory is currdir you can call the make utility as follows mkpcp G myfiles Related information d Tool Options Make Utility 5 181 Command line syntax 1 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 mkpcp i The make utility exits without an error code even when an error occurs Related information f 5 182 PCP Reference Manual 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 variable is not specified Examp
151. entifier A typedef name shall be a unique identifier A tag name shall be a unique identifier No object or function identifier with static storage duration should be reused No identifier in one name space should have the same spelling as an identifier in another name space with the exception of structure and union member names No identifier name should be reused The plain char type shall be used only for storage and use of character values signed and unsigned char type shall be used only for the storage and use of numeric values typedefs that indicate size and signedness should be used in place of the basic types Bit fields shall only be defined to be of type unsigned int or signed int Bit fields of type signed int shall be at least 2 bits long Octal constants other than zero and octal escape sequences shall not be used Declarations and definitions 81 8 2 R Functions shall have prototype declarations and the prototype shall be visible at both the function definition and call Whenever an object or function is declared or defined its type shall be explicitly stated MISRA C Rules 8 3 8 4 8 5 8 6 8 7 X 8 8 x 8 9 x 8 10 8 12 Initialization 9 1 9 2 9 3 R R R R R R R R R R R R R For each function parameter the type given in the declaration and definition shall be identical and the return types s
152. er If you do not specify this option the linker uses a default script file You can specify the existing file target 1s1 or the name of a manually created 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 The 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 in the system e the section layout definition describes how to locate sections in memory Example To read linker script file information from file tclv1_3 1s1 lpcp dtclvl1l_3 1sl test o lpcp lsl file tclvl1_3 1sl test o Related information db Linker option Isl check Check LSL file s and exit Section 6 7 Controlling the Linker with a Script in Chapter Linker of the User s Manual Tool Options Linker 5 95 diag Command line syntax diag format all_ number number Optionally you can use one of the following display formats format text The default is plain text html Display explanation in HTML format rtf Display explanation in RTF format Description With this option you can ask for an extended description of error messages in the format you choose The output is directe
153. er no entries to copy data sections from ROM to RAM are placed in the copy table The data sections are initialized when the application is downloaded The data sections are not re initialized when the application is restarted Example lpcp N test o lpcp no rom copy test o The linker does not generate ROM copies for data sections Related information i 5 118 PCP Reference Manual 7 ho rescan 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 on 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 only once When the linker has not resolved all symbols after the first scan it reports
154. er but ignores C style comments Related information d Compiler option c ISO C standard Tool Options Compiler 5 7 align stack Command line syntax align stack value Default align stack 64 Description Align static stack sections with a size smaller than or equal to value so that these sections are not located over a page boundary This optimization saves code becuase the DPTR does not have to be reload when it already contains the right page number The disadvantage is that data space is spilled for the alignment The alignment must be a power of two in the range 1 64 1 equals to no alignment optimizations The default value 64 turns on alignment optimization for all static sections Example To specify another alignment value cpcp align stack 32 test c cpcp align stack 20 test c not allowed value is not a power of 2 Related information 5 8 PCP Reference Manual C cpu Command line syntax Ccpu cpu cpu Description With this option you define the target processor for which you create your application Make sure you choose a target processor with pcp The compiler always includes the register file regcpu sfr Example To compile the file test c for the TC1920B processor a processor with pcp and use the SFR file regtc1920b sfr cpcp Ctc1920b test c cpcp cpu tc1920b test c To avoid conflicts make sure you specify the same target processor to the assembler
155. eral 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 Linker Script Language e The page_size field sets the page alignment and page size in MAUs for the address space It must be a power of 2 The default value is 1 If one or more page ranges are supplied the supplied value only sets the page alignment The ranges specify the available space in each page as offsets to the page start which is aligned at the page alignment See also the page keyword in subsection Locating a group in section 8 8 2 Creating and Locating Groups of Sections e With the optional direction field you can specify how all sections in this space should be located This can be either from low_to_high addresses this is the default or from high_to_low addresses e The map keyword specifies how this address
156. ers not modified A function should have a single point of exit Every exit point shall have a return of the declared return type For void functions return shall not have an expression Function calls with no parameters should have empty parentheses If a function returns error information it should be tested A violation is reported when the return value of a function is ignored include shall only be preceded by other directives or comments Non standard characters shall not occur in include directives 9 8 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 R R R A A R R R A R R R A A R R R PCP Reference Manual include shall be followed by either lt filename gt or filename Plain macros shall only be used for constants qualifiers specifiers Macros shall not be define d and undefd within a block undef should not be used A function should be used in preference to a function like macro A function like macro shall not be used without all arguments Macro arguments shall not contain pre preprocessing directives A violation is reported when the first token of an actual macro argument is Macro definitions parameters should be enclosed in parentheses Don t use undefined identifiers in pre processing directives A macro definition shall contain
157. es Command line syntax no default libraries Description Default the control program specifies the standard C libraries and run time library to the linker With this option you tell the control program not to specify the standard C libraries and run time library to the linker In this case you must specify the libraries you want to link to the linker with the option ibrary_name The control program recognizes the option 1 as an option for the linker Example ccpcp 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 ccpcp no default libraries lmy test c Related information Gls Linker option 1 Search also in system library libx a 5 158 PCP Reference Manual no map file Command line syntax no map file Description By default the control program generates a linker map file map 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 Example To prevent the generation of the linker map file test map
158. est c When an error occurs during compiling assembling or linking the erroneous generated output files will not be removed Related information d 5 152 PCP Reference Manual L library directory ignore default library path Command line syntax Lpath library directory paih L ignore default library path Description With this option you can specify the path s where your system libraries specified with the 1 option are located If you want to specify multiple paths use the option L for each separate path The default path is PRODDIR lib pcp1 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 variables LIBTC1V1_2 LIBTC1V1_ 3 or LIBTC2 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 1 option is 1 The path that is specified with the L option 2 The path that is specified in the environment variables LIBTC1V1_2 LIBTC1V1_3 or LIBTC2 when the product was installed 3 The default directory PRODDIR lib pcpl PRODDIR lib pcp15 or PRODDIR lib pcp2 Example Suppose you call the control program as follows ccpcp test c Lc mylibs lcs ccpcp test c library directory c mylibs lcs First the linker looks in the directory c mylibs for library
159. etters digits and underscore characters and the first character cannot be a digit The assembler issues a warning if you redefine an existing symbol Macros represent a special case DEFINE directive translations are applied to the macro definition as it is encountered When the macro is expanded any active DEFINE directive translations will again be applied A label is not allowed before this directive Example If the following DEFINE directive occurred in the first part of the source program DEFINE LEN 32 then the source line below SPACE LEN MESSAGE The length is LEN would be transformed by the assembler to the following SPACE 32 MESSAGE The length is 32 Related information UNDEF Undefine DEFINE symbol SET Set temporary value to a symbol PCP Assembly Language 3 29 DUP ENDM Syntax label DUP expression ENDM Description The sequence of source lines between the DUP and ENDM directives will be duplicated by the number specified by the integer expression If the expression evaluates to a number less than or equal to 0 the sequence of lines will not be included in the assembler output The expression result must be an absolute integer and cannot contain any forward references to address labels labels that have not already been defined You can nest the DUP directive to any level If you specify label it gets the value of the location counter at the start of
160. eturns the smallest integer not less than x as a double Returns the largest integer not greater than x as a double Returns the rounded integer value as an int according to the current rounding direction See fenv h Not implemented Returns the rounded integer value as along int according to the current rounding direction See fenv h Not implemented Returns the rounded integer value aS along long int according to the current rounding direction See fenv h Not implemented Returns the rounded integer value as a floating point according to the current rounding direction See fenv h Not implemented Returns the nearest integer value of x as int Not implemented Returns the nearest integer value of x as long int Not implemented Returns the nearest integer value of x as long long int Not implemented Returns the truncated integer value x Not implemented 2 14 7 Remainder after devision PCP Reference Manual Math h Tgmath h Description fmod fmodf fmodl fmod Returns the remainder r of x ny n s chosen as trunc Xx y r has the same sign as x remainder remainderf remainder Returns the remainder r of remainderl x ny n is chosen as trunc xX y r may not have the same sign as x Not implement ed remquo remquof remquol remquo Same as remainder In addition Srexp Ildexp modf scalbn scalbin Math h Tgmath h the argument quo is givena specific value see ISO
161. eturns the value of the LIST ON OFF control flag as an integer Whenever a LIST ON control is encountered in the assembler source the flag is incremented when a LIST OFF control is encountered the flag is decremented Example DUP ABS LST list unconditionally LUN expression Converts the 32 bit expression to a floating point value expression should represent a binary fraction Example DBLFRC1 EQU LUN 0x40000000 DBLFRC1 0 5 DBLFRC2 EQU LUN 3928472 DBLFRC2 0 007354736 DBLFRC3 EQU LUN 0xE0000000 DBLFRC3 0 75 MAC symbol Returns an integer 1 if symbol has been defined as a macro name 0 otherwise Example IF MAC DOMUL does macro DOMUL exist MAX expr1f exprN Returns the greatest of expr exprN as a floating point value Example MAX BYTE MAX 1 2 137 3 5 MAX 3 5 MIN expr1fexprN Returns the least of expr exprN as a floating point value Example MIN BYTE MIN 1 2 137 3 5 MIN 2 137 3 14 PCP Reference Manual 7 MSB expression Returns the most significant byte of the result of the expression expression is interpreted as a half word 16 bit Example VAR1 SET MSB 0x34 VAR1 0x00 VAR2 SET MSB 0x1234 VAR2 0x12 VAR3 SET MSB 0x654321 VAR3 0x43 MXPQ Returns an integer 1 if the assembler is expanding a macro 0 otherwise Example IF MXP Macro expansion active POS str1 str2 start Returns the position of str2
162. ffset Sets the position indicator for stream origin FSS implementation 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 ftell stream Returns the current file position for stream or 1L on error FSS implementation rewind stream Sets the file position indicator for the stream to the beginning of the file This function is equivalent to void fseek stream 0L SEEK_SET clearerr stream FSS implementation fgetpos stream pos Stores the current value of the file position indicator for stream in the object pointed to by pos FSS implementation fsetpos stream pos Positions stream at the position recorded by fgetpos in pos FSS implementation Libraries 2 31 Operations on files Stdio h Description remove file rename old new tmpfile tmpnam buffer Error handling Stdio h Removes the named file so that a subsequent attempt to open it fails Returns a non zero value if not succesful Changes the name of the file from old name to new name 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 poin
163. file Example mkpcp r The make utility does not read the implicit make rules in mkpcp mk Related information i 5 190 PCP Reference Manual S Command line syntax S Description With this option you cancel the effect of the option k This is never necessary except 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 mkpcp S The effect of the option k is cancelled so the make utility stops with the make process after it encounters an error The option k in this example may have been set with the environment variable MAKEFLAGS or in a recursive call to mkpcp in the makefile Related information Make utility option k On error abandon the work for the current target only Tool Options Make Utility 5 191 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 mkpcp s The make utility rebuilds your files but does not print the commands it executes during the make process Related information d Make utility option n Perform a dry run 5 192 PCP Reference Manual 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
164. follows aspcp Ic proj include test sre aspcp include directory c proj include test sre First the assembler looks in the directory where test src is located for the file myinc inc If it does not find the file it looks in the directory c proj include for the file myinc inc this option Related information Section 5 6 How the Assembler Searches Include Files in Chapter Using the Assembler of the User s Manual Tool Options Assembler 5 73 Section 1 3 1 Configuring the Command Line Environment in Chapter Software Installation of the User s Manual Assembler option H Include file at the start of the input files 5 74 PCP Reference Manual i symbol scope Command line syntax i g I symbol scope global local Default il 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 Example aspcp ig test srce aspcp symbol scope global test src The assembler treats all symbols as global symbols unless they are defined as local symbols in the assembly source file Related information J Tool Options Assembler 5 75 k keep output files Command line syntax k keep output files Description If an error occurs during assembly the resulting o file may be incomplete or inc
165. formation ab Control Pogram option D Define preprocessor macro Tool Options Control Program 5 165 V version Command line syntax V version Description Display version information The control program ignores all other options or input files Example ccpcp V ccpcp version The control program does not call any tools but displays the following version information TASKING PCP VX toolset control program vx yrz Build nnn Copyright 2003 year Altium BV Serial 00000000 Related information d 5 166 PCP Reference Manual 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 Example ccpcp v test c ccpcp verbose test c The control program processes the file test c and displays the invocations of the tools it uses to create the final object file Related information db Control program option n Verbose output and suppress execution Tool Options Control Program Wtool pass Command line syntax Weoption pass c oplion Pass option directly to the C compiler Waoption pass assembler option Pass option directly to the assembler Wloption pass linker option Pass option directly to the linker Description With this option you tell the control program to call a tool with the specified option The co
166. formed into a function This reduces code size possibly at the cost of execution speed However in the process of finding sequences of matching instructions compile time and compiler memory usage increase quadratically with the number of instructions considered for code compaction With this option you tell the compiler to limit the number of matching instructions it considers for code compaction Example To limit the maximum number of instructions in functions that the compiler generates during code compaction cpcp Or compact max size 100 test c cpcp optimize tcompact compact max size 100 test c Related information d gt Compiler option Or Common subexpression elimination 5 12 PCP Reference Manual 7 core Command line syntax core core You can specify the following core arguments pcp1 pep1_5 pcp2 Description With this option you specify the core architecture for a custom target processor for which you create your application By default the PCP toolset derives the core from the processor you selected Example To check for syntax errors without generating code cpcp core pcpl test c Related information d Compiler option C Use SFR definitions for CPU Tool Options Compiler 5 13 D define Command line syntax Dmacro_name macro_definition define macro_name macro_definition Description With this option you can define a macro and specify it to the preproce
167. fy an option a default value may become active 5 4 PCP Reference Manual help Command line syntax help ifem 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 typedefs Show the list of predefined typedefs Description Displays an overview of all command line options With an argument you can specify which extended information is shown Example The following invocations all display a list of the available command line options cpcp cpcp help cpcp The following invocation displays a list of the available pragmas cpcp help pragmas Related information J Tool Options Compiler 5 5 A language Command line syntax Alflags language ags You can set the following flags g G gcc Enable a number of gcc extensions p P comments Allow C style comments in ISO C90 x X strings Relaxed const check for string literals Default AGpx Description With this option you control the language extensions the compiler can accept By default the PCP C compiler allows all language extensions except for gcc extensions The option A language without flags is the equivalent of AGPX and disables all language extensions With Ag you tell the compiler to enable the following gcc languages extensions e The identifier _FUNCTION__ expands to the cu
168. fy the path where your include files are located A relative path will be relative to the current directory The order in which the compiler searches for include files is 1 The pathname in the C source file and the directory of the C source only for include files that are enclosed in 2 The path that is specified with this option 3 The path that is specified in the environment variable CPCPINC when the product was installed 4 The default directory PRODDIR include unless you specified option no stdinc 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 compiler as follows cpcp Imyinclude test c cpcp 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 5 26 PCP Reference Manual e Related information d gt Compiler option H Include file at the start of a compilation Compiler option no stdinc Skip standard include files dire
169. g unsigned int 32 32 0 282 4 unsigned long enum 32 32 231 231_4 long long signed 32 32 231 231 4 long long unsigned 32_ tong dong 32 32 0 292 1 Pointer pointer to data 32 3 0 281 1 pointer to func 0 232 1 Floating 3 402e88 1 175e738 Point Peete 92 92 1 175e738 3 402838 double 32 32 3 402e88 1 175e738 long double 1 175e738 3 402838 Table 1 1 Fundamental Data Types PCP C Language 1 3 KEYWORDS _asmQ With the __asm keyword you can use assembly instructions in the C source and pass C variables as operands to the assembly code __asm instruction_template output_param_list instruction_template parm_nr regnum output _param_list input_param_list amp constraint _char C_expression register_save_list register_name input_param_list register _save_list Assembly instructions that may contain parameters from the input list or output list in the form parm_nr regnum Parameter number in the range 0 7 With the optional regnum you can access an individual register from a register pair or register quad 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
170. g execution See also section 6 6 Linking the C Startup Code in Chapter Using the Linker of the User s Manual 4 3 STACK USAGE The stack is used for parameter passing allocation of automatics temporary storage and storing the function return address The compiler uses a Static stack Overlay sections are generated by the compiler to contain the stack objects The overlay sections are overlayed by the linker using a call graph 4 4 c PCP Reference Manual 4 4 HEAP ALLOCATION 6 The heap is only needed when you use one or more of the dynamic memory management library functions malloc calloc free and realloc The heap is a reserved area in memory Only if you use one of the memory allocation functions listed above the linker automatically allocates a heap as specified in the linker script file with the keyword pcp_heap A special section called pep_heap is used for the allocation of the heap area The size of the heap is defined in the linker script file te_arch 1s1 in directory include 1s1 with the macro PCPHEAP which results in a section called pep_heap The linker defined labels _PCP_ lc _ub heap and _PCP_ _1c_ue_ heap begin and end of heap are used by the library function sbrk which is called by malloc when memory is needed from the heap The special pcp_heap section is only allocated when its linker labels are used in the program 4 5 FLOATING POINT ARITHMETIC Floating point
171. g 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 MISRA C e MISRA C 2004 Guidelines for the Use of the C Language in Critical Systems MIRA Ltd 2004 See also http www misra c com e Guidelines for the Use of the C Language in Vehicle Based Software MIRA Ltd 1998 See also http www misra org uk TASKING Tools e PCP C Compiler Assembler Linker User s Manual Altium MA160 025 00 00 PCP C LANGUAGE all TASKING M daLdVH PCP C Language 1 3 1 1 INTRODUCTION The TASKING PCP C compiler fully supports the ISO C standard but adds possibilities to program the special functions of the PCP This chapter contains complete overviews of the following C language extensions of the TASKING PCP C compiler e Data types e Keywords e Function qualifiers e Intrinsic functions e Pragmas e Predefined macros 1 4 7 1 2 DATA TYPES PCP Reference Manual The TASKING PCP C compiler cpcp supports the following data types Size Align Type Keyword bit bit Ranges Boolean _Bool 32 32 Oori Character char 32 32 231 231 1 signed char unsigned char 32 32 0 282 4 Integral short 231 231_ signed short 32 32 E REE Sl unsigned short 32 32 0 282 4 int signed int long 32 32 231 231_4 signed lon
172. get the size of the section asection sizeof sect asection amp The group and sect arguments only works in assignments The mem argument can be used anywhere in section layouts Linker Script Language 8 11 8 3 6 LSL DEFINITIONS IN THE LINKER SCRIPT FILE description lt definition gt 1 definition architecture_definition derivative_definition board_spec section definition e At least one architecture definition must be present in the LSL file 8 3 7 MEMORY AND BUS DEFINITIONS mem_def memory mem name lt mem descr gt 7 9 e A mem_def defines a memory with the mem_name as a unique name type lt reserved gt l1 mem type mau expr mem descr 2 35 size expr speed number mapping e Amem def contains exactly one type statement e Amem def contains exactly one mau statement non zero size e A mem_def contains exactly one size statement e Amem def contains zero or one speed statement default value is 1 e Amem def contains at least one mapping mem_type rom attrs rx ram attrs rw nvram attrs rwx bus_def bus bus_name lt bus_descr gt e A bus_def statement defines a bus with the given bus_name as a unique name within a core architecture bus_descr mau expr width expr bus width nr of data bits mapping legal destination bus only 8 12 mapping map _descr 23 des
173. git minor version number Examples 1 0 gt 1000 v12 3 gt 12003 Table 1 3 Predefined macros 1 16 C LANGUAGE PCP Reference Manual LIBRARIES all TASKING M daLdVH Libraries 2 3 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 libc a and some functions of the floating point library Libfp a or libfpt a 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 libraries are included in the PCP cpcp toolchain The control program cepep automatically selects the appropriate libraries depending on the specified options Library to link Description libc a C library Some functions require the floating point library Also includes the startup code libfp a Floating point library non trapping libfpt a Floating point library trapping Control program option fp trap Table 2 1 Overview of libraries 2 4 PCP Reference Manual 7 2 2 LIBRARY FUNCTIONS The tables in the sections below list all library functions grouped per header file in which they are declared Some functions are not completely implemented because their implementaio
174. gned long addr Load a 32 bit value from a 32 bit fpi address using the 1d f instruction with size 32 Returns a 32 bit value for fpi memory address PCP C Language Example unsigned int 1d32 void return _ ld32_fpi unsigned long amp P10_OUT U generates ldl iu 1r5 HI 0x 0003210 ldl il r5 LO 0x 0003210 id rl r5 size 32 st32_fpio void volatile _ st32_fpi unsigned long addr unsigned long value Store a 32 bit value on a 32 bit fpi address using the st f instruction with size 32 Example include lt regtc1775b sfr gt void st32 unsigned int value _st32_fpi unsigned long amp P10_OUT U value generates ldl iu 1r5 HI 0xf0003210 ldl il 1r5 LO 0x 0003210 st f r1 r5 size 32 _exit void __exit int srpn To allow rearbitration of interrupts a voluntary exiting scheme is supported via the intrinsic __exit This intrinsic generates an EXIT instruction with the following settings EC 0 ST 0 INT 1 EP 1 cc_UC The R6 TOS is set for a PCP service request and the sprn value is loaded in R6 SPRN It is your responsibility not to use this intrinsic in combinmation with the Channel Start at Base mode 1 10 PCP Reference Manual The srpn value must be in range 0 255 If R6 SPRN is set to zero it causes an illegal operation error on the PCP When srpn is set to zero no code is generated for loading R6 SPRN and the interrupt f
175. group in a single address range Within a contiguous group the input sections are located in arbitrary order however the group occupies one contiguous 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 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 fill keyword If the group is located in RAM the gaps are treated as reserved scratch space If the group is located in ROM the alignment gaps are filled with zeros by default You can however change the fill pattern by specifying a bit pattern The result of the expression or list of expressions is used as values to write to memory each in MAU The overlay keyword tells the linker to overlay the sections in the group The linker places all sections in the address
176. hall also be identical If objects or functions are declared more than once their types shall be compatible There shall be no definitions of objects or functions in a header file Functions shall be declared at file scope Objects shall be defined at block scope if they are only accessed from within a single function An external object or function shall be declared in one and only one file An identifier with external linkage shall have exactly one external definition All declarations and definitions of objects or functions at file scope shall have internal linkage unless external linkage is required The static storage class specifier shall be used in definitions and declarations of objects and functions that have internal linkage When an array is declared with external linkage its size shall be stated explicitly or defined implicitly by initialization All automatic variables shall have been assigned a value before being used This rule is checked using worst case assumptions This means that violations are reported not only for variables that are guaranteed to be uninitialized but also for variables that are uninitialized on some execution paths Braces shall be used to indicate and match the structure in the non zero initialization of arrays and structures nn In an enumerator list the construct shall not be used to explicitly initialize members other than the first unless all items are explicitly initial
177. he assembler list file below the title The specified subtitle is valid until the assembler encouters a new STITLE control By default the subtitle is empty The STITLE control itself will not be printed in the source listing If the page width is too small for the title to fit in the header it will be truncated Example STITLE This is the title SSTITLE This is the subtitle The header of the second page in the list file will now be TASKING PCP Assembler vx yrz Build nnn SN 00000000 This is the title Page 2 This is the subtitle Related option Related information Gs Assembler control TITLE Set program title in header of list file Assembler option 1 Generate list file in Section 5 2 Assembler Options of Chapter Tool Options PCP Assembly Language 3 79 TITLE Syntax TITLE title Description If you generate a list file with the assembler option 1 you can use the TITLE control to specify the program title which is printed at the top of each page in the assembler list file By default the title is empty If the page width is too small for the title to fit in the header it will be truncated Example STITLE This is the title The header of the list file will now be TASKING PCP Assembler vx yrz Build nnn SN 00000000 This is the title Page 1 Related option Related information d STITLE Set program subtitle in header of assembly list file 3 80 PCP Reference Manual
178. he data byte within the Data Record 0 for the first byte 7 10 PCP Reference Manual 7 Example 0200000400FFFB _ checksum _ upper_address _ type _ offset _ length Data Record The Data Record specifies the actual program code and data length offset 00 data Ea The length byte specifies the number of data bytes The linker has an option that controls the length of the output buffer for generating Data records The default buffer length is 32 bytes The offset is the 16 bit starting load offset Together with the address specified in the Extended Address Record it specifies an absolute address in memory where the data is to be located when loaded by a tool Example l _ checksum _ data _ type _ offset 0F00200000232222754E00754F04AF4FAE4E22C3 _ length Object File Formats 7 11 Start Linear Address Record The Start Linear Address Record contains the 32 bit program execution start address Layout 04 0000 05 address checksum Example 0400000500FF0003F5 _ checksum _ address _ type _ offset _ length End of File Record The hexadecimal file always ends with the following end of file record 00000001FF _ checksum _ type _ offset _ length 7 12 OBJECT FORMATS PCP Reference Manual LINKER SCRIPT LANGUAGE all TASKING M ddaLdVH Linker Script Language 8 3 8 1 INTR
179. he list file You must specify this option in combination with the option 1 generate list file Example aspcp l tcl test srce aspcp l section info console list test sre The assembler generates a list file and writes the section information to this file The section information is also displayed on stdout Section summary REL 4 zbss_clr_testl REL 46 text_testl REL 4 zdata_rom_testl Related information d gt Assembler option 1 Generate list file 5 86 PCP Reference Manual V version Command line syntax V version Description Display version information The assembler ignores all other options or input files Example aspcp V aspcp version The assembler does not assemble any files but displays the following version information TASKING PCP VX toolset Assembler vxx yrz Build nnn Copyright years Altium BV Serial 00000000 Related information i Tool Options Assembler 5 87 w no warnings Command line syntax w 777 no warnings 777 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 all warnings aspc
180. he specified maximum number of errors When 0 null is specified the linker emits all errors Without this option the maximum number of errors is 42 Example To stop linking after 10 errors occurred enter lpcp error limit 10 test o Related information i 5 100 7 PCP Reference Manual f option file Command line syntax f file option file ile Description Instead of typing all options on the command line you can create an option file which contains all options and files 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 Multiple command line arguments on one line in the option file are allowed To include whitespace in an argument surround the argument with single or double quotes If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded Note that adjacent strings are concatenated When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation
181. hich they appear in the LSL file Internal core architecture section layouts always take precedence over global section layouts The attributes field selects all sections that carry or do not carry the given attribute With attribute you select sections that have the specified attribute set With attribute you select sections that do not have the specified attribute set You can specify one or more of the following attributes r readable sections writable sections executable sections initialized sections sections that should be cleared at program startup arewa scratch sections not cleared and not initialized To select all read only sections group select attributes r w Keep in mind that all section selections are restricted to the address space of the section layout in which this group definition occurs With the ref_tree field you can select a group of related sections The relation between sections is often expressed by means of references By selecting just the root of tree the complete tree is selected This is for example useful to locate a group of related sections in special memory e g fast memory The referenced sections must meet the following conditions in order to be selected 1 The sections are within the section layout s address space 2 The sections match the specified attributes 3 The sections have no absolute restriction as is the case for all wildcard selectio
182. his option you keep the generated output files when an error occurs By default the linker removes the generated output files when an error occurs This is useful when you use the make utility mkpcp If the erroneous files are not removed the make utility may process corrupt files on a subsequent invocation Use this option when you still want to use the generated file For example when you know that the error s do not result in a corrupt output file or when you want to inspect the output file or send it to Altium support Example lpcp k test o lpcp keep output files test o When an error occurs during linking the generated output file test elf will not be removed Related information ib 5 106 PCP Reference Manual L library directory ignore default library path Command line syntax Lpath library directory path L ignore default library path Description With this option you can specify the path s where your system libraries specified with the 1 option are located If you want to specify multiple paths use the option L for each separate path The default path is PRODDIR 1lib 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 LIBTC1V1_ 2 LIBTC1V1 3 or LIBTC2 So the linker ignores steps 2 3 and 4 as listed below The
183. hould 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 8 4 7 PCP Reference Manual See section 8 5 Semantics of the Architecture Definition for detailed descriptions of LSL in the architecture definition The derivative definition required db 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 Altium provides LSL descriptions of supported derivatives along with SFR files
184. ield is only used for Data Records In other records this field is coded as four ASCII zero characters 0000 is the record type This value occupies one byte two hexadecimal digits The record types are Object File Formats 7 9 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 content is the information contained in the record This depends on checksum the record type is the record checksum The linker computes the checksum by first adding the binary representation 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 offset index is the base address where the two most significant bytes are the upper_address and the two least significant bytes are zero is the 16 bit offset from the Data Record is the index of t
185. ies 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 MISRA C Rules 9 7 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 R R R R R R R R R R R A A R R A A R R Functions shall not call themselves either directly or indirectly A violation will be reported for direct or indirect recursive function calls in the source file being checked Recursion via functions in other source files or recursion via function pointers is not detected Function prototypes shall be visible at the definition and call The function prototype of the declaration shall match the definition Identifiers shall be given for all prototype parameters or for none Parameter identifiers shall be identical for declaration definition Every function shall have an explicit return type Functions with no parameters shall have a void parameter list An actual parameter type shall be compatible with the prototype The number of actual parameters shall match the prototype The values returned by void functions shall not be used Void expressions shall not be passed as function parameters const should be used for reference paramet
186. ifies 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 address The section must be located at the address shown in the Properties column List File Formats address range address range ballooned Properties Sections Related information The section must be located in the union of the address ranges shown in the Properties column end addreses are not included in the range size The sections must be located in some address range with size not larger than shown in the Properties column the second number in that field is the alignment requirement for the address range After locating all sections the largest remaining gap in the space is used completely for the stack and or heap The contents depends on the Type column The sections to which the rule applies restrictions between sections are shown in this column lt ordered l contiguous clustered For contiguous sections the linker uses the section order as shown here Clustered sections can be located in any relative order ab Section 6 9 Generating a Map File in Chapter Using the Linker of the User s Manual Linker option M Generate map file 6 12 LIST FILE FORMATS PCP Reference Manual OBJECT FILE FORMATS all TASKING M ddaLdVH Object File Formats 7 3 7 1_ELF DWARF OB
187. ignment The sizeof function with the mem argument can be used anywhere in section layouts You can use the following built in functions in expressions All functions return a numerical value This value is a 64 bit signed integer absoluteQ int absolute expr Converts the value of expr to a positive integer absolute labelA labelB addressofQ int addressof addr_id Returns the address of addr_id which is a named section or group To get the offset of the section with the name asect addressof sect asect This function only works in assignments 8 10 PCP Reference Manual 7 exists int exists section_name The function returns 1 if the section section_name exists in one or more object file 0 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 Q 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 minQ int min expr expr Returns the value of the expression hat has the smallest value To get the lowest value of two symbols min Sym1 sym2 sizeofQ int sizeof size id Returns the size of the object group section or memory the identifier refers to To
188. ilation the resulting src file may be incomplete or incorrect With this option you keep the generated output file src when an error occurs By default the compiler removes the generated output file src when an error occurs This is useful when you use the make utility mkpcp 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 Example cpcp k test c When an error occurs during compilation the generated output file test sre will not be removed Related information Gls Compiler option warnings as errors Treat warnings as errors Tool Options Compiler 5 31 misrac Command line syntax misrac all number number Description With this option you specify to the compiler which MISRA C rules must be checked With the option misrac all the compiler checks for all supported MISRA C rules Example cpcp 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 d See Chapter 9 MISRA C Rules for a list of all supported MISRA C rules Compiler option misrac advisory warnings Compiler option misrac required warnings Compiler option misrac version Linker option misra c report 5 32 PCP Reference Manual misrac advisory warnings
189. ile 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 consists of four lines TASKING PCP VX toolset Assembler vx yrz Build nnn SN 00000000 This is the page header title Page 1 ADDR CODE CYCLES LINE SOURCE LINE The first line contains information about the assembler name version number and serial number The second line contains a title specified by the TITLE first page assembler directive and a page number The third line is empty The fourth line contains the heading of the source listing Source listing The following is a sample part of a listing An explanation of the different columns follows below ADDR CODE CYCLES LINE SOURCE LINE 0000 93COrrrr 26 ldl il r7 DPTR _PCP__99900 0002 54rr 27 st pi r2 _PCP__999001__1 0003 9340rrrr 28 ldl il 4r5 LO _PCP_1lc_ub_ 0005 93COrrrr 29 ldl il r7 DPTR _PCP_ data_ 0007 55rr 30 st pi r5 _PCP__data__ printf 0008 9240rrrr 31 ldl il r1 LO _PCP_1 str 000A 93COrrrr 32 ldl il r7 DPTR _PCP__99900 000C 52rr 33 ld pi r2 _PCP__ 999001 __1 000D E800rrrr 34 jg _PCP_printf 0000 RESERVED 86 Space 1 The meaning of the various columns is ADDR 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
190. in the directory where 1s1file 1s1 is located for the file mypart 1s1 If it does not find the file it looks in myinclude subdirectory relative to the current directory for the file mypart 1s1 this option Finally it looks in the directory PRODDIR include 1s1 Related information d Linker option d Linker script file 5 104 PCP Reference Manual i user provided initialization code Command line syntax 1 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 Example To link with your own startup code lpcp i test o lpcp user provided initialization code test o Related information i Tool Options Linker 5 105 k keep output files Command line syntax k keep output files Description If an error occurs during linking the resulting output file may be incomplete or incorrect With t
191. information d gt Linker option d Linker script file Linker option Isl dump Dump LSL info Chapter 8 Linker Script Language Tool Options Linker 5 111 Isl dump Command line syntax Isl dump i e Description With this option you tell the linker to dump the LSL part of the map file in a separate file independent of the M generate map file option If you do not specify a filename the file lpcp 1df is used Example lpcp lsl dump mydump ldf test o The linker dumps the processor and memory info from the LSL file in the file mydump 1df Related information d Linker option m Map file formatting options 5 112 PCP Reference Manual 7 M map file Command line syntax M file map file i e Description With this option you tell the linker to generate a linker map file If you do not specify a filename and you specified 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 A linker map file is a text file that shows how the linker has mapped the sections and symbols from the various object files 0 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 the option m map file formatting you can specify which parts you want to
192. ing Loop transformations Forward store Constant propagation Code compaction reverse inlining Subscript strength reduction Peephole optimizations Use the following options for predefined sets of flags O0 optimize 0 No optimization Alias for OABCEFGHILOPRSY 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 same order as written in the source code associative and commutative properties are not used O1 optimize 1 Debug purpose optimization Alias for OabcefghILOPRSy Enables optimizations that do not affect the debug ability of the source code Use this level when you are developing debugging new source code 02 optimize 2 Release purpose optimization default Alias for OabcefghIlopRSy 5 40 PCP Reference Manual Enables more optimizations to reduce code size 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 have already been debugged This is the default optimization level 0O03 optimize 3 Aggressive optimization Alias for OabcefghiloprSy Enables aggressive global optimization techniques Although in theory debugging is still possible the relation between source code and generated instructions is complex and hard to understand Use this le
193. ion occurred can be detected See therefor the IEEE 754 trap handler discussion above if you want more control over floating point results 4 8 PCP Reference Manual E Example include lt float h gt include lt signal h gt static void pass fp exception_to_signal _fp_exception_info_t info info suppress parameter not used warning cause SIGFPE signal to be raised raise SIGFPE now continue the program with the unaltered result 4 5 4 FLOATING POINT TRAP HANDLING API For purposes of dealing with floating point arithmetic exceptions the following library calls are available include lt float h gt int _fp_get_exception_mask void void _fp_set_exception_mask int A pair of functions to get or set the mask which controls which type of floating point arithmetic exceptions are either ignored or passed on to the trap handler The types of possible exception flag bits are defined as EFINVOP EFDIVZ EFOVFL EFUNFL EFINEXCT while EFALL is the OR of all possible flags See below for an explanation of each flag Run time Environment 4 9 include lt float h gt int _fp_get_exception_status void void _fp _set_exception_status int A pair of functions for examining or presetting the status word containing the accumulation of all floating point exception types which occurred so far See the possible exception type flags above include lt float h gt v
194. ion 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 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 Libraries 2 35 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 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 rem of struct div_t ldiv_t and 1ldiv_t which have the same types Multibyte wide character and string conversions mblen s n mbtowc pwc s n wctomb s wc mbstowcs pwces s n westombs s pwcs n Determines the number of bytes in the multi byte chara
195. ions 5 198 PCP Reference Manual 2 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 arpcp arpcp Related information d Tool Options Archiver 5 199 d Command line syntax d v Description Delete the specified object modules from a library With the suboption v the archiver shows which files are removed V Verbose the archiver shows which files are removed Example arpcp d lib a objl o obj2 o The archiver deletes obj1 0 and obj2 0 from the library lib a arpcp d v lib a objl o obj2 o0 The archiver deletes obj1 0 and obj2 0 from the library lib a and displays which files are removed Related information ib 5 200 7 f PCP Reference Manual 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 files you want to specify With this option you specify the option file to the archiver 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 If you use instead of a filename it means that the options are read from stdin Format of an option file Multiple command line arguments on one line in the option fi
196. is the offset in bytes of member within structure type type 2 2 18 STDINT H d See section 2 2 8 inttypes h and stdint h 2 2 19 STDIO H AND WCHAR H Types The header file stdio h contains for performing input and output A number of also have a parallel wide character function or macro defined in wchar h The header file wchar h also stdio h In the C language many I O facilities are based on the concept of streams The stdio h header file defines the data type FILE which holds the information about a stream An FILE object is created with the function fopen The pointer to this object is used as an argument in many of the in this header file The FILE object can contain the following information e the current position within the stream e pointers to any associated buffers e indications of for read write errors e end of file indication The header file also defines type fpos_t as an unsigned long Libraries 2 21 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
197. ist File Formats Tool Options Assembler 5 79 m preprocessor type Command line syntax m n t preprocessor type none tasking Default mt 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 the assembler not to use a preprocessor Example aspcp test src aspcp mt test src aspcp preprocessor tasking test src These invocations have the same effect the assembler preprocesses the file test src with the TASKING preprocessor Related information f 5 80 PCP Reference Manual 7 no tasking sfr Command line syntax no tasking sfr Description Normally the assembler includes a special function register SFR file before compiling The assembler automatically selects the SFR file belonging to the target you select on the Processor definition page of the Processor options assembler option C With this option the assembler does not include the register file regcpu def as based on the selected target processor Use this option if you want to use your own set of SFR def files Example aspcp Ctc1920b no tasking sfr test src The register file regtc1920b def is not included but the assembler allows the use of MMU instructions due to C Related information d Assembler option C Select CPU T
198. it section is copied from ROM to RAM at startup noread section can be executed from but not read Data attibutes noclear section is not cleared during startup max data overlay with other parts with the same name is implicit a type of noclear rom data section remains in ROM A label is not allowed before this directive Example define a section on location 100 decimal org 100 define a relocatable nameless section org define a relocatable data section org data PCP Assembly Language define a data section on 0x8000 org 0x8000 data Related information db SDECL Declare section name and attributes SECT Activate a declared section 3 51 3 52 PCP Reference Manual PMACRO Syntax PMACRO symbol symbol Description With the PMACRO directive Purge Macro you tell the assembler to undefine the specified macro so that later uses of the symbol will not be expanded A label is not allowed before this directive Example PMACRO MAC1 MAC2 This statement causes the macros named MAC1 and MAC2 to be undefined Related information d MACRO Define Macro PCP Assembly Language 3 53 SDECL Syntax SDECL name type attribute AT address Description With the SDECL directive you can define a section with a name type and optional attributes Before any code or data can be placed in a section you must use the SECT directive to activate the section This
199. ith 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 aspcp 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 enter aspcp diag html all gt aserrors html 5 62 PCP Reference Manual e Related information d gt Section 5 8 Assembler Error Messages in Chapter Using the Assembler of the User s Manual Tool Options Assembler 5 63 E preprocess Command line syntax E preprocess Description With this option the assembler will only preprocess the assembly source file The assembler sends the preprocessed file to stdout Example aspcp E test src aspcp preprocess test srce Related information d 5 64 PCP Reference Manual emit locals Command line syntax emit locals lag You can set the following flags when you specify no flags the default is Es e E equs emit local EQU symbols s S___ symbols emit local non EQU symbols Description With the option emi
200. ition and Board Specification 8 16 8 3 11 Section Placement Definition 0 4 8 16 8 4 Expression Evaluation 00 00 eee eens 8 21 8 5 Semantics of the Architecture Definition 8 22 8 5 1 Defining an Architecture 00 0000 ee eee 8 23 8 5 2 Defining Internal Buses 0000 00 c eee eee 8 24 8 5 3 Defining Address Spaces 0 0000 eee eee 8 24 8 5 4 Mappings s tea ete heath 3 Res SER ee ee 8 27 8 6 Semantics of the Derivative Definition 8 30 8 6 1 Defining a Derivative 00 00 eee 8 30 8 6 2 Instantiating Core Architectures 005 8 31 Vil VIII Table of Contents 8 6 3 Defining Internal Memory and Buses 8 32 8 7 Semantics of the Board Specification 8 34 8 7 1 Defining a Processor uuna unuau 8 34 8 7 2 Instantiating Derivatives 0 0 0 000 0000 8 8 35 8 7 3 Defining External Memory and Buses 8 36 8 8 Semantics of the Section Layout Definition 8 38 8 8 1 Defining a Section Layout 0 0 eee eee ee 8 39 8 8 2 Creating and Locating Groups of Sections 8 40 8 8 3 Creating or Modifying Special Sections 8 46 8 8 4 Creating Symbols lt en ekevace scene heehee eens ea 8 51 8 8 5 Conditional Group Statements 005 8 52 MISRA C RULES 9 1 9 1 MISRA C 1998 loann 9 3 9 2 MERA C 200E spartire Pe tel a seep RA Ea 9 1
201. ive bytes whose lower seven bits represent the ASCII value of the character The standard C escape sequences are allowed WORD R 0x52 WORD ABCD 0x41424344 HALF R 0x52 HALF AB 0x4142 HALF ABCD 0x4142 0x4344 If the evaluated argument is too large to be represented in a word halfword the assembler issues an error and truncates the value Examples WRD WORD 14 1635 0x34266243 ABCD HLF HALF 14 1635 0x2662 AB PCP Assembly Language 3 65 With the BYTE directive you can obain exactly the same effect WRD BYTE 14 0 0 0 1635 256 6 0 0 0x43 0x62 0x26 0x34 D C B A HLF BYTE 14 0 1635 256 6 0x62 0x26 B A Related information d SPACE Define storage ASCII ASCIIZ Define ASCII string without with ending NULL BYTE Define a constant byte 3 66 PCP Reference Manual 3 3 3 OVERVIEW OF ASSEMBLER CONTROLS The following tables provide an overview of all assembler controls Overview of assembler listing controls Function Description LIST ON OFF Generation of assembly list file temporary ON OFF LIST flags Exclude include lines in assembly list file PAGE Generate formfeed in assembly list file PAGE settings Define page layout for assemlly list file PRCTL Send control string to printer STITLE a program subtitle in header of assembly list ile TITLE Set program title in headerof assembly
202. ized 9 14 7 PCP Reference Manual Arithmetic type conversions 10 1 R 10 2 R 10 3 R 10 4 R 10 5 R 10 6 The value of an expression of integer type shall not be implicitly converted to a different underlying type if a it is not a conversion to a wider integer type of the same signedness or b the expression is complex or c the expression is not constant and is a function argument or d the expression is not constant and is a return expression The value of an expression of floating type shall not be implicitly converted to a different type if a it is not a conversion to a wider floating type or b the expression is complex or c the expression is a function argument or d the expression is a return expression The value of a complex expression of integer type may only be cast to a type that is narrower and of the same signedness as the underlying type of the expression The value of a complex expression of floating type may only be cast to a narrower floating type If the bitwise operators and lt lt are applied to an operand of underlying type unsigned char or unsigned short the result shall be immediately cast to the underlying type of the operand A U suffix shall be applied to all constants of unsigned type Pointer type conversions 11 1 11 2 11 3 A Conversions shall not be performed between a pointer to a function and any type other than an int
203. keyword size you can specify a size for a given reserved area or section 8 48 PCP Reference Manual 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 lt rom gt scratch rx yes r lt rom gt executable rw yes rw lt ram gt data rw no rw lt ram gt scratch rwx yes rw lt ram gt executable group reserved
204. l expr2 Returns the arc tangent of expr1 expr2 as a floating point value in the range pi to pi Expri and expr2 must be separated by a comma Example ATAN2 EQU AT2 1 0 1 0 j ATAN2 0 7853982 3 8 PCP Reference Manual E ATN expression Returns the arc tangent of expression as a floating point value in the range pi 2 to pi 2 Example ATAN SET ATN 1 0 ATAN 0 78539816339744828 CAT string1 string2 Concatenates the two strings into one string The two strings must be enclosed in single or double quotes Example DEFINE ID CAT PCP assembler 71D PCP assembler CEL expression Returns a floating point value which represents the smallest integer greater than or equal to expression Example CEIL SET CEL 1 05 CEIL 1 0 CNTQ Returns the number of arguments of the current macro expansion as an integer The assembler issues a warning if this function is used when no macro expansion is active Example ARGCNT SET CNT reserve argument count COH expression Returns the hyperbolic cosine of expression as a floating point value Example HYCOS EQU COH VAL compute hyperbolic cosine PCP Assembly Language 3 9 COS expression Returns the cosine of expression as a floating point value Example WORD COS CVF COUNT FREQ compute cosine value CPU string Returns an integer 1 if string corresponds to the selected CPU type 0 otherwise S
205. lag in the EXIT instruction is disabled EXIT EC 0 ST 0 INT 0 EP 1 cc_UC 1 6 PRAGMAS Pragmas are keywords in the C source that control the behavior of the compiler Pragmas overrule compiler options and keywords db For general information on pragmas see section 2 6 Pragmas to Control the Compiler in Chapter PCP C Language of the User s Manual The syntax is pragma pragma spec ON OFF RESTORE DEFAULT Or _Pragma pragma spec ON OFF RESTORE DEFAULT The compiler recognizes the following pragmas other pragmas are ignored Sometimes the resemblence of a pragma and a compiler option is so strong that no explanation is given but instead is referred to the description of the corresponding compiler option pragma alias symbol defined_symbol Define symbol as an alias for defined_symbol It corresponds to an equate directive ALIAS at assembly level The symbol should not be defined elsewhere and defined_symbol should be defined with static storage duration not extern or automatic d gt See also the ALIAS directive directive in Section 3 3 Assembler Directives and Controls in Chapter Assembly Language pragma clear pragma noclear Performs clearing or no clearing of non initialized static public variables pragma compactmaxmatch value Control the maximum size of a match PCP C Language 1 11 See compiler option compact max size in section Compiler Options in
206. lation 5 150 PCP Reference Manual 7 iSso 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 aN Independent 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 ccpcp iso 90 test c Related information d gt Compiler option c ISO C standard Tool Options Control Program 5 151 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 Example ccpcp k test c ccpcp keep output files t
207. le mkpcp K The make utility preserves all temporary files Related information Section 1 3 1 Configuring the Command Line Environment in Chapter Software Installation of the User s Manual Tool Options Make Utility 5 183 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 mkpcp 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 d Make utility option S Undo the effect of k 5 184 7 PCP Reference Manual 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 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 m multiple times Format of an option file Multiple command line arguments on one line in the option file are allowed To include whitespace in an argument surround the argument with single or double quotes If you wa
208. le LIBTC1V1_2 LIBTC1V1_ 3 or LIBTC2 unless you used the option L without a directory AN If you use the libc a library you must always link the Libfp a library as well Remember that the order of the specified libraries is important Example To search in the system library libfp a floating point library lpcp test o mylib a lfp lpcp test o mylib a library fp The linker links the file test o and first looks in mylib a in the current directory only then in the system library libfp a to resolve unresolved symbols Related information d Linker option L Additional search path for system libraries Section 6 4 1 Specifying Libraries to the Linker in Chapter Using the Linker of the User s Manual Tool Options Linker 5 109 link only Command line syntax link only Description With this option you suppress the locating phase The linker stops after linking The linker complains if any unresolved references are left Example lpcp link only hello o The linker checks for unresolved symbols and creates the file task1l out Related information d Control program option cl Stop after linking 5 110 PCP Reference Manual Isil check Command line syntax Isl check Description With this option the linker just checks the syntax of the LSL file s and exits No linking or locating is performed Example To check the LSL file s and exit lpcp lsl check lsl file mylslfile 1lsl Related
209. le are allowed To include whitespace in an argument surround the argument with single or double quotes If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels Tool Options Archiver 5 201 Example Suppose the file myoptions contains the following lines x mylib objl o w5 Specify the option file to the archiver arpcp f myoptions This is equivalent to the following command line arpcp x mylib objl o w5 Related information i 5 202 PCP Reference Manual 7 m Command line syntax m a posname b posname Description Move the specified object modules to another position in the library The ordering of members in a library can make a difference in how programs are linked if a symbol is defined in more than one member Default the specified members are moved to the end of the archive Use the suboptions a or b to move them to a specified place instead a posname Move the specified object module s after the existing module posna
210. le_name cpcp rename sections data pcp module name test c 5 44 PCP Reference Manual 7 Related information d gt Section 2 10 Compiler Generated Sections in Chapter PCP C Language of the User s Manual Tool Options Compiler 5 45 S source Command line syntax S source Description With this option you tell the compiler to merge C source code with generated assembly code in the output file The C source lines are included as comments Example cpcp s test c The output file test srce contains the original C source lines as comments besides the generated assembly code Related information dh 5 46 PCP Reference Manual Signed bitfields Command line syntax signed bitfields Description For bit fields it depends on the implementation whether a plain int is treated as signed int or unsigned int By default an int bit field is treated as unsigned int This offers the best performance With this option you tell the compiler to treat int bit fields as signed int In this case you can still add the keyword unsigned to treat a particular int bit field as unsigned Example cpcp signed bitfields test c Related information d Tool Options Compiler 5 47 Static 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 wi
211. libc a this option Tool Options Control Program 5 153 If it does not find the requested libraries it looks in the directory that is set with the environment variables LIBTC1V1_2 LIBTC1V1_ 3 or LIBTC2 Then the linker looks in the default directory PRODDIR lib tc1 or PRODDIR lib tc2 for libraries Related information d Linker option 1 Search also in system library libname 5 154 PCP Reference Manual I library Command line syntax Iname library name Description With this option you tell the linker via the control program to search also in system library libname a 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 variables LIBTC1V1_2 LIBTC1V1_3 or LIBTC2 unless you used the option L without a directory Example To search in the system library libfp a floating point library ccpcp test obj mylib a lfp ccpcp test obj mylib a library fp The linker links the file test obj and first looks in mylib a in the current directory only then in the system library libfp a to resolve unresolved symbols Related information db Control program option L Add library directory Section 6 4 Linking with Libraries in the User s Manual Tool Options Control Program 5 155 list files Command line syntax Iname list files e Description With this optio
212. ll 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 cpcp static modulel c module2 c module3 c Related information J 5 48 PCP Reference Manual t tradeoff Command line syntax t 0 1 2 3 4 tradeoff 0 1 2 3 4 Default t2 Description If the compiler uses certain optimizations option O you can use this option to specify whether the used optizations should opimize for more speed regardless of code size or for smaller code size regardless of speed Default the compiler balances speed and size while optimizing t2 AN If you have not used the option O the compiler uses default medium optimization so you can still specify the option t Example To set the trade off level for the used optimizations cpcp t4 test c cpcp tradeoff 4 test c The compiler uses the default medium optimization level and optimizes for code size rather than for speed Related information d gt Compiler option O Specify optimization level Tool Options Compiler 5 49 U undefine Command line syntax Umacro_name undefine macro_name Description With this option you can undefine an earlier defined macro as with undef This option is for example useful to undefine predefined m
213. locale category LC_CTYPE see section 2 2 11 locale h Numeric conversions Next functions 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 functions 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 Wchar h float strtof s endp float westof s endp double strtod s endp double westod s endp long double strtold s endp long double westold s endp Libraries 2 33 Next functions 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 Wchar h long strtol s endp base long westol s endp base long long strtoll long long wcestoll s endp base s endp base unsigned long strtoul unsigned long westoul s endp base s endp base unsigned long long strtoull unsigned long long westoull s endp base s endp base Random number generation rand Returns a pseudo random integer in the range 0 to RAND_MAX srand seed Same as rand but uses seed for a new sequence of pseudo random numbers Memory management malloc size Allocates space for an object with siz
214. locale specific functions and wide character classification wetype property Constructs a value of type wctype_t that describes a class of wide characters identified by the string property lf property identifies a valid class of wide characters according to the LC_TYPE category see 2 2 11 locale h of the current locale a non zero value is returned that can be used as an argument in the iswctype function iswctype wc desc 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 iswentrl wc iswctype wc wctype cntr1 iswdigit wc iswctype wc wctype digit iswgraph wc iswctype wc wctype graph Libraries 2 45 Function Equivalent to locale specific test iswlower wc iswprint wc iswpunct wc iswspace wc iswupper wc iswxditig wc iswctype wc wctype lower iswctype wc wctype print iswctype wc wctype punct iswctype wc wctype space iswctype wc wctype upper iswctype wc wctype xdigit wetrans property Constructs a value of type wctype_t that describes a mapping between wide characters identified by the string property If property identifies a valid mapping of wide characters according to the LC_TYPE categ
215. lt Error Description Exception Flag Default Result with Trapping Invalid Operation EFINVOP NaN Division by zero EFDIVZ INF or INF Overflow EFOVFL INF or INF Underflow EFUNFL zero Inexact EFINEXT undefined INF Infinite which is the largest absolute floating point number which is always INF lt every finite number lt INF NAN Not a Number a symbolic entity encoded in floating point format Table 4 3 Exception Type Flag Codes To ensure all exception types are specified you can specify EFALL to a function which is the binary OR of all above enlisted flags 4 12 PCP Reference Manual TOOL OPTIONS all TASKING M ddaLdVH Tool Options Compiler 5 3 5 1 COMPILER OPTIONS This section lists all compiler options Short and long option names Options have both short and long names Short option names always begin with a single minus character long option names always begin with two minus characters You can abbreviate long option names as long as it forms a unique name You can mix short and long option names on the command line Options can have flags or suboptions To switch a flag on use a lowercase letter or a longflag To switch a flag off use an uppercase letter or a longflag Separate longflags with commas The following two invocations are equivalent cpcp Oac test c cpcp optimize tcoalesce cse test c When you do not speci
216. lt address size is generated Example To create the SREC file test s with S1 records type ccpcp format SREC address size 2 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 Tool Options Control Program 5 133 C cpu Command line syntax Ccpu Description With this option you define the target processor for which you create your application Make sure you choose a target processor with pcp Based on the specified target processor the control program always includes the correct register files unless you specify control program option no tasking sfr Example To generate the file test elf for the TC111IB processor ccpcp Ctc1920b test c ccpcp cpu ttc1920b test c Related information d gt Compiler option C Use SFR definitions for CPU Assembler option C Select CPU Section 4 4 Calling the Compiler in Chapter Using the Compiler of the User s Manual 5 134 PCP Reference Manual 7 case insensitive Command line syntax case insensitive Description With this option you tell the control progam not to distinguish between upper and lower case characters By default upper and lower case characters are considered as different characters Note that in assembly instruction mnemonics register names directives and controls are always treated case inse
217. macros in errno h 2 6 PCP Reference Manual EZERO 0 No error EPERM 1 Not owner ENOENT 2 No such file or directory EINTR 3 Interrupted system call EIO 4 I O error EBADF 5 Bad file number EAGAIN 6 No more processes ENOMEM 7 Not enough core EACCES 8 Permission denied EFAULT 9 Bad address EEXIST 10 File exists ENOTDIR 11 Not a directory EISDIR 12 Is a directory EINVAL 13 Invalid argument ENFILE 14 File table overflow EMFILE 15 Too many open files ETXTBSY 16 Text file busy ENOSPC 17 No space left on device ESPIPE 18 Illegal seek EROFS 19 Read only file system EPIPE 20 Broken pipe ELOOP 21 Too many levels of symbolic links ENAMETOOLONG 22 File name too long Floating point errors EDOM 23 Argument too large ERANGE 24 Result too large Errors returned by prinff scanf ERR_FORMAT 25 Illegal format string for printf 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 fgetwe getwc mbrtowc etc EILSEQ 30 Illegal byte sequence including too few bytes Libraries 2 7 2 2 4 FCNTL H The header file fent1 h contains the function open which calls the low level function _open and definitions of flags used by the low level function _open This header file is not defined in ISO IEC9899 open 2 2 5 FENV H
218. mbol definition directives Directive Description ALIAS Create an alias for a symbol EQU Assign permanent value to a symbol EXTERN External symbol declaration GLOBAL Global section symbol declaration LOCAL Local symbol declaration NAME Specify name of original C source file SET Set temporary value to a symbol SIZE Set size of symbol in the ELF symbol table TYPE Set symbol type in the ELF symbol table WEAK Mark symbol as weak Overview of data definition storage allocation directives FLOAT DOUBLE FRACT SFRACT SPACE WORD HALF Directive Description ACCUM Define 64 bit constant of 18 46 bits format ALIGN Define alignment ASCII ASCIIZ Define ASCII string without with ending NULL byte BYTE Define constant byte Define a 32 bit 64 bit floating point constant Define a 16 bit 32 bit constant fraction Define storage Define a word half word constant 3 20 PCP Reference Manual 7 Overview of macro and conditional assembly directives Directive Description DUP ENDM Duplicate sequence of source lines DUPA ENDM Duplicate sequence with arguments DUPC ENDM Duplicate sequence with characters DUPF ENDM Duplicate sequence in loop EXITM Exit macro IF ELIF ELSE Conditional assembly ENDIF MACRO ENDM Define macro PMACRO Undefine purge macro definition Overview of debug directives Function Descrip
219. me b posname Move the specified object module s before the existing module posname Example Suppose the library lib a contains the following objects see option t objl o obj2 0 obj3 0 To move obj1 0 to the end of lib a arpcp m lib a objl o To move obj3 0 just before obj2 0 arpcp m b obj3 0 lib a obj2 0 The library lib a after these two invocations now looks like obj3 0 obj2 0 objl o Related information db Archiver option t Print library contents Tool Options Archiver 5 203 Command line syntax P Description Print the specified object module s in the library to standard output This option is only useful when you redirect or pipe the output to other files or tools that serve your own purposes Normally you do not need this option Example arpcp p lib a objl o gt file o The archiver prints the file obj1 0 to standard output where it is redirected to the file file o The effect of this example is very similar to extracting a file from the library but in this case the extracted file gets another name Related information de 5 204 7 PCP Reference Manual F Command line syntax r a posname b posname c ul v Description B You can use the option r for several purposes e Adding new objects to the library e Replacing objects in the library with the same object of a newer date e Creating a new library The option r normally adds a new module to the
220. ment or another if statement All if else if constructs shall be terminated with an else clause Switch statements 15 1 15 2 R 15 3 15 4 R 15 5 R Functions 16 1 R 16 2 R 163 R 16 4 R A switch label shall only be used when the most closely enclosing compound statement is the body of a switch statement An unconditional break statement shall terminate every non empty switch clause The final clause of a switch statement shall be the default clause A switch expression shall not represent a value that is effectively Boolean Every switch statement shall have at least one case clause Functions shall not be defined with variable numbers of arguments Functions shall not call themselves either directly or indirectly A violation will be reported for direct or indirect recursive function calls in the source file being checked Recursion via functions in other source files or recursion via function pointers is not detected Identifiers shall be given for all of the parameters in a function prototype declaration The identifiers used in the declaration and definition of a function shall be identical 9 18 16 5 16 6 16 7 16 8 16 9 16 10 R R A R R R PCP Reference Manual Functions with no parameters shall be declared with parameter type void The number of arguments passed to a function shall match the number of parameters A p
221. much information about the event To install your own trap handler use the library call _fp_install_trap_ handler When installing your own exception handler you must select on which types of exceptions you want to have your handler invoked using the function call _fp_set_exception_ mask See below for more details on the floating point library exception handling function interface SIGFPE Signal Handler In ANSI C the regular approach of dealing with floating point exceptions is by installing a so called signal handler by means of the ANSI C library call signal If such a handler is installed floating point exceptions cause this handler to be invoked To have the signal handler for the SIGFPE signal actually become operational with the provided floating point libraries a very basic version of the IEEE 754 exception handler must be installed see example below which will raise the desired signal by means of the ANSI C library function call raise For this to be achieved the function call fp install_trap_ handler is present When installing your own exception handler you will have to select on which types of exceptions you want to receive a signal using the function call _fp_set_exception_ mask See further below for more details on the floating point library exception handling function interface There is no way to specify any information about the context or nature of the exception to the signal handler Just that a floating point except
222. n cannot be ordered contiguous or clustered memory reference mem lt proc_name gt 0 1 lt core_name gt 0 1 mem name e A proc_name refers to a defined processor e A core_name refers to a defined core e A mem_name refers to a defined memory if statement if expr section_statement lt else section _statement gt 1 section_creation_statement section section_name section_specs lt section_statement2 gt 9 section_specs section spec lt section spec gt 7 section spec attributes fill_spec size expr blocksize expr overflow section_name section_statement2 select_section_statement group_descr2 lt section_statement2 gt 7 9 group_descr2 group lt group_name gt 9 1 group_specs2 section _statement2 group_specs2 group _spec2 lt group_spec2 gt gt 0 group_spec2 group alignment attributes load_addr Linker Script Language 8 21 8 4 EXPRESSION EVALUATION Only constant expressions are allowed including sizes but not addresses of sections in object files All expressions are evaluated with 64 bit precision integer arithmetic The result of an expression can be absolute or relocatable A symbol you assign is created as an absolute symbol 8 22 PCP Reference Manual 8 5 SEMANTICS OF THE ARCHITECTURE DEFINITION Keywords in the architecture definition architecture extends endianness big little bus mau wi
223. n be overruled by a normal global definition The linker will not complain about the duplicate definition and ignore the weak definition d See the WEAK directive in Section 3 3 Assembler Directives and Controls in Chapter Assembly Language 1 7 PREDEFINED MACROS In addition to the predefined macros required by the ISO C standard the TASKING PCP C compiler supports the predefined macros as defined in Table 1 3 The macros are useful to make conditional C code Macro Description _ BIGENDIAN _ Expands to 0 BUILD __ Expands to the build number of the compiler BRRRYrrr The B is the build number RRR is the major branch number and rrr is the minor branch number Examples Build 134 gt 134000000 Build 22 1 4 gt 22001004 __CPCP__ Identifies the compiler You can use this symbol to flag parts of the source which must be recognized by the cpcp assembler only It expands to 1 CPU Expands to a string with the CPU supplied with the option cpu When no cpu is supplied this symbol is not defined __CORE__ Expands to a string with the core depending on the C compiler options option cpu The symbol expands to pcp2 when the option cpu is not specified _ DATE __ Expands to the compilation date mmm dd yyyy __DOUBLE_FP__ Expands to 0 The PCP always treats a double as float FILE Expands to the current source file name LINE Expands to the line number of the line whe
224. n depends on the context where your application will run These functions are for example all I O related functions Where possible these functions are implemented using file system simulation FSS This system can be used by CrossView Pro to simulate an I O environment which enables you to debug your application 2 2 1 ASSERT H assert expr Prints a diagnostic message if NDEBUG is not defined Implemented as macro 2 2 2 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 alpha betic character or a number A Z a z O 9 isalpha iswalpha Returns a non zero value when c is an alphabetic character A Z a z isblank iswblank Returns a non zero value when c is a blank character tab space iscntrl iswentrl Returns a non zero value when c is a control character isdigit iswditit Returns a non zero value when c is a numeric character 0 9 isgraph iswgraph Returns a non zero value when c is printable but not a space islower iswlower Returns a non zero value when c is a lowercase character a z Libraries 2 5 Ctype h Wctype h Description isprint ispunct isspace isupper isxdigit
225. n initial conversion state Returns a non zero value if so mbsrtowcs pwes src Restartable version of mbstowcs See n ps section 2 2 20 sidlib h The initial conversion state is specified by ps The input sequence of multibyte charactersis specified indirectly by src wesrtombs s src Restartable version of westombs See n ps section 2 2 20 sidlib h The initial conversion state is specified by ps The input wide string is specified indirectly by src mbrtowc pwc s n ps Converts a multibyte character s to a wide character pwc according to conversion state ps See also mbtowc in section 2 2 20 stdlib 2 44 PCP Reference Manual wertomb 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 wetob c Returns the multi byte character corresponding to the wide character c The returned multi byte character is represented as one byte Returns EOF on error mbrlen s n ps Inspects up to n bytes from the string s to see if those characters represent valid multibyte characters relative to the conversion state held in ps 2 2 25 WCTYPE H Most functions in wetype h represent the wide character variant of functions declared in ctype h and are discussed in section 2 2 2 ctype h In addition this header file provides extensible
226. n you tell the assembler via the control program 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 assembler generates a relocatable object file with relative addresses With the optional file 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 a file name or you specify more than one input file the control program names the generated list file s after the specified input file s with extension lst Note that object files and library files are not counted as input files Related information db Assembler option list file Generate list file Assembler option list format Format list file 5 156 PCP Reference Manual 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 Example To see how the control program will invoke the tools it needs to process the file test c ccpcp n test c ccpcp dry run test c The control program only displays the invocations of the tools it would use to create the final object file but does not actually perform the steps Related information d Control program option v Verbose output Tool Options Control Program 5 157 no default librari
227. name to it The definition of a heap is similar to the definition of a stack See also the heap keyword in section 8 8 3 Creating or Modifying Special Sections 8 25 8 26 7 db PCP Reference Manual See section 8 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 You must define exactly one copy table in one of the address spaces for a core Optionally you can specify an alignment for the copy table with the argument align This alignment must be equal or larger than the alignment that you specify for the address space itself If smaller the alignment for the address space is used The copy_unit argument specifies the size in MAUs of information chunks that are copied If you do not specify the copy unit the MAU size of the address space itself is used The dest argument specifies the destination address space that the code uses for the copy table The linker uses this information to generate the correct addresses in the copy table The memory into where the sections must be copied at run time must be accessible from this destination space Sections generated for the copy table may get a page restriction with the address space s page si
228. ng assembler operation The following tables provide an overview of all built in assembler functions expr can be any assembly expression resulting in an integer value Expressions are explained in section 3 6 Assembly Expressions in chapter Assembly Language of the User s Manual 3 4 7 PCP Reference Manual Overview of mathematical functions Function Description ABS expr Absolute value ACS expr Arc cosine ASN expr Arc sine AT2 expr1 expr2 Arc tangent ATN expr Arc tangent CEL expr Ceiling function COH expr Hyperbolic cosine COS expr Cosine FLR expr Floor function L10 expr Log base 10 LOG expr Natural logarithm MAX expr exerN MIN expr exprN POW expr1 expr2 RND SGN expr SIN expr SNH expr SAQAT expr TAN expr TNH expr XPN expr Maximum value Minimum value Raise to a power Random value Returns the sign of an expression as 1 0 or 1 Sine Hyperbolic sine Square root Tangent Hyperbolic tangent Exponential function raise e to a power PCP Assembly Language Overview of conversion functions Function Description CVF expr Convert integer to floating point CVI expr Convert floating point to integer FLD base value Shift and mask operation width start FRACT expr Convert floating point to 32 bit fractional SFRACT expr Convert floating point to 16 bit fractional LNG expr Conc
229. not the processed files part 5 114 PCP Reference Manual 7 Related information db Linker option M Generate map file Section 6 2 Linker Map File Format in Chapter List File Formats Tool Options Linker 5 115 misra c report Command line syntax misra c report i e Description With this option you tell the linker to create a MISRA C Quality Assurance report This report lists the various modules in the project with the respective MISRA C settings at the time of compilation If you do not specify a filename the file name mcr is used Example lpcp misra c report test o The linker creates a MISRA C report file test mcr Related information d gt Compiler option misrac 5 116 PCP Reference Manual munch Command line syntax munch Description With this option you tell the linker to activate the muncher in the pre locate phase The data sections are initialized when the application is downloaded The data sections are not re initialized when the application is restarted Example lpcp munch test o The linker activates the muncher in the pre locate phase while linking the file test o Related information i Tool Options Linker 5 117 N no rom copy Command line syntax N n0o 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 sections Howev
230. ns 8 42 PCP Reference Manual For example to select the code sections referenced from fool group refgrp ordered contiguous run_addr mem ext_c select ref_tree fool attributes x If section fool references foo2 and foo2 references foo3 then all these sections are selected by the selection shown above 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 _le_gb_group_name and _le_ge_group_name mark the begin and end of the group respectively where the begin is the lowest address used within this group and the end is the highest address used Notice that a group not necessarily occupies all memory between begin and end address The given label refers to where the section is located at run time versus load time 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 sectio
231. ns 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 w or rw attributes and you can switch between the b and s attributes Linker Script Language 8 43 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 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 in the section_layout space properties the linker places the sections in the address space like C B A where section A gets the highest possible address The contiguous keyword tells the linker to locate the sections in the
232. nsitive Assembly source files that are generated by the compiler must always be assembled and linked case sensitive When you are writing your own assembly code you may want to specify the case insensitive mode Example To create the file test e1f with case insensitive assembling and linking ccpcp c test c ccpcp case insensitive test c The assembler and linker now consider upper and lower case characters as being the same So for example the label LabelName is the same label as labelname Related information d Assembler option case sensitive Assemble case insensitive Linker option case sensitive Link case insensitive Tool Options Control Program 5 135 cs co cl 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 Stop after C files are compiled to assembly src co Stop after the files are assembled to object files obj cl Stop after the files are linked to a linker object file e1n To generate the object file test o ccpcp c test c ccpcp create object test c The control program stops after the file is assembled It does not link nor locate the generated output Related information d 5 136 P
233. nt This directive has no effect on the exit code of the assembler A label is not allowed before this directive Example DEFINE LONG SHORT MESSAGE This is a LONG string MESSAGE 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 Related information d gt FAIL Programmer Generated Error WARNING Programmer Generated Warning PCP Assembly Language 3 49 NAME Syntax NAME string Description The SOURCE directive specifies the name of the original C source module This directive is generated by the C compiler You do not need to specify this directive in hand written assembly Example SOURCE main c Related information 3 50 PCP Reference Manual ORG Syntax ORG abs loc sect_type attribute Description With the ORG directive you can specify an absolute location abs_ oc in memory of a section This is the same as a SDECL SECT without a section name This directive uses the following arguments abs loc Initial value to assign to the run time location counter abs loc must be an absolute expression If abs_loc is not specified then the value is zero sect_type An optional section type code code section data data section attribute An optional section attribute Code attibutes in
234. nt 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 Note that adjacent strings are concatenated When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels Tool Options Make Utility 5 185 Example Suppose the file myoptions contains the following lines k err errors txt test elf Specify the option file to the make utility mkpcp m myoptions This is equivalent to the following command line mkpcp k err errors txt test elf Related information i 5 186 PCP Reference Manual Command line syntax n Description With this option you tell the make utility to perform a dry run The make utility shows what it would do but does not actually perform these tasks This option is for example useful to quickly inspect what would happen if you call the make utility Example mkpcp n The make utility does not perform any tasks but displays what it would do if called without the option n Related information d Make utility option s Do not print commands before execution Tool Options Make Utility 5 187
235. ntrol program does not use the option itself but specifies it directly to the tool which the control program calls Example ccpcp Wl r test c The control program does not use the option r but calls the linker with the option r lpcp r Related information dhs 5 167 5 168 PCP Reference Manual w no warnings Command line syntax w n7 no warnings 77 Description With this option suppresses all warning messages or a specific warning If you do not specify this option all warnings are reported Example To suppress all warnings ccpcp w test c ccpcp no warnings test c To suppress warnings 100 ccpcp wl00 test c ccpcp no warnings 100 test c Related information dE Control program option warnings as errors Warnings as errors Tool Options Control Program 5 169 Wwarnings as errors Command line syntax warnings as errors Description With this option you tell the control program to treat warnings as errors Example ccpcp warnings as errors test c When a warning occurs the control program considers it as an error Related information db Control program option w Suppress all warnings 5 170 PCP Reference Manual 5 5 MAKE UTILITY OPTIONS You can use the make utility mkpcp from the command line to build your project The invocation syntax is mkpcp option target macro def This section describes all options for the make utility
236. numbers shall not be used A violation is reported when a pointer to a floating point type is converted to a pointer to an integer type typedef names shall not be reused Numeric constants should be suffixed to indicate type A violation is reported when the value of the constant is outside the range indicated by the suffixes if any Octal constants other than zero shall not be used All object and function identifiers shall be declared before use Identifiers shall not hide identifiers in an outer scope Declarations should be at function scope 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 MISRA C Rules 32 33 34 35 36 37 38 39 40 42 43 4
237. o 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 Libraries 2 43 2 2 24 WCHAR H Many functions in wchar h represent the wide character variant of other functions so these are discussed together See sections 2 2 19 stdio h 2 2 20 stdlib h 2 2 21 strings b and 2 2 22 time h The remaining functions are described below They perform conversions between multi byte characters and wide characters In these functions 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 wehar_t we_value wide character value solved so far unsigned short n_bytes number of bytes of solved multibyte unsigned short encoding encoding rule for wide character lt gt multibyte conversion mbstate_t When multibyte characters larger than 1 byte are used this struct will be used to store the conversion information when not all the bytes of a particular multibyte character have been read from the source In this implementation multi byte characters are 1 byte long MB_CUR_MAX and MB LEN MAX are defined as 1 and this will never occur mbsinit ps Determines whether the object pointed to by ps is a
238. of Contents PCP C LANGUAGE 1 1 1 1 Introduction a sr na n SS R A a 1 3 1 2 DatasTy AEAEE E EA E A OM E 1 4 1 3 Key WOrdS 222 ae a A TAE chs bale AAAA Ae A E 1 5 1 4 Function Qualifiers 2 00 00 auaa 1 7 1 5 Intrinsic Functions eie senese cpta d p nerea ee 1 8 1 6 r A E E E E RA ee E ET 1 10 1 7 Predefined Macros oie rroi ees aia meenu eari raa 1 14 LIBRARIES 2 1 2 1 INtrOdUChON y e O ETEA EE ek te as es 2 3 2 2 Library Functions Aeee eoa aeea teens 2 4 2 2 1 assert hrr eene kena ena Men E AA 8a 2 4 2 2 2 ctype h and wetype h suuuaaaauaaa eee 2 4 2 2 3 erno ena yh E O E OE OL 2 5 2 2 4 fenti h Gor teose roa rE kG ae ee AENA 2 7 2 2 5 fenV r s aoina A Ace he ots aad A sane A A 2 7 2 2 6 EELA a AEE AE AE E EEA EAA E AOS EE N 2 8 2 207 SS Hranu teeta tartiet eee seine eee hee ol es 2 8 2 2 8 inttypes h and stdinth 0 0 0 2c e eee 2 9 2 2 9 ISOOAG sae haea UG assy vob hase a wel a e hae 2 10 2 2 10 mits ae a eea oe recat e heen hk a e AA hace 2 10 2 2 11 LOCALE h es oink Rea a a A ES Bs 2 10 2 2 12 math h and tgmath h 2 ee 2 11 2 2 13 Semp oe hove fates eos dA ae beamed 2 18 2 2 14 Siena Ne ic adaecats a seh hds chs R dnd Phas on SA aded ata 2 18 2 2 15 Stare aces AE E OA ee ae the DAR cA he oh 2 19 2 2 16 Std bOOl Pict ats cued dwelt ear haels Martha aA 2 19 22 17 stddef Hire hrena neru tEn ee ete ede E O as OC 2 20 2 2 18 stdin teea elesen a seed wee e e e eaa 2 20 2 2 19 stdio h and wchar h 6 ee
239. oid _fp _install_trap_handler void _fp_exception_info t This function call expects a pointer to a function which in turn expects a pointer to a structure of type fp exception_info_t The members of _fp_exception_info_t are exception This member contains one of the following numerical values EF INVOP EFDIVZ EFOVFL EFUNFL EFINEXCT operation This member contains one of the following numbers _OP_ADDITION _OP_SUBTRACTION _OP_COMPARISON _OP_EQUALITY _OP_LESS_THAN _OP_LARGER_THAN _OP_MULTIPLICATION _OP_DIVISION _OP_CONVERSION source format destination_format PCP Reference Manual Numerical values of these two members are _TYPE_ SIGNED CHARACTER _TYPE_UNSIGNED CHARACTER _TYPE SIGNED SHORT INTEGER _TYPE_UNSIGNED_SHORT_ INTEGER _TYPE SIGNED INTEGER _TYPE UNSIGNED INTEGER _TYPE SIGNED LONG INTEGER _TYPE_UNSIGNED_ LONG INTEGER _TYPE FLOAT _TYPE DOUBLE operand1 left side of binary or right side of unary operand2 right side for binary result These three are of the following type to receive and return a value of arbitrary type typedef union fp value_union t char c unsigned char uc short s unsigned short us int i unsigned int ui long l unsigned long ul float f if _SINGLE_FP double d endif fp value union t Run time Environment The following table lists all the exception code flags the corresponding error description and resu
240. ointer parameter in a function prototype should be declared as pointer to const if the pointer is not used to modify the addressed object All exit paths from a function with non void return type shall have an explicit return statement with an expression A function identifier shall only be used with either a preceding amp or with a parenthesized parameter list which may be empty If a function returns error information then that error information shall be tested A violation is reported when the return value of a function is ignored Pointers and arrays x x 17 1 17 2 17 3 17 4 17 5 17 6 R R R R A R Pointer arithmetic shall only be applied to pointers that address an array or array element Pointer subtraction shall only be applied to pointers that address elements of the same array gt gt lt lt shall not be applied to pointer types except where they point to the same array In general checking whether two pointers point to the same object is impossible The compiler will only report a violation for a relational operation with incompatible pointer types Array indexing shall be the only allowed form of pointer arithmetic The declaration of objects should contain no more than 2 levels of pointer indirection A violation is reported when a pointer with three or more levels of indirection is declared The address of an object with automatic storage shall n
241. on as a floating point value Example HTAN SET TNH 1 HTAN 0 76159415595 PCP Assembly Language 3 17 UNF expression Converts expression to a floating point value expression should represent a 16 bit binary fraction Example FRC EQU UNF 0x4000 FRC 0 5 XPN expression Returns the exponential function base e raised to the power of expression as a floating point value Example EXP EQU XPN 1 0 EXP 2 718282 3 18 7 PCP Reference Manual 3 3 ASSEMBLER DIRECTIVES AND CONTROLS 3 3 1 OVERVIEW OF ASSEMBLER DIRECTIVES Assembler directives are grouped in the following categories Assembly control directives Symbol definition directives Data definition Storage allocation directives Macro and conditional assembly directives Debug directives The following tables provide an overview of all assembler directives Overview of assembly control directives Directive Description COMMENT Start comment lines DEFINE Define substitution string END End of source program FAIL Programmer generated error message INCLUDE Include file MESSAGE Programmer generated message ORG Initialize memory space and location counters to create a nameless section SDECL Declare a section with name type and attributes SECT Activate a declared section UNDEF Undefine DEFINE symbol WARNING Programmer generated warning PCP Assembly Language Overview of sy
242. ons in sets of two bytes If an argument is NULL its corresponding address location is filled with zeros If the evaluated argument is out of the range 1 1 gt the assembler issues a warning and saturates the fractional value Example FRCT FRACT 0 1 0 2 0 3 SFRCT SFRACT 0 1 0 2 0 3 Related information d SPACE Define storage ACCUM Define 64 bit constant fraction in 18 46 bits format PCP Assembly Language 3 41 GLOBAL Syntax GLOBAL symbol symbol Description All symbols or labels defined in the current section or module are local to the module by default You can change this default behavior with assembler option ig With the GLOBAL directive Global Section Symbol Declaration you declare one of more symbols as global This means that the specified symbols are defined within the current section or module and that those definitions should be accessible by all modules using the EXTERN directive Only symbols that are defined with the EQU directive or program labels can be made global If the symbols that appear in the operand field are not used in the module the assembler gives a warning A label is not allowed before this directive Example SDECL pcpdata data DATA SECT pcpdata data GLOBAL LOOPA LOOPA will be globally accessible by other modules LOOPA HALF 0x100 assigns the value 0x100 to LOOPA Related information d EXTERN External symbol declaration
243. ool Options Assembler 5 81 O optimize Command line syntax Oflags optimize lags You can set the following flags g G generics Allow generic instructions s S__ instr size Optimize instruction size Default Ogs Description With this option you can control the level of optimization If you do not use this option Ogs is the default Example The following invocations are equivalent and result all in the default optimizations aspcp test src aspcp Ogs test src aspcp optimize t generics instr size test src Related information d Section 5 3 Assembler Optimizations in Chapter Using the Assembler of the User s Manual 5 82 PCP Reference Manual o output Command line syntax Ofile output i e 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 o Example aspcp o relobj o asm src aspcp output relobj o asm src The assembler creates the file relobj o for the assembled file asm src Without the option o the assembler uses the name of the input file and creates asm o Related information i Tool Options Assembler 5 83 P prefix Command line syntax Pprefix prefix prefix Description PCP assembler only With this option you can specify a prefix to use for global and external symbols The prefix can be useful to
244. option without arguments you tell the linker to treat all warnings as errors This means that the exit status of the linker will be non zero after the detection of one or more linker warnings As a consequence the linker will not produce any output files You can also limit this option to specific warnings by specifying a comma separated list of warning numbers Example lpcp warnings as errors test o When a warning occurs the linker considers it as an error Related information db Linker option w Suppress some or all warnings 5 130 5 4 PCP Reference Manual CONTROL PROGRAM OPTIONS The control program cepep facilitates the invocation of the various components of the PCP toolchain from a single command line Some options are interpreted by the control program itself other options are passed to those programs in the toolchain that accept the option Recognized input files The control program recognizes the following input files Files with a c suffix are interpreted as C source programs and are passed to the compiler Files with a asm suffix are interpreted as hand written assembly source files which have to be passed to the assembler Files with a sre suffix are interpreted as compiled assembly source files They are directly passed to the assembler Files with a a or e1b suffix are interpreted as library files and are passed to the linker Files with a o suffix are interpreted as object files
245. or precedence rules Mixed arithmetic should use explicit casting 9 6 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 A R A R R R A R R R R A R R A R R A A R R PCP Reference Manual Tests of a non Boolean value against 0 should be made explicit F P variables shall not be tested for exact equality or inequality Constant unsigned integer expressions should not wrap around There shall be no unreachable code All non null statements shall have a side effect A null statement shall only occur on a line by itself Labels should not be used The goto statement shall not be used The continue statement shall not be used The break statement shall not be used except in a switch An if or loop body shall 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 modif
246. orrect With this option you keep the generated object file 0 when an error occurs By default the assembler removes the generated object file 0 when an error occurs This is useful when you use the make utility mkpcp 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 Example aspcp k test src When an error occurs during assembly the generated output file test o will not be removed Related information d gt Assembler option warnings as errors Treat warnings as errors 5 76 PCP Reference Manual L list format Command line syntax Lflags list format flags You can set the following flags 0 same as LCDEGILMNPQRVWXY 1 same as Lcdegilmnpqrvwxy d D_ section Section directives e E symbol Symbol definition directives g G generic expansion Generic instruction expansion i I generic Generic instructions m M macro Macro definitions n N empty line Empty source lines p P conditional Conditional assembly q Q equate Assembler EQU and SET directives r R relocations Relocation characters r v V equate values Assembler EQU and SET values w W wrap lines Wrapped source lines x X macro expansion Macro expansions y Y cycle count Cycle c
247. ory see 2 2 11 locale h of the current locale a non zero value is returned that can be used as an argument in the towctrans function towctrans wc desc Transforms wide character wc into another Function wide character described by desc Equivalent to locale specific transformation towlower wc towupper wc towctrans wc wctrans tolower towctrans wc wctrans toupper 2 46 LIBRARIES PCP Reference Manual PCP ASSEMBLY LANGUAGE all TASKING M ddaLdVH PCP Assembly Language 3 3 3 1 INTRODUCTION This chapter contains a detailed description of all built in assembly functions directives and controls For a description of the PCP instruction set refer to the PCP2 32 bit Single Chip Microcontroller 2000 Infineon 3 2 BUILT IN ASSEMBLY FUNCTIONS 3 2 1 OVERVIEW OF BUILT IN ASSEMBLY FUNCTIONS The built in assembler functions are grouped into the following types Mathematical functions comprise among others transcendental random value and min max functions Conversion functions provide conversion between integer floating point and fixed point fractional values String functions compare strings return the length of a string and return the position of a substring within a string Macro functions return information about macros Address calculation functions return the high or low part of an address Assembler mode functions relati
248. osinus of x atanh atanhf atanhl atanh Returns the arc hyperbolic tangent of xX Exponential and logarithmic functions All of these functions are new in C99 except for exp log and 1og10 Math h Tgmath h Description exp expf expl exp Returns the result of the exponential function ex exp2 exp2f exp2l exp2 Returns the result of the exponential function 2 Not implemented expml expmlf expm1l expm1 Returns the result of the exponential function e 1 Not implemented log logf logl log Returns the natural logarithm 1n x x gt 0 log10 logl0f 1log101 log10 Returns the base 10 logarithm of x x gt 0 loglp loglpf loglpl loglp Returns the base e logarithm of 1 x x lt gt 1 Not implemented log2 log2f 1log21 log2 Returns the base 2 logarithm of x x gt 0 Not implemented ilogb ilogbf ilogbl ilogb Returns the signed exponent of x as an integer x gt 0 Not implemented logb logbf logbl logb Returns the exponent of x as a signed integer in value in floating point notation x gt 0 Not implemented Libraries Rounding functions Math h Tgmath h Description ceil ceilf ceill floor floorf floorl rint rintf rintl lrint lrintf Ilrintl llrint Jlrintf Ilrintl nearbyint nearbyintf nearbyintl round roundf roundl lround lroundf lroundl llround1lroundf llroundl trunc truncf truncl ceil floor rint lrint llrint nearbyint round lround llround trunc R
249. ot be assigned to another object that may persist after the first object has ceased to exist MISRA C Rules Structures and unions 18 1 18 2 x 18 3 18 4 R R R R All structure or union types shall be complete at the end of a translation unit An object shall not be assigned to an overlapping object An area of memory shall not be reused for unrelated purposes Unions shall not be used Preprocessing directives 19 1 19 2 x 19 3 19 4 19 5 19 6 19 7 19 8 19 9 19 10 19 11 19 12 A A R R R R A R R R R R include statements in a file should only be preceded by other preprocessor directives or comments Non standard characters should not occur in header file names in include directives The include directive shall be followed by either a lt filename gt or filename sequence C macros shall only expand to a braced initializer a constant a parenthesized expression a type qualifier a storage class specifier or a do while zero construct Macros shall not be define d or undef d within a block undef shall not be used A function should be used in preference to a function like macro A function like macro shall not be invoked without all of its arguments Arguments to a function like macro shall not contain tokens that look like preprocessing directives A violation is reported when the first
250. ot perform any tasks but displays the following version information TASKING PCP VX toolset ELF archiver vxx yrz Build nnn Copyright year Altium BV Serial 00000000 Related information i 5 208 PCP Reference Manual 7 X Command line syntax x o v Description Extract an existing module from the library o Give the extracted object module the same date as the last modified date that was recorded in the library Without this suboption it receives the last modified date of the moment it is extracted v Verbose the archiver shows which files are extracted Example To extract the file obj o from the library lib a arpcp x lib a objl o If you do not specify an object module all object modules are extracted arpcp x lib a Related information J Tool Options Archiver 5 209 W Command line syntax wlevel Description With this suboption you tell the archiver to suppress all warnings above the specified level The level is a number between 0 9 The level of a message is printed between parentheses after the warning number If you do not use the w option the default warning level is 8 Example To suppresses warnings above level 5 arpcp x w5 lib a objl o Related information ds 5 210 TOOL OPTIONS PCP Reference Manual LIST FILE FORMATS all TASKING M daLdVH List File Formats 6 3 6 1 ASSEMBLER LIST FILE FORMAT The assembler list f
251. ou can mix short and long option names on the command line Options can have flags or suboptions To switch a flag on use a lowercase letter or a longflag To switch a flag off use an uppercase letter or a longflag Separate longflags with commas The following two invocations are equivalent lpcp mfkl test o lpcp map file format files link locate test o When you do not specify an option a default value may become active 5 90 PCP Reference Manual _ 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 lpcp lpcp help lpcp To see a detailed description of the available options enter lpcp help options Related information ib Tool Options Linker 5 91 c chip output Command line syntax c basename formal addr_size chip output basename format addr_size You can specify the following formats THEX Intel Hex SREC Motorola S records The addr_size specifies the size of the addresses in bytes record length For Intel Hex you can use the values 1 2 and 4 default For Motorola S you can specify 2 S1 records 3 S2 records default or 4 bytes S3 records Description With this option you specify the Intel Hex or Motorol
252. ounts Default LDEGiMnPqrVWXy Description With this option you specify which information you want to include in the list file Use this option in combination with the option 1 list file If you do not specify this option the assembler uses the default LDEGiMnPqrVWXy With option tl the assembler also writes section information to the list file Tool Options Assembler 5 77 Example aspcp l Ldm test src aspcp list file list format section macro test src The assembler generates a list file that includes all default information plus section directives and macro definitions Related information d gt Assembler option 1 Generate list file Assembler option tl Display section information in list file Linker option M Generate map file Section 6 1 Assembler List File Format in Chapter List File Formats 5 78 PCP Reference Manual I list file Command line syntax 1 list 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 Example To generate a list file with the name test 1st enter aspcp l test src aspcp list file test sre Related information dE Assembler option L List file formatting options Linker option M Generate map file Section 6 1 Assembler List File Format in Chapter L
253. p group specifications section_statements With the section_statemenis you generally select sets of sections to form the group This is described in subsection Selecting sections for a group Instead of selecting sections you can also modify special sections like stack and heap or create a reserved section This is described in section 8 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 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 Dg matches with all section names K matches with a single character in the section name a4 takes the next character literally abc matches with a single a b or c character a z matches with any single character in the range a to z group 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 Linker Script Language 8 41 6 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 w
254. p w test src aspcp no warnings test sre To suppress warnings 135 and 136 aspcp wl35 136 test src aspcp no warnings 135 136 test sre Related information d Assembler option warnings as errors Treat warnings as errors 5 88 PCP Reference Manual 7 Wwarnings as errors Command line syntax warnings as errors 2umber Description If the assembler encounters an error it stops assembling When you use this option without arguments you tell the assembler to treat all warnings as errors This means that the exit status of the assembler will be non zero after one or more assembler warnings As a consequence the assembler now also stops after encountering a warning You can also limit this option to specific warnings by specifying a comma separated list of warning numbers Example aspcp warnings as errors test src When a warning occurs the assembler considers it as an error No object file is generated unless you specify option k keep output files Related information db Assembler option w suppress some or all warnings Tool Options Linker 5 89 5 3 LINKER OPTIONS d See section 5 4 Control Program Options 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 two minus characters You can abbreviate long option names as long as it forms a unique name Y
255. pare westoull 2 10 7 2 2 9 1SO0646 H PCP Reference Manual The header file iso646 h adds tokens that can be used instead of regular operator tokens define define define define define define define define define define define and and_eq bitand bitor compl not not_eq or or_eq xor xor_ eq 2 2 10 LIMITS H RM em I gt ona oi 5 gt Contains the sizes of integral types defined as macros 2 2 11 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 LC_COLLATE LC_CTYPE m LC_NUMERIC LC_MONETARY gt Libraries 211 struct lconv localeconv void Returns a pointer to type stuct lconv with values appropriate for the formatting of numeric quantities according to the rules of the current locale The struct lconv in this header file is conforming the ISO standard 2 2 12 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
256. pecify E without flags the default is ECMP c C comments Keep comments m M make Generate dependencies for make p P noline Strip line source position info Description With this option you tell the compiler to preprocess the C source On the command line the compiler sends the preprocessed file to stdout To capture the information in a file specify an output file with the option o With Ec you tell the preprocessor to keep the comments from the C source file in the preprocessed output With Em the compiler generates dependency lines that can be used in a Makefile The preprocessor output is discarded The default target name is the basename of the input file with the default object file suffix With Ep you tell the preprocessor to strip the line source position information lines starting with line These lines are normally processed by the assembler and not needed in the preprocessed output When you leave these lines out the output is easier to read Example cpcp EcMP test c o test pre cpcp preprocess comments make noline test c output test pre The compiler preprocesses the file test c and sends the output to the file test pre Comments are included but no dependencies are generated and the line source position information is not stripped from the output file 5 18 PCP Reference Manual 7 Related information i Tool Options Compiler 5 19 error file Command line synt
257. place in the map file Example To generate a map file test map lpcp Mtest map test o lpcp map file test map test o The control program by default tells the linker to generate a map file Related information Gls Linker option m Map file formatting options Section 6 2 Linker Map File Format in Chapter List File Formats Tool Options Linker 5 113 m map file format Command line syntax m flags map file format lags You can set the following flags 0 same as mcfikLMNoQrSU link info 1 same as mCfiKIMNoQRSU locate info 2 same as mcfiklmNoQrSu most info c C callgraph Call graph info f F files Processed files info i I invocation Invocation and tool info k K link Link result info 1 L__ 4 locate Locate result info m M memory Memory usage info n N nonalloc Non alloc info 0 O_ overlay Overlay info q Q statics Module local symbols r R crossref Cross references info s S_ 1sD Processor and memory info u U rules Locate rules Default m2 Description With this option you specify which information you want to include in the map file Use this option in combination with the option M map file If you do not specify this option the linker uses the default m2 Example lpcp Mtest map mF test o lpcp map file test map map file format files test o The linker generates the map file test map that includes all default information but
258. pressions of real floating type Math h Tgmath h Description isgreater Returns the value of x gt y isgreaterequal Returns the value of x gt y isless Returns the value of x lt y islessequal Returns the value of x lt y islessgreater Returns the value of x lt y x gt y isunordered Returns 1 if its arguments are Classification macros unordered 0 otherwise The next are implemented as macros These macros are type generic and therefor do not have a parallel function in tgmath h All arguments must be expressions of real floating type Math h Tgmath h Description fpclassify Returns the class of its argument FP_INFINITE FP_NAN FP_NORMAL FP_SUBNORMAL Or FP_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 value is negative 2 18 PCP Reference Manual 7 2 2 13 SETJMP H The setjmp and longjmp in this header file implement a primitive form of nonlocal jumps which may be used to handle exceptional situations This facility is traditionally considered more portable than signal h int setjmp jmp_buf env Records its caller
259. priority order in which the linker searches for system libraries specified with the 1 option is 1 The path that is specified with the L option 2 The path that is specified in the environment variable LIBTC1V1_2 LIBTC1V1_3 or LIBTC2 when the product was installed 3 The default directory PRODDIR 1lib 4 The processor specific directory for example PRODDIR lib pcp1 Example Suppose you call the linker as follows lpcp test o Lce mylibs lc First the linker looks in the directory c mylibs for library libc a this option Tool Options Linker 5 107 If it does not find the requested libraries it looks in the directory that is set with the environment variable LIBTC1V1_ 2 LIBTC1V1_ 3 or LIBTC2 Then the linker looks in the default directory PRODDIR 1lib for libraries Related information d Linker option 1 Link system library Section 6 4 2 How the Linker Searches Libraries in Chapter Using the Linker of the User s Manual Section 1 3 1 Configuring the Command Line Environment in Chapter Software Installation of the User s Manual 5 108 PCP Reference Manual I library Command line syntax Iname library name Description With this option you tell the linker to search also in system library libname a 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 variab
260. program tells the compiler assembler and linker to redirect error messages to a file The error file will be named after the input file with extension err compiler errors ers assembler errors or e1k linker errors Example To write errors to error files instead of stderr enter ccpcp error file t test c Related information d Control program option warnings as errors Warnings as errors Tool Options Control Program 5 143 F no double Command line syntax F no double Description With this option you tell the control program 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 Example ccpcp F test c ccpcp no double test c The file test c is processed where variables of the type double are treated as float in the compilation phase Related information db Control program option use double precision fp Do not replace doubles with floats 5 144 7 PCP Reference Manual f option file Command line syntax f file option file ile Description Instead of typing all options on the command line you can create a option file which contains all options and file you want to specify With this option you specify the option file to the control program Use an option file when the length of the command line would exceed the limits of the operating
261. ption 1 Generate list file in section 5 2 Assembler Options of Chapter Tool Options Related information d Assembler control LIST Exclude include lines in assembly list file Assembler function LST in section 3 2 Built in Asembly Functions 3 72 7 PCP Reference Manual LIST flags Syntax Begin of assembly file LIST flags Description If you generate a list file with the assembler option 1 you can use the LIST controls to specify which type of source lines the assembler must exclude from the list file Without the command line option 1 the LIST control has no effect You can set the following flags to remove or include lines d D e E 2 G i I m M n N p P q Q r R v V w W x X y Y Lines with section directives SECT and SDECL Lines with symbol definition directives EXTERN GLOBAL LOCAL CALLS Lines with generic instruction expansion Lines with generic instructions Lines with macro definitions MACRO and DUP Empty source lines Lines with conditional assembly Lines with the EQU or SET directive Lines with relocation characters r Lines with EQU or SET values Wrapped part of a line Lines with expanded macros Lines with cycle counts If you do not specify this control or the assembler option Lflag the assembler uses the default LCDEGiIMnPqrVWXy Example To exclude assembly files with controls from the list file begin of source LIST c Rel
262. r Options of Chapter Tool Options Related information d 3 68 PCP Reference Manual HW_ONLY Syntax HW_ONLY Description Normally the assembler replaces instructions by other smaller or faster instructions For example the instruction jeq d0 0 label1 is replaced by jz d0 labell With the HW_ONLY control you instruct the assembler to encode all instruction as they are The assembler does not substitute instructions with other faster or smaller instructions Example begin of source SHW_ONLY the assembler does not substitute instructions with other smaller or faster instructions Related option d Assembler option Og Allow generic instructions in section 5 2 Assembler Options of Chapter Tool Options Related information ds PCP Assembly Language 3 69 IDENT Syntax IDENT LOCAL IDENT GLOBAL Description With the controls SIDENT LOCAL and SIDENT GLOBAL you tell the assembler how to treat symbols that you have not specified explicitly as local or global with the assembler directives LOCAL or GLOBAL By default the assembler treats all symbols as local symbols unless you have defined them explicitly as global Example begin of source SIDENT GLOBAL assembly labels are global by default Related option d Assembler option i Treat labels by default local global in section 5 2 Assembler Options of Chapter Tool Options Related information d gt Assembler di
263. r Options 1 0 0 0 0 c cece ee ee 5 3 5 2 Assembler Options 0 0 00 000 cece eee ees 5 54 5 3 Linker Options 0 00 0 0 e aa ae aeai ae eee 5 89 5 4 Control Program Options 0 000 eee eee 5 130 5 5 Make Utility Options 0 00 0 c eee 5 170 5 6 Archiver Options sesent 44 eta eedud veneers EE 5 197 Table of Contents LIST FILE FORMATS 6 1 6 1 Assembler List File Format 0 00 00 00005 6 3 6 2 Linker Map File Format 00 00 00 eee 6 5 OBJECT FILE FORMATS 7 1 7 1 ELF DWARF Object Format 00000005 7 3 7 2 Motorola S Record Format 0 00000 e eee ee 7 4 7 3 Intel Hex Record Format 00 0 00 cee 7 8 LINKER SCRIPT LANGUAGE 8 1 8 1 IntroductiOn aee e Ried E Payee ek a oA 8 3 8 2 Structure of a Linker Script File 8 3 8 3 Syntax of the Linker Script Language 8 6 8 3 1 Preprocessing rhe ea Ve A Aes Bee egies 8 6 8 3 2 Lexical Syntax ta ctiet earch oe Min ou ee oY 8 7 8 3 3 ToGnnti fiers oes ca isk Bis ah BAe A a ace oe aan 8 7 8 3 4 EXPressiOns jes cdg eins MEG Ee Eth SG he ea 8 8 8 3 5 Built in Functions 0 anea c cee eee 8 9 8 3 6 LSL Definitions in the Linker Script File 8 11 8 3 7 Memory and Bus Definitions 00 8 11 8 3 8 Architecture Definition 00 0000 c eee 8 13 8 3 9 Derivative Definition 0 00 000 e eee ee 8 15 8 3 10 Processor Defin
264. r not to locate any section in the memory by default You can locate sections in such memories using an absolute address or range restriction see subsection Locating a group in section 8 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 The size field specifies the size in MAU of the memory This field is required 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 The map field specifies how this memory maps onto an internal bus Mappings are described in section 8 5 4 Mappings Linker Script Language 8 33 memory mem_name type rom mau 8 size 64k speed 2 map map description With the bus keyword you define a bus in a derivative definition Buses are described in section 8 5 2 Defining Internal Buses 8 34 7 PCP Reference Manual 8 7 SEMANTICS OF THE BOARD SPECIFICATION Keywords in the board specification processor derivative bus mau width map memory type reserved rom ram nvram mau size speed map map dest bus space dest_dbits dest_offset size src_dbits src_offset 8 7 1 DEFINING A PROCESSOR b If you have a target board with multiple processors that have the same derivative you need to in
265. re this macro is called REVISION _ Expands to the revision number of the compiler Digits are represented as they are characters for prototypes alphas betas are represented by 1 Examples v1 0r1 gt 1 v1 0rb gt 1 PCP C Language Macro Description __SFRFILE_ cpu This macro expands to the filename of the used SFR file including the lt gt The cpu is the argument of the macro For example if cpu tc1920b is specified the macro__ SFRFILE___ __CPU___ expands to __SFRFILE__ tc1920b which expands to lt regtcl1920b sfr gt __SINGLE_FP__ Expands to 1 The PCP compiler always treats a double as float _ STDC __ Identifies the level of ANSI standard The macro expands to 1 if you set option language Control language extensions otherwise expands to 0 __STDC_HOSTED__ Always expands to 0 indicating the implementation is not a hosted implementation __STDC_VERSION _ Identifies the ISO C version number Expands to 199901L for ISO C99 or 199409L for ISO C90 __TASKING__ Identifies the compiler as a TASKING compiler Expands to 1 ifa TASKING compiler is used __TASKING_SFR__ Expands to 1 if TASKING sfr files are used Not defined when option no tasking sfr is used _ TIME _ Expands to the compilation time hh mm ss __VERSION__ Expands to a number to identify the compiler version Mmmm The M is the major version number and the mmm is a three di
266. rective LOCAL Local symbol declaration Assembler directive GLOBAL Global symbol declaration 3 70 PCP Reference Manual LIST ON OFF Syntax LIST ON assembly source lines LIST OFF Description If you generate a list file with the assembler option 1 you can use the LIST ON and LIST OFF controls to specify which source lines the assembler must write to the list file Without the command line option I the LIST ON and LIST OFF controls have no effect The LIST ON control actually increments a counter that is checked for a positive value and is symmetrical with respect to the LIST OFF control Note the following sequence Counter value currently 1 SLIST ON Counter value 2 SLIST ON Counter value 3 SLIST OFF Counter value 2 SLIST OFF Counter value 1 The listing still would not be disabled until another LIST OFF control was issued Example Suppose you assemble the following assembly source with the assembler option L SDECL pcptext code code SECT pcptext code 7 source line in list file SLIST OFF 7 source line not in list file SLIST ON 7 source line also in list file END PCP Assembly Language 3 71 The assembler generates a list file with the following lines SDECL pcptext code code SECT pcptext code 7 source line in list file SLIST ON sree END source line also in list file Related option d gt Assembler o
267. rence Manual SECT Syntax SECT name RESET Description With the SECT directive you activate a previously declared section with the name name Before you can activate a section you must define the section with the SDECL directive You can activate a section as many times as you need With the section attribute RESET you can reset counting storage allocation in data sections that have section attribute max Examples sdecl pcpdata data data declare data section sect pepdata data activate section d SDECL Declare a section with name type and attributes ORG Initialize a nameless section PCP Assembly Language 3 57 SET Syntax symbol SET expression SET symbol expression Description With the SET directive you assign the value of expression to symbol temporarily If a symbol was defined with the SET directive you can redefine that symbol in another part of the assembly source using another SET directive The SET directive is useful in establishing temporary or reusable counters within macros Expression must be absolute and forward references are allowed LAN Symbols that are set with the EQU directive cannot be redefined Example COUNT SET 0 Initialize COUNT Later on you can assign other values to the symbol COUNT LA L Related information d EQU Assign permanent value to a symbol 3 58 PCP Reference Manual SIZE Syntax SIZE s
268. rent directory Related information db Assembler option I Add directory to include file search path in section 5 2 Assembler Options of Chapter Tool Options PCP Assembly Language 3 45 LOCAL Syntax LOCAL symbol symbol Description All symbols or labels defined in the current section or module are local to the module by default You can change this default behavior with assembler option ig With the LOCAL directive Local Section Symbol Declaration you declare one of more symbols as local This means that the specified symbols are explicitly local to the module in which you define them If the symbols that appear in the operand field are not used in the module the assembler gives a warning A label is not allowed before this directive Example SDECL pcpdata data data SECT pcpdata data LOCAL LOOPA LOOPA is local to this section LOOPA HALF 0x100 assigns the value 0x100 to LOOPA Related information d gt EXTERN External symbol declaration GLOBAL Global symbol declaration 3 46 PCP Reference Manual MACRO ENDM Syntax macro name MACRO argument argumeni macro_definition_statements ENDM Description With the MACRO directive you define a macro Macros provide a shorthand method for handling a repeated pattern of code or group of instructions You can define the pattern as a macro and then call the macro at the points in the program where the patte
269. rgument is used as an index to jump within this table binary switch force binary lookup table code A binary search table is a table filled with a value to compare the switch argument with and a target address to jump to smart_switch let the compiler decide the switch method used Gb See section 2 11 Switch Statement of the User s Manual pragma tradeoff level Specify whether the used optizations should opimize for more speed 0 regardless of code size or for smaller code size 4 regardless of speed Gb See also compiler option t tradeoff in section Compiler Options in Chapter Tool Options pragma warning number With this pragma you can disable warning messages If you do not specify a warning number all warnings will be suppressed db See also compiler option w no warnings in section Compiler Options in Chapter Tool Options pragma 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 1 14 n PCP Reference Manual A weak definition ca
270. rintf s format arg 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 Performs a formatted write to the stream stdout Returns EOF WEOF on error FSS implementation Performs a formatted write to string s Returns EOF WEOF on error Same as sprintf butn specifies the maximum number of characters including the terminating null character to be written Same as fprintf fwprintf but extra arguments are given as variable argument list arg See section 2 2 15 stdarg h FSS implementation Same as printf wprintf but extra arguments are given as variable argument list arg See section 2 2 15 stdarg h FSS implementation Same as sprintf swprintf but extra arguments are given as variable argument list arg See section 2 2 15 stdarg h 2 30 7 Direct input output Stdio h PCP Reference Manual Description fread ptr size nobj stream fwrite ptr size nobj stream Random access Stdio h Description Reads nobj members of size bytes from the given stream into the array pointed to by ptr Returns the number of elements succesfully read FSS implementation Writes nobj members of size bytes from to the array pointed to by pir to the given stream Returns the number of elements succesfully written FSS implementation fseek stream o
271. ription Instead of typing all options on the command line you can create an option file which contains all options and files you want to specify With this option you specify the option file to the assembler 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 Multiple command line arguments on one line in the option file are allowed To include whitespace in an argument surround the argument with single or double quotes If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded Note that adjacent strings are concatenated When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels 5 68 PCP Reference Manual 7 Example Suppose the file myoptions contains the following lines Ctc1920b test src Specify the option file to the assembler aspcp f myoptions aspcp option file myoptions This is equivalent to the following command line aspcp Ctcl
272. rn would repeat The ENDM directive indicates the end of the macro The definition of a macro consists of three parts e Header which assigns a name to the macro and defines the arguments e Body which contains the code or instructions to be inserted when the macro is called e Terminator which indicates the end of the macro definition ENDM directive The arguments are symbolic names that the macro preprocessor replaces with the literal arguments when the macro is expanded called Each formal argument must follow the same rules as symbol names the name can consist of letters digits and underscore characters _ The first character cannot be a digit Argument names cannot start with a percent sign Macro definitions can be nested but the nested macro will not be defined until the primary macro is expanded You can use the following operators in macro definition statements PCP Assembly Language Operator Name Description Macro argument Concatenates a macro argument with concatenation adjacent alphanumeric characters Return decimal Substitutes the symbol sequence with a value of symbol character string that represents the decimal value of the symbol Return hex Substitutes the symbol sequence with a value of symbol character string that represents the hexadecimal value of the symbol Macro string Allows the use of macro arguments as literal delimiter strings Macro local lab
273. ror messages and verbose messages to standard out Without this option the make utility sends these messages to standard error AN This option is only useful on UNIX systems Example mkpcp w The make utility sends messages to standard out instead of standard error Related information i Tool Options Archiver 5 197 5 6 ARCHIVER OPTIONS The archiver and library maintainer arpcp is a tool to build library files and it offers the possibility to replace extract and remove modules from an existing library The invocation syntax is arpcp key option sub_option library object_file This section describes all options for the archiver Some suboptions can only be used in combination with certain key options They are described together Suboptions that can always be used are described separately The archiver is a command line tool so there are no equivalent options in EDE Description Option Suboption Display an overview of all options Display version information V Read options from file f file Print object module to standard output p Suppress warnings above level n wn Main functions Delete object module from library d V Move object module to another position m a b v Replace or add an object module r a b c u v Print a table of contents of the library t s0 s1 Extract an object module from the library X V Table 5 1 Overview of archiver options and subopt
274. rrent function name e Alternative syntax for variadic macros e Alternative syntax for designated initializers e Allow zero sized arrays e Allow empty struct union e Allow empty initializer list e Allow initialization of static objects by compound literals e The middle operand of a operator may be omitted e Allow a compound statement inside braces as expression e Allow arithmetic on void pointers and function pointers e Allow a range of values after a single case label e Additional preprocessor directive warning e Allow comma operator conditional operator and cast as lvalue 5 6 PCP Reference Manual E e An inline function without static or extern will be global e An extern inline function will not be compiled on its own For an exact description of these gcc extensions please refer to the gcc info pages info gcc With 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 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 does not produces a warning char p void main void p hello Example cpcp APx c90 test c cpcp language comments strings iso 90 test c The compiler compiles in ISO C90 mode accepts assignments of a constant string to a non constant string point
275. rules to rebuild them Example mkpcp 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 d Tool Options Make Utility 5 193 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 mkpcp time The make utility displays the current date and time and updates out of date files Related information dh 5 194 PCP Reference Manual V Command line syntax V Description Display version information The make utility ignores all other options or input files Example mkpcp v The make utility does not perform any tasks but displays the following version information TASKING PCP VX toolset program builder vxx yrz Build nnn Copyright year Altium BV Serial 00000000 Related information i Tool Options 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 mkpcp W test elf The make utility rebuilds out of date targets in the makefile except the file test elf which is considered now as up to date Related information d 5 195 5 196 PCP Reference Manual 7 W Command line syntax W Description With this option the make utility sends er
276. ry functions you can use in your C source The libraries are implemented according to the ISO IEC 9899 1999 E standard Chapter 3 PCP Assembly Language Contains an overview of all assembly functions that you can use in your assembly source code Chapter 4 Run time Environment Contains a description of the C startup code and explains stack and heap usage and floating point arithmetic Chapter 5 Tool Options Contains a description of all tool options e Compiler options e Assembler options e Linker options e Control program options e Make utility options e Archiver options Chapter 6 List File Formats Contains a description of the following list file formats e Assembler List File Format e Linker Map File Format Manual Purpose and Structure xI Chapter 7 Object File Formats Contains a description of the following object file formats e ELF DWARF Object Formats e Motorola S Record Format e Intel Hex Record Format Chapter 8 Linker Script Language Contains a description of the linker script language LSL Chapter 9 MISRA C Rules Contains a description the supported and unsupported MISRA C code checking rules XII PCP Reference Manual CONVENTIONS USED IN THIS MANUAL Notation for syntax The following notation is used to describe the syntax of command line input bold italics Example Type this part of the syntax literally Substitute the italic word by an instance For example
277. s Layout S 9 lt length_byte gt lt address gt lt checksum_byte gt Example 9030210EA checksum _ address _ length The checksum calculation of S9 records is identical to SO 7 8 7 PCP Reference Manual 7 3 INTEL HEX RECORD FORMAT Intel Hex records describe the hexadecimal object file format for 8 bit 16 bit and 32 bit microprocessors The hexadecimal object file is an ASCII representation of an absolute binary object file There are six different types of records Data Record 8 16 or 32 bit formats End of File Record 8 16 or 32 bit formats Extended Segment Address Record 16 or 32 bit formats Start Segment Address Record 16 or 32 bit formats Extended Linear Address Record 32 bit format only Start Linear Address Record 32 bit format only For the PCP the linker generates records in the 32 bit format 4 byte addresses with linker option ofilename IHEX General Record Format In the offset type output file the record format is is the record header 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 OxFF 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 f
278. s large as the largest element in the overlay group The page keyword tells the linker to place the group in one page Instead of specifying a run time address you can specify a page and optional a page number Page numbers start from zero If you omit the page number the linker chooses a page The page keyword refers to pages in the address space as defined in the architecture definition With the page_size keyword you can override the page alignment and size set on the address space See also the page_size keyword in section 8 5 3 Defining Address Spaces group page group page 3 8 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 keyword stack tells the linker to reserve memory for the stack The name for the stack section refers to the stack as defined in the architecture definition If no name was specified in the architecture definition the default name is stack Linker Script Language 8 47 Heap With the keyword size you can specify the size for the stack If the size is not specified the linker uses the size given by the min_size argument as defined for the stack in the architecture definition Normally the linker automatically tries to maximize the si
279. s its arguments and sends them to the listing file the control line itself is not printed unless there is an error You can specify the following arguments exp a byte expression which may be used to encode non printing control characters such as ESC string an assembler string which may be of arbitrary length up to the maximum assembler defined limits The PRCTL control can appear anywhere in the source file the assembler sends out the control string at the corresponding place in the listing file If a SPRCTL control is the last line in the last input file to be processed the assembler insures that all error summaries symbol tables and cross references have been printed before sending out the control string In this manner you can use a PRCTL control to restore a printer to a previous mode after printing is done Similarly if the PRCTL control appears as the first line in the first input file the assembler sends out the control string before page headings or titles Example SPRCTL 1B E Reset HP LaserJet printer Related option Related information db Assembler option 1 Generate list file in Section 5 2 Assembler Options of Chapter Tool Options 3 78 PCP Reference Manual STITLE Syntax STITLE title Description If you generate a list file with the assembler option 1 you can use the STITLE control to specify the program subtitle which is printed at the top of all succeeding pages in t
280. s part of the map file shows all processed files This also includes object files that are extracted from a library with the symbol that led to the extraction 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 0 to output sections in File The name of an input object file 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 The resulting output section name 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 Call Graph Part This part of the map file contains a schematic overview that shows how library functions call each other To obtain call graph information the assembly file must contain CALLS directives which you must manually add to the assembly source List
281. s present in both libraries you may want the linker to extract the most recent function Example 6 lpcp first library first a a test o b a If the file test o calls a function which is both present in a a and b a normally the function in b a would be extracted With this option the linker first tries to extract the symbol from the first library a a Note that routines in b a that call other routines that are present in both a a and b a are now also resolved from a a Related information db Linker option no rescan Do not rescan libraries Tool Options Linker 5 103 I include directory Command line syntax Ipath include directory paih Description With this option you can specify the path where your LSL include files are located A relative path will be relative to the current directory The order in which the linker searches for LSL include files is 1 The pathname in the LSL file and the directory where the LSL files are located only for include files that are enclosed in 2 The path that is specified with this option 3 The default PRODDIR include 1s1 directory relative to the installation directory Example Suppose that the LSL file 1slfile 1s1 contains the following lines include mypart 1sl You can call the linker as follows lpcp Imyinclude dlslfile 1lsl test o lpcp include directory myinclude lsl file lslfile lsl test o First the linker looks
282. sed within the context of a derivative definition to specify internal memory and on chip buses In the context of a board specification the memory and bus definitions are used to define external off chip memory and buses Given the above definitions the linker can convert a logical address into an offset into an on chip or off chip memory device See section 8 7 3 Defining External Memory and Buses for more information on how to specify the external physical memory layout Internal memory for a processor should be defined in the derivative definition for that processor The board specification The processor definition and memory and bus definitions together form a board specification LSL provides language constructs to easily describe single core and heterogeneous or homogeneous multi core systems The board specification describes all characteristics of your target board s system buses memory devices I O sub systems and cores that are of interest to the linker Based on the information provided in the board specification the linker can for each core e convert a logical address to an offset within a memory device e locate sections in physical memory e maintain an overall view of the used and free physical memory within the whole system while locating The section layout definition optional db The optional section layout definition enables you to exactly control where input sections are located Features are provided such as
283. space bus or memory With the map field you specify how addresses from the source space bus or memory are translated to addresses of a destination space bus The following mappings are possible e 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 8 28 PCP Reference Manual e The src_offset argument specifies the offset of the source addresses In combination with size this specifies the range of address that are mapped By default the source offset is 0x0000 e The size argument specifies the number of addresses that are mapped This argument is required e The dest_offset argument specifies the position in the destination to which the specified range of addresses is mapped By default the destination offset is 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 sre_dbits begin end and the range of destination data lines you want to map them to dest_dbits first last e The src_dbits
284. 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 8 44 6 PCP Reference Manual For each input section within the overlay the linker automatically defines two symbols The symbol _le_cb_section_name is defined as the load time start address of the section The symbol _le_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_p1 select my _ovl_p2 group b select my _ovl_q1 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 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
285. 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 which address space must be emitted 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 s If you do not specify space_name the default address space is emitted In this case the name of the output file will be filename _spacename with the extension hex or s Example To create the IHEX file test hex type ccpcp format IHEX space far test c If the specified memory space does not exist the control program emits the default space name and reflects this in the output file name Related information d gt Control program option format Set linker output format Linker option o Specify an output object file 5 162 PCP Reference Manual 7 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 comman
286. ssor 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 limit of the operating system you can define the macros in an option file which you then must specify to the compiler with the option f file Defining macros with this option instead of in the C source is for example useful to compile conditional C source as shown in the example below Example Consider the following C program with conditional code to compile a demo program and a real program void main void if DEMO demo func compile for the demo program else real func compile for the real program endif You can now use a macro definition to set the DEMO flag cpcp DDEMO test c cpcp DDEMO 1 test c cpcp define DEMO test c cpcp define DEMO 1 test c Note that all four invocations have the same effect 5 14 PCP Reference Manual 7 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 cpcp D MAX A B A gt B A B Related information db Compiler option U Remove preprocessor macro Compiler option f Specify an option file Tool Options Compiler 5 15 diag Command line syntax diag
287. stantiate each individual processor in a processor definition This information tells the linker which processor has which derivative and enables the linker to distinguish between the present processors 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 Linker Script Language 8 35 With the keyword processor you define a processor You can freely choose the processor name The name is used to refer to it at other places in the LSL file processor proc_name processor definition 8 7 2 INSTANTIATING DERIVATIVES With the keyword derivative you tell the linker that the given processor has a certain derivative The derivative name refers to an existing derivative definition in the same LSL file For examples if you have two processors on your target board called myproc_1 and myproc_2 that have the same derivative called myderiv you must instantiate both processors as follows processor myproc_1 derivative myderiv processor myproc_2 derivative myderiv If the derivative definition has parameters you must specify the arguments that correspond with the parameters For example myderiv1 expects two parameters which are used in the derivative definition processor myproc derivati
288. sult is the checksum The sum of all bytes following the record type is OxFF S1 record With the linker option oftlename SREC 2 the actual program code and data is supplied with S1 records with the following layout S T lt length_byte gt lt address gt lt code bytes gt lt checksum_byte gt This record is used for 2 byte addresses Object File Formats 7 5 Example 1130250F03EF04DFOACE8A408A2A013EDFCDBO0E6 _ checksum lf _ code _ address _ length The linker has an option that controls the length of the output buffer for generating S1 records The default buffer length is 32 code bytes The checksum calculation of S1 records is identical to SO S2 record With the linker option oftlename SREC 3 which is the default the actual program code and data is supplied with S2 records with the following layout S 2 lt length_byte gt lt address gt lt code bytes gt lt checksum_byte gt For the PCP the linker generates 3 byte addresses Example 213FF002000232222754E00754F04AF4FAE4E22BF l _ 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 the actual program code and data is supplied with S3 records with the following layout S 3
289. system or just to store options and save typing You can specify the option f multiple times Format of an option file Multiple command line arguments on one line in the option file are allowed To include whitespace in an argument surround the argument with single or double quotes If you want to use single quotes as part of the argument surround the argument by double quotes and vise versa This has a single quote embedded This has a double quote embedded This has a double quote and a single quote embedded Note that adjacent strings are concatenated When a text line reaches its length limit use a to continue the line Whitespace between quotes is preserved This is a continuation line gt This is a continuation line It is possible to nest command line files up to 25 levels Tool Options Control Program 5 145 Example Suppose the file myoptions contains the following lines g k test c Specify the option file to the control program ccpcp f myoptions cpcp option file myoptions This is equivalent to the following command line ccpcp g k test c Related information ib 5 146 PCP Reference Manual 7 format Command line syntax format format You can specify the following formats ELF ELF DWARF THEX Intel Hex SREC Motorola S records Description With this option you specify the output format for the resulting
290. t it will be created A weak external reference is resolved by the linker when a global or weak definition is found in one of the object files However a weak reference will not cause the extraction of a module from a library to resolve the reference You can overrule a weak definition with a GLOBAL definition in another module The linker will not complain about the duplicate definition and ignore the weak definition Only program labels and symbols defined with EQU can be made weak Example LOOPA EQU 1 definition of symbol LOOPA GLOBAL LOOPA LOOPA will be globally accessible by other modules mark LOOPA as weak WEAK LOOPA e Related information ib 3 64 PCP Reference Manual WORD HALF Syntax label WORD argument argument label HALF argument argument Description With the WORD or HALF directive the assembler allocates and initializes one word 32 bits or a halfword 16 bits of memory for each argument An argument can be e a single or multiple character string constant e an expression e NULL indicated by two adjacent commas Multiple arguments are stored in sets of four or two bytes If an argument is NULL its corresponding address locations are filled with zeros If you specify label it gets the value of the location counter at the start of the directive processing In case of single and multiple character strings each character is stored in consecut
291. t ap lastarg 2 2 16 STDBOOL H 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 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 This macro initializes ap After this call each call to va_arg will return 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 bit type argument in the list 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 define true define false define bool true false are defined 2 20 PCP Reference Manual 7 2 2 17 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
292. t locals equs the assembler also emits local EQU symbols to the object file Without a flag or with emit locals symbols the assembler also emits non EQU local symbols to the object file Normally only global symbols are emitted Having local symbols in the object file can be useful for debugging Example To emit local non EQU symbols enter aspcp emit locals test srce Related information d Tool Options Assembler 5 65 error file Command line syntax error file i e 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 ers instead of stderr enter aspcp error file errors ers test src Related information Gb Assembler option warnings as errors Treat warnings as errors 5 66 PCP Reference Manual error limit Command line syntax error Limit 7umber Description With this option you tell the assembler to only emit the specified maximum number of errors When 0 null is specified the assembler emits all errors Without this option the maximum number of errors is 42 Example To stop assembling after 10 errors occurred enter aspcp error limit 10 test src Related information d Tool Options Assembler 5 67 f option file Command line syntax f file option file ile Desc
293. t shows how the link phase has mapped the sections and symbols from the various object files o 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 Jen CIC OSI EEE Processed Files Part 4 AK Ak kk kk kk kk k aici kama K K a File From archive Symbol causing the extraction cstart o libc a _START hello o printf o libc a printf a KKK KK KK k k k k k k k k k k k k k k kk kk kk kk kk kk ER kk kkk Link Part kkk kkk kkk kk kk kk kkk kkk kkk kkk kkk kkk kkk Pr nn nt in File in Section in Size out Offset out Section hello o text hello main 0x00000014 0x00000000 text hello main cstart o text libc 0x00000202 0x00000000 text libc strcpy o text libc 0x00000024 0x00000204 printf o text libc 0x0000002c 0x00000800 a a a a ee iat cstart o text libc reset 0x00000008 0x00000000 text libc reset fr nt JESS kkk IOC IAI Module Local Symbols Part Aka kkk Ae k k Emm III I Symbol translation sorted on name Scope hello o a a Name Address Space hello src 0x00000000 rodata hello 0xa00000e0 spe
294. ter 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 inte ger errno See section 2 2 3 errno h 2 2 20 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 e Numeric conversions e Random number generation e Memory management e Envirnoment communication e Searching and sorting 2 32 PCP Reference Manual e Integer arithmetic e Multibyte wide character and string conversions Macros RAND _MAX 32767 Highest number that can be returned by the rand srand function EXIT SUCCES 0 Predefined exit codes that can be used in the exit EXIT FAILURE 1 function MB_CUR_MAX 1 Maximum number of bytes in a multibyte character for the extended character set specified by the current
295. 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 tctarget 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 Example To read linker script file information from file mylslfile 1s1 ccpcp dmylslfile 1lsl test obj ccpcp lsl file mylslfile 1lsl test obj Related information d Section 6 7 Controlling the Linker with a Script in the User s Manual 5 140 PCP Reference Manual 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 Example To display an explanation of message number 103 enter ccpcp diag 103 This results in message 103 with explan
296. tination space space name bu PCP Reference Manual The mau and width statements appear exactly once in a bus_descr The default value for width is the mau size The bus width must be an integer times the bus MAU size The MAU size must be non zero A bus can only have a mapping on a destination bus through dest bus map map_descr lt map_descr gt 9 dest destination dest_dbits range dest_offset expr size expr sre_dbits range sre_offset expr A mapping requires at least the size and dest statements Each map_descr can occur only once You can define multiple mappings from a single source Overlap between source ranges or destination ranges is not allowed If the sre_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 S 3 lt proc_name core name gt 1 bus name A space_name refers to a defined address space A proc_name refers to a defined processor A core_name refers to a defined core A bus_name refers to a defined bus The following mappings are allowed source to destination space gt space space gt bus bus gt bus memory gt bus number ee number Linker Script Language 8 13 8 3 8 ARCHITECTURE DEFINITION architecture_definition architecture arch name lt parameter list gt 9l 1 lt extends arch_name lt argument_list
297. tion CALLS Passes call information to object file Used by the linker to build a call graph and calculate stack size MISRAC Pass MISRA C information 3 3 2 DETAILED DESCRIPTION OF ASSEMBLER DIRECTIVES 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 The assembler recognizes both upper and lower case for directives PCP Assembly Language 3 21 ACCUM Syntax label ACCUM expression expression Description With the ACCUM directive Define 64 bit Constant the assembler allocates and initializes two words of memory 64 bits for each argument Use commas to separate multiple arguments An expression can be e a fractional fixed point expression range 2 7 27 gt e NULL indicated by two adjacent commas Multiple arguments are stored in successive address locations in sets of two bytes If an argument is NULL its corresponding address location is filled with zeros If the evaluated expression is out of the range 2 2 7 gt the assembler issues a warning and saturates the fractional value Example ACC ACCUM 0 1 0 2 0 3 Related information d SPACE Define storage FRACT SFRACT Define 32 bit 16 bit constant fraction 3 22 PCP Reference Manual ALIAS Syntax alias name ALIAS function name Description With the ALIAS directive you can creat
298. tion 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 all warnings cpcp test c w cpcp test c no warnings To suppress warnings 135 and 136 cpcp test c w135 w136 cpcp test c no warnings 135 no warnings 136 Related information d Compiler option warnings as errors Treat warnings as errors Tool Options Compiler 5 53 Wwarnings as errors Command line syntax warnings as errors 7umber Description If the compiler encounters an error it stops compiling When you use this option without arguments you tell the compiler to treat all warnings as errors This means that the exit status of the compiler will be non zero after one or more compiler warnings As a consequence the compiler now also stops after encountering a warning You can also limit this option to specific warnings by specifying a comma separated list of warning numbers Example cpcp warnings as errors test c When a warning occurs the compiler considers it as an error Related information Gs Compiler option w suppress some or all warnings 5 54 PCP Reference Manual e 5 2 ASSEMB
299. tion selection in the group the linker selects the load time ROM copy of the named section s instead of the regular sections Just like run_addr you can specify an absolute address or an address range The load_addr keyword itself without an assignment specifies that the group s position in the LSL file defines its load time address group load_addr select mydata select ROM copy of mydata mydata The load time and run time addresses of a group cannot be set at the same time If the load time property is set for a group the group only restricts the positioning at load time of the group s sections It is not possible to set the address of a group that has a not unrestricted parent group 8 46 7 PCP Reference Manual The properties of the load time and run time start address are e 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 e The start addresses cannot be set to absolute values for unrestricted groups e For non overlay groups that do not have an overlay parent the load time start address equals the run time start address e For any group if the run time start address is not set the linker selects an appropriate address For overlays the linker reserves memory at the run time start address a
300. tive aspcp c test src aspcp case insensitive test src The assembler considers upper and lower case characters as being the same So for example the label Labe1Name is the same label as labelname Related information Gb Linker option case sensitive Link case insensitive 5 58 PCP Reference Manual 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 assembler reports any warnings and or errors Example To check for syntax errors without generating code aspcp check test src Related information db Compiler option check Check syntax Tool Options Assembler 5 59 D define Command line syntax Dmacro_name macro_definition define macro_name macro_definition Description With this option you can define a macro and specify it to the assembler preprocessor If you only specify a macro name no macro definition the macro expands as I You can specify as many macros as you like On the command line you can use the option D multiple times If the command line exceeds the limit of the operating system you can define the macros in an option file which you then must specify to the assembler with the option ffile Defining macros with this option instead of in the assembly source is for example useful in combination with conditional assem
301. to create Intel Hex or Motorola S record output files for each chip suitable for loading into a PROM programmer Example To create the output file myfile hex of the address space named linear lpcp test o omyfile hex IHEX 2 linear lpcp test o output myfile hex IHEX 2 linear Related information d Linker option c Generate an output file for each chip Section 7 1 ELF DWARF Object Format in Chapter Object File Formats 5 124 PCP Reference Manual 7 r incremental Command line syntax f incremental Description Normally the linker links and locates the specified object files With this option you tell the linker only to link the specified files The linker creates a linker output file out You then can link this file again with other object files until you have reached the final linker output file that is ready for locating In the last pass you call the linker without this option with the final linker output file out The linker will now locate the file Example In this example the files test1 o test2 o and test3 o are incrementally linked 1 lpcp r testl o test2 o otest out testl oand test2 o are linked 2 lpcp incremental test3 o0o test out test3 o is linked together with test out File task1 out is created 3 lpcp taskl out task1 out is located Related information Gb Section 6 5 Incremental Linking in Chapter Using the Linker of the User s Manual Tool Options Linker
302. tolower toupper _tolower _toupper isascii toascii iswprint iswpunct iswspace iswupper iswxdigit towlower towupper 2 2 3 ERRNO H int errno Returns a non zero value when c is printable including spaces Returns a non zero value when c is a punctuation character such as l Returns a non zero value when c is a space type character space tab vertical tab formfeed linefeed carriage return Returns a non zero value when c is an uppercase character A Z Returns a non zero value when cis a hexadecimal digit 0 9 A F a f Returns c converted to a lowercase character if it is an uppercase character otherwise c is returned Returns c converted to an uppercase character if it is a lowercase character otherwise c is returned 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 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 Returns a non zero value when c is in the range of 0 and 127 This function is not defined in ISO IEC 9899 Converts c to an ASCII value strip highest bit This function is not defined in ISO IEC 9899 External variable that holds implementation defined error codes The following error codes are defined as
303. ttom of the page Default 0 Specify a value so that blankiop blankbim 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 control without arguments it causes a formfeed the next source line is printed on the next page in the list file The PAGE control itself is not printed You can omit an argument by using two adjacent commas If the remaining arguments after an argument are all empty you can omit them Example SPAGE formfeed the next source line is printed on the next page in the list file SPAGE 96 set page width to 96 Note that you can omit the last four arguments PAGE 3 3 use 3 line top bottom margins Related option J 3 76 7 PCP Reference Manual Related information gb Assembler control STITLE Set program subtitle in header of list file Assembler control TITLE Set program title in header of list file Assembler option 1 Generate list file in Section 5 2 Assembler Options of Chapter Tool Options Assembler option L List file formatting options in Section 5 2 Assembler Options of Chapter Tool Options PCP Assembly Language 3 77 PRCTL Syntax PRCTL exp string exp string Description If you generate a list file with the assembler option 1 you can use the PRCTL control to send control strings to the printer The PRCTL control simply concatenate
304. twc c stream putwce c stream putwchar c stdout fputws s stream Performs a formatted read from stdin 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 15 stdarg h Same as sscanf swscanf but extra arguments are given as variable argument list arg See section 2 2 15 stdarg h Same as scanf wscanf but extra arguments are given as variable argument list arg See section 2 2 15 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 Implemented as macro FSS implementation Writes string s to the given stream Returns EOF WEOF on error FSS implementation Libraries 2 29 Stdio h Wchar h Description puts s fprintf stream format printf format sprintf s format snprintf s n format vfprintf stream format arg vprintf format arg vsprintf s format arg fwprintf stream format wprintf format swprintf s n format vfwprintf stream format arg vwprintf format arg vswp
305. uments to the seanf related functions should be pointers to variables in default memory of the type which is specified in the format string The format string can contain Blanks or tabs which are skipped Normal characters not which should be matched exactly in the input stream Conversion specifications starting with a character Conversion specifications should be built as follows in order A meaning that no assignment is done for this field A number specifying the maximum field width The conversion characters d i n o u and x may be preceede by h if the argument is a pointer to short rather than int or by T letter ell if the argument is a pointer to Long The conversion characters e f and g may be preceede by T if a pointer double rather than float is in the argument list and by L if a 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 2 26 7 PCP Reference Manual Length specifier and length modifier are optional the conversion character is not The conversion character must be one of the following if a character following is not in the list the behavior is undefined Character Scanned as d on Oo xX O e E
306. urrent module the assembler issues a warning and inserts the EXTERN directive for that symbol A label is not allowed before this directive Example EXTERN AA CC DD defined elsewhere Related information GLOBAL Global symbol declaration LOCAL Local symbol declaration 3 38 PCP Reference Manual 7 FAIL Syntax FAIL string exp string exp Description With the FAIL directive Programmer Generated Error you tell the assembler to output an error message during the assembling process The total error count will be incremented as with any other error The FAIL directive is for example useful in combination with conditional assembly for exceptional condition checking The assembly process proceeds normally after the error has been printed Optionally you can specify an arbitrary number of strings and expressions in any order but separated by commas to describe the nature of the generated error If you use expressions the assembler outputs the result The assembler outputs a space between each argument With this directive the assembler exits with exit code 1 an error A label is not allowed before this directive Example FAIL Parameter out of range This results in the error E143 filename line Parameter out of range Related information MESSAGE Programmer Generated Message WARNING Programmer Generated Warning PCP Assembly Language 3 39 FLOAT DOUBLE Synta
307. used as operands to operators other than amp amp and Bitwise operators shall not be applied to operands whose underlying type is signed The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left hand operand This violation will only be checked when the shift count evaluates to a constant value at compile time The unary minus operator shall not be applied to an expression whose underlying type is unsigned The comma operator shall not be used Evaluation of constant unsigned integer expressions should not lead to wrap around 9 16 7 12 12 12 13 R A PCP Reference Manual The underlying bit representations of floating point values shall not be used A violation is reported when a pointer to a floating point type is converted to a pointer to an integer type The increment and decrement operators should not be mixed with other operators in an expression Control statement expressions 13 1 13 2 13 3 13 4 13 5 13 6 13 7 R A R R R R R Control flow 14 1 14 2 14 3 14 4 14 5 R R R R R Assignment operators shall not be used in expressions that yield a Boolean value Tests of a value against zero should be made explicit unless the operand is effectively Boolean Floating point expressions shall not be tested for equality or
308. ve myderivl 2 4 8 36 7 PCP Reference Manual 8 7 3 DEFINING EXTERNAL MEMORY AND BUSES ib db It is common to define external memory off chip and external buses at the global scope outside any enclosing definition Internal memory on chip memory 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 mem_name type rom mau 8 size 64k speed 2 map map description For a description of the keywords see section 8 6 3 Defining Internal Memory and Buses With the keyword bus you define a bus the combination of data and corresponding address bus The bus name is used to identify a bus and does not conflict with other identifiers Bus descriptions at the global scope outside any definition define external buses These are buses that are present on the target board bus bus_name mau 8 width 8 m
309. vel to compress your program into the system memory or to decrease execution time to meet your real time requirements Default O2 Description With this option you can control the level of optimization If you do not use this option the default optimization level is medium optimization option O2 or O or OabcefghIlopRSy When you use this option to specify a set of optimizations you can overrule these settings in your C source file with pragma optimize flag and pragma endoptimize In addition to the 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 cpcp test c cpcp 02 test c cpcp optimize 2 test c cpcp 0 test c cpcp optimize test c Tool Options Compiler 5 41 cpcp OacefgIklMopsvwy test c cpcp optimize coalesce cse expression flow glo inline schedule loop simd forward propagate subscript ifconvert pipeline peephole test c Related information 4b Compiler option t Trade off between speed t0 and size t4 pragma optimize flag pragma endoptimize Section 4 3 Compiler Optimizations in Chapter Using the Compiler of the User s Manual 5 42 PCP Reference Manual o output Command line syntax Ofile
310. verflow fields With the keyword size you specify the fixed size of the output section Input sections are placed from output section start towards higher addresses offsets When the end of the output section is reached and one or more input sections are not yet placed an error is emitted If however the overflow field is set to another output section remaining sections are located as if they were selected for the overflow output section 8 50 PCP Reference Manual group section tskl_ data size 4k attributes rw f i11 0 overflow overflow_data select data tsk1 section tsk2 data size 4k attributes rw fill 0 overflow overflow data select data tsk2 section overflow _ data size 4k attributes rx fill 0 With the keyword blocksize the size of the output section will adapt to the size of its content For example group flash_area run_addr 0x10000 section flash_code blocksize 4k attributes rx fill 0 select flash If the content of the section is 1 mau the size will be 4k if the content is 11k the section will be 12k etc If you use size in combination with blocksize the size value is used as default minimal size for this section If it is omitted the default size will be of blocksize It is not allowed to omit both size and blocksize from the section definition The linker creates two labels to mark the begin and end
311. void if DEMO 1 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 ccpcp DDEMO test c ccpcp DDEMO 1 test c 5 138 PCP Reference Manual 7 ccpcp define DEMO test c ccpcp 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 ccpcp D MAX A B A gt B A B ccpcp define MAX A B A gt B A B Related information db Control program option U Undefine preprocessor macro Control program option f Read options from file Tool Options Control Program 5 139 d Isl file Command line syntax d ile Isl file ile 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 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
312. 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 Linker Script Language 8 45 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 acomplete memory device written as mem mem_name ora memory address range mem mem_name expr expr group run_addr mem my_ dram You can use the to specify an address range of more than one physical memory device group run_addr mem A mem B The load_addr keyword changes the meaning of the sec
313. which provide easy access to registers in I O sub systems from C and assembly programs When you build an ASIC or use a derivative that is not yet supported by the TASKING tools you may have to write a derivative definition 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 8 6 Semantics of the Derivative Definition for a detailed description of LSL in the derivative definition The processor definition db 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 8 7 Semantics of the Board Specification for a detailed description of LSL in the processor definition Linker Script Language 8 5 The memory and bus definitions optional db Memory and bus definition are u
314. 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 Example To scan the libraries only once lpcp no rescan test o a a b a The linker resolves all unresolved symbols while scanning the object files and libraries and reports all remaining unresolved symbols after this scan Related information d gt Linker option first library first Scan libraries in the specified order Tool Options Linker 5 119 non romable Command line syntax non romable Description With this option the linker will locate all ROM sections in RAM A copy table is generated and is located in RAM When the application is started that data and BSS sections are re initialized Example lpcp non romable test o The linker locates all ROM sections in RAM Related information d 5 120 7 PCP Reference Manual O optimize Command line syntax Oflags optimize lags 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 1 L 4 first fit decreasing Use a first fit decreasing algorithm to locate unrestricted sections in memory t T 4 copytable compression Locate unrestricted sections in such a way that the size of the copy table is as sm
315. x abel FLOAT expression expression abel DOUBLE expression expression Description With the FLOAT or DOUBLE directive the assembler allocates and initializes a floating point number 32 bits or a double 64 bits in memory for each argument An expression can be e a floating point expression e NULL indicated by two adjacent commas You can represent a constant as a signed whole number with fraction or with the e format as used in the C language 12 457 and 0 27E 13 are legal floating point constants If you specify label it gets the value of the location counter at the start of the directive processing If the evaluated argument is too large to be represented in a single word double word the assembler issues an error and truncates the value Examples FLT FLOAT 12 457 0 27E 13 DBL DOUBLE 12 457 0 27E 13 Related information d SPACE Define storage 3 40 PCP Reference Manual FRACT SFRACT Syntax abel FRACT expression expression Vabel SFRACT expression expression Description With the FRACT or SFRACT directive the assembler allocates and initializes one word of memory 32 bits or a halfword 16 bits for each argument Use commas to separate multiple arguments An expression can be e a fractional fixed point expression range 1 1 gt e NULL indicated by two adjacent commas Multiple arguments are stored in successive address locati
316. xample cpcp n test c The compiler sends the output normally test src to stdout and does not create the file test src Related information d Tool Options Compiler 5 35 no clear Command line syntax no clear Description Normally global static variables are cleared at program startup With this option you tell the compiler to generate code to prevent non initialized global static variables from being cleared at program startup This option applies to constant as well as non constant variables Related information d gt Pragmas clear noclear 5 36 PCP Reference Manual no stdinc Command line syntax no stdinc Description With this option you tell the compiler not to look in the default include directory relative to the installation directory when searching for include files This way the compiler only searches in the include file search paths you specified Example cpcp Imyinclude no stdinc test c cpcp include directory myinclude no stdinc test c Same example as with I option but now the compiler does not search in the default include directory Related information db Compiler option I Add directory to include file search path Tool Options Compiler 5 37 no tasking sfr Command line syntax no tasking sfr Description Normally the compiler includes a special function register SFR file before compiling The compiler automatically selects the SFR file
317. ymbol 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 main type func function main ret16 main_function_end size main main_function_end main Related information d TYPE Set Symbol Type PCP Assembly Language 3 59 SPACE Syntax abel SPACE expression Description With the SPACE directive Define Storage the assembler reserves a block of memory The reserved block of memory is not initialized to any value With expression you specify the number of MAUs Minimum Addressable Units 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 For the PCP assembler aspcp the MAU size is 2 bytes for pcp code sections and 4 bytes for pep data sections If you specify label it gets the value of the location counter at the start of the directive processing Example To reserve 12 bytes not initialized of memory in a PCP data section sdecl pcpdata data data sect pcpdata data uninit SPACE 12 Sample buffer Related information ASCII ASCIIZ Define ASCI
318. ze by adding the page argument Start address The start_address keyword specifies the start 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 vecior 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 Linker Script Language 8 27 The symbol argument specifies the name of the label in the application code that should be located at the specified start address The symbol argument is required The linker will resolve the start symbol and use its value after locating for the start address field in IEEE 695 files and Intel Hex files If you also specified the run_addr argument the start symbol label must point to a section The linker locates this section such that the start symbol ends up on the start address space space name id 1 mau 8 align 8 page_size 1 stack name min_size 1k grows low_to_high start_address run_addr 0x0000 symbol start_label map map description 8 5 4 MAPPINGS You can use a mapping when you define a
319. ze unless you specified the keyword fixed group stack mystack size 2k The linker creates two labels to mark the begin and end of the stack _lec_ub_stack_name for the begin of the stack and _1lce_ue_stack_name for the end of the stack The linker allocates space for the stack when there is a reference to either of the labels See also the stack keyword in section 8 5 3 Defining Address Spaces The keyword heap tells the linker to reserve a dynamic memory range for the malloc function Each heap section has a name 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 keyword fixed group heap myheap size 2k The linker creates two labels to mark the begin and end of the heap _lc_ub_heap_name for the begin of the heap and _lc_ue_heap_name for the end of the heap The linker allocates space for the heap when a reference to either of the section labels exists in one of the input object files Reserved section The keyword reserved tells the linker to create an area or section of a given size The linker will not locate any other sections in the memory occupied by a reserved section with some exceptions Each reserved section has a name With the

Download Pdf Manuals

image

Related Search

Related Contents

BRUTEFORCE WPS CON INFLATOR  InLine 16461T power extension  Educarte fiche technique ( PDF  manual del usuario  

Copyright © All rights reserved.
Failed to retrieve file