Home

CC78K0R Ver. 2.00 C Compiler Operation UM

image

Contents

1. Error N rnbar Error Message F0911 Message Reading unwritten data no available directory space Cause An I O error was generated for the following reasons EOF was passed and input proceeded The temporary file cannot be created because of insufficient folder area on the drive F0912 Message Write error on temp Cause A write error was generated to the output temporary file Action by User A complex source expression such as too deep nesting may be the cause Contact support F0914 Message Insufficient memory in hostmachine Cause The CC78KOR cannot start because of insufficient memory Action by User Increase the free area in the conventional memory W0915 Message Asm statement found skip to jump optimize this function function name Cause asm block or asm statement was detected This function does not have jump optimization Perform the W0837 response E0922 Message Heap overflow please retry compile without QJ Cause A memory overflow was generated in jump optimization Recompile without specifying qj F0923 Message Illegal device file format Cause A device file in an old format was referenced F0924 Message Out of range please retry compile without QT Cause The code size that optimization can be performed exceeds 32 KB Action by User Recompile without specifying qt F0925 Message Out of range please retry compile without QL4 Cause The branch distance of the branch t
2. Salle Error Message E0316 Message Too many character constants Cause The character constant exceeds 2 characters E0317 Message Empty character constant Cause The character constant is empty E0318 Message No terminated string literal Cause There is no double quote at the end of the string E0319 Message Changing string literal Cause A character string literal is rewritten W0320 Message No null terminator in string literal Cause The null character is not added to the character string literal E0321 Message Compiler limit too many characters in string literal Cause The number of characters in the character string literal exceeded 509 E0322 Message Ellipsis requires three periods Cause The C compiler detected but is required E0323 Message Missing delimiter Cause The delimiter is incorrect E0324 Message Too many s Cause The and are incorrectly paired E0325 Message No terminated comment Cause The comment is not terminated by E0326 Message Illegal binary digit Cause This is illegal as a binary digit E0327 Message Hex constants must have at least one hex digit Cause At least 1 hexadecimal digit is required in a hexadecimal constant representation W0328 Message Unrecognized character escape sequence character Cause The escape sequence cannot be correctly recognized E0329 Message Compiler limit too many comment nesting Cause The number of nesting levels of comme
3. File Name File Role Normal Boot Area Flash Area clorm lib clOrm lib clorme lib Library runtime and standard libraries clOrl lib clOrl lib clOrle lib clormf lib clormf lib clOrmfe lib clOrlf lib clOrlf lib clOrife lib clOrxm ib clorxm lib clOorxme lib clorxl lib clOrxl lib clOrxle lib sOrm rel sOrmb rel sOrme rel Object files for startup routines sOrml rel sOrmlb rel sOrmle rel sOrl rel sOrlb rel sOrle rel sOrll rel sOrllb rel sOrlle rel For details on the file contents refer to 2 5 1 Library files User s Manual U18549EJ1VOUM 155 CHAPTER 8 STARTUP ROUTINES 8 1 3 src folder contents The src folder contains the assembler sources of the startup routines ROM routines error processing routines and standard library functions a portion If the source must be modified to conform to the system the object files for linking can be created by modifying this assembler source and using a batch file in the bat folder to assemble Table 8 3 src Folder Contents Startup Routine Source File Name Description cstart asmNete Source file for startup routine when standard library is used cstartn asmote Source file for startup routine when standard library is not used rom asm Source file for ROMization routine _putchar asm putchar function putchar asm putchar function getchar asm getchar function longjmp asm longjmp function setjmp asm setjmp function
4. 9 2 9 Error messages for a preprocessing directive Table 9 9 Error Messages for Preprocessing Directive lt from 0801 gt Slee Error Message E0801 Message Undefined control Cause A symbol starting with cannot be recognized as a keyword E0802 Message Illegal preprocess directive Cause The preprocess directive is illegal Action by User Check if the preprocess directive such as pragma is written in front of the header of the file and if there is any error E0803 Message Unexpected non whitespace before preprocess directive Cause A character other than a whitespace character precedes the preprocess directive W0804 Message Unexpected characters following preprocess directive directive newline expected Cause Extra characters follow the preprocess directive E0805 Message Misplaced else or elif Cause The if ifdef and ifndef do not correspond to else and elif E0806 Message Misplaced endif Cause The if ifdef and ifndef do not correspond to endif E0807 Message Compiler limit too many conditional inclusion nesting Cause The nesting of conditional compiling exceeded 255 E0810 Message Cannot find include file file name Cause The include file was not found Action by User Specify the path in which an include file exists or specify a path using the i option for the environmental variable INC78KOR E0811 Message Too long file name file name Cause The file name is too long E0812 Message Include directive syntax
5. Interpretation when omitted No error list file is output Function The se option adds the C source module file to the error list file In addition the output destination or output file name is specified Application f you want to output the error list file and the C source module file together specify the se option Description Adisk file name or device file name can be specified as the file name Ifthe output file name is omitted when the se option is specified the error list file name becomes input file name cer fthe extension for the output file name is omitted when the se option is specified error list file output file name cer will be output fthe drive name is omitted when the se option is specified the error list file is output to the current drive The folder and the file name cannot be specified for include files If the file type of the include file is H the error list file with the file type of her is output to the current drive It the file type of the include file is C the error list file with the file type of cer is output In all other cases the error list file with the er file type is output If there weren t any errors the C source is not added In this case the error list file is not created for the include file If the wO option is specified warning messages are not output Cautions To change the output destination when using PM specif
6. 4 5 1 Specifies the name of the drive A to Z storing the file 2 Specifies the name of the root directory 3 Specify the subdirectory name Specify a character string of a length allowed by the OS Characters that can be used All the characters allowed by the OS except parentheses semicolons and commas Note that a hyphen cannot be used as the first character of a path name lt 4 gt Primary name Specify a character string of a length allowed by the OS Characters that can be used All the characters allowed by the OS except parentheses semicolons and commas Note that a hyphen cannot be used as the first character of a path name lt 5 gt File type Specify a character string of a length allowed by the OS Characters that can be used All the characters allowed by the OS except parentheses semicolons and commas o6 Remarks 1 A space cannot be specified before and after or V 2 Uppercase and lowercase letters are not distinguished not case sensitive Users Manual U18549EJ1VOUM 2 Specifying device file names The following logical devices are available CON Output to the console PRN Output to the printer AUX Output to an auxiliary output device NUL Dummy output nothing is output User s Manual U18549EJ1VOUM CONTENTS CHAPTER 1 OVERVIEW 13 1 1 Role of CC78KOR 13 1 2 Development Pr
7. PUBLIC _ cstart _ cend P CM IF BRKSW PUBLIC _ BRKADR _ MEMTOP _ MEMBTM SENDIF EXTRN main _ STBEG hdwinit _ MAA cd IF EXITSW EXTRN exit SENDIF 19 EXTRN R INIT _ RLINIT _ R_INIS _ DATA _ DATAL _ DATS DATA DSEG BASEP near 6 IF EXITSW _ FNCTBL DS 4 32 _ FNCENT DS 2 _ MEMTOP DS 32 _ MEMBTM SENDIF 160 User s Manual U18549EJ1VOUM CHAPTER 8 STARTUP ROUTINES Including include files def inc gt For setting library according to the type macro inc gt Macro definition for each typical pattern Library switch If standard libraries in comments are not used by changing the EQU definition to 0 the space secured for the processing of unused libraries and for use by the library can be conserved The default is set to use everything In a startup routine without library processing this processing is not performed Symbol definitions The symbols used when using the standard library are defined External reference declaration of symbol for stack resolution The public symbol _ STBEG for stack resolution is an external reference declaration OSTBEG has the value of the last address in the stack area 1 J QSTBEG is automatically generated by specifying the symbol generation option s for stack resolution in the linker Therefore always specify the s option when
8. Jv Create Sta al s Area Name zl Warning Level vw T Flash Start Address for the Product with Flash ROM zb H Use Command File Parameterfile f Y Browse Other options boot Inf Reset Option data read Option data save Command Line Options oa Imf pa map bcl rme lib bclOrmfe lib i C Program Files NEC Electronics Tools CC78KOR Sx xxSlibz8k0r s boot Imf Users Manual U18549EJ1 VOUM 77 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING iii Setting object converter option for flash area Be sure to specify the Divide HEX File for Product with Flash ROM zf check box By specifying the zf option the HEX file for boot area e g flash hxb and the HEX file for flash area e g flash hxf are output The flash hxb and the boot hex that is generated when the program for boot area is built have the same contents However when the HEX file for boot area is already written and the program for flash area is built again it is recommended to confirm that there is no difference in the saved boot hex and the created flash hxb Object Converter Options Output Output2 Others HEX Module o Output File Name X Browse Object Complement u Select HEX Format Value Intel Format ki Intel Extend Format kie C Tex Format kt C C Start Address Motorola S type Format standard km Motorola S type Format 32bit kme Command Line Options 2f C
9. Preprocess list file name Number of characters enabled by OS Outputs the specified file name If the file type is omitted ppl is attached Contents that exceed the line length are output beginning at column 13 on the next line 146 User s Manual U18549EJ1VOUM CHAPTER 6 C COMPILER OUTPUT FILES nern Description bie Format Number P Columns 7 Parameter file Outputs the parameter file contents contents Contents that exceed the line length are output beginning at column 13 on the next line A semicolon is output to column 1 One or more white space characters or tabs are replaced by a single white space character 8 Line number 5 fixed Outputs a right aligned decimal value with zeros suppressed 9 C source This is the input C source Contents that exceed the line length are output beginning at column 9 on the next line 10 Target device for Maximum 15 Indicates the target device that is specified by a this compiler variable command line option or in a source file 11 Device file 6 fixed Displays the version number of the input device file version User s Manual U18549EJ1VOUM 147 6 5 CHAPTER 6 C COMPILER OUTPUT FILES Cross reference List File Cross reference list files contain lists of identifiers such as declarations definitions referenced functions and variables They also include other information such as attributes and line numb
10. accordingly the executing speed becomes slower Users Manual U18549EJ1VOUM 51 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 4 When Others is selected in the Group drop down list box Figure 3 13 Compiler Options Dialog Box When Others Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output Group v Aggressive Optimization qw Generate relative branch table for switch qt Command Line Options Cancel Apply Help Aggressive Optimization qw Select this check box to perform aggressive optimization reshuffling the execution order in an expression selected by default Generate relative branch table for switch qt Select this check box to make the branch table in a switch statement of a function allocated to the far area into of a relative branch 52 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Debug tab Figure 3 14 Compiler Options Dialog Box When Debug Tab Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output C Output Debugging Information to rel Only a1 Qutput Debugging Information to both asm and rel 32 Command Line Options Cancel Help Output Debugging Information Select this check box when outputting debug information selected by de
11. printf n Sd primes found count void printf char s int i 1 int ji char KSSS J ay SS S void putchar char c char a 3 d c Users Manual U18549EJ1VOUM 207 APPENDIX A SAMPLE PROGRAMS A 2 Execution Example C gt cc78KOR cfll 66a0 prim C a X ng prime prime prime prime prime Q000 N Copyright C 18 20 26 35 41 Target chip Device file N EC Compilation complete CC78KOR CC78KOR CC78KOR CC78KOR CC78KOR uPD78F1166_ VX XX warning warning warning warning warning AO 0 error s 78KOR C Compiler Vx xx xx xxx xxxx Electronics Corporation W0745 W0745 W0622 W0622 W0622 XXXX XXXX Expected function prototype Expected function prototype No return value No return value No return value and 5 warning s found 208 User s Manual U18549EJ1VOUM APPENDIX A SAMPLE PROGRAMS A 3 Output List A 3 1 Assembler source module file 78KOR C Compiler Vx xx Assembler Source Date Xx XXX XXXX Command cfll66a0 prime c a p x ng In file prime c Asm file prime asm Para file SPROCESSOR f1166a0 SNODEBUG SNODEBUGA SKANJICODE EUC STOL_INF O3FH 100H 02H OOH OOH EXTRN _ RTARGO EXTRN isrem PUBLIC mark PUBLIC main PUBLIC _printf PUBLIC putchar CNST CSEG TRRORP L0011 DB 6d
12. C cc78k0r cfl1166a0 sample c o no Since the no option is specified last the o option becomes invalid and the no option has priority Options not described in Table 5 1 are not particularly affected by other options However if the help specification option h was specified all of the option specifications become invalid The help specification option h cannot be specified in PM To reference help in PM click the Help button in each option dialog box of PM 90 User s Manual U18549EJ1VOUM 5 3 Types CHAPTER 5 COMPILER OPTIONS Compiler options are categorized into the following types Table 5 2 List of Compiler Options Types Option Description Device type specification C Specifies the type of target device Object module file creation specification O Specifies the output of the object module files no Memory assignment specification r Specifies the method of memory assignment nr rd Specifies the automatic assignment of an external variable external static variable except for the const alll type variable to the saddr area rs Specifies the automatic assignment of a static auto variable to the saddr area nr Optimization specification q Specifies optimization types nq Debugging information output g Specifies the output of the C source level debugging specification information ng Preprocess list fi
13. CODE SIZE 117 bytes CLOCK SIZI Fi 86 clocks STACK_SIZE 16 bytes SCALL printf 18 be pointer ax int sp 2 SCALL putchar 18 be pointer ax int sp 2 SCALL putchar 20 be int ax SCALL printf 25 be pointer ax int sp 2 SFUNC printf 31 be pointer s ax int i sp 4 CODE SIZE 22 bytes CLOCK_SIZE 20 clocks STACK SIZE 14 bytes SFUNC putchar 41 be char i x CODE SIZE 16 bytes CLOCK SIZE 16 clocks STACK SIZE 6 bytes Target chip uPD78F1166 A0 Device file Vx xx User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Error list file creation specification 1 e Description format e output file name Interpretation when omitted No error list file is output Function The e option specifies the output of the error list file In addition the output destination or output file name is specified Application f you want to change the output destination or the output file name of the error list file specify the e option Description Adisk file name or device file name can be specified as the file name fthe output file name is omitted when the e option is specified the error list file name becomes input file name ecc fthe extension for the output file nam
14. Description The type specifications of the z option are as follows Type Specification Description p The characters after until the line return are interpreted as a comment C Nested comments are allowed gNote Interprets the kanji 2 byte character code in comments as SJIS eNote Interprets the kanji code in comments as EUC nNote Interprets comments as not containing kanji codes 2 byte codes b char unsigned char type argument and return value are not int extended a Functions not in the ANSI standard are illegal The ANSI compliant portion of the functions are valid Specifically the following tasks are performed The following are no longer reserved words callt sreg bit boolean asm endasm The trigraph sequence 3 character representation becomes valid The compiler defined macro STDC is 1 Data allocation to the last one byte of a 64 KB boundary area is enabled by performing a relational expression for the far pointer for three bytes The following warning is output for a int type bit field CC78KOR warning W0787 Bit field type is not int f w2 is specified the following warnings are output for the qc zp zc options CC78KOR warning W0029 QC option is not portable CC78KOR warning W0031 ZP option is not portable CC78KOR warning W0032 ZC option is not portable If w2 is specified the following warning is output for each pr
15. For the conditional branch instruction the number of clocks when the condition is established is output Hazards are not considered Note therefore that the output clock count is different from the actual clock count It is just a reference value Function information start Indicates start of function information Function information file name Outputs target source file name with full path Information starting with FILE User s Manual U18549EJ1VOUM 141 CHAPTER 6 C COMPILER OUTPUT FILES tem Description RUmoSROT Format Number Columns 24 Function information Outputs function name and defined line number definition function as decimal code Information starting with FUNC 25 Function information Outputs the definition function s return value return value register and argument information register or argument of definition stack position function 26 Function information Outputs the size clock and maximum definition function s consumption stacks calculated statically for the size clock stack definition function Only the stack size used by a function itself is shown here If a function calls another function the stack size used by the called function is not added to the stack size of the calling function CLOCK_SIZE is the result to which the number of clocks in item 21 is added 27 Function information Outputs the function
16. When specifying the k option a preprocess list file can be used as a C source module file unless n has been specified as the processing type When the kd option is specified the list with define expansion is output Output format When PAGEWIDTH 80 gt 78KOR C Compiler V 1 x xx Preprocess List Date 2 xx xxx xx Page 3 xxx Command 4 cf1166a0 prime c p 1w80 In file 5 prime c PPL file 6 prime ppl Para file C mur 8 1 9 define TRUE 1 8 2 9 define FALSE 0 8 3 9 define SIZE 200 8 4 9 8 5 9 char mark SIZE l 8 6 9 10 Target chip uPD78F1166 AO 11 Device file Vx xx Item Number of Number Description Columns Format 1 Version number 4 fixed Displayed in x yz format 2 Date 11 fixed System date Displayed in DD Mmm YYYY format 3 Number of 4 fixed Outputs a right aligned decimal number with zeros pages suppressed Command line Outputs the command line contents following CC78KOR Contents that exceed the line length are output beginning at column 13 on the next line One or more white space characters or tabs are replaced by a single white space character C source module file name Number of characters enabled by OS Outputs the specified file name If the file type is omitted c is attached as the file type extension Contents that exceed the line length are output beginning at column 13 on the next line
17. c CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Edit Option dialog box In the Compiler Options dialog box when the Edit button is clicked for the following path settings the following dialog box appears Define macro under the Preprocessor tab Undefine macro under the Preprocessor tab Include search path under the Preprocessor tab Items are edited in list format in the Edit Option dialog box Figure 3 4 Edit Option Dialog Box Edit Opiton LIST I Cancel The Edit Option dialog box is described below Add button Adds a list item If the item to be added is a file or folder the corresponding Browse for Folder dialog box opens In all other cases the Add Option dialog box opens Specify details of the item to be added in this box Figure 3 5 Add Option Dialog Box Add Option TTT OK Cancel ok Deletes the selected list item Delete button Up button Moves the selected list item up Down button Moves the selected list item down User s Manual U18549EJ1VOUM 39 40 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Add Sub Directory button A subdirectory can be added to the selected list item when the item is specified as Include Search Path i l under the Preprocessor tab User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 1 4 Description of each part of Compiler Options dialog box Each part of the
18. C Small ms E C Large ml Control Object Output the Object for Flash Memory zf Command Line Options m Cancel Help Caution The settings for the Memory Model tab cannot be performed if special compiler options are set per source file Memory Model Select the memory model type used for compilation by selecting the appropriate radio button Small ms Medium mm Large ml Medium mm is selected by default J Control Object Output the Object for Flash Memory zf Select this check box to output object from flash Users Manual U18549EJ1VOUM 45 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Data Assign tab 46 Figure 3 9 Compiler Options Dialog Box When Data Assign Tab Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign ptimize Debug Output Assign External Variable to S amp DDR Area Le see cd d Ee Assign Static Variable to S amp DDR Area None Assign Bit Field from MSB rb Indirect address in byte units ra Packing structure members and indirect address in byte units rc Command Line Options m Cancel Help Assign External Variable to SADDR Area The type of an external variable to be assigned to the saddr area is selected in the drop down list box None only char size rd1 char short int size rd2 char short int long size rd4 struct uni
19. Cause There are more initial values than members in the declared structure E0758 Message Cannot initialize a function function name Cause The function cannot be initialized E0759 Message Compiler limit initializers too deeply nested Cause The depth of the nesting of initialized elements exceeded the limit WO0760 Message Double and long double are treated as IEEE 754 single format Cause double and long double are handled as IEEE 754 single precision formats WO0761 Message Cannot declare sreg with const or function Cause sreg cannot be declared with a const declaration or function Program An sreg declaration is ignored Processing WO0762 Message Overlapped memory area variable name 1 and variable name 2 Cause The variable name 1 and variable name 2 areas for which absolute address allocation specification is performed overlap W0763 Message Cannot declare const with bit boolean Cause bit and boolean type variables cannot have const declarations Program A const declaration is ignored Processing W0764 Message Variable name initialized and declared extern ignored extern Cause An externally referenced variable without a body was initialized Program The extern declaration is ignored Processing E0765 Message Undefined static function function name Cause There was a reference to a function whose body is not in the same file and was declared static User s Manual U18549EJ1VOUM 193 CHAPTER 9 ERROR M
20. Char Expression Behavior Automatic Allocation Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Jebug Output Group I TESI sa EU eee v Char Expression Behavior Iv Assign char without Siga Expand qe Change Plain char to unsigned char qu Automatic Allocation Use SADDA Area for Register Variable qr Iv Use Register for Auto Variable qv v Jump Optimization qi Command Line Options pate Cancel Appl Help Char Expression Behavior Assign char without Sign Expand qc Select this check box to perform calculations including char without sign extension selected by default Change Plain char to unsigned char Select this check box to regard the char as a qu unsigned char A Automatic Allocation Use SADDR Area for norec Register Select this check box to add a register variable to Variable qr a register and assigns it to the saddr area and select the variable to be assigned by selecting the appropriate radio button norec Parameter Auto Variable qr1 qr1 Register Variable qr2 If this check box is selected qr Register Vari able qr2 is selected by default Use Register for Auto Variable qv Selecet the check box to assign an auto variable automatically to a register or the saddr area selected by default Users Manual U18549EJ1VOUM 49 50 CHAPTER 3
21. Compiler Options dialog box is described Figure 3 6 Compiler Options Dialog Box Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output Define Macro d m Edit Undefine Macro u zb ta Include Search Path i zb te Command Line Options gm Cancel Help Setting of compiler options The compiler options are divided into the following 9 options and set respectively Each setting screen is displayed by clicking the corresponding tab at the top of the dialog box Preprocessor tab default Memory Model tab Data Assign tab Optimize tab Debug tab Output tab Extend tab Others tab Startup Routine tab Users Manual U18549EJ1VOUM 41 42 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Command Line Options The option character string currently set is displayed The option character string entered is reflected and displayed in real time Nothing can be input in this display area Even though the default option of the CC78KOR is the specified state i e a check box is selected etc nothing is displayed in this area by default Options that do not fit in the option character display area can be checked by scrolling with the scroll bar OK button The settings edited in this dialog box are set and the Compiler Options dialog box closes If Special Compiler Options is selected i
22. b is startup routine for boot area and e is that for flash area Note 3 If a fixed area in the standard library is used I is added Note 4 if the small model or medium model is specified m is added if the large model is specified I is added if the small model or medium model is specified use the startup routine that I is added when variables are allocated in the far area Remark rom asm defines the label indicating the final address of the data copied by ROMization The object of the rom asm is included in the library User s Manual U18549EJ1VOUM 159 CHAPTER 8 STARTUP ROUTINES 8 3 2 Description of sample program cstart asm This section uses cstart asm and rom asm as examples to describe the contents of the startup routines A startup routine consists of the preprocessing initial settings ROMization processing starting the main function and postprocessing Remark cstart is called in the format added _ to its head 1 Preprocessing Preprocessing in cstart asm is described lt cstart asm preprocessing gt NAME cstart SINCLUDE def inc oJ SINCLUDE macro inc 42 BRKSW EQU 1 brk sbrk calloc free malloc realloc function use EXITSW EQU 1 exit atexit function use RANDSW EQU 1 rand srand function use DIVSW EQU 1 div function use LDIVSW EQU 1 ldiv function use FLOATSW EQU 1 floating point variables use STRTOKSW EQU 1 strtok function use
23. but Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein Renesas Electronics products are classified according to the following three quality grades Standard High Quality and Specific The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application categorized as Specific without the prior written consent of Renesas Electronics Further you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics The quality grade of each Renesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers off
24. to 20 lines describe as C cc78k0r cf1166a0 prime c x 1120 124 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 3 It Description format lt number of characters Interpretation when omitted It8 Function The It option indicates the basic number of characters for outputting a horizontal tabulation HT code in the source module file replacing it with several blanks spaces in each list tabulation processing Application If few characters are specified in 1 line in each list by the Iw option few blanks will result from an HT code so specify the It option to reduce the number of characters Description The range of the number of characters that can be specified by the lIt option is as follows 0 number of specifiable characters 8 Ifthe It0 is specified the tabulation processing is not performed and the tab codes are output fthe number of characters is omitted the number of expansion characters of a tab becomes 8 characters Ifthe list file specification specifies nothing the It option is invalid Use Example Ifthe It option is omitted the compiler presumes that the It8 option was specified and the number of blanks to be output from the HT code is set to 8 C cc78k0r cfl1166a0 prime c p The number of blanks to be output from the HT code is set to 1 C cc78k0r cfll66a0 prime c p lt1 Users
25. v option Ww W option WARNING X X option Y y option Z z option 232 Users Manual U18549EJ1VOUM 129 128 150 121 135 133 For further information please contact NEC Electronics Corporation 1753 Shimonumabe Nakahara ku Kawasaki Kanagawa 211 8668 Japan Tel 044 435 5111 http www necel com America NEC Electronics America Inc 2880 Scott Blvd Santa Clara CA 95050 2554 U S A Tel 408 588 6000 800 366 9782 http www am necel com Europe NEC Electronics Europe GmbH Arcadiastrasse 10 40472 Dusseldorf Germany Tel 0211 65030 http www eu necel com Hanover Office Podbielskistrasse 166 B 30177 Hannover Tel 0 511 33 40 2 0 Munich Office Werner Eckert Strasse 9 81829 M nchen Tel 0 89 92 10 03 0 Stuttgart Office Industriestrasse 3 70565 Stuttgart Tel 0 711 99 01 0 0 United Kingdom Branch Cygnus House Sunrise Parkway Linford Wood Milton Keynes MK14 6NP U K Tel 01908 691 133 Succursale Francaise 9 rue Paul Dautier B P 52 78142 Velizy Villacoublay C dex France Tel 01 3067 5800 Sucursal en Espa a Juan Esplandiu 15 28007 Madrid Spain Tel 091 504 2787 Tyskland Filial Taby Centrum Entrance S 7th floor 18322 Taby Sweden Tel 08 638 72 00 Filiale Italiana Via Fabio Filzi 25 A 20124 Milano Italy Tel 02 667541 Branch The Netherlands Steijgerweg 6 5616 HS Eindhoven The Netherlands Tel
26. 040 265 40 10 Asia amp Oceania NEC Electronics China Co Ltd 7th Floor Quantum Plaza No 27 ZhiChunLu Haidian District Beijing 100083 P R China Tel 010 8235 1155 http www cn necel com Shanghai Branch Room 2509 2510 Bank of China Tower 200 Yincheng Road Central Pudong New Area Shanghai P R China P C 200120 Tel 021 5888 5400 http www cn necel com Shenzhen Branch Unit 01 39 F Excellence Times Square Building No 4068 Yi Tian Road Futian District Shenzhen PR China P C 518048 Tel 0755 8282 9800 http www cn necel com NEC Electronics Hong Kong Ltd Unit 1601 1613 16 F Tower 2 Grand Century Place 193 Prince Edward Road West Mongkok Kowloon Hong Kong Tel 2886 9318 http www hk necel com NEC Electronics Taiwan Ltd 7F No 363 Fu Shing North Road Taipei Taiwan R O C Tel 02 8175 9600 http www tw necel com NEC Electronics Singapore Pte Ltd 238A Thomson Road 12 08 Novena Square Singapore 307684 Tel 6253 831 1 http www sg necel com NEC Electronics Korea Ltd 11F Samik Lavied or Bldg 720 2 Yeoksam Dong Kangnam Ku Seoul 135 080 Korea Tel 02 558 3737 http www kr necel com G0706
27. 78KOR the on chip peripherals for the devices and the interrupts can be simulated Since external parts and procedures are provided to construct dummy target Systems the programs including the operation of the target system are debugged at an early stage independent of hardware development Figure 1 11 System Simulator Function Load module file Object information Debugging information System Simulator Users Manual U18549EJ1VOUM 23 CHAPTER 1 OVERVIEW 1 2 9 PM PM provides an integrated development environment that allows users to develop programs efficiently Using PM a series of works required upon user program development such as starting the editor builder and debugger can be performed Figure 1 12 PM Function Product planning System design Hardware design Software design l Production Coding Inspection Wi Compiling assembling Yes No Debugging Yes System debugging System evaluation Commercialization ee System simulator Assembler Compiler Linker Object Converter Integrated debugger 24 User s Manual U18549EJ1VOUM CHAPTER2 PRODUCT OVERVIEW AND INSTALLATION This chapter explains the procedure to install the files stored in the supply media of the CC78KOR to the user development environment host machine and the procedure to uninstall them from the user development environment 2 1 Host
28. CC78KOR Vx xx inc78k0r y C Program Files NEC Electronics Tools dev lt Example 2 Linking program for boot area gt C 1k78k0r sOrllb rel boot rel b C Program Files NEC Electronics ToolsNCC78KORNVx xxMlib78k0rNclOrxm lib b C Program Files NEC Electronics ToolsNCC78KORNVx xxMlib78k0rNclOrm lib s oboot lmf zb2000h y C Program Files NEC Electronics Tools dev Example 3 Object converting program for boot area C oc78k0r boot lmf oboot lmf y C Program Files NEC Electronics Tools dev Caution After the program for boot area is compiled and object converted write in the HEX file e g boot hex with a flash programmer After writing be sure to save the load module file e g boot Imf and the HEX file created in the above procedure Do not build the program for boot area again b Compiling to linking program for flash area Example 1 Compiling program for flash area C cc78k0r cf1166a0 flash c zf i C MProgram Files NEC Electronics Tools CC78KOR Vx xx inc78k0r y C Program Files NEC Electronics Tools dev lt Example 2 Linking program for flash area gt C 1k78k0r boot lmf sOlle rel flash rel b C Program Files NEC Electronics Tools CC78KOR Vx xx 1lib78k0r cl0rxm lib b C Program Files NEC Electronics Tools CC78KOR Vx xx 1lib78k0r cl0rm lib s oflash lmf
29. CHAPTER 8 STARTUP ROUTINES 2 Initial settings The initial settings in cstart asm are described Initial settings in cstart asm gt VECTOO CSEG AT 0 t DW _ cstart LCODE CSEG BASE _ cstart SEL RBO s 453 MOV A _ MAA gt 2 MOV1 CY A 0 MOV1 MAA CY MOVW SP LOWW _ STBEG SP lt stack begin address 4 CALL hdwinit 45 IF BRKSW OR EXITSW OR RANDSW OR FLOATSW CLRW AX SENDIF 1 162 Reset vector setting The segment of the reset vector table is defined as follows The first address of the startup routine is set VECTOO CSEG AT 0000H DW _ cstart Mirror area setting The mirror area is set For the mirror area refer to the user s manual of the target device Register bank setting Register bank RBO is set as the work register Stack pointer SP setting _ STBEG is set in the stack pointer _ STBEG is automatically generated by specifying the symbol generation option s for stack resolution in the linker Hardware initialization function call The hdwinit function is created when needed by the user as the function for initializing a peripheral device SFR By creating this function initial settings can be made to match the user s objectives If the user does not create the hdwinit function the process returns without doing anything User s Manual U18549EJ1VOUM CHAPTER 8 STARTUP ROUTINES 3 ROMization p
30. DB OOH L0017 DB ra DB OAH DB d primes found DB OOH DATA DSEG BASEP _mark DS 201 DS ds line 5 line 8 CODE CSEG BASE _main push hl P subw sp 08H p movw hl sp line 11 clrw ax H movw hl r count line 13 movw FF nhlee6 tg ax J i L0003 movw ax hi 6 3 H cmpw ax 0C8H r 200 rL 2Y un dd skc bnz L0004 line 14 movw ax hl 6 pega movw be ax mov _mark bc 01H sv movw ao iuo SE 6 5 H HHH HH hz er c Fx ox oh H HHH mj nj m ong Time xx Xxx xx NNN W IN DO BRN Users Manual U18549EJ1VOUM 209 APPENDIX A SAMPLE PROGRAMS incw ax INF lys movw Hb 56s ap aX zoxX E INF 2d br L0003 INF 2 4 10004 line 15 clrw ax k INF Lv movw Duk BG ff ge ax ee H INF any 10006 movw ax ht re eain H INF Z 3 cmpw ax 0C8H 200 E INF 3 7 ort OY uda H INF P Skc gt INF 2g d bnz L0007 INF De ge CA line 16 movw ax Ri 6 ie at T INF 2 3 addw ax loww mark INF 3 movw de ax INF ge d mov a de H INF Bp cmpO a p INF d XT bz L0015 z INF Z4 line 17 movw ax hU 4 6 al H INF 2 4 addw ax ax INF qw addw ax 03H 05 INF EN movw hl 4 ax prime H INF 2 y line 18 push ax H INF 1 5 movw ax loww L0011 0 R INF E D call printf F INF 4 3 pop ax P INF line 19 movw ax hl r count gt INF incw ax H F P mo
31. Expected endasm Cause There is no endasm W0835 Message Too many characters in assembler source line Cause A line in the assembler source is too long W0836 Message Expected assembler source Cause There is no assembler source between asm and endasm W0837 Message Output assembler source file not object file Cause There is a asm block or asm statement Assembler source file is output instead of the object file Action by User Specify the a or sa compiler option in order to output the asm and asm statement description to the object file and then assemble the output assembler file E0838 Message Duplicated pragma VECT or INTERRUPT or RTOS INTERRUPT character string Cause The pragma VECT character string INTERRUPT character string or RTOS INTERRUPT character string is duplicated E0839 Message Unrecognized pragma VECT or INTERRUPT or RTOS INTERRUPT character string Cause There is an unrecognized pragma VECT character string INTERRUPT character string or RTOS_INTERRUPT character string W0840 Message Undefined interrupt function function name ignored BANK or SP SWITCH or LEAFWORK specified Cause The save destination is specified for an undefined interrupt function Program Register bank specifications stack switching specifications specifications are Processing ignored E0842 Message Unrecognized pragma SECTION character string Cause There is an unrecognized pragma SECTION character string
32. LINKING 3 2 2 Compiling to linking in command line for command prompt 1 When parameter file is not used The command below is used to start the CC78KOR assembler and linker in a command line Assembling is not needed when there is no assembler description in C source In this case link the object module file output from a C compiler A space path name cc78k0r Aoption AC source name Aoption path name ra78k0r Aoption Aassembler source name Aoption path name lk78k0r Aoption A object module name A option Caution To link libraries created by users be sure to specify the libraries attached to the CC78KOR and the floating point libraries at the end of the library list To use the sprintf sscanf printf scanf vprintf and vsprintf functions supporting floating points specify the floating point libraries attached to the CC78KOR and the libraries attached to the compiler in this order To use the sprintf sscanf printf scanf vprintf and vsprintf functions not supporting floating points specify the libraries attached to the CC78KOR and the floating point libraries attached to the compiler in this order Also specify the startup routine attached to the CC78KOR before the user programs The library and object module file specification order during linking is shown below Library specification order When using sprintf sscanf printf scanf vprintf and vsprintf functions not supporting floating points
33. Machines and Supply Medium The CC78KOR supports the development environments listed below Table 2 1 Supply Medium and Recording Formats for CC78KOR OS Supply Medium Windows 2000 XP Professional XP Home Edition CD ROM User s Manual U18549EJ1VOUM 25 CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION 2 2 Installation The procedure for installing to the host machine the files provided in the CC78KOR s supply media is described below 1 Starting up Windows Power on the host machine and peripherals and start Windows 2 Set supply media Set the CC78KOR s supply media in the appropriate drive CD ROM drive of the host machine The setup programs will start automatically Perform the installation by following the messages displayed in the monitor screen Caution If the setup program does not start automatically execute INSTALL EXE in the root 3 Confirmation of files Using Windows Explorer etc check that the files contained in the CC78KOR s supply media have been installed to the host machine For the details of each folder refer to 2 4 Folder Configuration 26 User s Manual U18549EJ1VOUM CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION 2 3 Installation of Device Files Obtain the device file by downloading it from the Online Delivery Service ODS which can be accessed from the following Website http www necel com micro ods eng Use the device file installer to install the device f
34. Manual U18549EJ1VOUM 125 CHAPTER 5 COMPILER OPTIONS 4 If Description format exu Interpretation when omitted The new page break code will not be added Function The lf option specifies adding the new page break code at the end of each list file Description Ifthe list file specification specifies nothing the lf option is invalid Use Example To add the new page break code at the end of the assembler source module file prime asm describe as C cc78k0r cf1166a0 prime c a 1f 126 Users Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 5 li Description format Interpretation when omitted No C sources of the include file will be added Function The li option adds the C source of the include file to the assembler source module file with C source comments Description Ifthe sa option is not specified this option is ignored Use Example To add the C source file of the include file to the assembler source module file prime asm with C source comments describe as C cc78k0r cf1166a0 prime c sa 1li Users Manual U18549EJ1VOUM 127 CHAPTER 5 COMPILER OPTIONS Warning output specification 1 w Description format w level Interpretation when omitted w1 Function The w option specifies whether a warning message is output to the console Application This
35. The character number of the identifier including exceeds 250 Action by User Shorten the length of the identifier E0305 Message Compiler limit too many identifiers with block scope Cause There are too many symbols having block scope in 1 block E0306 Message Illegal index indirection not allowed Cause An index is used in an expression that does not take a pointer value E0307 Message Call of non function variable name Cause The variable name is used as a function name E0308 Message Improper use of a typedef name Cause The typedef name is improperly used W0309 Message Unused variable name Cause The specified variable is declared in the source but is never used W0310 Message Variable name is assigned a value which is never used Cause The specified variable is used in an assignment statement but is never used otherwise E0311 Message Number syntax Cause The constant expression is illegal E0312 Message Illegal octal digit Cause This is illegal as an octal digit E0313 Message Illegal hexadecimal digit Cause This is illegal as a hexadecimal digit E0314 Message Too big constant Cause The constant is too large and cannot be represented E0315 Message Too small constant Cause The constant is too small and cannot be represented 180 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 4 Error Messages for Configuration Element from 0301 gt
36. U18549EJ1VOUM 87 CHAPTER5 COMPILER OPTIONS When the CC78KOR is started the compiler options can be specified The compiler options provide instructions for the CC78KOR operation and indicate the information required beforehand in program execution The compiler options are not only specified individually but multiple options can also be simultaneously specified The user selects the compiler options to match the objectives and to perform the tasks efficiently 5 1 Specifying Compiler Options Compiler options can be specified in the following ways J Specified in the command line when the CC78KOR starts Specified in the Compiler Options dialog box of PM Specified in the parameter file For the specification methods for the compiler options described above see CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Specify the suboption or file name after a compiler option without inserting a blank such as a space Spaces are required between the compiler options Uppercase characters and lowercase characters are not distinguished for the compiler options Example cc78k0rA cfl1166a0Aprime cA aprime asmA qx2 Remark A blanks such as spaces 88 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 5 2 Prioritization For the compiler options shown in the following table the prioritization is explained in a case where two or more options along the vertical axis and options along the horizontal
37. axis are simultaneously specified Table 5 1 Prioritization of Compiler Options no p np d u a e X sa r NG q NG z 3 A g NG 7 I y k A NG d OK u E OK E sa s NG s Iw E A E E 5 Il A A A A It A A A A If A A A A li s 2 A Location marked by NG If an option in the horizontal axis is specified the option in the vertical axis becomes invalid Example C cc78k0r cf1166a0 sample c no rd g The rd and g options become invalid Location marked by A If an option in the horizontal axis is not specified the option in the vertical axis becomes invalid Example C cc78k0r cfl1166a0 sample c p k Since the p option is specified the k option is valid Location marked by OK The option specified last out of an option in the horizontal axis and an option in the vertical axis has priority Example C cc78k0r cf1166a0 sample c utest dtest 1 Since the d option is specified last the u option becomes invalid and the d option has priority User s Manual U18549EJ1VOUM 89 CHAPTER 5 COMPILER OPTIONS As with the o and no options the option specified last has priority even if n can be added before the option name Example
38. beginning at column 13 on the next line 6 Cross reference Number of Outputs the specified file name list file name characters If the file type is omitted xrf is attached Contents enabled by OS that exceed the line length are output beginning at column 13 on the next line 148 User s Manual U18549EJ1VOUM CHAPTER 6 C COMPILER OUTPUT FILES Item Number Description Number of Columns Format 7 Parameter file contents Outputs the parameter file contents Contents that exceed the line length are output beginning at column 13 on the next line One or more white space characters or tabs are replaced by a single white space character Include file Number of characters enabled by OS Outputs the file name specified in the C source n is a number starting with 1 that indicates the include file number Contents that exceed the line length are output beginning at column 13 on the next line This line is not output when there is no include file Symbol attribute 6 fixed Displays the symbol attributes An external variable is displayed as EXTERN an external static variable as EXSTC an internal static variable as INSTC an auto variable as AUTOnn a register variable as REGnn where nn is the scope value a numerical value that begins with 1 an external typedef declaration as EXTYP an internal typedef declaration as INTYP a label as LABEL a structure or union tag as
39. bit boolean ignored Cause The address of a bit field or bit or boolean type variable is not obtained W0528 Message amp is not allowed array function ignored Cause The amp operator does not have to be applied to an array name or function name E0529 Message Sizeof returns zero Cause The value of the sizeof expression becomes zero 186 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 6 Error Messages for Expression from 0501 tide Error Message E0530 Message Illegal sizeof operand Cause The operand of the sizeof expression must be an identifier or a type name E0531 Message Disallowed conversion Cause Illegal casting occurred Action by User Check for illegal casting This error occurs when a constant is cast to a pointer or when an address is outside the range of the memory model E0532 Message Pointer on left needs integral right operator Cause Since the left operand is a pointer the right operand must be an integral value E0533 Message Invalid left or right operand operator Cause The left or right operand is illegal for the operator E0534 Message Divide check Cause The divisor of the operation or operation is zero E0535 Message Invalid pointer addition Cause 2 pointers are not added E0536 Message Must be integral value addition Cause Only integral values can be added to a pointer E0537 Message Illegal pointe
40. can be specified as the file name fthe output file name is omitted when the sa option is specified the assembler source module file name becomes input file name asm fthe extension for the output file name is omitted when the sa option is specified assembler source module file output file name asm will be output fthe drive name is omitted when the sa option is specified the assembler source module file is output to the current drive f both the sa and a options are simultaneously specified the sa option is ignored TheC source in an include file is not added to the comments in the output assembler source module However if the li option is specified the C source in the include file is also added to the comments Caution To change the output destination when using PM specify the new output destination in the Output Path combo box in the Create Assembler Source Module File area under the Output tab and select either with C Source without Include sa or with C Source with Include sa li When individual compiler options are specified the output file name can also be changed Specify the file name or the output destination in the Output Path combo box under the Output tab To specify a file name append the extension asm Use Example To add the C source prime c as a comment to the assembler source module file prime asm describe as C cc78k0r cfl1166a0 pri
41. certain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Elect
42. delimit between compiler options by a space It does not matter whether a description is written in uppercase or lowercase non case sensitive For detailed information see CHAPTER 5 COMPILER OPTIONS The i option specification b option path specification and y option specification can be omitted depending on the condition For details see CHAPTER 5 COMPILER OPTIONS and RA78KOR Assembler Package Operation User s Manual User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 2 When parameter file is used When multiple options are input in starting a C compiler assembler or linker the same specification may be repeated several times if sufficient information for startup has not been specified in the command line In such cases a parameter file should be used Specify the parameter file specification option f in the command line when using a parameter file The following shows the startup method for a compiler assembler and linker by using a parameter file path name cc78k0rA fparameter file nam path name ra78k0rA fparameter file nam path name lk78k0rA fparameter file nam The following shows a usage example C cc78k0r fpara pcc C ra78k0r fpara pra C 1k78k0r fpara plk Parameter files are created by an editor All options and output file names that should be specified in a command line can be written The following shows examples of creati
43. di Electronics Tools CC78KOR Vx xx CC78KOR STACK SIZE User s Manual U18549EJ1VOUM 139 CHAPTER 6 C COMPILER OUTPUT FILES 28 o5 rod 14 bytes z 6 bytes Target chip bc pointer ax SFUNC printf 31 be pointer s ax CODE SIZE 23 bytes SFUNC putchar 41 be charc x CODE SIZE 16 bytes 19 uPD78F1166_A0 int sp 2 int i sp t4 Ty CLOCK SIZE 22 clocks STACK SIZE CLOCK SIZE 18 clocks STACK SIZE Device file 20 Vx xx Item d Number of Number Description Columns Format 1 Version number 4 fixed Displayed in x yz format 2 Date 11 fixed System date Displayed in DD Mmm YYYY format 3 Time 8 fixed System time Displayed in HH MM SS format 4 Command line Outputs the command line contents following CC78KOR Contents after column 80 are output beginning at column 15 on the next line A semicolon is output to column 1 One or more white space characters or tabs are replaced by a single white space character 5 C source module file Number of Outputs the specified file name name characters If the file type is omitted c is attached as the file enabled by OS type extension Contents after column 80 are output beginning at column 15 on the next line A semicolon is output to column 1 6 Assembler source Number of Outp
44. granted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information When exporting the products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations Renesas Electronics has used reasonable care in preparing the information included in this document
45. i option specification b option path specification and y option specification can be omitted depending on the condition For details see CHAPTER 5 COMPILER OPTIONS and RA78KOR Assembler Package Operation User s Manual Users Manual U18549EJ1VOUM 81 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 4 l OFiles of C Compiler The CC78KOR inputs the C source module files written in the C language These are converted into machine language and output as object module files After compiling the assembler source module files are output so that the user can check and revise the contents at the assembly language level Based on the compiler options the list files such as the preprocess list cross reference list and error list are output If there is a compiler error the error message is output to the console and the error list file If errors occur various files other than an error list file cannot be output The CC78KOR I O files are shown below Table 3 1 C Compiler I O Files Type File Name Description Default File Type Input Files C source module file Source file written in the C language File created by the user Include file File referenced by a C source module h file File written in the C language File created by the user Parameter file File created by the user when the user pcc wants to specify multiple commands that cannot be specified in the command line when the C comp
46. invalid _ If several k options are simultaneously specified the last specified one is valid Users Manual U18549EJ1VOUM 107 CHAPTER 5 COMPILER OPTIONS Use Example To perform deletion of comments line number processing and page processing when the preprocess list file prime ppl describe as C cc78k0r cfl1166a0 prime c p kcen Output example 78KOR C Compiler Vx xx Preprocess List Date XX XXX XXXX Page 1 Command cfll66a80 prime c p kcen In file prime c PPL file prime ppl Para file 1 define TRUE 1 2 define FALSE 0 3 define SIZE 200 4 5 char mark SIZE 1 6 7 main 8 Target chip uPD78F1166_A0 Device file VX XX 108 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Preprocess specification 1 d Description format dmacro name definition name macro name definition name Multiple specifications are possible Interpretation when omitted Only the macro definitions in a C source module file are valid Function The d option specifies the same macro definition as the define statement in the C source Application Specify this option when you want to validate the special macro definition Description By delimiting each definition by a comma 30 macro definitions are made at one time Spaces are not allowed before and after and Ifthe definition name is om
47. is not the name of a structure or a union but is a pointer to a structure or a union Action by User Make the expression before the operator a structure or a union variable E0516 Message Zero sized structure structure name Cause The size of the structure is zero E0517 Message Illegal structure operation Cause An operator that cannot be used in a structure is used E0518 Message Illegal structure union comparison Cause 2 structures or unions cannot be compared E0519 Message Illegal bit field operation Cause There is an illegal description for a bit field E0520 Message Illegal use of pointer Cause The only operators that can be used on pointers are addition subtraction assignment relational indirection and member reference gt E0521 Message Illegal use of floating Cause An operator that cannot be used on floating point variables is used W0522 Message Ambiguous operators need parentheses Cause 2 shift relational and bit logical operators appear continuously without parentheses E0523 Message Illegal bit boolean type operation Cause An illegal operation is performed on bit or boolean type variables E0524 Message amp on constant Cause A constant address is not obtained E0525 Message amp requires lvalue Cause The amp operator can only be used in an expression assigned to the left value E0526 Message amp on register variable Cause The address of a register variable is not obtained E0527 Message amp on
48. label is described two or more times in a switch statement E0606 Message Non constant case expression Cause Something other than an integral constant is specified in a case statement E0607 Message Compiler limit too many case labels Cause The number of case labels in the switch statement exceeded 257 E0608 Message Default not in switch Cause The default statement is not described in the correct position E0609 Message More than one default Cause The default statement is described multiple times in the switch statement E0610 Message Compiler limit block nest level too depth Cause The block nesting exceeded 45 E0611 Message Inappropriate else Cause There is no correspondence between if and else W0613 Message Loop entered at top of switch Cause A while do or for is specified immediately after the switch statement W0615 Message Statement not reached Cause The statement is never reached E0617 Message Do statement must have while Cause A while is required at the end of a do E0620 Message Break continue error Cause The positions of the break and continue statements are incorrect E0621 Message Void function function name cannot return value Cause A function declared as void returns a value 188 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 7 Error Messages for Statement from 0601 gt Te Error Message W0622 Message No return value Cause A function tha
49. linking In this case specify the name of the area used in the stack If the name of the area is omitted the RAM area is used but the stack area can be located anywhere by creating a link directive file For memory mapping refer to the user s manual of the target device An example of a link directive file is shown below The link directive file is a text file created by the user in an ordinary editor for details about the description method refer to RA78KOR Assembler Package Operation User s Manual Example when sSTACK is specified in linking Create IKk78kOr dr link directive file Since ROM and RAM are allocated as default operations by referencing the memory map of the target device it is not necessary to specify ROM and RAM allocations unless they should be changed For link directive refer to Ik78kOr dr in the smp78kOr cc78k0r folder First address Size l memory SDR OxFFE20h 0000098h memory STACK Oxxxxxxh Oxxxxxxh Specify the first addressand size here then specify 1k78k0r dr by the d linker option Example dlk78k0r dr merge INIS SDR merge DATS SDR merge BITS SDR 5 External reference declaration of label for ROMization processing The label for ROMization processing is defined in the postprocessing section 6 Securing area for standard library The area used when using the standard library is secured Users Manual U18549EJ1VOUM 161
50. member whose bit specification number of bit field declaration is 0 W0787 Message Bit field type is not int Cause Type other than int is specified for bit field type E0788 Message Cannot allocate a flash function function name Cause Oneofthe flash functions cannot be allocated E0789 Message ZF option did not specify cannot allocate an EXT FUNC function function name Cause Flash memory area object creation option zf is not specified It cannot be allocated to the function specified in the 2pragma EXT FUNC E0790 Message Callt interrupt are not allowed for EXT FUNC function function name Cause Callti interrupt declarations are not allowed for the function specified in the pragma EXT FUNC 194 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 8 Error Messages for Declaration and Function Definition from 0701 gt Eom Error Message E0791 Message ZF option specified cannot allocate a callt function function name Cause Flash memory area object creation option zf was specified A callt function cannot be allocated E0799 Message Cannot allocate variable name out of address range Cause Address specification for variable names for which absolute address allocation specification is performed exceed the specifiable address range User s Manual U18549EJ1VOUM 195 CHAPTER 9 ERROR MESSAGES
51. name and function call line call function number as decimal code Information starting with CALL 28 Function information Outputs return value register and argument Call function s return value argument information during function call register or stack position 142 User s Manual U18549EJ1VOUM CHAPTER 6 C COMPILER OUTPUT FILES 6 3 Error List File An error list file contains messages regarding any errors and warnings that occurred during compilation The C source program can be added to the error list by specifying a compiler option An error list file that contains a C source program can be used as a C source module file by revising the C source program and deleting comments such as the list header 6 3 1 Error list file with C source Output format 78KOR C Compiler V 1 x xx Error List Date 2 xx XXX xx Time 3 xx xx xx Command 4 cf1166a0 prime c se C file 5 prime c Err file 6 prime cer Para file 7 xp 8 define TRUE 1 8 define FALSE 0 8 define SIZE 200 8 char mark SIZE 1 8 void main void 8 int i prime k count 8 cont 0 CC78KOR error 9 EO711 10 Undeclared cont function main 8 for i20 i lt SIZE i 8 mark i TRUE 8 for i 0 i lt SIZE i 8 if mark i prime i i 3 printf 6d prime CC78K0R warning 9 W0745 10 Expected functi
52. option specifies whether to output warning messages to the console Detailed messages can also be output Description The levels of the warning message are given below Level Description 0 Do not output warning messages 1 Output normal warning messages 2 Output detailed warning messages Ifthe e or se option is specified the warning messages are output to the error list file A Level 0 indicates not to output warning messages to the console and the error list file when e or se is specified Use Example Ifthe w option is omitted the compiler presumes that the w1 option was specified and outputs normal warning messages C cc78k0r cfl1166a0 prime c 128 Users Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Execution state display specification 1 v nv Description formats nv Interpretation when omitted NV Function The v option outputs the execution state of the current compilation to the console The nv option invalidates the v option Application Specify this option to check the execution status of compilation Description The phase name and function names in the process are output f both the v and nv options are simultaneously specified the last specified one is valid Use Example To output the current status of compilation to the console describe as C cc78k0r cfll166a
53. refer to CC78KOR C Compiler Language User s Manual E0719 Message Illegal use of type Cause An illegal type name is used E0720 Message Illegal void type for identifier Cause The identifier is declared by void WO0721 Message Illegal type for register declaration Cause A register declaration is specified with an illegal type Program The register declaration is ignored and processing continues Processing E0722 Message Illegal keyword for rtos task function Cause An illegal qualifier was specified for the RTOS task function E0724 Message Structure redefinition Cause The same structure is redefined W0725 Message Illegal zero sized structure member Cause The area taken as a structure member is not secured E0726 Message Function cannot be structure union member Cause A function cannot be a member of a structure or a union E0727 Message Unknown size structure union name Cause Structures or unions have undefined sizes E0728 Message Compiler limit too many structure union members Cause The members in a structure or union exceeded 256 E0729 Message Compiler limit structure union nesting Cause The nesting of structures or unions exceeded 15 E0730 Message Bit field outside of structure Cause A bit field is declared outside of the structure E0731 Message Illegal bit field type Cause A type other than an integral type is specified in a bit field type E0732 Message Too long bit field size Cause The number of bit specifications in a bit field
54. rs and specification are Possible nr are specified simultaneously rd n m n 1 2 4 Specifies external variables external static ku last Pii variables are specitiea are enabled automatically assigned to the saddr area rs n m n 1 2 4 Assigns a static auto variable automatically to the saddr area nr The r rd rk and rs options are disabled Optimization aLoptimization type Specifies calling the If q and nq are qcjlvw specification Multiple specifications optimization phase to specified are possible generate efficient simultaneously objects the last one specified is nq Invalidates the q option enabled Debugging g n n 1 2 Specifies the output of If g and ng are g2 information the source level specified output debugging information simultaneously specification R the last one nq Invalidates the g option specified is enabled Preprocess p output file name Specifies the output of If p is not None no file list file the preprocess list files specified then k is output creation is disabled k process type Specifies processing for kfin specification Multiple specifications are possible the preprocess lists User s Manual U18549EJ1VOUM 227 APPENDIX C COMMAND OPTIONS Table C 1 Compiler Options of Relationship with Interpretation Types Description Format Functions Other Options When omitted Preprocess dma
55. source the specified option takes priority A warning message is output at that time Ifthe help option has been specified all other options are ignored 2 File output destinations Only disk type files can be specified as the output destination for object module files 3 Error messages When a syntax error has been found in a file an error message is attached to the file name If a device file has been specified at a prohibited location the specified character string is output by itself In all other cases the drive path and file extension must be attached 4 Source file names In the CC78KOR the part except the source file name extension primary name is used as the module name by default Therefore some restrictions apply to the source file names that can be used Regarding the length of the file name configure the file name with a primary name and extension within the range allowed by the OS and separate the primary name and the extension with a dot The characters that can be used for the primary name and the extension consist of the characters allowed by the OS except parentheses semicolons and commas Note that a hyphen cannot be used as the first character of a file name or file name Do not specify file names that include a space or 2 byte characters An error is output during linking for files that have the same name as the first 8 characters of the primary name Sharp symbol c
56. the number of characters that can be specified by the Iw option is as follows and does not include terminators CR LF 72 number of characters printed in 1 line 132 fthe number of characters is omitted the number of characters in 1 line becomes 132 characters If output to the console there is a maximum of 80 characters Ifthe list file specification specifies nothing the Iw option is invalid Use Example Tosetthe number of characters on 1 line of the cross reference list file prime xrf to 72 characters describe as C cc78k0r cfll66a80 prime c x 1w72 Users Manual U18549EJ1VOUM 123 CHAPTER 5 COMPILER OPTIONS 2 Il Description format ll number of lines Interpretation when omitted There is no page break Function The Il option specifies the number of lines on 1 page of each type of list file Application f you want to change the number of lines in 1 page in each type of list file specify the Il option Description The range of the number of lines that can be specified by the lIl option is as follows 20 number of lines printed on 1 page 65535 f ll0 is specified there is no page break fthe number of lines is omitted there is no page break Ifthe list file specification specifies nothing the Il option is invalid Use Example To set the number of lines on 1 page of the cross reference list file prime xrf
57. using the Browse button Opens the Browse for Folder dialog box Parameterfile Input into this combo box parameter file to which the name of an input file and options are to be input Only one folder can be specified in this combo box Up to 259 characters can be input into this combo box Specification is also possible using the Browse button Opens the ParameterFile dialog box Other Options If a compiler option other than the various option specification items must be specified input that option in the combo box Up to 259 characters can be input into this combo box Reset button Clicking this button sets the default option settings Option file read button Clicking this button causes the option information file containing the option settings to be read Option file save button Option settings are saved as an option information file This button is enabled only when information has been set with the OK button or the Apply button User s Manual U18549EJ1VOUM 63 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Startup Routine tab Figure 3 21 Compiler Options Dialog Box When Startup Routine Tab Is Selected Compiler Options Preprocessor Memory Model Data Assign Optimize Debug Output Others Startup Routine v Using Fixed Area of Standard Library M ROMization processes of far area Select Object Nomal Boot J Startup Routine sOtlrel v Using Library Usi
58. vectxx asm Vector source for each interrupt xx vector address def inc For setting library according to type macro inc Macro definition for each typical pattern vect inc Start address of flash memory area branch table library inc Selection of library assigned to boot area explicitly Note A file name with n added is a startup routine that does not have standard library processing Use only if the standard library will not be used cstartb asm is a startup routine for boot area and cstarte asm is a startup routine for flash area 156 User s Manual U18549EJ1VOUM CHAPTER 8 STARTUP ROUTINES 8 2 Batch File Description 8 2 1 Batch files for creating startup routines The mkstup bat in the bat folder is used to create the object file of a startup routine The assembler in the RA78KOR Assembler Package is required for mkstup bat Therefore if PATH is not specified specify it and run How to use this file is described next How To Use Execute the following command line in the src cc78kOr bat folder containing mkstup bat mkstup devi ce t ypeNote Note Refer to the user s manual of the device used or Device Files Operating Precautions Use Example The startup routine to be used is created when the target device is the uPD78F1166 AO mkstup f1166a0 The mkstup bat batch file is stored in the form that overwrites the object file of the startup routine in the lib folder at the same level as the
59. 0 Pointer mismatch func sizeof st sizeof st 0 st b An error E0737 will occur if the tag is used in a return value type declaration of an argument declaration and a structure union or enum type is specified lt Example gt rnt func2 void funcl struct st E0737 Undeclared structure union enum tag struct st E0737 Undeclared structure union enum tag int struct st char memb1 char memb2 7 Prevention method Define the tag of the structure union or enum beforehand Initialization of array structure or union in function Arrays structures and unions using something other than a static variable address constant or character string cannot be initialized lt Example gt void void char char vola void p pl p2 ocaq 3 p o p2 Jo y Error E0750 Prevention method Describe an assignment statement and use it instead of initialization lt Example gt void void void void char Rea qq char pa ge SPL gc SSD Awe ca 0 p cal 1 pl ca 2 p2 224 User s Manual U18549EJ1VOUM APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 21 extern callt function If the address of an extern callt function is referenced by initializing the function table etc and the callt functio
60. 0 prime c v Users Manual U18549EJ1VOUM 129 CHAPTER 5 COMPILER OPTIONS Parameter file specification 1 f Description format ffile name Interpretation when omitted The input of an option and an input file name is possible only from a command line Function The f option specifies the input of the options or input file name from the specified file Application When sufficient information for starting the CC78KOR cannot be specified in a command line because multiple options are input while compiling specify the f option When specifying options repeatedly for compilation describe the options in the parameter file and specify the f option Description Parameter file nesting is not allowed The number of characters that can be described in a parameter file is not limited Spaces and tabs delimit the options or input file names The options or input file names described in the parameter file are expanded at the location of the parameter file specification in the command line The prioritization of the expanded options is that the last specified one is valid Characters described after the and are interpreted as comments until the end of the line Use Example A Contents of the parameter file prime pcc parameter file prime c cfl166a0 aprime asm e x The parameter file prime pcc is used in the compilation C cc7
61. 022 Message Same category option specified ignored option Cause Conflicting options had duplicate specifications Program The option specified later is validated and processing continues Processing WO0023 Message Incompatible chip name Cause The device type in the command line and the device type in the source differ Program The device type in the command line has priority Processing User s Manual U18549EJ1VOUM 175 CHAPTER 9 ERROR MESSAGES Table 9 1 Error Messages for Command Line from 0001 elas Error Message F0024 Message Illegal chip specifier on command line Cause The device type in the command line is incorrect W0029 Message QC option is not portable Cause The qc option does not conform to the ANSI standard For details about qc see CHAPTER 5 COMPILER OPTIONS W0031 Message ZP option is not portable Cause The zp option does not conform to the ANSI standard For details about zp see CHAPTER 5 COMPILER OPTIONS W0032 Message ZC option is not portable Cause The zc option does not conform to the ANSI standard For details about zc see CHAPTER 5 COMPILER OPTIONS F0033 Message Same category option specified option Cause Conflicting options had duplicate specifications Action by User Please enter cc78k0r if you want help message is output Use the or h option to reference the help file and correct the inp
62. 0501 Error messages for an expression From 0601 Error messages for a statement From 0701 Error messages for a declaration and function definition From 0801 Error messages for a preprocessing directive From 0901 Error messages for fatal file I O and running on an illegal operating system If the file name contains a syntax error the file name is added to the message An error message is added changed and deleted according to the language specification of the C compiler being developed User s Manual U18549EJ1VOUM 173 CHAPTER 9 ERROR MESSAGES 9 2 1 Error messages for a command line Table 9 1 Error Messages for Command Line from 0001 E Error Message F0001 Message Missing input file Cause The input source file name was not specified Action by User Please enter cc78k0r if you want help message is output Use the or h option to reference the help file and input the file name correctly F0002 Message Too many input files Cause Multiple input source file names are specified Action by User Please enter cc78k0r if you want help message is output Use the or h option to reference the help file and input the file name correctly F0003 Message Unrecognized string Cause An item other than an option was specified on the interactive command line F0004 Message Illegal file name file name Cause Either the format characters or num
63. 1 Librarian 21 Library 30 219 Library file 30 Library naming rule 31 Link directive file 161 169 218 Linker 19 Ik78kOr dr 29 Il option 124 It option 125 lw option 123 M m option 136 mkstup bat 29 154 157 N ng option 105 no option 96 nq option 102 nr option 98 100 101 nv option 129 nz option 133 Users Manual U18549EJ1VOUM 231 Oo o option 96 Object converter 20 Object module file 138 On line help file 29 Optimization 85 P p option 106 Parameterfile 63 PATH 34 151 Preprocess list file 146 prime c 29 Q q option 102 R roption 98 rd option 100 readme doc 29 repgetc bat 154 repputc bat 154 repputcs bat 154 reprom bat 29 154 repselo bat 154 repselon bat 154 repvect bat 154 Reset vector 162 rom asm 29 159 ROMization 87 153 ROMization processing 163 170 ROMization routine 154 rs option 101 Runtime library 30 87 S SOr rel 29 159 sa option 114 sample bat 29 se option 119 sjis 34 Source file name 216 Stack pointer 162 Standard library 30 87 Startup module 170 Startup routine 30 87 153 157 158 218 Startup routine naming rule 31 System simulator 23 T toption 131 TMP 34 151 U u option 110 V
64. 163 CHAPTER 8 STARTUP ROUTINES XQR INIT segment name INIT _ R_INIT first label Copy Area storing initial value of variable a R INIT end label The first and end labels in the G QR INIT segment are defined by QR INIT and R INIT The first and end labels in the INIT segment are defined by OQINIT and INIT The variables b and d are not copied but zeros are directly placed in the segment determined by the RAM The tables below show the segment names of the ROM and RAM areas where the variables a to d are placed and the first and end labels of the initial values in each segment ROM Area for Initial Values User s Manual U18549EJ1VOUM Variable Type Segment First Label End Label External variable with initial value a R_INIT _ R_INIT _ R_INIT when allocated in near area External variable with initial value a RLINIT _ RLINIT _ RLINIT when allocated in far area sreg variable with initial value c R_INIS _ R_INIS _ R_INIS lt RAM Area for Initial Values Copy Destination gt Variable Type Segment First Label End Label External variable with initial value a INIT _ INIT _ INIT when allocated in near area External variable with initial value a INITL _ INITL INITL when allocated in far area External variable without initial value b DATA _ DATA _ DATA when allocated in near area External variable without
65. 177 9 2 3 Error messages for a character 179 9 2 4 Error messages for configuration element 180 9 2 5 Error messages for conversion 183 9 2 6 Error messages for an expression 185 9 2 7 Error messages for a statement 188 151 9 2 8 Error messages for a declaration and function definition 190 9 2 9 Error messages for a preprocessing directive 196 9 2 10 Error messages for fatal file I O and running on an illegal operating system 201 9 3 List of PM Error Messages 203 APPENDIX A SAMPLE PROGRAMS 207 A 1 C Source Module File 207 A 2 Execution Example 208 A 3 Output List 209 A 3 1 Assembler source module file 209 A 3 2 Preprocess list file 213 A 3 3 Cross reference list file 214 A 3 4 Error list file 215 APPENDIX B LIST OF USE RELATED CAUTIONS 216 APPENDIX C COMMAND OPTIONS 227 INDEX 231 10 User s Manual U18549EJ1VOUM LIST OF FIGURES Figure No Title Page MM WR o Ll nl lll Eon ave T C rd OANOAARWNH HHH HPOOAONDAKRWN Di WWWWWWWW CO CO L o Development Process 13 Software Development Process 14 Program Development Procedure Using CC78KOR 15 Creating Source Module Files 16 C Compiler Function 17 Assembler Function 18 Linker Function 19 Object Converter Function 20 Librarian Function 21 Debugger Function 22 System Simulator Function 23 PM Function 24 Folder Config
66. 2 E0750 Initializer syntax Prevention method Do not specify the initializer of a union with nesting Example struct Ss int di 5 2 union Au struct Ss Ul pouch gu 24 Kanji code 2 byte code classification To use a source containing EUC code set the environmental variable LANG78K to euc or specify the ze option 25 Section start address specification The size of the section whose start address is specified with the pragma section directive is always an even number 226 User s Manual U18549EJ1VOUM APPENDIX C COMMAND OPTIONS In this chapter the program options are summarized in table format Use this when developing programs This option table can be used as an option index Table C 1 Compiler Options E Relationship with Interpretation Types Description Format Functions Other Options when amitted Device type cdevice type Specifies the type of Independent Specification specification target device of this option cannot be omitted Object o output file name Specifies the output of If o and no are oinput file module file the object module files specified name rel creation simultaneously specification Specifies not to output the last one the object module file specified is enabled Memory rprocess type Specifies the method of If r and nr rd nr assignment Multiple specifications memory assignment and nr
67. 8k0r fprime pcc 130 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Temporary file creation folder specification 1 t Description format tfolder Interpretation when omitted The temporary files are created in the drive folder specified by the environment variable TMP If not specified the files are created in the current drive and current folder Function The t option specifies the drive and folder where the temporary files are created Application The location for creating the temporary files can be specified Description Evenif there are temporary files that have been created previously if a file is not protected it is overwritten the next time it is created A temporary file expands in memory to the required memory size If the required memory size is no longer available the temporary file is created in the specified folder and the memory contents are written to the file Accesses to subsequent temporary files are to files not in memory The temporary files are deleted when compilation ends By pressing CTRL C the files are deleted when compilation stops Use Example To output the temporary files to the tmp folder describe as C cc78k0r cfll66a80 prime c ttmp Users Manual U18549EJ1VOUM 131 CHAPTER 5 COMPILER OPTIONS Help specification 1 2 h Description formats Interpretation when omitted Nothin
68. A SAMPLE PROGRAMS for information about the sample program How to execute on the PM and how to execute from the command line is described for information on installation see 2 2 Installation 3 1 PM This section describes the user interface when the CC78KOR is started in PM included in the RA78KOR Assembler Package If the CC78KOR is started from PM cc78kOrp dll included in CC78KOR is referenced 3 1 1 Position of cc78kOrp dll tools DLL The tools DLL file such as the cc78kOrp dll file is needed to run the Windows version of the 78KOR C compiler CC78KOR from PM 3 1 2 Execution environment This environment conforms to PM User s Manual U18549EJ1VOUM 35 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 1 3 CC78KOR option setting menu 1 Option menu items The item Compiler Options is added to the Tools menu in PM by the tools DLL file included in the CC78KOR C Compiler Package 2 Compiler Options dialog box Select the Compiler Options menu under Tools in PM to call the option setting function for the tools DLL and open the Compiler Options dialog box Figure 3 1 Compiler Options Dialog Box Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign ptimize Debug Output Define Macro d Edit Undefine Macro u zb es Include Search Path i Command Line Options Cancel Help 36 User s Man
69. A78KOR Assembler Package Operation User s Manual and Ik78kOr dr in the smp78kOr folder equipped with the CC78KOR Example When you want to place external variables without initial values except sreg variables from a certain C source file to the external memory 1 Change the section name for the external variables without initial value at the beginning of the C source pragma section DATAL EXTDATA Caution Initialization of the changed segment and ROMization should be performed by changing the startup routine 2 Create a link directive file lt lk78kOr dr gt memory EXTRAM 040000h 1000h merge EXTDATA EXTRAM Heed the following points when creating a link directive file When using the s automatic generation option for stack symbols while linking it is recommended to secure the stack area by the memory directive of the link directive file and specify its name explicitly If the area name is omitted it is used as the stack area in the RAM except for the SFR area Example When added to the link directive file IK78kOr dr memory EXTRAM 040000h 1000h memory STK OFBOOOH 100H merge EXTDATA EXTRAM Command line gt lk78k0r sOrml rel prime rel bclO0rm lib sSTK dlk78k0r dr The following error may be output when linking in the defined memory area RA78KOR error E3206 Segment xxx can t allocate to memory ignored Cause Bec
70. CC78KOR warning W0745 Expected function prototype prime c CC78KOR warning W0745 Expected function prototype prime c 26 CC78KOR warning W0622 No return value prime c CC78KOR warning W0622 No return value prime c CC78KOR warning W0622 No return value Target chip uPD78F1166 A0 Device file Vx xx Compilation complete 0 error s and 5 warning s found If a fatal error was detected where the compiling process cannot continue during compilation the compiler outputs a message to the console stops compilation and returns control to the operating system An example that outputs an error is shown below 78KOR C Compiler Vx xx xx xxx xxxx Copyright C NEC Electronics Corporation xxxx XXXX CC78KOR error F0018 Option is not recognized s Please enter CC78KOR if you want help messages Program aborted In this example since a nonexistent compiler option s was input an error results and the compiler stops If the CC78KOR outputs error messages and stops the compilation find the sources of these error messages in CHAPTER 9 ERROR MESSAGES and correct 84 User s Manual U18549EJ1VOUM CHAPTER4 CC78KOR FUNCTIONS 4 1 Optimization Method Optimization is performed to create efficient object module files in the CC78KOR The table below lists the supported optimization methods Table 4 1 Optimization Methods Phase Contents Example Syntax 1
71. Cause The file name in the definition of the include statement is not correctly enclosed by or lt gt E0813 Message Compiler limit too many include nesting Cause The nesting of the include files exceeded 50 E0814 Message Illegal macro name Cause The macro name is illegal E0815 Message Compiler limit too many macro nesting Cause The number of nesting macros exceeds 200 196 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 9 Error Messages for Preprocessing Directive from 0801 2 Ene Error Message W0816 Message Redefined macro name macro name Cause The macro name is redefined W0817 Message Redefined system macro name macro name Cause The system macro name is redefined E0818 Message Redeclared parameter in macro macro name Cause The same identifier appears in the parameter list in the macro definition W0819 Message Mismatch number of parameter macro name Cause The number of parameters when referencing differs from the number of parameters defined by define E0821 Message Illegal macro parameter macro name Cause The description enclosed by parentheses in the function format macro is illegal E0822 Message Missing macro name Cause The right parenthesis was not found in the same line as the define definition in the function format macro E0823 Message Too long macro expansion macro
72. Debug ss Use the hardware debugger in circuit emulator etc to verify the operation i NO System Evaluation 14 User s Manual U18549EJ1VOUM CHAPTER 1 OVERVIEW 1 2 Development Procedure Using CC78KOR The development procedure using CC78KOR is shown below Figure 1 3 Program Development Procedure Using CC78KOR C source module file C compiler Assembler source module file d Assembler source module file Include file Real time OS Object module file Assembler Library file list file wW Library file Linker Load module file S e 7 v Object converter Integrated Debugger USB In circuit emulator v Absolute A le li ssemble lst Hexadecimal fil S object module file PROM programmer Flash memory programmer Users Manual U18549EJ1VOUM 15 CHAPTER 1 OVERVIEW 1 2 1 Using editor to create source module files 1 program is divided into several functional modules 1 module is the coding unit and becomes the input unit to the C compiler A module that is the input unit to the C compiler is called a C source module After each C source module is coded use the editor to save the source module to a file A file created in this way is called a C source module file The C source module files become the CC78KOR input files Figure 1 4 Creating Source Module Files Program Source Module Write to File Editor Sour
73. E0843 Message Unspecified start address of section name Cause The correct starting address is not specified after AT in the pragma section E0845 Message Cannot allocate section name out of address range Cause The specified section cannot be placed at the specified starting address 198 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 9 Error Messages for Preprocessing Directive from 08012 Tode Error Message W0846 Message Rechanged section name section name Cause The same section name is duplicated and its specification is changed Program The section name specified last is valid and processing continues Processing E0847 Message Different BANK or SP_SWITCH specified on same interrupt function function name Cause A different register bank specification or stack switching specification is specified for an interrupt function with the same name W0849 Message pragma statement is not portable Cause The pragma statement does not conform to ANSI W0850 Message Asm statement is not portable Cause The ASM statement does not conform to ANSI W0851 Message Data aligned in area name Cause The segment area or structure tag is data aligned The area name is a segment name or a structure tag W0852 Message Module name truncate to module name Cause The specified module name is too long Program It is shortene
74. ESSAGES Table 9 8 Error Messages for Declaration and Function Definition from 0701 gt Tage Error Message E0769 Message far is not allowed for callt interrupt function Cause The far qualifier must not be used for the callt and interrupt functions E0770 Message Parameters are not allowed for interrupt function Cause An interrupt function cannot have arguments E0771 Message Interrupt function must be void type Cause An interrupt function must have the void type E0772 Message Callt are not allowed for interrupt function Cause An interrupt function cannot be declared callt E0773 Message Cannot call interrupt function Cause An interrupt function cannot be called E0774 Message Interrupt function can t use with the other kind interrupts Cause An interrupt function cannot be used in other types of interrupts E0775 Message Cannot call rtos task function Cause RTOS task cannot be called E0776 Message Cannot call ret int kernel int entry Cause System call ret int kernel int entry cannot be called from a function E0777 Message Cannot allocate rtos system call Cause The RTOS system call function must not be allocated E0778 Message Cannot call ext tsk in interrupt function Cause System call ext tsk cannot be called in the interrupt function interrupt handler E0780 Message Zero width for bit field member name Cause Member name is specified to the
75. Execute during constant a 3 5 gt a 15 computations compilation 2 True or false decision based on 0 amp amp a Il b 0 partial evaluation of a logical 1 a amp b 1 expression 3 Offset calculations of pointers Calculate the offsets during compilation arrays etc Code Generator 4 Register management Effectively use unused registers 5 Use the special instructions of a a c1l1 Use the inc instruction the target CPU Use the move instruction to substitute array elements 6 Use short instructions If there is an instruction with the same operation use the instruction with fewer bytes mov a 0 gt clrb a 7 Change long jump instructions to The intermediate code that was output is reprocessed short jump instructions Optimizer 8 Delete common partial a bctc a b G5 expressions d b t cte d atej 9 Move outside an instruction loop for i 0 i lt 10 i a b t c i a b toco for i20 i lt 10 i 10 Delete unused instructions asa Delete After a b a is not referenced Delet a is an automatic variable User s Manual U18549EJ1VOUM 85 CHAPTER 4 CC78KOR FUNCTIONS Table 4 1 Optimization Methods Phase Contents Example 11 Delete copies ab c atd b ds a is not referenced any more a is an automatic variable c Change the calc
76. KOR error C0101 xxx c lt yyy gt zzz CC78KOR error C0103 xxx c lt yyy gt zzz CC78KOR error C0104 Internal error Intermediate fil rror Illegal use of register Remark xxx c source file name yyy line number zzz message 172 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES 9 2 List of Error Messages It is necessary to understand the format of an error number before using the list of error messages The error number indicates the type of error message and the CC78KOR processing for the error The error number format is as follows F E C Wxxxx 1 Abort error Fxxxx Compilation is always stopped if this error occurs The object module file and assembler source file are not output 2 Fatal error Exxxx If more than a specific number of this error occurs compilation is stopped The object module file and assembler source file are not output 3 Internal error Cxxxx Compilation is always stopped if this error occurs The object module file and assembler source file are not output 4 Warning Wxxxx Compilation continues Remark xxxx 4 digit number Caution Type Description From 0001 Error messages for a command line From 0101 Error messages for an internal error and memory From 0201 Error messages for a character From 0301 Error messages for configuration element From 0401 Error messages for conversion From
77. Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Use Example The no option that is specified first is ignored the o option that is specified second is valid so the object module file prime o will be output C cc78k0r cfll 66a0 prime c no o Users Manual U18549EJ1VOUM 97 CHAPTER 5 COMPILER OPTIONS Memory assignment specification 1 r nr Description formats rprocess type Multiple specifications are possible nr Interpretation when omitted nr Function The r option specifies how to assign a program to the memory The nr option invalidates the r option Application f you want to specify how to assign a program to the memory specify the r option Description The process types that can be specified by the r option are shown below Process type specification cannot be omitted Otherwise Fatal error F0012 will occurs Process Type Function a Performs indirect reference in 1 byte units b Assigns a bit field from the most significant bit MSB d n m Assigns an external variable external static variable except for the const type n2 1 2 4 variable automatically to the saddr area irrespective of whether there is an sreg declaration or not For details see 2 rd nr s n m Assigns a static auto variable automatically to the saddr area irrespective of n2 1 2 4 whether there is an sreg declaration or not F
78. OUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Extend tab Figure 3 19 Compiler Options Compiler Options Preprocessor Memory Model Extend Change Source Regulation Dialog Box When Extend Tab Is Selected Data Assign Optimize Debug Output Others Startup Routine Enable C Comment Ignore from Till End of Line zp Comment Can Nest zc Not Expand Argument and Return Value zb Command Line Options Kanji Code of Source SJIS zs C EUC ze C None zn E Cancel Apply Help Change Source Regulation Disable Extensions ANSI Standard Only za Select this check box to disable functions not prescribed by ANSI and when enabling specific functions of ANSI Enable C Comment Ignore from Till End of Line zp Select this check box when the portion after until the line return is interpreted as a comment Comment Can Nest zc Select this check box to allow nested comments Not Expand Argument and Return Value zb Select this check box when not expanding char unsigned char type arguments or return values to be int Kanji Code of Source Select the type of kanji code 2 byte code used in the comment of the source by selecting the appropriate radio button SJIS zs EUC ze None zn SJIS zs is selected by default Users Manual U18549EJ1VOUM 61 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
79. Others tab Figure 3 20 Compiler Options Dialog Box When Others Tab Is Selected Compiler Options Preprocessor Memory Model Data Assign Optimize Debug Output Startup Routine Use Command File Temporary File Creation Directory t se Browse Parameterfile M Browse Dther ptions x Option file read Command Line Options Cancel Apply Help Verbose Compile Messages v Select this check box to output the execution state of the compilation to the console Warning Level w Specify the warning level The specifiable range for the level is 0 to 2 Level Description 0 Do not output warning messages 1 selected by default Output normal warning messages 2 Output detailed warning messages Use Command File Select this check box to create the command file The option character string is output to the command file so awareness of restrictions on the length of the option character string is not required Caution This check box cannot be performed if special compiler options are set per source file 62 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Temporary File Creation Directory t Input the folder in which to store the temporary files in the combo box Only one folder can be specified in this combo box Up to 259 characters can be input into this combo box Specification is also possible
80. PROCEDURE FROM COMPILING TO LINKING Jump Optimization qj Selecet the check box to optimize jump instructions selected by default User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 When Optimize Object Size by Calling Library is selected in the Group drop down list box Figure 3 12 Compiler Options Dialog Box When Optimize Object Size by Calling Library Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model DataAssign Optimize Debug Output ELC MEM Optimize Object Size by Calling Library Y V Optimize Object Size by Calling Libraries Don t Calling Libraries ql1 Preprocessing Postprocessing for Function Only ql2 C gl2 Low level Libraries ql3 C gl3 Subroutine call same codes ql4 Command Line Options porate Cancel Apply Help Optimize Object Size by Calling Libraries Select this check box to perform optimization that gives priority to the code size and replace the standard code pattern with a library selected default Specify using radio buttons the range to be replaced by a library for the case when selecting Don t Calling Libraries ql1 Preprocessing for Function Only ql2 ql2 Low level Libraries ql3 or ql3 Subroutine call same codes gl4 Don t Calling Libraries ql1 is selected by default When the number n of qln becomes greater the object code size becomes smaller and
81. R 5 COMPILER OPTIONS Use Example To output the cross reference list file prime xrf describe as C cc78k0r cf1166a0 prime c x Output example 78KOR C Compiler Vx xx Cross reference List Date XX XXX XXXX Page 1 Command cfll 66a0 prime c x In file prime c Xref file prime xrf Para file ATTRIB MODIFY TYPE SYMBOL DEFINE REFERENCE EXTERN NEAR array mark 5 29 31 37 EXTERN FAR func printf 7 33 40 REGI pointer s 7 13 PARA REG1 int i 7 12 PARA REG1 int j 9 12 REG1 pointer ss 10 13 EXTERN FAR func putchar 16 35 REG1 char c 16 19 PARA REG1 char d 18 19 EXTERN FAR func main 22 REG1 int i 24 28 28 28 29 30 30 30 31 32 32 36 REG1 int prime 24 32 33 36 36 REG1 int k 24 36 36 36 37 REG1 int count 24 26 34 35 40 define TRUE 1 29 define FALSE 2 37 define SIZE 3 5 28 30 36 Target chip uPD78F1166 A0 Device file Vx xx 122 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS List format specification 1 Iw Description format lw number of characters Interpretation when omitted Iw132 For console output this becomes 80 characters Function The lw option specifies the number of characters in 1 line of each type of list file Application f you want to change the number of characters in 1 line of each list file specify the Iw option Description The range of
82. ROMization Function 87 4 2 1 Linking 87 CHAPTER 5 COMPILER OPTIONS 88 5 1 Specifying Compiler Options 88 5 2 Prioritization 89 5 3 Types 91 5 4 Descriptions 93 CHAPTER 6 C COMPILER OUTPUT FILES 138 6 1 Object Module File 138 User s Manual U18549EJ1VOUM 6 2 Assembler Source Module File 139 6 3 Error List File 143 6 3 1 Error list file with C source 143 6 3 2 Error list file with error message only 145 6 4 Preprocess List File 146 6 5 Cross reference List File 148 CHAPTER 7 USING C COMPILER 150 7 1 Efficient Operation EXIT Status Function 150 7 2 Setting Up Development Environment Environment Variables 7 3 Interrupting Compilation 152 CHAPTER 8 STARTUP ROUTINES 153 8 1 File Organization 153 8 1 1 bat folder contents 154 8 1 2 lib folder contents 155 8 1 3 src folder contents 156 8 2 Batch File Description 157 8 2 1 Batch files for creating startup routines 157 8 3 Startup Routines 158 8 3 1 Overview of startup routines 158 8 3 2 Description of sample program cstart asm 160 8 3 3 Revising startup routines 167 8 4 ROMization Processing in Startup Module for Flash Area 170 CHAPTER 9 ERROR MESSAGES 172 9 1 Error Message Format 172 9 2 List of Error Messages 173 9 2 1 Error messages for a command line 174 9 2 2 Error messages for an internal error and memory
83. TAG a member as MEMBER and a function parameter as PARAM Symbol qualifier attributes 6 fixed Displays the symbol qualifier attributes left aligned A const variable is displayed as CONST a volatile variable as VLT a callt function as CALLT an sreg bit variable as SREG an sfr variable as RWSFR a read only sfr variable as ROSFR a write only sfr variable as WOSFR an interrupt function as VECT functions and variables allocated in near area as NEAR functions and variables allocated in far area as FAR 11 Symbol type 7 fixed Displays the symbol type Types include char int short long and field u is added at the start for unsigned type Additional types include void float double Idouble long double func array pointer struct union enum bit inter and define 12 Symbol name 15 fixed If the symbol name exceeds 15 characters and fit into a line that name is output as itis If it exceeds 15 characters and one line the excess is output from column 23 on the next line and items 13 and 14 are output from column 39 on the next line Symbol definition line number 8 fixed This outputs the line number and file name defined for the symbol and is displayed as line number 5 digit include file number 2 digit Symbol reference line number 8 fixed This outputs the line number and file name that reference the symbol and is displayed as line numbe
84. TER 2 PRODUCT OVERVIEW AND INSTALLATION This chapter describes how to install the CC78KOR the file names of the supplied programs and the operating environment for programs CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING This chapter uses sample programs to describe how to run the CC78KOR and presents examples showing the processes from compiling to linking CHAPTER 4 CC78KOR FUNCTIONS This chapter describes optimization methods and ROMization functions in the CC78KOR CHAPTER 5 COMPILER OPTIONS This chapter describes the functions of the compiler options specification methods and prioritization CHAPTER 6 C COMPILER OUTPUT FILES This chapter describes the output of various list files output by the CC78KOR CHAPTER 7 USING C COMPILER This chapter introduces techniques to aid in the skillful use of the CC78KOR User s Manual U18549EJ1VOUM CHAPTER 8 STARTUP ROUTINES The CC78KOR provides startup routines as samples This chapter describes the uses of the startup routines and provides suggestions on how to improve them CHAPTER 9 ERROR MESSAGES This chapter describes the error messages output by the CC78KOR APPENDIXES The appendices provide and a sample programs a list of the use related cautions a command options and an index How to Read This Manual First those who want to see how to actually use CC78KOR read CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Users with a general knowledge of C compilers or users who have
85. To our customers Old Company Name in Catalogs and Other Documents On April 1 2010 NEC Electronics Corporation merged with Renesas Technology Corporation and Renesas Electronics Corporation took over all the business of both companies Therefore although the old company name remains in this document it is a valid Renesas Electronics document We appreciate your understanding Renesas Electronics website http www renesas com April 1 2010 Renesas Electronics Corporation Issued by Renesas Electronics Corporation http www renesas com Send any inquiries to http www renesas com inquiry 2 NE S AS 10 11 12 Notice All information included in this document is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas Electronics products listed herein please confirm the latest product information with a Renesas Electronics sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is
86. Z movw p hob o2 d epa E i INF 2 ry line 34 movw ax hl 4 NE F INF 2 g movw hl y ax Ss f INF lg line 35 addw Sp 04H f INF 2 pop hl 7 INF ly l ret H INF T S line 38 _putchar push hl INF Too movw hl ax INF Lge ot line 40 mov aps ah F INF d gt ke mov h a x INF typt line 41 pop hl INF I 4 1 ret H INF de Gt 5 END Code Information SFILE auto proj cmp cc new work egashira cc78sk0r src test prime2 c r SFUNC main 8 be void i CODE SIZE 155 bytes CLOCK SIZE 117 clocks STACK SIZE 16 bytes SCALL printf 18 H be pointer ax int sp 2 Users Manual U18549EJ1VOUM 211 APPENDIX A SAMPLE PROGRAMS 212 SCALL putchar 20 be int ax SCALL printf 25 be pointer ax int t sp 2 SFUNC printf 29 be pointer s ax int i sp 4 CODE SIZE 18 bytes CLOCK_SIZE 16 clocks STACK_SIZE 8 bytes SFUNC putchar 38 be char c x CODE SIZE 6 bytes CLOCK_SIZE 11 clocks STACK_SIZE 2 bytes Target chip Device file VX XX uPD78F1166 AO0 User s Manual U18549EJ1VOUM APPENDIX A SAMPLE PROGRAMS A 3 2 Preprocess list file 78KOR C Compiler Vx xx Preprocess List Date xx XXX XXXX Command cfll66a0 prime c a p x ng In file prime c PPL file prime ppl Para file xf 1 define TRUE 1 2 defin
87. able in a switch statement exceeds 64 KB Action by User Separate the file so that the code size does not exceed 32KB or recompile without specifying ql4 202 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES 9 3 List of PM Error Messages Table 9 11 PM Error Messages Error Type Error Message Message Out of range The range of columns is from 72 to 132 Cause A value out of the specifiable range is described for the number of characters per line Action by User Specify a value in the specifiable range and retry the execution Button OK Close the message box Message Out of range The range of lines is from 0 and 20 to 32 767 Cause A value out of the specifiable range is described for the number of lines per page Action by User Specify a value in the specifiable range and retry the execution Button OK Close the message box Message Out of range The range of TAB character is from O to 8 Cause A value out of the specifiable range is described for the tab stop position Action by User Specify a value in the specifiable range and retry the execution Action by User Button OK Close the message box Message Out of range The range of warning level is from 0 to 2 Cause A value out of the specifiable range is described for the warning level Specify a value in the specifiable range and retry the execution Butto
88. agma statement CC78KOR warning W0849 pragma statement is not portable If w2 is specified the following warning is output for an asm statement and the assemble output is performed CC78KOR warning W0850 Asm statement is not portable f w2 is specified the following error is output for an asm to endasm block CC78KOR error E0801 Undefined control etc f Outputs object from flash Note Ss e and n cannot be specified simultaneously Use Example The characters after until the line return in the C source prime c are interpreted as a comment Also nested comments are allowed C cc78k0r cfll66a0 prime c zpc 134 Users Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Device file search path 1 y Description format yfolder Interpretation when omitted Normal search path only Remark The normal search paths are as follows i lt dev gt for the path where cc78kOr exe started ii Path where the CC78KOR started iii Current folder iv PATH environment variable Function The y option first searches the path specified as the search path for reading device files If it does not exist the normal paths are searched Application fthe device file is not installed in the normal search path but in a special folder the path is specified by this option Caution When using PM a folder is determined when regi
89. al variables are placed in the ROM These values are copied to RAM when the system is executed The CC78KOR provides startup routines with the processing of programs in ROM as samples For ROMization using the startup routines in ROM eliminates the problem of describing ROMization processes for startup For information about the startup routines see 8 3 Startup Routines How to store a program on ROM is described below 4 2 4 Linking During linking the startup routine object module files and libraries are linked The startup routine initializes the object program sOr rel Startup routine when stored on ROM The copy routine for the initialization data is included and the beginning of the initial data is indicated The label cstart symbol is added to the start address clor lib Library attached to CC78KOR The library files of the CC78KOR include the following 2 libraries 1 Runtime library is added to the symbol head of the runtime library name For the special library cprep cdisp however _ is added to the symbol head 2 Standard library o is added to the symbol head of the standard library name Jib Library created by a user is added to the symbol head Caution The CC78KOR provides various kinds of startup routines and libraries For details of startup routine refer to CHAPTER 8 STARTUP ROUTINES For details of libraries refer to 2 5 1 Library files Users Manual
90. alog Box When Optimize Tab Is Selected 67 Linker Options Dialog Box 68 C Compiler I O Files 83 Compiler Options Dialog Box 93 Users Manual U18549EJ1VOUM 11 LIST OF TABLES Table No Title Page 2 1 2 2 2 3 2 4 3 1 4 1 5 1 5 2 7 1 7 2 8 1 8 2 8 3 8 4 8 5 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 9 10 9 11 B 1 C 1 12 Supply Medium and Recording Formats for CC78KOR 25 File Organization 29 Library Files 30 Environment Variables 34 C Compiler I O Files 82 Optimization Methods 85 Prioritization of Compiler Options 89 List of Compiler Options 91 EXIT Status 150 Environment Variables 151 bat Folder Contents 154 lib Folder Contents 155 src Folder Contents 156 ROM Area Section for Initialization Data 170 RAM Area Section for Copy Destination 170 Error Messages for Command Line from 0001 174 Error Messages for Internal Error and Memory from 0101 177 Error Messages for Character from 0201 179 Error Messages for Configuration Element from 0301 180 Error Messages for Conversion from 0401 183 Error Messages for Expression from 0501 185 Error Messages for Statement from 0601 188 Error Messages for Declaration and Function Definition from 07012 190 Error Messages for Preprocessing Directive from 0801 2 196 Error Messages for Fatal File I O and Runni
91. ancel Help c Building project Projects are built with the set options Build of an entire project is done by selecting Build from the Build menu or by clicking the Build button on the tool bar PM MAKE is started up by the automatically created make file Upon completion of build a message dialog box appears Check that build has been completed normally Caution The contents displayed in the OutPut window during build are saved as the Project file name plg file name to the project folder 78 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 3 2 Compiling to linking in command line for command prompt 1 When parameter file is not used The command below is used to start the CC78KOR assembler and linker in a command line Assembling is not needed when there is no assembler description in the C source In this case link the object module file output from a C compiler A space path name cc78k0r Aoption AC source name A option gt path name ra78k0r Aoption Aassembler source name Aoption gt path name 1k78k0r Aoption AObject module name etc Aoption The following shows examples of compiling and linking the C source for boot area and the C source for flash area a Compiling to linking object converting program for boot area lt Example 1 Compiling program for boot area gt C cc78k0r cf1166a0 boot c i C Program Files NEC Electronics Tools
92. annot be used for file names and path names in parameter files 5 Include files It is not possible to define functions excluding declarations in an include file and then expand the file within the C source When definitions are made within an include file problems such as incorrect display of definition lines during source debugging may occur 216 User s Manual U18549EJ1VOUM APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 6 Use of output assembler source When a C source program contains descriptions that use assembly language such as asm blocks or asm statements the load module file creation procedure sequence is compile assemble and then link Be careful about the following points when using the assembler by outputting the assembler source to perform assembly without outputting direct objects by the CC78KOR such as when descriptions using assembly language are used f symbols need to be defined in the asm block part between asm and endasm and the asm statement use a symbol of 8 or less characters beginning with the strings 7L for example 7L 01 7L sym etc However these symbols cannot be defined externally PUBLIC declaration It is not possible to define segments in the asm block and the asm statement If a symbol beginning with the strings L is not used the Fatal error F2114 is output during assembly When using variable
93. anual U18549EJ1VOUM 165 CHAPTER 8 STARTUP ROUTINES The ROMization processing file rom asm is described The relocatable object file of rom asm is in the library NAME rom PUBLIC R INIT _ RLINIT _ R_INIS PUBLIC _ INIT _ INITL _ DATA _ DATAL _ INIS DATS R_INIT CSEG UNIT64KP x d _ R_INIT RLINIT CSEG UNIT64KP _ RLINIT R_INIS CSEG UNIT64KP _ R_INIS INIT DSEG BASEP _ INIT INITL DSEG UNIT64KP INITE DATA DSEG BASEP _ DATA DATAL DSEG UNIT64KP _ DATAL INIS DSEG SADDRP _ INIS DATS DSEG SADDRP _ DATS END 1 Definition of labels used in ROMization processing The labels used for each variable a to d see 3 ROMization processing in ROMization processing are defined These labels indicate the last address of the segment storing the initial value of each variable 166 User s Manual U18549EJ1VOUM CHAPTER 8 STARTUP ROUTINES 8 3 3 Revising startup routines The startup routines provided by the CC78KOR can be revised to match the target system actually being used The essential points about revising these files are explained in this section 1 When revising startup routine The essential points about revising a startup routine source file are described After revising use the batch file mkstup bat in the src cc78kOr bat folder to assemble the revised source file cstart asm alphanumeric symbols Sym
94. arget device specification to be omitted from the command line C cc78k0r prime c Specify different devices in C source prime c and the command line and then start the compiler C source pragma pc f1166a0 define TRUE 1 define FALSE 0 define SIZE 200 char mark SIZE 1 void main void int i prime k count lt Command line gt C cc78k0r cf1176 prime c The target device specified in the command line is given priority so the compiler runs as follows 78KOR C Compiler Vx xx xx xxx xxxx Copyright C NEC Electronics Corporation XXxxx XXXxx sample prime c 1 CC78K0R warning W0832 Duplicated chip specifier sample prime c 18 CC78KOR warning W0745 Expected function prototype sample prime c 20 CC78KOR warning W0745 Expected function prototype sample prime c 26 CC78K0R warning W0622 No return value sample prime c 37 CC78KOR warning W0622 No return value sample prime c 44 CC78KOR warning W0622 No return value Target chip uPD78F1176 Device file Vx xx Compilation complete 0 error s and 6 warning s found Users Manual U18549EJ1VOUM 95 CHAPTER 5 COMPILER OPTIONS Object module file creation specification 1 o no Description formats o output file name no Interpretation when omitted oinput file name rel Function The o option specifies the output of t
95. arning 7 uPD78F1166 A0 Device file 8 Vx xx Compilation complete 5 0 error s and 6 5 warning s found nem Description jeu eai Format Number p Columns 1 C source module Number of Outputs the specified file name file name characters enabled If the file type is omitted c is attached as the file by OS type extension 2 Line number 5 fixed Outputs a right aligned decimal value with zeros suppressed 3 Error message 5 fixed Outputs the error message number in nnnn number format F is output if is an abort error E if itis a fatal error C if is an internal error and W if it is a warning nnnn the error number is displayed as a 4 digit decimal number no zero suppression 4 Error message See CHAPTER 9 ERROR MESSAGES 5 Number of errors 4 fixed Outputs a right aligned decimal value with zeroes suppressed 6 Number of 4 fixed Outputs a right aligned decimal value with zeroes warnings suppressed 7 Target device for Maximum 15 Displays the target device as specified via this compiler variable command line option c or the source file 8 Device file 6 fixed Displays the version number of the input device version file User s Manual U18549EJ1VOUM 145 CHAPTER 6 C COMPILER OUTPUT FILES 6 4 Preprocess List File The preprocess list file is an ASCII image file that contains results of C source program preprocessing only
96. ause Flash area branch table start address is not specified Program Specify the zf option only when the self rewriting function is used in flash Processing memory products with a self rewriting function E0862 Message Illegal EXT FUNC id specifier out of OxO Oxff Cause The ID value of the function in the flash memory area that are specified by pragma EXT FUNC must be 0x80 0xff80 E0863 Message Redefined pragma EXT FUNC name function name Cause The function name specified by the pragma EXT FUNC is redefined E0864 Message Redefined pragma EXT FUNC id D value Cause The ID value specified by the 2pragma EXT FUNC is redefined E0865 Message Out of range cannot allocate an EXT FUNC function function name Cause Address of the flash memory area branch table exceeds the specifiable address A tinction specified by the pragma EXT_FUNC cannot be allocated E0866 Message pragma section found after C body cannot include file containing pragma section and without C body at the line Cause There is pragma section syntax after C body description Subsequent files that contain pragma section syntax and no C body including external reference declarations of variables and functions cannot be included E0867 Message pragma section found after C body cannot specify include after pragma section in this file Cause There is pragma section syntax after C body description Hereafter include syntax cannot be described E0868 Message include foun
97. ause of insufficient space in the defined memory area the indicated segment cannot be located Response The response action is roughly divided into the following 3 steps i Examine the size of a segment that cannot be located refer to the map file ii Based on the size of the segment examined in step i increase the size of the area where the segment is located in the directive file iii Specify directive file specification option d and link However based on the type of the segment marked by an error in step i the method used to examine the segment size differs in the following way When the segment is automatically generated during compilation Examine the size of the segment by the map file that is linked and created When the segment is created by the user Examine the size of the segment that is not located by the assemble list file prn 218 User s Manual U18549EJ1VOUM APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 8 When using va start macro The operation of va start macro defined in stdarg h is not guaranteed because the offset of the first argument differs depending on the function Choose a macro as follows When the first argument is specified use the va starttop When the second and subsequent arguments are specified use the va start macro Startup routines and libraries Use the provided star
98. ax 1 MB in total and specifies the near or far area Large model Considers the memory to consist of a code portion of 1 MB max and a data portion of 1 MB max 1 MB in total and specifies the near or far area Remark Even if a memory model that consists of a data portion or code portion of 64 KB max is specified functions and variables for which the far qualifier is specified can be allocated to the space of 1 MB max Memory model specification specifies the location of functions or variables for which the __ far qualifier is not specified 136 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Use Example To use the small model for the memory model during compilation describe as C cc78k0r cf1166a0 prime c ms Users Manual U18549EJ1VOUM 137 CHAPTER6 C COMPILER OUTPUT FILES This chapter describes the files that the CC78KOR outputs The CC78KOR outputs the following files J Object Module File A Assembler Source Module File Error List File Preprocess List File A Cross reference List File 6 1 Object Module File The object module file is a binary image file containing C source program compilation results If the debug data output option g has been specified the object module file will also contain debug data 138 User s Manual U18549EJ1VOUM CHAPTER 6 C COMPILER OUTPUT FILES 6 2 Assembler Source Module File The assembler source module file is a
99. b clOrle lib libraries Note 1 clormf lib clormf lib clOrmfe lib clOrlf lib clOrlf lib clOrlfe lib clorxm lipNote3 clorxm lipNote3 clorxme lipNote3 sOrm rel sOrmb rel sOrme rel Object files for startup routines sOrml rel sOrmlb rel sOrmle rel Note 2 sOrl rel sOrlb rel sOrle rel sOrll rel sOrllb rel sOrlle rel User s Manual U18549EJ1VOUM CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION Note 1 The rule for naming libraries is given below lib78k0rNclOr mul model float flash lib mul None X model m float None flash None e Multiplier not used Multiplier used Small model or medium model Large model Standard library and runtime library floating point library is not used For floating point library For normal boot area For flash memory area Note 2 The rule for naming startup routines is given below lib78k0rNsOr model lib flash rel model m lib None flash None b Medium model can also be used for specifying the small model Large model When standard library functions are not used When standard library functions are used Normal For boot area For flash memory area User s Manual U18549EJ1VOUM 31 32 CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION Note 3 The CC78KOR libraries are compatible with the following multiplier devices However if an interrupt occurs while computa
100. bat folder as shown below The startup routine that is required to link the object file is output to each folder The names of the object files created in lib are shown below r bat mkstup bat lib sOrm rel sOrmb rel sOrme rel sOrml rel sOrmlb rel sOrmle rel sOrl rel sOrlb rel sOrle rel sOrll rel sOrllb rel sOrlle rel Users Manual U18549EJ1VOUM 157 CHAPTER 8 STARTUP ROUTINES 8 3 Startup Routines 8 3 1 Overview of startup routines A startup routine makes the preparations needed to execute the C source program written by the user By linking to a user program a load module file that achieves the objective can be created 1 Function Memory initialization ROMization for inclusion in the system and the starting and ending processes for the C source program are performed ROMization The initial values of the external variables static variables and sreg variables defined in the C source program are located in ROM However the variable values cannot be rewritten only placed in ROM as is Therefore the initial values located in ROM must be copied to RAM This process is called a ROMization When a program is written to ROM it can be run by a microcontroller 2 Configuration The figure below shows the programs related to the startup routines and their configurations For system inclusion Preprocessote 1 Initial settings Note 2 hdwinit function call ROMization Start
101. ber of characters in the specified file name are incorrect F0005 Message Illegal file specification Cause An illegal file name was specified F0006 Message File not found Cause The specified input file does not exist F0007 Message Input file specification overlapped file name Cause Duplicate input file names were specified F0008 Message File specification conflicted file name Cause Duplicate I O file names were specified F0009 Message Unable to make file file name Cause Since the specified output file already exists as a read only file it cannot be created F0010 Message Directory not found Cause A drive or folder not existed is included in the output file name F0011 Message Illegal path Cause An illegal path name was specified in the option setting the path name in the parameter F0012 Message Missing parameter option Cause A required parameter is not specified Action by User Please enter cc78k0r if you want help message is output Use the or h option to reference the help file and input the parameter correctly 174 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 1 Error Messages for Command Line from 0001 Salle Error Message F0013 Message Parameter not needed option Cause An unnecessary option parameter was specified Action by User Please enter cc78k0r if you want help message i
102. bols used in standard library functions If the library functions listed in the table below are not used the symbols corresponding to each function in the startup routine cstart asm can be deleted However since the exit function is used in the startup routine FNCTBL and GQFNCENT cannot be deleted if the exit function is deleted these symbols can be deleted The symbols in the unused library functions can be deleted by changing the library switch Library Function Name Symbols Used brk _errno sbrk _ MEMTOP malloc _ MEMBTM calloc OBRKADR realloc free exit _ FNCTBL _ FNCENT rand _ SEED srand div _ DIVR Idiv _ LDIVR strtok _ TOKPTR atof _errno strtod Mathematical function Floating point runtime library User s Manual U18549EJ1VOUM 167 168 CHAPTER 8 STARTUP ROUTINES A Areas that are used for utility functions block assignments releases If the size of the area used by a utility function block assignment release is defined by the user this is explained in the following example Example If you want to reserve 72 bytes for use by utility functions block assignments releases make the following changes to the initial settings of the startup routine _ MEMTOP DS 73 _ MEMBTM _ MEMTOP gt 72 bytes reserved as area for utility functions block assignments releases _ MEMBTM gt gt Add one byte to the area size to be sec
103. ce Module File 16 User s Manual U18549EJ1VOUM CHAPTER 1 OVERVIEW 1 2 2 C compiler The C compiler translates C language into a machine language taking the device file and C source module file as input If it finds a description error in the C source module file the C compiler outputs a compilation error If no compilation error occurs an object module file is output In addition an assembler source module file can also be output so that the program can be modified and checked at the assembly language level To output an assembler source module file specify the a option or sa option when compiling for details of options refer to CHAPTER 5 COMPILER OPTIONS Figure 1 5 C Compiler Function Note Device file C source module file C Compiler Object module file Assembler source module file Note Obtain the device file by downloading it from the Version up Service which can be accessed from the following Website http www necel com micro ods eng Users Manual U18549EJ1VOUM 17 CHAPTER 1 OVERVIEW 1 2 3 Assembler Assembly is executed by using the assembler included in the RA78KOR assembler package sold separately The assembler inputs the device file and assembler source module file and translates the source module file from the assembly language to a machine language If a description error is found in the assembler source module an assembly error is output If no assembly error occurs an object module fil
104. ck box to use the sprintf sscanf printf sprintf sscanf printf scanf vprintf vsprintf scanf vprintf and vsprintf functions supporting floating points Using Multiplier Select this check box when using a device that has a multiplier and the multiplier is used selected by default if a device that has a multiplier has been spec ified Caution Product types that do not have a multiplier cannot be selected Library Displays the file name of the library to be used Users Manual U18549EJ1VOUM 65 3 2 3 2 1 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Procedure When Not Using Self Rewrite Mode MAKE from PM The MAKE method using PM is described below PM is a software program used for the integrated management of tools as the core of the development environment Using PM enables handling application programs and environment settings as projects Program creation using an editor source management compilation and debugging can be performed as a continuous series of operations 1 66 Starting up PM When a development tool packages are correctly installed the NEC Electronics Tools menu is created in the Programs folder displayed from the Start button and PM and other programs are registered in this menu Click PM from the menu to start up PM Creating project Register a project first to start a series of development operations using PM To register a proje
105. cro name definition Specifies processing Independent Only the specification 2ame macro which is compatible for macro HUI dee aaron text that is defined in the definitions in a name Multiple specifications C source C nobel are possible module file are valid umacro name macro Disables macro Independent A macro name definitions similar to the definition Multiple specifications undef statement in the specified with are possible C source d is valid ifolder folder Specifies input of the Independent 1 Folder with Multiple specifications include files specified by source file are possible the include statement 2 Folder in the C source from the specified by specified folder environment variable INC78KOR 3 C Program Files NEC Electronics Tools CC78K OR Vx xx inc7 8kOr Assembler a output file name Specifies the output of If a and sa are No assembler source the assembler source specified source module file module file simultaneously module file is creation then sa is output specification 9 output file name Adds the C source as a disabled comment to the assembler source module file Error list fle eloutput file name Specifies the output of Independent No error list creation the error list file file is output specification se output file name Adds the C source Independent module file to the error list file Cross x output file name Specifies the
106. ct first create the workspace in which that project is managed For the procedure to create a workspace refer to the PM User s Manual Setting compiler and linker options A minimum number of options are set for build in the MAKE file created automatically upon completion of project creation Project specific options are set in the Tools menu If the Compiler Options in the Tools menu is selected the Compiler Options dialog box appears An example changing the Optimize option from default qcjlvw to Exec Time qx1 is shown below User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Figure 3 22 Compiler Options Dialog Box When Optimize Tab Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model DataAssign Optimize Debug Output Group Integrated Recommendable Optimizing Option v Integrated Recommendable Optimizing Option Default qx2 C Code Size qx3 Subroutine call same codes qx4 Command Line Options gx1 Cancel Apply Help If Using Startup Routine is selected in the Startup Routine tab of the Compiler Options dialog box the standard startup routine for this C compiler gets linked before all sources not displayed to the Linker Options dialog box When Using Library is selected the standard library for this C compiler gets linked behind all libraries If C source is included in the source file
107. cted is ignored Check the special option settings as necessary Button OK Close the message box Message Only fin of an extension is effective Cause An extension other than fin was specified for the function information file name Action by user Specify fin as an extension for the function information file name Button OK Close the message box Message There is options that specification different from whole options cannot be done The options was set automatically Cause There are options for which the same specification must be made by a common option and special option Action by user Specification of the common option is automatically reflected in that of the special option Options to be reflected ms mm mc ml zf rd Button OK Close the message box 206 User s Manual U18549EJ1VOUM APPENDIX A SAMPLE PROGRAMS This chapter introduces sample programs for the CC78KOR A 1 C Source Module File define TRUE 1 define FALSE 0 define SIZE 200 char mark SIZE 1 void main void int i prime k count counb e 0 f for i20 i lt SIZE i mark i TRUE for i 2 0 i lt SIZE i if mark i prime i i 3 printf 6d prime count t t if count 8 0 putchar n for k i prime k lt SIZE k prime mark k FALSE
108. current compilation specified specification execution status is simultaneously output to the console the last one specified is nv Invalidates the v option enabled Parameter ffile name Specifies the input of the Independent The input of file options or input file an option and specification name from the specified an input file file name is possible only from a command line User s Manual U18549EJ1VOUM 229 APPENDIX C COMMAND OPTIONS Table C 1 Compiler Options Relationship with Interpretation Types Description Format Functions Other Options Wwhen ormitted Temporary tfolder Creates temporary files Independent The tempo file creation in specified drives and rary files are folder folders created in the specification drive folder specified by the environment variable TMP If not specified the files are created in the current drive and current folder Help h The and h options All other options Nothing is specification display brief are disabled displayed explanations of the options and the help messages such as the default options on the console valid only in the command line Function ztype Enables extended If z and nz are nz expansion Multiple specifications functions specified specification are possible simultaneously nz Invalidates the z option aa enabled Device file y folder Specifies paths that Independe
109. d the following dialog box appears Figure 3 16 Assembler Options Dialog Box Assembler Options Assembler Sorce Options gt Command Line Options Cancel Use Assembler common option Select this check box to enable all the options set in the Assembler Options dialog box selected by default Assembler Source Options To enable options for the output assembler source file of the C compiler input a character string including the option name in the combo box Up to 259 characters can be input into this combo box Caution Do not describe chip type specification c device file specification y and parameter file specification f because they are set separately with this tools DLL User s Manual U18549EJ1VOUM 55 56 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Command Line Options This edit box is a read only box The option character strings that are currently set are displayed All of the assembler common options and assembler source options are targets Option character strings that are specified with radio buttons check boxes or combo boxes in the option setting dialog boxes are displayed in this edit box User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 2 When Error List File Cross reference List File is selected in the Group drop down list box Figure 3 17 Compiler Options Dialog Box When Error List File Cross reference List File Is Se
110. d after C body cannot specify pragma section after include directive Cause There is include syntax after C body description Hereafter pragma section syntax cannot be described W0869 Message Section name section cannot change after C body Cause Specified section cannot be changed after C body description W0870 Message Data aligned before variable name in section name Cause Data alignment is done before variable name is allocated in section name W0871 Message Data aligned after variable name in section name Cause Data alignment is done after variable name is allocated in section name E0899 Message Character string specified by error is output Cause An error character string was specified 200 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES 9 2 10 Error messages for fatal file I O and running on an illegal operating system Table 9 10 Error Messages for Fatal File I O and Running on an Illegal Operating System from 0901 gt Error N mbe Error Message F0901 Message File I O error Cause A physical I O error was generated during file input output Action by User If an intermediate file is the cause increase the conventional memory or use EMS or XMS memory F0902 Message Cannot open file name Cause The file cannot be opened Action by User Check if a device file is installed in an ordinary search path The pa
111. d by user When PM is specified for the parameter file created by the user those contents are loaded to the parameter file created by PM When creating a parameter file be careful about the following points Otherwise an error will occur during build execution Specify a file with the same name as the parameter file created by PM Do not describe the device type specification option c device file search path specification option y and source file No validity check is performed for the options described in the parameter file created by the user b Assembler Options dialog box Do not specify the c f and y options and the source file or an error will occur during build execution No validity check is performed for the options specified in the Assembler Options dialog box so an error will occur during build execution in case of description errors c Include file dependence relationship During checking of dependence relationships of include files during MAKE file creation with PM condition statements such as if are ignored Therefore include files not required for build are mistaken as required files If described as comments or character strings they are correctly judged as without dependence relationship Example if 0 include headerl h Dependence relationship judged to exist else ORM ero xy include header2 h endif include header3 h f header1 h is judged as required for build during the d
112. d to the displayed module name Processing E0853 Message Unrecognized pragma NAME module name Cause Unrecognizable characters are in the module name E0854 Message Undefined rtos task character string Cause The body of RTOS task is not defined E0855 Message Cannot assign rtos interrupt handler to non maskable and software interrupt Cause The non maskable interrupt and software interrupt cannot be specified in the RTOS INTERRUPT handler W0856 Message Rechanged module name module name Cause Duplicate module names are specified W0857 Message Section name truncate to section name Cause The specified section name is too long Program It is shortened to the displayed section name Processing Make the section name 8 or fewer characters E0858 Message Unrecognized pragma pragma character string illegal character string Cause There is an unrecognized pragma pragma character string illegal character string E0859 Message Cannot allocate EXT_TABLE out of 0xcO Oxff80 Cause The start address of the flash area branch table must be within OxcO to Oxff80 User s Manual U18549EJ1VOUM 199 CHAPTER 9 ERROR MESSAGES Table 9 9 Error Messages for Preprocessing Directive from 0801 2 te Error Message E0860 Message Redefined pragma EXT TABLE Cause The pragma EXT TABLE is redefined E0861 Message No EXIT TABLE specifier C
113. d when project creation is ended Project specific options are set with the Tools menu Selecting Compiler Options in the Tools menu displays the Compiler Options dialog box i Setting compiler option Specify the Output the Object for Flash Memory zf check box under the Memory Model tab Compiler Options Extend Others Startup Routine Preprocessor Memory Model DataAssign Optimize Debug Output Memory Model C Small ms Medium mm C Large ml Control Object Command Line Options Select Flash radio button in the Select Object box under the Startup Routine tab User s Manual U18549EJ1VOUM ii CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Setting linker option Specify the boot area load module file that was created in the Other options combo box Since the Using Startup Routine and Using Library check boxes are selected under the Startup Routine tab in the Compiler Options dialog box it is not necessary to specify the startup routine and library in the Linker Options dialog box Also since the C source flash c is included in the source file specification Create Stack Symbol s option is automatically set Remark For information about the linker options refer to RA78KOR Assembler Package Operation User s Manual Linker Options Dutputl Output Library Others Directive File d v Browse Temporary Directory t NEM Browse
114. declaration exceeds the number of bits in that type Users Manual U18549EJ1VOUM 191 CHAPTER 9 ERROR MESSAGES Table 9 8 Error Messages for Declaration and Function Definition from 0701 gt ae Error Message E0733 Message Negative bit field size Cause The number of bit specifications in a bit field declaration is negative E0734 Message Illegal enumeration Cause The enumeration type declaration does not match the syntax E0735 Message Illegal enumeration constant Cause The enumeration constant is illegal E0736 Message Compiler limit too many enumeration constants Cause The number of enumeration constants exceeded 255 E0737 Message Undeclared structure union enum tag Cause A tag is not declared E0738 Message Compiler limit too many pointer modifying Cause The number of indirection operators exceeded 12 in a pointer definition E0739 Message Expected constant Cause A variable is used in the index in an array declaration E0740 Message Negative subscript Cause The specification of the size of an array is negative E0741 Message Unknown size array array name Cause The size of an array is undefined Action by User Specify the size of the array E0742 Message Compiler limit too many array modifying Cause The array declaration exceeds 12 dimensions E0743 Message Array element type cannot be function Cau
115. e Windows 2000 XP J Command prompt in Windows 2000 XP 2 7 2 Environment variables Set the following environment variables for command prompt operation Table 2 4 Environment Variables Environment Variable Description PATH Specifies the folder where the compiler is located TMP Specifies the folder where temporary files are created LANG78K Specifies the kanji code 2 byte code in the source files sjis Shift JIS Default euc EUC none No 2 byte codes INC78KOR Specifies the folder where the standard header files of the C compiler are located LIB78KOR Specifies the folder where the C compiler s libraries are located Specification Example set TMP C tmp set LANG78K sjis PATH PATH C Program Files NEC Electronics Tools CC78KOR Vx xx bin set INC78KOR C Program Files NEC Electronics Tools CC78KOR Vx xx inc78k0r set LIB78KOR C Program Files NEC Electronics Tools CC78KOR Vx xx lib78k0r 34 User s Manual U18549EJ1VOUM CHAPTER3 PROCEDURE FROM COMPILING TO LINKING This chapter uses the CC78KOR and the RA78KOR Assembler Package to describe the procedure from compiling to linking By actually performing the processes from compiling to linking of the prime c sample program following the execution procedure given in this chapter you can become familiar with the operations of compiling assembling and linking see APPENDIX
116. e signed char type variable Constants from 128 to 255 and unsigned char unsigned char type type variable Constants from 128 to 127 and signed char signed char type type variable Constants from 0 to 255 with suffix U and unsigned char type signed char type variable r Adds a register variable to a register and assigns it to the saddr area j Optimizes jump instructions x n Assigns the optimization options automatically according to the priority of n21 4 speed code size The assigned option differs depending on the value of n as follows If nis omitted it is interpreted as n 2 1 Speed precedence Regarded as the qcjvw option specification 2 Default Regarded as the qcjlvw option specification 3 Code size precedence Regarded as the qcjl3vw option specification 4 Code size precedence Regarded as the qcjl4vw option specification w Performs aggressive optimization Reshuffles the execution order in an expression V Assigns an argument and automatic variable automatically to a register or the saddr area I n Performs optimization based on the priority of code size and replaces the nz 1 4 standard code pattern with a library If this option is not specified the code is optimized based on the priority of speed The scope changes depending on the value of n as follows If nis omitted it is interpreted as n 1 1 No replacement 2 Executes the only the processes before after a function 3 Executes the processes b
117. e 8 1 bat Folder Contents Batch File Name Description mkstup bat Assemble batch file for startup routine reprom bat Batch file for updating rom asmNote 1 repgetc bat Batch file for updating getchar asm repputc bat Batch file for updating putchar asm repputcs bat Batch file for updating _putchar asm repselo bat Batch file for updating setimp asm and longjmp asm the compiler reserved area is saved Noe 2 repselon bat Batch file for updating setimp asm and longjmp asm the compiler reserved area is not saved Note 2 repvect bat Batch file for updating vect asm Note 1 Since ROMization routines are in the library the library is also updated by this batch file Note 2 The setjmp and longjmp that save the compiler reserved area saddr area secured for KREGxx etc and the setjmp and longjmp that do not save the compiler reserved area only the registers are saved are created 154 Users Manual U18549EJ1VOUM 8 1 2 lib folder contents CHAPTER 8 STARTUP ROUTINES The lib folder contains the object files that were assembled from the source files of startup routines and libraries This object file can be linked with programs for any 78KOR target device If the code modification is not especially needed link the default object file as is This object file is overwritten when batch file mkstup bat which is provided by the CC78KOR is executed Table 8 2 lib Folder Contents
118. e FALSE 0 3 define SIZE 200 4 o s far char mark SIZE 1 6 4 qd gf void main void e gu int i prime k count 10 ld count 0 12 13 for i20 i lt SIZE i 14 mark i TRUE V5 for i 20 i lt SIZE i 16 if mark i 17 prime i i 3 18 printf 6d prime 19 count 20 if count 8 putchar n 21 for k i prime k lt SIZE 22 mark k FALSE 23 24 25 printf n Sd primes found count 26 1 27 28 printf char s int i 29 30 int 3g 31 char ss 32 33 j 2i j 34 SS S 35 t a 36 37 putchar char c 38 39 char a 40 d cy 41 Target chip uPD78F1166_A0 Device file VX XX Page 1 da k prime Users Manual U18549EJ1VOUM 213 APPENDIX A SAMPLE PROGRAMS A 3 3 Cross reference list file 78KOR C Compiler Vx xx Cross reference List Date xx XXX XXXX Command cfll66a80 prime c a p Xx ng In file prime c Xref file prime xrf Para file ATTRIB MODIFY TYPE SYMBOL DEFINE REFERENCE EXTERN FAR array mark 5 14 16 22 EXTERN FAR func main 7 AUTO int 9 l3 X3 3v 4 Tos 215 21 AUTO int prime 9 l7 X8 2X 21 AUTO int k 9 21 21 21 22 AUTO int count 9 11 19 20 25 EXTERN FAR func printf 28 L8 25 EXTERN FAR func putchar 37 20 PARAM pointer s 28 34 PARAM int i 28 33 AUTO int j 30 33 AUTO1
119. e containing machine language information and location information that indicates to which address of memory each machine language code is to be allocated is output In addition information during assembly is also output as an assemble list file Figure 1 6 Assembler Function Note Device file Asemmbler source module file Assembler Object module file Assemble list file Note Obtain the device file by downloading it from the Version up Service which can be accessed from the following Website http www necel com micro ods eng 18 User s Manual U18549EJ1VOUM CHAPTER 1 OVERVIEW 1 2 4 Linker Linking is performed by using the linker included in the RA78KOR Assembler Package sold separately The linker inputs the device file and multiple object module files output by the C compiler or object module files output by the assembler and links them to the library files even if there is 1 object module linking must be performed 1 load module file is output In this case the linker determines the location addresses of relocatable segments in the input module This determines the values of relocatable symbols and external reference symbols and embeds the correct values in the load module file The linker outputs the linking information as a link map file Figure 1 7 Linker Function Device filet Multiple object module files Library file Load module file Link map file Note Obtain the device file by downloading it fr
120. e following labels are added if the large model is specified or variables are allocated in the far area E RLINIT E INITL E DATAL nthe terminal module the following labels are added at the terminal of each segment in ROM area and RAM area E R INIT E R INIS E INIT E DATA E INIS E DATS E RLINIT E INITL E7DATAL The startup module copies the contents from the first label address of each segment in ROM area to the end label address 1 to the area from the first label address of each segment in RAM area Zeros are embedded from E DATA to E DATA and from E DATS to E DATS 170 User s Manual U18549EJ1VOUM CHAPTER 8 STARTUP ROUTINES Furthermore zeros are embedded from E DATAL to E DATAL if the large model is specified or variables are allocated in the far area Users Manual U18549EJ1VOUM 171 CHAPTER9 ERROR MESSAGES This chapter explains the causes of error messages output by the CC78KOR 9 1 Error Message Format The error message format is as follows Source file name line number Error message Examples prime c 8 CC78KOR error E0712 Declaration syntax prime c 8 CC78KOR error E0301 Syntax error prime c 8 CC78KOR error E0701 External definition syntax prime c 19 CC78KOR warning W0745 Expected function prototype However the C0101 C0103 and C0104 internal errors are output in the following format xxx c lt yyy gt zzz CC78
121. e is omitted when the e option is specified error list file output file name ecc will be output fthe drive name is omitted when the e option is specified the error list file is output to the current drive fthe w0 option is specified warning messages are not output Cautions To change the output destination when using PM specify the new output destination in the Output Path combo box in the Create Error List File area under the Output tab and select without C Source e When individual compileroptions are specified the output file name can also be changed Specify the file name or the output destination in the Output Path combo box under the Output tab Users Manual U18549EJ1VOUM 117 CHAPTER 5 COMPILER OPTIONS Use Example 118 To output the error list file prime ecc describe as C cc78k0r cf1166a0 prime c e Output example prime c 18 CC78KOR warning W0745 Expected function prototype prime c 20 CC78KOR warning W0745 Expected function prototype prime c 26 CC78KOR warning W0622 No return value prime c 37 CC78KOR warning W0622 No return value prime c 44 CC78KOR warning W0622 No return value Target chip uPD78F1166 A0 Device file Vx xx Compilation complete 0 error s and 5 warning s found User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 2 se Description format se output file name
122. e library line When linking a program for flash area and a program for boot area specify the load module file for boot area in the beginning and specify the startup routine for flash area before the user program The following shows the library and object module file specification orders when linking Library specification order When using sprintf sscanf printf scanf vprintf and vsprintf functions not supporting floating points i User program library file specified with the b option ii Library file attached to the CC78KOR specified with the b option iii Floating point library file attached to the CC78KOR specified with the b option When using sprintf sscanf printf scanf vprintf and vsprintf functions supporting floating points i User program library file specified with the b option ii Floating point library file attached to the CC78KOR specified with the b option iii Library file attached to the CC78KOR specified with the b option Caution Specify the library for boot area when linking the program for boot area and the library for flash area when linking the program for flash area Specification order of other files i Load module file for boot area of user program ii Startup routine object module file for flash area attached to the CC78KOR iii Object module file for flash area of user program 80 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 2 Whe
123. e the standard library the area e is not used The following shows an example of changing RAM size with the link directive file Ik78kOr dr When changing memory size do not overlap another area Refer to the memory map of the target device to be used when changing memory size lt lk78kOr dr gt Fir f iz memory RAM OFCF00h 002F20h Make this size larger memory SDR OFFE20h 000098h also change the first address if necessary merge INIS SDR gt Specifies the location of the segment merge DATS SDR gt Specifies the location of the segment merge BITS SDR gt Specifies the location of the segment If you want to change the location of the segment add a merge statement If the function to revise the compiler output section name was used the segment can be independently located refer to CC78KOR C Compiler Language User s Manual If the result of changing the location of a segment does not provide enough memory for the location change the corresponding memory statement When using RTOS The RX78KOR and CC78KOR provide sample programs for initialization routines assembler format When using the RX78KOR and CC78KOR in combination initialization routines for both tools must therefore be modified For the method for modifying initialization routines refer to the RX78KOR Functions user s manual User s Manual U18549EJ1VOUM 169 CHAPTER 8 STARTUP ROUTINES 8 4 ROMization P
124. ed in this statement means NEC Electronics Corporation and also includes its majority owned subsidiaries 2 NEC Electronics products means any product developed or manufactured by or for NEC Electronics as defined above M8E 02 11 1 User s Manual U18549EJ1VOUM 3 MEMO 4 User s Manual U18549EJ1VOUM INTRODUCTION The purpose of this manual is to enable complete understanding of the functions and operation of the CC78KOR 78KOR Microcontroller C Compiler This manual does not explain how to write CC78KOR source programs Therefore before reading this manual please read CC78KOR Ver 2 20 C Compiler Language User s Manual U18548E hereafter called the Language manual Target Devices Software for 78KOR microcontrollers can be developed by using the CC78KOR To use this software the RA78KOR 78KOR Microcontroller Assembler Package sold separately and the target model s device file are required Target Readers This manual is written for users who have the knowledge gained from reading through the user s manual for the device once and have software programming experience However since knowledge about C compilers and the C language is not particularly needed first time users of C compilers can use this manual Organization The organization of this manual is described below CHAPTER 1 OVERVIEW This chapter describes the role and position of the CC78KOR in microcontroller development CHAP
125. efore after a function uses a lower level library 4 Executes the processes before after a function and subroutine call same codes When the mm or ml option is specified the code size per file does not exceed 32KB If the code size exceeds 32KB an error message F0925 will be output Users Manual U18549EJ1VOUM 103 CHAPTER 5 COMPILER OPTIONS Optimization Type Process Description t Makes the branch table in a switch statement of a function allocated to the far area into of a relative branch If the branch distance exceeds 64 KB an error message F0924 will be output Multiple optimization types can be specified If the q option or optimization types are omitted the optimization is identical to when the qcjlvw option is specified To delete a portion of the default options specify the options other than the options you want to delete Example qr is specified gt Deletes qcjlvw If both the object module file and the assembler source module file are not output the q option other than qu becomes invalid If both the q and nq options are simultaneously specified the last specified one is valid If several q options are simultaneously specified the last specified one is valid Use Example 104 Regarding char without a qualifier as an unsigned char enhances code efficiency C cc78k0r cfl1166a0 prime c qu The qc option that is specified first is ign
126. endable Optimizing Option Is Selected Compiler Options Extend Dthers Startup Routine Preprocessor Memory Model Data Assign ptimize Debug Output Group G erae mes s ERROR v ntegrated Recommendable Optimizing Option fo c C C Command Line Options Cancel Apply Help Integrated Recommendable Optimizing Option The Integrated Recommendable Optimizing Option integrates optimization options according to purpose instead of specifying them individually Accordingly this option makes the optimization option easier to set Select this check box to perform optimization and select the integrated recommendable optimizing option by selecting the appropriate radio button Exec Time qx1 Default qx2 Their meanings are as follows Exec Time qx1 Select this option when the efficiency of executing speed is important Default qx2 Select this option when both the efficiency of executing speed and the efficiency of object code size are equally important selected by default Code Size qx3 Select this option when the efficiency of object code size is important Subroutine call same codes qx4 Select this option when subroutine call same codes 48 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 2 When Char Expression Behavior Automatic Allocation is selected in the Group drop down list box Figure 3 11 Compiler Options Dialog Box When
127. ependence relationship check If the header1 h file exists header1 h gets registered to ProjectWindow of PM Prevention method None However this has no effect on the build processing d Project related file settings The CC78KOR attribute startup routines and standard libraries can be added and deleted from the Project menu of PM or from Add Project Related File displayed by right clicking in the Project window Perform the CC78KOR attribute startup routine and standard library settings from the Startup Routine tab in the Compiler Options dialog box 16 Prototype declaration An error E0301 E0701 will occur if a function prototype declaration does not contain a function type specification Example f void E0301 Syntax error E0701 External definition syntax Prevention method Describe the function type Example int f void 222 User s Manual U18549EJ1VOUM APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 17 Error message output If there is a spelling error in the keyword at the beginning of a line outside the function the display position of the error line may be offset and an inappropriate error output Example extren int i extern spelling error No error will occur here comment void f void EOF Error such as E0712 Prevention method None 18 Description of comments
128. ers These are output in the order they are found Output format When PAGEWIDTH 80 gt Command In file Inc file EXTERN EXTERN AUTO AUTO AUTO1 AUTO Xref file Para file i 3p 9 ATTRIB 15 Target chip 16 Device file 10 MODIFY NEAR FAR 78KOR C Compiler V 1 x xx Cross reference List Page 3 xxx 11 TYPE array func int int int int uPD78F1166 A0 Vx xx Date 2 xx XXX XXXX 12 SYMBOL 13 DEFINE 14 REFERENCE mark 5 14 16 22 main 7 d 9 13 13 13 14 15 15 I5 16 17 A7 21 prime 9 17 18 21 21 k 9 21 21 21 22 count 9 11 19 20 25 nem Description Number oi Format Number P Columns 1 Version number 4 Displayed in x yz format 2 Date 11 fixed System date Displayed in DD Mmm YYYY format 3 Number of 4 fixed Outputs a right aligned decimal number with zeros pages suppressed 4 Command line Outputs the command line contents following CC78KOR Contents that exceed the line length are output beginning at column 13 on the next line One or more white space characters or tabs are replaced by a single white space character 5 C source module Number of Outputs the specified file name file name characters If the file type is omitted c is attached as the file type enabled by OS extension Contents that exceed the line length are output
129. es and options from specified files Temporary file creation folder t Specifies the drive and folder where the temporary specification files are created Help specification Outputs help messages to the console h Function expansion specification Z Enables extended functions nz Device file search path y Specifies paths that search device files Memory model specification m Specifies the memory model used for compilation User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 5 4 Descriptions This section describes each compiler option in detail This example illustrates starting the CC78KOR in the command line To start in PM specify the command device type specification and options left out of the C source in the Compiler Options dialog box Example In command line C cc78k0r cfll66a0 prime c g Example When using PM Figure 5 1 Compiler Options Dialog Box Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output Define Macro d zb s Undefine Macro u ea Include Search Path i a te Command Line Options Cancel Help Users Manual U18549EJ1VOUM 93 CHAPTER 5 COMPILER OPTIONS Device type specification 1 c Description format cdevice type Interpretation when omitted Specification of this option cannot be omitted Func
130. external static variable except for the const type variable to the saddr area irrespective of whether there is an sreg declaration or not specify the rd option Description A Variables to be assigned change depending on the value of n and the specification of m Specification of n m Variable Types to Be Assigned n When n 1 char unsigned char When n 2 char unsigned char short unsigned short int unsigned int enum near pointer When n 4 char unsigned char short unsigned short int unsigned int enum long unsigned long pointer m Structure Union Array Omitted All variables The sreg declared variable is automatically assigned to the saddr area irrespective of the rd option specification The variable that is referenced by means of an extern declaration is processed as are to be assigned to the saddr area The variable assigned to the saddr area by specifying this option is handled in a similar way to an sreg variable Use Example To allocate the char or unsigned char type external variable or external static variable automatically to the saddr area regardless of whether sreg has been declared describe as C cc78k0r cf1166a0 rdl 100 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 3 rs nr Description formats Interpretation when omitted nr Function The rs option specifies the automatic assignment
131. fault if Debug Build is selected in PM Specify using radio buttons the file to which debug information is to be output Out put Debugging Information to rel Only g1 or Output Debugging Information to both asm and rel ga If this check box is selected Output Debugging Information to both asm and rel g2 is selected by default User s Manual U18549EJ1VOUM 53 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Output tab 1 When Object Module File Assembler Source Module File is selected in the Group drop down list box Figure 3 15 Compiler Options Dialog Box When Object Module File Assembler Source Module File Is Selected Compiler Options Extend Dthers Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output Group Object Module File Assembler Source Module File v Object Module File Output Path E Browse Create Assembler Source Module File xl aces sd Command Line Options mmm Cancel Apply Help Qbject Module File To specify an object module file output path input the path name in the combo box Up to 259 characters can be input into this combo box Specification is also possible using the Browse button Opens the Browse for Folder dialog box When universal options are specified in PM processing is always performed assuming that the path name is specified When the source file is specified processing is perfo
132. function parameters are illegal Action by User Specify just one parameter A parameter whose size exceeds 4 bytes cannot be specified E0710 Message Illegal storage class Cause The auto and register declarations are outside the function or the boolean variable is defined inside the function E0711 Message Undeclared variable name function function name Cause An undeclared variable is used E0712 Message Declaration syntax Cause The declaration statement does not match the syntax E0713 Message Redefined variable name Cause Two or more of the same variables are defined Action by User Set the variable definition once WO0714 Message Too many register variables Cause There are too many declarations of register variables Action by User Decrease the number of register variables For the number that can be used refer to CC78KOR C Compiler Language User s Manual E0715 Message Too many sreg variables Cause There are too many declarations of sreg variables 190 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 8 Error Messages for Declaration and Function Definition from 0701 gt tuus Error Message E0718 Message Too many bit boolean type variables Cause There are too many bit and boolean type variables Action by User Decrease the number of bit boolean and boolean type variables For the number that can be used
133. g is displayed Function The and h options display brief explanations of the options and the help messages such as the default options on the console valid only in the command line ete Note Do not specify this option in PM To reference help in PM click the Help button in the Compiler Options dialog box Application The option and its description are displayed Refer to them when running the CC78KOR Description Ifthe or h option is specified all of the other compiler options become invalid When viewing the continuation of a displayed help message press the Enter key To exit the display before the end press any character other than the Enter key and then press the Enter key Use Example To display the help messages on the console describe as C cc78k0r h 132 Users Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Function expansion specification 1 z nz Description formats ztype Multiple specifications are possible z Interpretation when omitted nz Function The z option enables extended functions The nz option invalidates the z option Types must not be omitted otherwise Fatal error F0012 will occur Application The functions for processing by the following type specifications are available for the 78KOR expansion functions User s Manual U18549EJ1VOUM 133 CHAPTER 5 COMPILER OPTIONS
134. he include statement folders with source files are searched first If the include file name is specified with lt gt search is not performed Note2 This is an example of when the CC78KOR is installed to C Program Files NEC Electronics Tools CC78KOR V x xx Users Manual U18549EJ1VOUM 111 CHAPTER 5 COMPILER OPTIONS Use Example To input the include file that is specified in an include statement in the C source prime c from folder b and b sample describe as C cc78k0r cfl1166a0 prime c ib b sample 112 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Assembler source module file creation specification 1 a Description format a output file name Interpretation when omitted No assembler source module file is output Function The a option specifies the output of the assembler source module file In addition the output destination or output file name is specified Application f you want to change the output destination or the output file name of the assembler source module file specify the a option Description Adisk file name or device file name can be specified as the file name fthe output file name is omitted when the a option is specified the assembler source module file name becomes input file name asm Ifthe extension for the output file name is omitted when the a option is specified assembler source module f
135. he object module file In addition the output destination or output file name is specified The no option specifies not to output the object module file Application If you want to change the output destination or the output file name of the object module file specify the o option If only the output of the assembler source module file is the target for compilation specify the no option Consequently the compilation time is reduced Description If the output file name is omitted when the o option is specified the object module file name becomes input file name rel If the extension for the output file name is omitted when the o option is specified object module file output file name rel will be output If there is a compilation error even when the o option is specified the object module file is not output If the drive name is omitted when the o option is specified the object module file is output to the current drive If both the o and no options are simultaneously specified the last specified one is valid Cautions 96 To change the output destination when using PM specify the new output destination in the Output Path combo box in the Object Module File area under the Output tab When individual compiler options are specified the output file name can also be changed Specify the file name or the output destination in the Output Path combo box under the Output tab User s
136. i User program library file specified with the b option ii Library file attached to C compiler specified with the b option iii Floating point library file attached to C compiler specified with the b option When using sprintf sscanf printf scanf vprintf and vsprintf functions supporting floating points i User program library file specified with the b option ii Floating point library file attached to C compiler specified with the b option iii Library file attached to C compiler specified with the b option Specification order of other files i Object file of startup routine attached to CC78KOR ii Object module file of user program User s Manual U18549EJ1VOUM 69 70 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING The following shows an example of linking C source s1 c and assembler source s2 asm C cc78k0r cf1166a0 sl c e a i C MProgram Files NEC Electronics Tools CC78KOR Vx xx inc78k0r y C Program Files NEC Electronics Tools dev C ra78k0r cf1166a0 s2 asm e y C Program Files NEC Electronics Tools dev C 1k78k0r sOrll rel sOl rel s2 rel b C Program Files NEC Electronics Tools CC78KOR Vx xx lib78k0r cl0Orxm 1lib b C Program Files NEC Electronics Tools CC78KOR Vx xx lib78k0r cl0rm lib s osample lmf y C Program Files NEC Electronics Tools dev Remark When specifying multiple compiler options
137. ible using the Browse button Opens the Browse for Folder dialog box When universal options are specified processing is always performed assuming that the path name is specified When the source file is specified processing is performed as a path name if a path exists and as a file name if no path exists User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 When Preprocess List File List Format is selected in the Group drop down list box Figure 3 18 Compiler Options Dialog Box When Preprocess List File List Format Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output Group izifzvipis Osage MMe eee p Create Preprocess List File z sowe E d 7 Add Form Feed at End of List File lf Columns per Line lw 132 4 Lines per Page ll 0 Expand TAB Character lt 95 Command Line Options meo Cancel Apply Help Create Preprocess List File Select this check box to output the preprocess list file and validate the specification for the following preprocess list files Delete Comment kc Select this check box to delete comments Execute define kd Select this check box to execute define Execute if ifdef ifndef kf Select this check box to execute if ifdef ifndef selected by default Execute include ki Select this check box
138. ice equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems medical equipment or systems for life support e g artificial life support devices or systems surgical implantations or healthcare intervention e g excision etc and any other applications or purposes that pose a direct threat to human life You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under
139. ied in a function call is more than the number of parameters specified in the list of argument types or the function definition E0509 Message Too few actual arguments Cause The number of arguments specified in a function call is fewer than the number of parameters specified in the list of argument types or the function definition W0510 Message Pointer mismatch in function function name Cause The given arguments have different pointer types than the arguments specified in the list of argument types or the function definition WO0511 Message Different argument types in function function name Cause The argument types given in the function call do not match the list of argument types or the function definition E0513 Message Illegal structure union member member name Cause A member that is referenced in the structure and not defined is indicated E0514 Message Expected structure union pointer Cause The expression before the gt operator is not a pointer to a structure or a union but is the name of a structure or a union Action by User Make the expression before the gt operator a pointer to a structure or a union User s Manual U18549EJ1VOUM 185 CHAPTER 9 ERROR MESSAGES Table 9 6 Error Messages for Expression from 0501 2 tim Error Message E0515 Message Expected structure union name Cause The expression before the operator
140. ify a const object variable name Cause A variable with the const attribute is rewritten E0407 Message Cannot write for read only sfr SFF name Cause Tried to write to a read only sfr E0408 Message Cannot read for write only sfr SFR name Cause Tried to read a write only sfr E0409 Message Illegal SFR access SFR name Cause Illegal data was read from or written to an sfr W0410 Message Illegal pointer conversion Cause A pointer and an object other than a pointer are converted W0411 Message Illegal pointer combination Cause Different types are mixed in the same pointer combination W0412 Message Illegal pointer combination in conditional expression Cause Different types in a pointer combination are used in a conditional expression W0413 Message Illegal structure pointer combination Cause Pointers to structures with different types are mixed E0414 Message Expected pointer Cause A pointer is required W0415 Message Conversion may lose significant digits for far pointer Cause An attempt was made to convert a far pointer into a near pointer or int Note that the values may be lost User s Manual U18549EJ1VOUM 183 CHAPTER 9 ERROR MESSAGES Table 9 5 Error Messages for Conversion from 0401 dos Error Message W0416 Message Illegal type and size far near pointer combination Cause Different types or different sizes far or near pointer are used together in the same pointer combination W0417 Mes
141. ile output file name asm will be output fthe drive name is omitted when the a option is specified the assembler source module file is output to the current drive f both the a and sa options are simultaneously specified the sa option is ignored Caution To change the output destination when using PM specify the new output destination in the Output Path combo box in the Create Assembler Source Module File area under the Output tab and select without C Source a When individual compiler options are specified the output file name can also be changed Specify the file name or the output destination in the Output Path combo box under the Output tab To specify a file name append the extension asm Use Example To output the assembler source module file sample asm describe as C cc78k0r cf1166a0 prime c asample asm Users Manual U18549EJ1VOUM 113 CHAPTER 5 COMPILER OPTIONS 2 sa Description format sa output file name Interpretation when omitted No assembler source module file is output Function The sa option adds the C source as a comment to the assembler source module file In addition the output destination or output file name is specified Application f you want to output the assembler source module file and the C source module file together specify the sa option Description Adisk file name or device file name
142. iler is run Output Files Object module file Binary image file containing machine rel language information relocatable information related to the location address of the machine language and symbol information Assembler source ASCII image file of the object code asm module file output by the compiler Preprocess list file List file output by the preprocess ppl instructions such as include ASCII image file Cross reference list file List file containing the function name xf and variable name information used in the C source module file Error list file List file containing the source file and ecc compiler error messages cer her erNote I O File Temporary file Intermediate file for compiling nn The file is renamed to an appropriate file name fixed name when compiling ends without error and is deleted when compiling ends in error 82 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Note The following 4 file types are available for error list files File Types Description cer Error list files with C source corresponding to c files output by specifying the se option her Error list files with C source corresponding to h files output by specifying the se option er Error list files with C source corresponding to files other than the above output by specifying the se option ecc Error list files without C source corresponding to all of the source files ou
143. iles The device file installer is installed at the same time as the CC78KOR Users Manual U18549EJ1VOUM 27 CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION 2 4 Folder Configuration The standard folder displayed during installation is Program Files NEC Electronics Tools of the Windows System The configuration under the install folder is as follows Note that the drive and install folder can be changed during installation When performing make operation with PM perform installation of tools CC78KOR RA78KOR to the same drive and folder The descriptions in this manual assume installation to the standard folder with Program Files NEC Electronics Tools which is the default program name according to the setup program default directions Figure 2 1 Folder Configuration Program Files NEC Electronics Tools L CC78KORW x obin Folder storing C Compiler L CC78KORW x oMdoo Folder storing user s manual and supplementary explanations I CC78KO0RW xoohlp Folder storing on line help file CC78KOR Vx xx inc78kOr Folder storing header files CC78KOR Vx xx lib78kOn Folder storing library files object files for startup routines IL CC78KOR Vx xxismp78k0r CC78KOR Folder storing files for verifying installation L CC78KOR Vx xx src cc78kO0r Datis Folder storing batch files poe T 0 E A Folder storing library files object files for startup ro
144. in preprocessing directive In the description of preprocessing directives an error E0803 E0814 E0821 etc will occur when a comment is described at the same line as a function type macro either before or within a preprocessing directive Example coml fpragma sfr E0803 com2 define ONE af E0803 define com3 TWO 2 E0814 ifdef com4 ANSI C E0814 com5 fendif define SUB pl com6 p2 p2 pl E0821 Prevention method Describe the comment after the preprocessing directive Example pragma sfr coml define ONE 1 com2 define TWO 2 com3 ifdef ANSI C com4 endif com5 define SUB pl p2 p2 pi com6 User s Manual U18549EJ1VOUM 223 APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 19 20 Use of tag for structure union or enum If the tag for a structure union or enum is used before defining it in a function prototype declaration a warning will occur if condition a below is fulfilled and an error will occur if condition b below is fulfilled a Ifthe tag is used in an argument declaration and a pointer to a structure or union is defined the warning W0510 will occur when a function is called Example void func int struct st st char char struct membl memb2 void caller void W051
145. ing the 1 returned in the EXIT status execution can be stopped without processing the next C source in 962 150 User s Manual U18549EJ1VOUM CHAPTER 7 USING C COMPILER 7 2 Setting Up Development Environment Environment Variables The CC78KOR supports the following environment variables Table 7 2 Environment Variables Environment Variables Description PATH Search path for executable forms INC78KOR Search path for include files TMP Search path for temporary files LANG78K Type of kanji code 2 byte code can be specified by the zs ze or zn option sjis shift JIS code euc EUC code none no 2 byte codes LIB78KOR Search path for libraries Use Example lt When using command prompt gt AUTOEXEC BAT PATH C Program Files NEC Electronics Tools CC78KOR Vx xx bin C bat C cc78k0r C tool VERIFY O BREAK ON SET INC78KOR C Program Files NEC Electronics Tools CC78KOR Vx xx inc78k0r SE IB78KOR C Program Files NEC Electronics Tools CC78KOR Vx xx lib78k0r SE MP C tmp SE AANG78K sjis Description Executable files are searched in the sequence of C Program Files NEC Electronics Tools CC78KOR Vx xx bin C bat CAcc78k0r Cool by path specification Include files are searched from C Program Files NEC Electronics Tools CC78KOR Vx xx inc78kOr If no setting is made search is perfor
146. initial value b DATAL _ DATAL _ DATAL when allocated in far area sreg variable with initial value c INIS _ INIS _ INIS sreg variable without initial value d DATS _ DATS _ DATS C HAPTER 8 STARTUP ROUTINES 4 Starting main function and postprocessing Starting the main function and postprocessing in cstart asm are described Starting main function and postprocessing gt CALL IF EXITSW CLRW CALL SENDIF BR _ cend R_INI CSEG _ R_INIT RLINI CSEG _ RLINIT R_INIS CSEG _ R_INIS INIT DSEG _ INIT INITL DSEG _ INITL DATA DSEG _ DATA DATAL DSEG _ DATAL INIS DSEG _ INIS DATS DSEG _ DATS CALT CSEG CNST CSEG CNSTL CSEG BITS BSEG END main AX exit UNIT64KP UNIT64KP UNIT64KP BASEP UNIT64KP BASEP UNIT64KP SADDRP SADDRP CALLTO MIRRORP PAGE 64KP main 1 exit 0 2 3 1 Starting main function The main function is called 2 Starting exit function The exit function is called if needed 3 Definitions of segments and labels used in ROMization processing The segments and labels used in each variable a to d see 3 ROMization processing in ROMization processing are defined A segment indicates the area that stores the initial value of each variable A label indicates the first address in each segment User s M
147. itted the compiler presumes that macro name 1 was defined Ifthe same macro name was specified in both the d and u options the last specified one is valid Use Example This is an example where the following codes are defined in the C source prime c define TEST 1 define TIME 10 C cc78k0r cf1166a0 prime c dTEST TIME 10 Users Manual U18549EJ1VOUM 109 CHAPTER 5 COMPILER OPTIONS 2 u Description format umacro name macro name Multiple specifications are possible Interpretation when omitted A macro definition specified with d is valid Function The u option disables macro definitions similar to the undef statement in the C source Application Specify this option to invalidate the macro name defined by the d option Description By delimiting each macro name by a comma 30 macro definitions can be disabled at one time Spaces are not allowed before and after a comma A macro definition that can be disabled by the u option is one that has been defined by the d option A macro name defined by define in a C source module file or a system macro name of the CC78KOR cannot be disabled by the u option Ifthe same macro name is specified by both the d and u options the last specified one is valid Use Example The d option that is specified first is ignored and the u option that is specified second is valid the
148. le creation specification P Specifies the output of the preprocess list files k Specifies processing for the preprocess lists Preprocess specification d Performs macro definitions u Invalidates macro definitions i Reads from the folder that is specified as the include file Assembler source module file creation a Specifies the output from the assembler source specification module files sa Error list file creation specification e Specifies the output from the error list files se Cross reference list file creation X Specifies the output from the cross reference list files specification User s Manual U18549EJ1VOUM 91 CHAPTER 5 COMPILER OPTIONS Table 5 2 List of Compiler Options 92 Types Option Description List format specification Iw Specifies number of characters for 1 line of each list file Il Specifies number of lines for 1 page of each list file It Changes the expanded number of characters for each list file tab If Adds the page break code at the end of the list files li Adds the C source of the include files to the assembler source module file with C source comments Warning output specification W Specifies whether a warning message is output to the console Execution state display specification V Specifies whether the execution status of compilation is output to the console nv Parameter file specification f Inputs input file nam
149. le file If both g and ng are simultaneously specified the last specified one is valid If both the object module file and the assembler source module file are not output the g option becomes invalid Use Example To add debug information in the object module file prime o describe as C cc78k0r cfl1166a0 prime c g User s Manual U18549EJ1VOUM 105 CHAPTER 5 COMPILER OPTIONS Preprocess list file creation specification 1 p Description format p output file name Interpretation when omitted None no file is output Function The p option specifies the output of the preprocess list file In addition the output destination or output file name is specified If the p option is omitted no preprocess list file is output Application f you want to output the source file after preprocess processing is executed according to the k option process type or want to change the output destination or the output file name of the preprocess list file specify the p option Description fthe output file name is omitted when the p option is specified the preprocess list file name becomes input file name ppl fthe extension for the output file name is omitted when the p option is specified preprocess list file output file name ppl will be output fthe drive name is omitted when the p option is specified the preprocess list file is output
150. lected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output Group Site Sag AEN E 388 E Y Create Error List File Create Cross Reference List File x PO Bewe Command Line Options NE Cancel Apply Help Create Error List File Select this check box to output the error list file Specify using radio buttons whether to add C sources to the error list file whether to add include files without C Source e or with C Source se If this check box is selected without C Source e is selected by default To specify the error list file output path input the path name in the combo box Up to 259 characters can be input into this combo box Specification is also possible using the Browse button Opens the Browse for Folder dialog box When universal options are specified processing is always performed assuming that the path name is specified When the source file is specified processing is performed as a path name if a path exists and as a file name if no path exists Users Manual U18549EJ1VOUM 57 58 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Create Cross Reference List File x Select this check box to output the cross reference list file To specify the cross reference list file output path input the path name in the combo box Up to 259 characters can be input into this combo box Specification is also poss
151. les for ROMization routine asmNote 5 Source files for standard functions partial Remark Alphanumeric symbols User s Manual U18549EJ1VOUM 29 2 Note 1 Note 2 Note 3 Note 4 Note 5 Note 6 Note 7 5 1 CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION Refer to CC78KOR C Compiler Language User s Manual To modify the startup routine modify the source file below the CC78KOR Vx xx src cc78kOr lib folder The file assembled with a batch file is stored in the CC78KOR Vx xx src cc78kOr lib folder Copy the file to the CC78KOR Vx xx lib78kOr folder and link it with the user program Refer to 2 5 1 Library files The batch files contained in this folder are provided for use in command prompt so they cannot be used in PM Use these files only when modification of source files is required Refer to the contents in Table 8 1 2B E N B when the boot area is specified E when the flash area is specified N when the standard libraries are not used Refer to the contents in Table 8 3 Library files The library file consist of standard libraries runtime libraries and startup routines The table below lists the folder contents 30 Table 2 3 Library Files clOrxl li Note3 clOrxl lipNotes clOrxle lipNotes Folder File Name l File Role Name Normal Boot Area Flash Area lib78kOr clOrm lib clorm lib clorme lib Library runtime and standard clOrl lib clOrl li
152. macro definition for TEST thus becomes invalid C cc78k0r cfll66a0 prime c dTEST TIME 10 uTEST 110 Users Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 3 i Description format ifolder folder Multiple specifications are possible Interpretation when omitted The compiler considers that the following folders were specified i Folder with source fieNote 1 ii Folder specified by environment variable INC78KOR iii C Program Files NEC Electronics Tools CC78KORW x o inc78kor ete 2 Function The i option specifies input of the include files specified by the include statement in the C source from the specified folder Application Specify this option when you want to search for the include files from a certain folder Description By using a comma to delimit 64 folders can be specified at one time Spaces cannot be inserted before and after a comma f multiple folders are specified after i or if the i option is specified multiple times the files specified by include are searched for in the specified order The search sequence is as follows i Folder with source fijgNete 1 ii Folder specified with the i option iii Folder specified with environment variable INC78KOR iv C Program Files NEC Electronics Tools CC78KOR Vx xx inc78kOorNte 2 Note 1 If the include file name is specified with double quotation marks in t
153. main function Definitions of labels used in ROM processing Note 1 If the standard library is used the processing related to the library is performed first Files that do not have an n appended at the end of the name in the startup routine source file are processed in relation to the standard library Files with the appended n are not processed Note 2 The hdwinit function is a function created when needed by the user as the function to initialize a peripheral device sfr By creating the hdwinit function the timing of the initial settings can be sped up the initial settings can be made in the main function If the user does not create the hdwinit function the process returns without doing anything 158 User s Manual U18549EJ1VOUM CHAPTER 8 STARTUP ROUTINES cstart asm and cstartn asm have nearly identical contents The table below shows the differences between cstart asm and cstartn asm Type of Startup Routine Uses Library Processing cstart asm Yes cstartn asm No 3 Uses of startup routines Thetable below lists the names of the object files for the source files provided by the CC78KOR File Type Source File Object File Startup routine cstart asmNote 2 sOr re Note2 3 4 ROM file rom asm Included in library Note 1 If the standard library is not used n is added If used the character is not added Note 2
154. me c sa 114 User s Manual U18549EJ1VOUM Output example CHAPTER 5 COMPILER OPTIONS 78KOR C Compiler Vx xx Asse Command In file Asm file Para file cflil66a0 p prime c prime asm SPROCESSOR f1166a0 SDEBUG SNODEBUGA SKANJICODE SJIS STOL INF O3FH 100H SDGS FIL NAM file SDGS AUX_FIL prime c SDGS OD_NAM prime EXTR _ RTARGO EXTR isrem PUBLIC _printf PUBLIC putchar PUBLIC mark PUBLIC main CODEL CSEG main SDGL Te E9 push hl subw sp 08H movw hl sp bf main line nF int i prime line 10 line 11 count 0 SDGL 0 4 clrw ax movw du J aX line 12 7 dane 13 s for i 0 SDGL 0 6 movw hl 6 L0003 movw ax hl 6 cmpw ax 0C8H orl CY a 7 skc bnz L0004 Code Information mbler Source rime c sa OOH OOH Date xXx XXX XXXX 00H 037H OFFFEH OOH OFFFI p Eo Count Count i lt SIZE ax i s h i i s 200 7 E H INF INF INF INF INF i INF INF INF INF INF INF 00H O3FH N NNN WD 067H 077H BrP PR 01H OOH Time xx Xxx xx OOH 00H Users Manual U18549EJ1VOUM 115 CHAPTER 5 COMPILER OPTIONS SFILE C Program Files NEC Electronics Tools CC78KOR Vx xx smp78k0r cc78k0r prime c SFUNC main 8 be void
155. med from C Program Files NEC Electronics Tools CC78KOR V x xx inc78kOr if the CC78KOR is installed to C Program Files NEC Electronics Tools CC78KOR V x xx Library files are searched from C Program Files NEC Electronics Tools CC78KOR Vx xx lib78kOr during linking If no setting is made search is performed from C Program Files NEC Electronics Tools CC78KOR V x xx lib78kOr if the CC78KOR is installed to C Program Files NEC Electronics Tools CC78KOR V x xx Temporary files are created in C tmp Shift JIS code is used as kanji code Caution Do not set environment variables when using PM Users Manual U18549EJ1VOUM 151 CHAPTER 7 USING C COMPILER 7 3 Interrupting Compilation If compiling was started from the command line the compilation can be interrupted by the command key input CTRL C If break on was specified control returns to the operating system unrelated to the timing of the key input And for break off control returns to the operating system only when the screen is displayed Then all of the open temporary files and output files are deleted If you want to stop a build make in PM select Stop build in the Run menu in the PM or click the Stop Build button in the tool bar When building in PM command key input is not accepted 152 Users Manual U18549EJ1VOUM CHAPTER8 STARTUP ROUTINES To execute a C language program a program is needed to activate ROMization for inclusion in the s
156. ment u Select HEX Format Value Intel Format ki Intel Extend Format kie C TexFormat kt C C Start Address Size Motorola S type Format standard km Motorola S type Format 32bit kme Divide HEX File for the Product with Flash ROM zf Command Line Options Caution After the program for boot area is compiled and object converted write in the HEX file e g boot hex with a flash programmer After writing be sure to save the load module file e g boot Imf and HEX file created in the above procedure Do not build the program for boot area again c Building project Projects are built with the set options Build of an entire project is done by selecting Build from the Build menu or by clicking the Build button on the tool bar PM MAKE is started up by the automatically created MAKE file Upon completion of build a message dialog box appears Check that build has been completed normally Caution The contents displayed in the OutPut window during build are saved as the Project file name plg file name to the project folder Users Manual U18549EJ1VOUM 75 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 76 2 Compiling to linking program for flash area a Creating a project Create a project for the flash area and register the source file b Compiler linker and object converter option settings Only the minimum options required for build are set in MAKE file automatically create
157. mitted When the qr option is not specified objects for real time OS is output and register declarations when saddr area is used are ignored Function The q option specifies calling the optimization phase to generate efficient objects The nq option invalidates the q option Application If you want to improve the execution speed of the objects and reduce the code size specify the q option If the q option is specified and you want to perform multiple optimizations simultaneously specify the optimization types consecutively For details see Description Description The table below lists the optimization types that can be specified by the q option Optimization Type Process Description No specification When the qr option is not specified objects for real time OS is output and register declarations when saddr area is used are ignored Regards the char with no qualifier as a unsigned char to improve code efficiency 102 Users Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Optimization Type Process Description C Performs calculations including char without sign extension Calculation Target Calculation Result unsigned char type variable and unsigned char unsigned char type type variable unsigned char type variable and signed char unsigned char type type variable signed char type variable and signed char typ
158. n OK Close the message box Message Cannot find folder Willyou create Cause A non existing folder is described Action by User Click the OK button to create a new folder Click the Cancel button to cancel the folder creation Button OK Creates a folder and closes the message box Cancel Closes the message without creating a new folder Message Cannot find drive Make sure the drive Cause The specified drive is not found Action by User Specify the correct drive name Button Retry Retries accessing the drive Cancel Accessing is ignored User s Manual U18549EJ1VOUM 203 CHAPTER 9 ERROR MESSAGES Table 9 11 PM Error Messages Error Type Error Message Message Illegal File name Cause The file name includes characters whose use are not allowed by the OS or the CC78KO0R Action by User Do not use characters that cannot be handled by the OS or or which cannot be handled by the CC78KOR Button OK Close the message box Message Unable to create the falder Cause Folder creation was rejected by the OS because of a shortage of available disk space read only etc Action by User Check the available disk space and whether write is permitted Button OK Close the message box Message Ignored Options Cause Option information in the project file includes a combination of options
159. n ASCII image list of C source program compilation results and is a source module file in assembly language that corresponds to the target C source program It can also include the C source program to this file as comments by setting the assembler source module file creation specification option sa Output format 78KOR C Compiler V 1 x xx Assembler Source Time 3 xx xx xx 18 bf main 22 Code Information 23 SFILE prime c C Program Files NEC 27 CALL 28 putchar 20 bc int ax 27 SCALL printf 25 Command 4 cf1166a0 prime c sa In file 5 prime c Asm file 6 prime asm Para file CH SPROCESSOR 8 f1166a0 9 SDEBUG 10 SNODEBUGA 11 SKANJICODE SJIS 12 STOL_INE O3FH 100H 00H OOH OOH 13 DGS FIL NAM file 034H OFFFEH 14 EXTRN _ RTARGO line 15 1 16 4define TRUE 1 line 15 2 16 define FALSE 0 line 1573 16 define SIZE 200 14 main 17 DGL 1 14 14 push hl 14 subw sp 08H 14 movw ax Sp 14 movw hl ax Date 2 xx XXX xx O3FH 067H 21 INF 21 INF 21 INF 21 INF 24 SFUNC main 8 25 bc void 2 CODE SIZE 116 bytes CLOCK SIZE 16 bytes 27 CALL printf 18 28 be pointer ax int sp 2 86 clocks 01H OOH dr ge all 2 y d 2o l Ty
160. n is called by the same module the assemble list is illegal and an error will occur during assembly Example callt extern void funca void callt extern void funcb void callt extern void funcc void static void const func J funca Punch funce g void func2 void funce funch Gs funca Prevention method Separate the function table and function call module 22 Functions returning a structure When a function returns a structure an interrupt is generated in the process of returning a return value If there is a call of the same function during interrupt servicing the return value is illegal after the interrupt servicing ends Example struct str char e s int LEE long ps st struct str func Interrupt occurrence void main st func Interruptoccurrence If the func function is called at the interrupt destination during the above servicing st may be corrupted Prevention method None Users Manual U18549EJ1VOUM 225 APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 23 Union initialization An error E0750 will occur when during initialization of unions having structures unions or arrays as members the initializer syntax is specified with nesting Example struct Ss int di d2 li union Au struct 5s tl ju2 111
161. n parameter file is used When multiple options are input in starting a C compiler assembler or linker the same specification may be repeated several times if sufficient information for startup has not been specified in the command line In such cases a parameter file should be used Specify the parameter file specification option f in the command line when using a parameter file The following shows the startup method for a compiler assembler and linker by using a parameter file path name cc78k0rA fparameter file nam path name ra78k0rA fparameter file nam path name lk78k0rA fparameter file nam The following shows a usage example C cc78k0r fpara pcc C 1k78k0r fpara plk Parameter files are created by Editor All options and output file names that should be specified in a command line can be written The following shows examples of creating parameters by Editor Contents of para pcc cfll66a0 boot c i C MProgram Files NEC Electronics Tools CC78KOR Vx xx inc78k0r y C Program Files NEC Electronics Tools dev Contents of para pra gt sOrllb rel boot rel b C Program Files NEC Electronics ToolsNCC78KORNVx xxNMlib78kO0rNclOrxm lib b C Program Files NEC Electronics ToolsNCC78KORNVx xxMlib78k0rNclOrm lib s oboot lmf zb2000h y C Program Files NEC Electronics Tools dev Remark The
162. n the Project Window the options are set for the source file If Compiler Options is selected in the Tools menu the options are set for all of the source files Cancel button The options are not set and the dialog box closes The ESC key has the same effect as the Cancel button no matter where the focus is in the dialog box Apply button This button is effective only when option settings have been changed The edited contents in this dialog box are applied and the Compiler Options dialog box remains displayed Help button The help file for this dialog box opens User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Preprocessor tab Figure 3 7 Compiler Options Dialog Box When Preprocessor Tab Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data ssign ptimize Debug Dutput Define Macro d i sa Undefine Macro u es Include Search Path i i jee Command Line Options gm Cancel Help Define Macro d Input into this combo box a macro name and a definition name of the macro definition to be enabled For the macro name 30 macro definitions can be performed at once by delimiting with Up to 256 characters can be input for specifying a defined macro name Up to 7 709 characters can be input into this combo box Can be specified using the Edit button Opens the Edi
163. name Cause The actual argument during macro expansion is too long W0824 Message Identifier truncate to macro name Cause The macro name is too long Program It is shortened to the displayed macro name Processing W0825 Message Macro recursion macro name Cause The define definition becomes recursive E0826 Message Compiler limit too many macro defines Cause The number of macro definitions exceeded 10 000 E0827 Message Compiler limit too many macro parameters Cause 1 macro definition had over 31 calling parameters E0828 Message Not allowed undef for system macro name Cause The system macro name is specified by undef W0829 Message Unrecognized pragma character string Cause This character string is not supported Action by User Check that the keywords are correct This warning occurs if an incorrect segment was specified in the pragma section E0830 Message No chip specifier pragma pc Cause There is no device specifier Users Manual U18549EJ1VOUM 197 CHAPTER 9 ERROR MESSAGES Table 9 9 Error Messages for Preprocessing Directive from 0801 2 ae Error Message E0831 Message Illegal chip specifier pragma pc device type Cause The device specifier is illegal W0832 Message Duplicated chip specifier Cause The device specifier is duplicated E0833 Message Expected asm Cause There is no asm E0834 Message
164. ne file exceeds the processing limit Action By User Separate the source lines to several files so as not to exceed the processing limit 178 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES 9 2 3 Error messages for a character Table 9 3 Error Messages for Character from 02012 nated Error Message E0201 Message Unknown character hexadecimal number Cause Characters having the specified internal code cannot be recognized E0202 Message Unexpected EOF Cause The file ended while the function was operating W0203 Message Trigraph encountered Cause A trigraph sequence 3 character representation appeared Action by User If the za option was specified since trigraph sequences are valid this warning is not output Users Manual U18549EJ1VOUM 179 CHAPTER 9 ERROR MESSAGES 9 2 4 Error messages for configuration element Table 9 4 Error Messages for Configuration Element from 0301 ae Error Message E0301 Message Syntax error Cause A syntax error occurred Action by User Make sure there are no description errors in the source E0303 Message Expected identifier Cause An identifier is required for the goto statement Action by User Correctly describe the identifier to be specified for the goto statement W0304 Message Identifier truncate to identifier Cause The specified identifier is too long
165. ned macros 30 or fewer in total Button OK Close the message box Message Multiple undefine definition Cause The same undefined macro was specified twice Action by User Do not specify the same undefined macro twice Button OK Close the message box User s Manual U18549EJ1VOUM 205 CHAPTER 9 ERROR MESSAGES Table 9 11 PM Error Messages Error Type Error Message Message Too many characters for undefine Definition Up to 256 characters can be described for a macro name Cause The length of characters used for specifying the undefined macro name exceeds the specifiable range Action by User Keep the number of characters used for macro name specification 256 or fewer Button OK Close the message box Message Too many macro for macro Undefinition macro Definition and macro Undefinition can be specified to 30 in all Cause The number of defined and undefined macros that can be specified exceeds the specifiable range Action by User Keep the number of defined and undefined macros 30 or fewer in total Button OK Close the message box Message Can t set options correctly to source name Cause When an attempt was made to reflect a common option in a special option a contradiction was found in specification or the specification exceeds the quantitative limits Action by User Option specification that cannot be refle
166. ng Floating Point in sprintf sscanf printf scanf vprintf wsprintf r Library clOrm lib clOrmf lib Command Line Options EO I I Cancel Apply Help Caution The settings for the Startup Routine tab cannot be performed if special compiler options are set per source file Using Startup Routine Select this check box to use the standard startup routine provided for this C compiler selected by default Using Fixed Area of Standard Library Select this check box to use the fixed area used by the standard library selected by default ROMization processes of far area Select this check box to perform ROMization process ing for the far area selected by default Select Object Select the desired startup routine for the normal boot or flash area by selecting the appropriate radio button Normal Boot Flash If the Output the Object for Flash Memory zf check box under the Memory Model tab is not selected the startup routine for the normal or boot areas can be selected and if the check box is selected only the startup routine for the flash area can be selected Startup Routine Indicates the file name of the startup routine to be used 64 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Using Library Select this check box to use the standard library provided for this C compiler selected by default Using Eloating Point in Select this che
167. ng linker option Specify Elash Start Address for the Product with Flash ROM zb and then click the OK button Since Using Startup Routine and Using Library check boxes are selected under the Startup Routine tab it is not necessary to specify the startup routine and library in the Linker Options dialog box Also since the C source boot c is included in the source file specification Create Stack Symbol s option is automatically set Remark For information about the linker options refer to RA78KOR Assembler Package Operation User s Manual Linker Options Output Output2 Library Others Directive File d v Browse Temporary Directory t rT sl Browse IV Create Sta imbol s Area Name zl Warning Level vw T Flash Start Address for the Product with Flash ROM zb 2000 H Use Command File Parameterfile f Y Browse Other options Reset Option data read Option data save Command Line Options oa Imf pa map bcl rm lib belOrmf lib C Program Files NEC Electronics ToolsXCC 8K R VcxxMib 7 8kOr s zb2000h User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING iii Setting object converter option Do not specify the Divide HEX File for Product with Flash ROM zf check box Object Converter Options Output Output Others HEX Madule o Dutput File Name Browse jw Object Comple
168. ng on an Illegal Operating System from 0901 PM Error Messages 203 List of Use related Cautions 216 Compiler Options 227 User s Manual U18549EJ1VOUM 201 CHAPTER1 OVERVIEW The 78KOR C compiler CC78KOR translates C source programs written in ANSI CN or the C language for the 78KOR into the machine language for the 78KOR The CC78KOR can be started up on Windows9 by using PM supplied with the assembler package for the 78KOR When PM is not used the compiler is started up on the command prompt Note ANSI C is the C language that conforms to the standard set by the American National Standards Institute 1 1 Role of CC78KOR The position of CC78KOR in product development is shown below Figure 1 1 Development Process Product Planning System Design Hardware Design Software Design e a Compile CC78KOR Assemble C Compiler Defect System Evaluation Product Creation Users Manual U18549EJ1 VOUM 13 CHAPTER 1 OVERVIEW The software development process is shown below Figure 1 2 Software Development Process Software Development Write Program Specification Create Flow Chart Edit Source Modules e Depends on 78KOR C language or ANSI C i Compile Use the editor to create the C source module files YES NO Link 1o Link to the reference library and function library File Conversion e Convert the file to the hexadecimal format
169. ng parameters by the editor Contents of para pcc cfll66a0 sl c e a i C Program Files NEC Electronics y C Program Files NEC Electronics ToolsNCC78KORNVx xxNinc78k0r Tools Ndev Contents of para pra gt cfll66a0 s2 asm e y C Program Files NEC Electronics Tools dev Contents of para plk sOrll rel sl rel s2 rel b C Program Files NEC Electronics Tools CC78KOR Vx xx 1lib78k0r cl0Orxm lib b C Program Files NEC Electronics ToolsNCC78KORNVx xxMlib78k0rNclOrm lib s osample lmf y C Program Files NEC Electronics Tools dev The i option specification b option path specification and y option specification can be omitted depending on the condition For details see CHAPTER 5 COMPILER OPTIONS and RA78KOR Assembler Package Operation User s Manual Users Manual U18549EJ1VOUM 71 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 3 Procedure When Using Self Rewrite Mode This function is available only for the device having the flash memory self rewriting function 3 3 1 Compiling to linking via PM PM is used to illustrate the make technique Be sure to execute compiling to linking in the following order 1 Compiling to linking program for boot area a Creating a project Create a project for the boot area and register the source file b Compiler linker and object converter options setti
170. ngs Only the minimum options required for build are set in MAKE file automatically created when project creation is ended Project specific options are set with the Tools menu Selecting Compiler Options in the Tools menu displays the Compiler Options dialog box i Setting compiler option Do not specify the Output the Object for Flash Memory zf check box under the Memory Model tab Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign Optimize Debug Output Memory Model C Small ms E Im C Large ml Control Object Output the Object for Flash Memory zf Command Line Options E Cancel Help 72 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Select Boot radio button in the Select Object box under the Startup Routine tab Compiler Options Preprocessor Memory Model Data Assign Optimize Debug Output Extend Others Startup Routine V Using Fixed Area of Standard Library M ROMization processes of far area m Select Object C Nomal Boot C Flash Startup Routine str rel v Using Library Using Floating Point in sprintf sscanf printf scanf vprintf wsprintf Using Multiplier Library elOrm lib elOrmf lib Command Line Options gm Cancel Apply Help Users Manual U18549EJ1 VOUM 74 il CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Setti
171. nt Normal search path search device files search path only Memory mtype Specifies the memory Independent mm model model used for specification 230 compilation User s Manual U18549EJ1VOUM Symbols pragma pc 94 asm 29 bat 29 dll 29 h 29 hip 29 2 h option 132 BRKADR 167 _ DIVR 167 OFNCENT 167 OFNCTBL 167 _ LDIVR 167 OMEMBTM 167 OMEMTOP 167 _ SEED 167 _ STBEG 161 162 _ TOKPTR 167 Compiler Options dialog box 41 A aoption 113 ABORT 150 ANSI C 13 Assembler 18 Assembler source 217 Assembler source module file 139 C C compiler 17 c option 94 cc78kO0r exe 29 cc78k0r msg 29 cc78kOrp chm 29 cc78kOrp dll 35 cer 82 clOr lib 29 Cross reference list file 148 cstart asm 29 159 cstart asm 156 159 160 cstartn asm 156 159 D d option 109 Debugger 22 E e option 117 ecc 82 Environment variable 34 er 82 ermno 167 Error level 150 INDEX Error list file 143 F f option 130 G g option 105 H Hardware initialization function 162 Hdwinit function 158 162 her 82 l i option 111 INC78KOR 34 111 151 Include file 216 222 K k option 107 L LANG78K 34 151 If option 126 li option 127 LIB78KOR 34 15
172. nts exceeded the limit of 255 W0332 Message Non supported keyword found ignored function attributes in this file Cause A keyword not supported is detected Function attributes in this file are ignored W0340 Message Unreferenced label abel name Cause The specified label has been defined but has not been referenced even once Users Manual U18549EJ1VOUM 181 CHAPTER 9 ERROR MESSAGES Table 9 4 Error Messages for Configuration Element from 0301 gt Error N mb r Error Message E0342 Message function qualifier keyword is not allowed Cause This function qualifier cannot be used 182 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES 9 2 5 Error messages for conversion Table 9 5 Error Messages for Conversion from 0401 Tu Error Message W0401 Message Conversion may lose significant digits Cause A long was converted into int Be careful the value may be lost E0402 Message Incompatible type conversion Cause An illegal type conversion took place in the assignment statement E0403 Message Illegal indirection Cause The operator is used in an integer type expression E0404 Message Incompatible structure type conversion Cause The types on both sides of an assignment statement to a structure or structure pair differ E0405 Message Illegal lvalue Cause This is an illegal left value E0406 Message Cannot mod
173. ocated in the far area using the __ far qualifier or the like use the startup routine for the large model The following startup routines all including ROMization processing are provided by the CC78KOR If the flash memory self rewrite mode for is used refer to 8 3 3 3 When using RTOS Startup routines When not using C standard library area sOrm rel sOrl rel When using C standard library area sOrml rel sOrll rel Usage example C 1k78k0r sOrl rel sample rel s bclOrxm lib bclO0rm lib osample lmf sample rel Object module file of user program sOrl rel Startup routine clOrxm lib Library that uses a multiplier clOrm lib Runtime library standard library The s option is a stack symbol _ STBEG _ STEND automatic generation option Caution 1 Be sure to link the startup routine at the beginning Caution 2 When creating a library create it separately from the library provided by the CC78KO0R and specify it prior to the compiler library during linking Caution 3 Do not add user functions to the CC78KOR library Caution 4 When using a floating point library clOr f lib it is necessary to link the startup routine including the ROMization processing to both the standard library and the floating point library When using sprintf sscanf printf scanf vprintf and vsprintf functions supporting floating points lt Example gt bmylib lib bclO0rmf lib bclO0rm lib When using sprintf sscanf printf scanf vp
174. ocedure Using CC78KOR 15 1 2 1 Using editor to create source module files 16 1 2 2 C compiler 17 1 2 3 Assembler 18 1 2 4 Linker 19 1 2 5 Object converter 20 1 2 6 Librarian 21 1 2 7 Debugger 22 1 2 8 System simulator 23 1 2 9 PM 24 CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION 25 2 1 Host Machines and Supply Medium 25 2 2 Installation 26 2 3 Installation of Device Files 27 2 4 Folder Configuration 28 2 5 File Organization 29 2 5 1 Library files 30 2 6 Uninstallation 33 2 7 Environment Settings 34 2 7 1 Host machine 34 2 7 2 Environment variables 34 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 35 3 1 PM 35 3 1 1 Position of cc78kOrp dll tools DLL 35 3 1 2 Execution environment 35 3 1 3 CC78KOR option setting menu 36 3 1 4 Description of each part of Compiler Options dialog box 41 3 2 Procedure When Not Using Self Rewrite Mode 66 3 2 1 MAKE from PM 66 3 2 2 Compiling to linking in command line for command prompt 69 3 3 Procedure When Using Self Rewrite Mode 72 3 3 1 Compiling to linking via PM 72 3 3 2 Compiling to linking in command line for command prompt 79 3 4 I O Files of C Compiler 82 3 5 Execution Start and End Messages 84 3 5 1 Execution start message 84 3 5 2 Execution end message 84 CHAPTER 4 CC78KOR FUNCTIONS 85 4 1 Optimization Method 85 4 2
175. oes not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of NEC Electronics products listed in this document or any other liability arising from the use of such products No license express implied or otherwise is granted under any patents copyrights or other intellectual property rights of NEC Electronics or others e Descriptions of circuits software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples The incorporation of these circuits software and information in the design of a customer s equipment shall be done under the full responsibility of the customer NEC Electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits software and information e While NEC Electronics endeavors to enhance the quality reliability and safety of NEC Electronics products customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely To minimize risks of damage to property or injury including death to persons arising from defects in NEC Electronics products customers must incorporate sufficient safety measures in their design such as redundancy fire containment and anti failure features e NEC Electronics products are classified into the following three quality grade
176. of a static auto variable to the saddr area The nr option invalidates the rs option Application Ifyou want to automatically assign a static auto variable to the saddr area irrespective of whether there is an sreg declaration or not specify the rs option Description Variables to be assigned change depending on the value of n and the specification of m Specification of n m Variable Types to Be Assigned n When n 1 char unsigned char When n 2 char unsigned char short unsigned short int unsigned int enum near pointer When n 4 char unsigned char short unsigned short int unsigned int enum long unsigned long pointer m Structure Union Array Omitted All variables The sreg declared variable is automatically assigned to the saddr area irrespective of the rs option specification The static auto variable that is assigned to the saddr area by specifying this option is handled in a similar way to an sreg declared auto variable Use Example To allocate the char or unsigned char type static auto variable automatically to the saddr area regardless of whether sreg has been declared describe as C cc78k0r cfll 6a0 rs1 Users Manual U18549EJ1VOUM 101 CHAPTER 5 COMPILER OPTIONS Optimization specification 1 q nq Description formats q optimization type Multiple specifications are possible nq Interpretation when o
177. om the Version up Service which can be accessed from the following Website http www necel com micro ods eng Users Manual U18549EJ1VOUM 19 CHAPTER 1 OVERVIEW 1 2 5 Object converter The object converter uses the converter included in the RA78KOR Assembler Package sold separately The object converter inputs the device file and load module file output by the linker and converts it into an Intel HEX format object module file The object converter also outputs information upon file conversion as a symbol table file Figure 1 8 Object Converter Function Device fileNote Load module file Object Converter Hexadecimal object module file Symbol table file Note Obtain the device file by downloading it from the Version up Service which can be accessed from the following Website http www necel com micro ods eng 20 User s Manual U18549EJ1VOUM CHAPTER 1 OVERVIEW 1 2 6 Librarian Clearly defined modules having a general interface are formed into a library for convenience By creating the library many object modules form 1 file and become easy to handle The linker has functions to extract only the needed modules from the library file and link them Therefore if multiple modules are registered in 1 library file the names of the module files needed when linking no longer have to be individually specified The librarian uses the librarian included in the RA78KOR Assembler Package sold separately The librarian in
178. on array rdm char size and struct union array rd1m char short int size and struct union array rd2m char short int long size and struct union array rd4m None is selected by default Caution This area cannot be performed if special compiler options are set per source file Assign Static Variable to SADDR Area The type of a static variable to be assigned to the saddr area is selected in the drop down list box None only char size rs1 char short int size rs2 char short int long size rs4 struct union array rsm char size and struct union array rs1m char short int size and struct union array rs2m char short int long size and struct union array rs4m None is selected by default Assign Bit Field from MSB rb Select this check box when a member of the bit field structure is allocated from the MSB Indirect address in byte units ra Select this check box to perform indirect reference in 1 byte units User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Packing structure members and indirect address in byte units rc Select this check box to pack a structure and perform indirect reference in 1 byte units Users Manual U18549EJ1VOUM 47 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Optimize tab 1 When Integrated Recommendable Optimizing Option is selected in the Group drop down list box Figure 3 10 Compiler Options Dialog Box When Integrated Recomm
179. on prototype 11 Target chip uPD78F1166 A0 12 Device file Vx xx Compilation complete 13 1 error s and 14 5 warning s found Users Manual U18549EJ1VOUM 143 CHAPTER 6 C COMPILER OUTPUT FILES Dad Description Number Al Format Number P Columns 1 Version number 4 fixed Displayed in x yz format 2 Date 11 fixed System date Displayed in DD Mmm YYYY format 3 Time 8 fixed System time Displayed in HH MM SS format 4 Command line Outputs the command line contents following CC78KOR Contents after column 80 are output beginning at column 13 on the next line One or more white space characters or tabs are replaced by a single white space character 5 C source module Number of Outputs the specified file name file name characters enabled If the file type is omitted c is attached as the file by OS variable type extension Contents after column 80 are output beginning at column 13 on the next line 6 Error list file name Number of Outputs the specified file name characters enabled If the file type is omitted cer is attached by OS variable Contents after column 80 are output beginning at column 13 on the next line 7 Parameter file s Outputs the parameter file contents contents Contents after column 80 are output beginning at column 13 on the next line One or more white space characters or tabs are replaced by a
180. option has been specified Even then it is not output if the g1 option has been specified 14 Assembler source Outputs an assembler source file containing the compilation results 15 Line number 4 fixed Outputs the C source module file s line numbers as right aligned decimal value with zeros suppressed C source This is the input C source image Contents after column 80 are output beginning at column 16 on the next line A semicolon is output to column 1 17 Line number information Line number for line number entry information starts with DGL This information is output only when the debug data output option has been specified Even then it is not output if the g1 option has been specified 18 Labels for symbol information creation Maximum 34 variable Outputs function label information information starts with This information is output only when the debug data output option has been specified Target device for this compiler Maximum 15 variable Displays the target device as specified via command line option c or the source file Device file version 6 fixed Displays the version number of the input device file Size clock Outputs size and clock for output instructions Information starting with INF The number of clocks when accessing the internal RAM area or SFR area or when not accessing for data is output
181. or details see 3 rs nr C Performs indirect reference in 1 byte units Packs a structure and aligns the structure members to 1 byte Remark Multiple process types can be specified 98 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS When the nr option is specified the process types are interpreted as follows Process Type Function a Does not perform indirect reference in 1 byte units b Assigns a bit field from the least significant bit LSB d Does not automatically assign any variable to the saddr area S Does not automatically assign any variable to the saddr area C Does not perform indirect reference in 1 byte units Does not pack a structure and does not align the structure members to 1 byte Use Example To allocate the external variable or external static variable and static auto variable automatically to the saddr area regardless of whether sreg has been declared describe as C cc78k0r cfl1166a0 rds Users Manual U18549EJ1VOUM 99 CHAPTER 5 COMPILER OPTIONS 2 rd nr Description formats Interpretation when omitted nr Function The rd option specifies the automatic assignment of an external variable external static variable except for the const type variable to the saddr area The nr option invalidates the rd option Application lf you want to automatically assign an external variable
182. ored the qr option that is specified second is valid and arguments of norec auto variables and register variables are allocated to the saddr area C cc78k0r cf1166a0 prime c qc qr To validate both the qc and qr options describe as C cc78k0r cfl166a0 prime c qcr User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Debugging information output specification 1 g ng Description formats Interpretation when omitted g2 Function The g option specifies the addition of debugging information to the object module file The ng option invalidates the g option Application Ifthe g option is not specified the line numbers and symbol information needed in the object module file to be input to the debugger are not output Therefore in source level debugging all of the modules to be linked are compiled by specifying the g option Description The operation differs depending on the value of n as follows Value of n Function Omitted Regarded as n 2 1 Adds debug information information starting with DGS or DGL to the object module file only No debug information is added to the assembler source module file This option makes it easier to reference an assembler file Source debugging of object files is available since debug information is added to them 2 Adds debug information to the object module file and the assembler source modu
183. oss reference list file In addition the output destination or output file name is specified The cross reference list file is valuable for checking the referencing frequency definition and referenced point of a symbol Application f you want to output the cross reference list file or want to change the output destination or the output file name of the cross reference list file specify the x option Description Adisk file name or a device file name can be specified as the file name fthe output file name is omitted when the x option is specified the cross reference list file name becomes input file name xrf If the extension for the output file name is omitted when the x option is specified cross reference list file output file name xrf will be output Evenifan internal error other than C0101 or a compilation error with the number F0024 or a number starting from E occurs a cross reference list file is created However the contents of the file are not guaranteed Cautions To change the output destination when using PM specify the new output destination in the Output Path combo box in the Create Cross Reference List File x area under the Output tab When individual compiler options are specified the output file name can also be changed Specify the file name or the output destination in the Output Path combo box under the Output tab Users Manual U18549EJ1VOUM 121 CHAPTE
184. output of Independent No cross reference list the cross reference list reference list file creation file file is output specification 228 User s Manual U18549EJ1VOUM APPENDIX C COMMAND OPTIONS Table C 1 Compiler Options Relationship with Interpretation Types Description Format Functions Other Options wap mitted List format lw number of Specifies the number of Independent Iw132 For specification characters characters in 1 line of console each type of list file output this becomes 80 characters ll number of lines Specifies the number of Independent There is no lines on 1 page of each page break type of list file lt number of The It option indicates Independent It8 characters the basic number of characters for outputting a horizontal tabulation HT code in the source module file replacing it with several blanks spaces in each list tabulation processing 1f Specifies adding the new Independent The new page page break code at the break code end of each list file will not be added li Adds the C source of the Independent No C sources include file to the of the include assembler source file will be module file with C added source comments Warning w level Specifies the output of Independent w1 output warning messages to specification the console Execution v Specifies whether or not If v and nv are nv state display the
185. pecify the same include file path twice Button OK Close the message box Message Too many characters for Include Search Path Cause The include file path whose length exceeds the specifiable range was specified Action by User Specify the correct path name Button OK Close the message box Message Too many Include Search Path Up to 64 can be specified for Include Search Path Cause The number of specified include file paths exceeds the specifiable number Action by User Keep the number of specified paths 64 or fewer Button OK Close the message box Message Multiple define definition Cause The same defined macro was specified twice Action by User Do not specify the same defined macro twice Button OK Close the message box Message Too many characters for macro Definition Up to 256 characters can be described for a macro name Cause The length of characters used for specifying the defined macro name exceeds the specifiable range Action by User Keep the number of characters used for macro name specification 256 or fewer Button Message Cause OK Close the message box Too many macro for macro Definition macro Definition and macro Undefinition can be specified to 30 in all The number of defined and undefined macros that can be specified exceeds the specifiable range Action by User Keep the number of defined and undefi
186. pointer ss 31 34 REG1 char C 37 40 PARAM REGI char d 39 40 define TRUE 1 14 define FALSE 2 22 define SIZE 3 5 l3 X5 21 Target chip uPD78F1166 A0 Device file Vx xx 15 Page 1 16 T5 17 214 User s Manual U18549EJ1VOUM A 3 4 Error list file APPENDIX A SAMPLE PROGRAMS prime prime prime prime prime 00000 18 20 26 35 41 Target chip Device file Compilation complete CC78KOR CC78KOR CC78KOR CC78KOR CC78KOR warning warning warning warning warning uPD78F1166_A0 VX XX 0 error s W0745 W0745 W0622 W0622 W0622 Expected function prototype Expected function prototype No return value No return value No return value and 5 warning s found Users Manual U18549EJ1VOUM 215 APPENDIX B LIST OF USE RELATED CAUTIONS This chapter indicates cautions related to the use of the CC78KOR Table B 1 List of Use related Cautions Number Cautions 1 Specification of options When several specifications have been made for an option that does not allow multiple specifications the last specification takes priority is valid The type specification following the c option must not be omitted If it is omitted an abort error will occur If the c option is not specified be sure to enter Zpragma pc type in the C source module file instead During compilation if the specified option is different from the option in the C
187. puts object module files that are output from the C compiler or assembler and then outputs a library file Figure 1 9 Librarian Function Object module files output by compiler Object module file output by assembler Library file Users Manual U18549EJ1VOUM 21 CHAPTER 1 OVERVIEW 1 2 7 Debugger Source debugging using a GUI becomes possible by loading the load module files output by the linker into the IE in circuit emulator by using the ID78KOR QB 78KOR integrated debugger To debug the g option specifying the output of debugging information is specified when the target source program is compiled g is the default option By making this specification the symbols and line numbers needed in debugging are added to the object module For information on the compiler options see CHAPTER 5 COMPILER OPTIONS The debugger and the IE are packaged separately sold separately Figure 1 10 Debugger Function Object information Debugging information Integrated Debugger A v In circuit Emulator 22 Users Manual U18549EJ1VOUM CHAPTER 1 OVERVIEW 1 2 8 System simulator Source debugging using a GUI becomes possible by downloading the load module files output from the linker by using the SM for 78KOR 78KOR system simulator SM for 78KOR is software that simulates a load module file on the host machine in the same manner as operating with the ID78KOR QB In addition to simulating machine instructions in the SM for
188. r 5 digit include file number 2 digit If the line contents exceed the line length the remaining contents are output beginning at column 48 of the next line Target device for this compiler Maximum 15 variable Displays the target device as specified via command line option c or the source file Device file version 6 fixed Displays the version number of the input device file User s Manual U18549EJ1VOUM 149 CHAPTER7 USING C COMPILER This chapter introduces methods for efficiently using the CC78KOR 7 1 Efficient Operation EXIT Status Function When the compilation ends the CC78KOR returns the top error level generated during compilation to the operating system as the EXIT status The EXIT status is shown below Table 7 1 EXIT Status Processing EXIT Statuses Normal operation 0 WARNING occurs 0 FATAL ERROR occurs 1 ABORT 2 If PM is not used and the CC78KOR is started in the command line efficient operation can be further improved by using the status in a batch file Use Example cc78k0r cfl1166a0 1 IF ERRORLEVEL 1 GOTO ERR cC78k0r cfl1166a0 2 IF ERRORLEVEL 1 GOTO ERR GOTO EXI ERR echo Some error found EXIT Description When the C source passed to 1 was compiled a fatal error was generated Essentially the process continues after an error message was output But us
189. r subtraction Cause The subtraction between pointers must be for pointers having the same type E0538 Message Illegal conditional operator Cause The conditional operator is not correctly described E0539 Message Expected constant expression Cause A constant expression is required W0540 Message Constant out of range in comparison Cause The constant partial expression is compared to a value outside of the range permitted by the type of the other partial expression E0541 Message Function argument has void type Cause The argument of the function has the void type E0546 Message Too few actual argument for inline function function name Cause The number of arguments specified in the function call of a function expanded inline is less than the number of parameters provided in the specifications User s Manual U18549EJ1VOUM 187 CHAPTER 9 ERROR MESSAGES 9 2 7 Error messages for a statement Table 9 7 Error Messages for Statement from 0601 2 oiu Error Message E0602 Message Compiler limit too many characters in logical source line Cause The number of characters in a logical source line exceeded 2 048 E0603 Message Compiler limit too many labels Cause The number of labels exceeded 33 E0604 Message Case not in switch Cause The case statement is not described in the correct position E0605 Message Duplicate case label name Cause The same case
190. read the Language manual can skip CHAPTER 1 OVERVIEW Related Documents The table below shows the documents such as user s manuals related to this manual The related documents indicated in this publication may include preliminary versions However preliminary versions are not marked as such Documents related to development tools user s manuals CC78KOR Ver 2 00 C Compiler RA78KOR Ver 1 20 Assembler Package 6 Users Manual U18549EJ1VOUM Conventions The meanings of the symbols used in this manual are explained RTOS Real time OS for 78KOR Microcontroller RX78KOR eds Repeat in the same format Characters enclosed in these brackets can be omitted 4 Characters enclosed in these brackets are as shown character string DE Characters enclosed in these brackets are as shown character string T Characters enclosed in these brackets are as shown character string Boldface Characters in bold face are as shown character string Underlining at important locations or in examples is the input character sequence A At least one space Indicates an omission in a program description Characters between parentheses are as shown character string 13 Delimiter X Backslash File Name Conventions The conventions for specifying the input files that are designated in the command line are shown below 1 Specifying disk file names drive name NX path name primary name file type 1 2 3
191. rintf and vsprintf functions not supporting floating points Example bmylib lib bclO0rm lib bclO0rmf lib 11 Stack area symbol generation s In CC78KOR the user cannot secure a stack area To secure a stack area specify the s option during linking When using PM the s option is automatically attached when the source file specification includes the C source 220 User s Manual U18549EJ1VOUM APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 12 ROM code When ordering ROM code specify the r or u object converter options such as r UOFFH do not cancel the specification Example r uOFFH S Sort HEX file contents by order of addresses ucomplement value Fill empty space in ROM code with the specified complement value 13 Help specification option In PM compiler options and h which display option descriptions are ignored For help click the Help button in the Option Setup dialog box of each tool 14 Il option specification When using PM the maximum number that can be specified for the Il option is 32 767 If a number that exceeds 32 767 is specified specify the Il option with another option Users Manual U18549EJ1VOUM 221 APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 15 When using PM a Parameter file create
192. rmed as a path name if a path exists and as a file name if no path exists Create Assembler Source Module File Select this check box when outputting assembler source module files Specify using radio buttons whether to add C sources to the assembler source module files whether to add include files without C source a with C Source without Include sa or with C Source with Include sa lil If this check box is selected without C source a is selected by default 54 User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING To specify the output path of the assembler source module file input the path name in the combo box To specify a source file name append the extension asm Up to 259 characters can be input into this combo box Specification is also possible using the Browse button Opens the Browse for Folder dialog box When univarsal options are specified in PM processing is always performed assuming that the path name is specified When the source file is specified processing is performed as a path name if a path exists and as a file name if no path exists Assembler Options H button Specify assembler options for the assembler source module file If no option is specified processing is performed assuming that all assembler options have been specified When the Assembler Options H button under the Output tab in the Compiler Options dialog box is clicke
193. rocessing The ROMization processing in cstart asm is described ROMization processing copy external variables having initial value IF ESCOPY OV ES HIGHW QR INIT SENDIF OVW HL LOWW GR INIT OVW DE LOWW _ INIT BR SLINIT2 LINIT1 S_IF _ESCOPY OV Ap ES t T HE SELSE OV A HL SENDIF OV DE A INCW HL INCW DE LINIT2 MOVW AX HL CMPW AX LOWW R INIT BNZ SLINIT1 In ROMization processing the initial values of the external variables and the sreg variables stored in ROM are copied to RAM The variables to be processed have the 4 types a to d shown in the following example lt Example gt char c 1 a External variable with initial value int Ly b External variable without initial valueNote sreg int si 0 c sreg variable with initial value sreg char Sc 3 d sreg variable without initial valueNote void main void Note The external variables without initial value and sreg variables without initial value are not copied and zeros are written directly to RAM The figure below shows the ROMization processing for a External variable with initial value The initial value of the variable a is placed in R_INIT segment in the ROM by the CC78KOR The ROMization processing copies this value to the INIT segment in RAM the same processes are performed for the variable c User s Manual U18549EJ1VOUM
194. rocessing in Startup Module for Flash Area The startup modules for flash differ with the ordinary startup modules in the following points Table 8 4 ROM Area Section for Initialization Data Variable Type Segment First Label End Label External variable with initial value a ER INIT CSEG UNIT64KP EQ INIT E R INIT when allocated in near area External variable with initial value a ERLINIT CSEG UNIT64KP E RLINIT E RLINIT when allocated in far area sreg variable with initial value c ER_INIS CSEG UNIT64KP E R_INIS E R_INIS Table 8 5 RAM Area Section for Copy Destination Variable Type Segment First Label End Label External variable with initial value a EINIT DSEG BASEP E INIT E INIT when allocated in near area External variable with initial value a EINITL DSEG UNIT64KP E INITL E INITL when allocated in far area External variable without initial value D EDATA DSEG BASEP E DATA E DATA when allocated in near area External variable without initial value D EDATAL DSEG UNIT64KP E DATAL E DATAL when allocated in far area sreg variable with initial value c EINIS DSEG SADDRP E INIS E INIS sreg variable without initial value d EDATS DSEG SADDRP E DATS E DATS Inthe startup module the following labels are added at the head of each segment in ROM area and RAM area E R_INIT EGR INIS E INIT E DATA E INIS E DATS E INITL E DATAL Furthermore th
195. ronics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics 434 NE SAS User s Manual CC78KO0R Ver 2 00 C Compiler Operation Target Device 78KOR Microcontrollers Document No U18549EJ1VOUMOO 1st edition Date Published October 2007 NEC Electronics Corporation 2007 Printed in Japan MEMO 2 User s Manual U18549EJ1VOUM Windows and WindowsXP are either registered trademarks or trademarks of Microsoft Corporation in the United States and or other countries The information in this document is current as of October 2007 The information is subject to change without notice For actual design in refer to the latest publications of NEC Electronics data sheets or data books etc for the most up to date specifications of NEC Electronics products Not all products and or types are available in every country Please check with an NEC Electronics sales representative for availability and additional information e No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Electronics NEC Electronics assumes no responsibility for any errors that may appear in this document NEC Electronics d
196. s Standard Special and Specific The Specific quality grade applies only to NEC Electronics products developed based on a customer designated quality assurance program for a specific application The recommended applications of an NEC Electronics product depend on its quality grade as indicated below Customers must check the quality grade of each NEC Electronics product before using it in a particular application Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots Special Transportation equipment automobiles trains ships etc traffic control systems anti disaster Systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems life support systems and medical equipment for life support etc The quality grade of NEC Electronics products is Standard unless otherwise expressly specified in NEC Electronics data sheets or data books etc If customers wish to use NEC Electronics products in applications not intended by NEC Electronics they must contact an NEC Electronics sales representative in advance to determine NEC Electronics willingness to support a given application Note 1 NEC Electronics as us
197. s output Use the or h option to reference the help file and input the parameter correctly F0014 Message Out of range option Cause The specified value of the option parameter is out of range Action by User Please enter cc78k0r if you want help message is output Use the or h option to reference the help file and input the value correctly F0015 Message Parameter is too long Cause The number of characters in the option parameter exceeded the limit F0016 Message Illegal parameter option Cause There is a syntax error in the option parameter Action by User Please enter cc78k0r if you want help message is output Use the or h option to reference the help file and input the option correctly F0017 Message Too many parameters Cause The total number of option parameters exceeds the limit F0018 Message Option is not recognized option Cause An incorrect option was specified Action by User Please enter cc78kOr if you want help message is output Use the or h option to reference the help file and input the option correctly F0019 Message Parameter file nested Cause The f option was specified in the parameter file Action by User Since a parameter file cannot be specified in a parameter file correct them so that there is no nesting F0020 Message Parameter file read error Cause The parameter file read failed F0021 Message Memory allocation failed Cause Memory allocation failed W0
198. s that are extern ed in the asm block in C source EXTRN is not generated if there are no references in other C descriptions and a link error is output Therefore perform EXTRN in the asm block if no referencing is done in C f the C source contains asm blocks and asm statements specify the a or sa option to enable assembly descriptions and assemble the output assembler source When using PM either specify the a sa options through individual option specification for sources for which only assembler source files are output or specify the a sa options through universal option specification When using PM the RA78KOR is started regardless of compiler options o no when compiler option a or sa is specified When changing the segment name using the pragma section directive do not specify a segment having the same name as the primary name of the source file name Otherwise error F2106 is output during assembly Users Manual U18549EJ1VOUM 217 APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 7 Creating link directive file When an area outside of the ROM or RAM area of the target device is used when linking the objects created by the CC78KOR or when you want to place the code or data at any specified address create a link directive file and specify the d option when linking For information about creating link directive files see R
199. sage Illegal type and size far near pointer combination in conditional expression Cause Different types or different sizes far or near pointer are used in a conditional expression between pointers W0418 Message Illegal structure and size far near pointer combination Cause Pointers to structures with different types or different sizes far or near pointer are used together 184 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES 9 2 6 Error messages for an expression Table 9 6 Error Messages for Expression from 0501 2 alae Error Message E0501 Message Expression syntax Cause The expression contained a syntax error E0502 Message Compiler limit too many parentheses Cause The nesting of parentheses in the expression exceeded 32 W0503 Message Possible use of variable name before definition Cause The variable is used before a value is assigned to it W0504 Message Possibly incorrect assignment Cause The main operators in conditional expressions such as if while and do statements are assignment operators W0505 Message Operator operator has no effect Cause The operator has no effect in the program This is probably due to a description error E0507 Message Expected integral index Cause Only an integer type expression is allowed in the index of an array E0508 Message Too many actual arguments Cause The number of arguments specif
200. se An array of functions is not allowed W0744 Message Zero sized array array name Cause The number of elements of the defined array is zero W0745 Message Expected function prototype Cause The function prototype is not declared E0747 Message Function prototype mismatch Cause The function prototype declaration contains errors Action by User Check whether the parameter and return value types match the function W0748 Message A function is declared as a parameter Cause A function is declared as an argument WO0749 Message Unused parameter parameter name Cause The parameter is not used 192 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 8 Error Messages for Declaration and Function Definition from 0701 gt ale Error Message E0750 Message Initializer syntax Cause The initialization does not match the syntax E0751 Message Illegal initialization Cause The constant of an initial value setting does not match the type of the variable W0752 Message Undeclared initializer name name Cause The initializer name is not declared E0753 Message Cannot initialize static with automatic Cause The static variable cannot be initialized using an automatic variable E0756 Message Too many initializers array name Cause There are more initial values than elements in the declared array E0757 Message Too many structure initializers
201. settings stack symbol automatic generation option s is automatically specified to the linker The name of the startup routine file does not affect the load module file name Users Manual U18549EJ1VOUM 67 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Figure 3 23 Linker Options Dialog Box Linker Options Output1 Output Library Others Directive File d X Browse Temporary Directory t NEED Browse IV Create Stack Symbol s Area Name Warning Level v Flash Start Address for the Product with Flash ROM zb H Use Command File Parameterfile f Y Browse Other options x Reset Option data read Option data save Command Line Options oa Imf pa map bcl rm lib belOrmf lib i C sProgram Files NEC Electronics ToolsNCC78KOR SV1 OONMib 7 8k r s Cancel Apply Help 4 Building project 68 Projects are built with the set options Building of an entire project is done by selecting Build from the Build menu or by clicking the Build button on the tool bar PM MAKE is started up by the automatically created MAKE file Upon completion of build a message dialog box appears Check that build has been completed normally Caution The contents displayed in the OutPut window during build are saved as the Project file name plg file name to the project folder User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO
202. single white space character 8 C source This is the input C source image Contents after column 80 are not wrapped to the next line 9 Error message 5 fixed Outputs error numbers in the nnnn format number F is output if is an abort error E if itis a fatal error C if is an Internal error and W if itisa warning nnnn the error number is displayed as a 4 digit decimal number no zero suppression 10 Error message See CHAPTER 9 ERROR MESSAGES Contents after column 80 are not wrapped to the next line 11 Target device for Maximum 15 Displays the target device as specified via this compiler variable command line option c or the source file 12 Device file 6 fixed Displays the version number of the input device version file 13 Number of errors 4 fixed Outputs a right aligned decimal value with zeroes suppressed 14 Number of 4 fixed Outputs a right aligned decimal value with zeroes warnings suppressed 144 User s Manual U18549EJ1VOUM CHAPTER 6 C COMPILER OUTPUT FILES 6 3 2 Error list file with error message only Output format Q000 0 Target chip 2 2 2 26 2 2 CC78KOR CC78KOR CC78KOR CC78KOR CC78KOR warning warning warning warning 3 W0745 4 Expected function prototype 3 W0745 4 Expected function prototype 3 W0622 4 No return value 3 W0622 4 No return value 3 W0622 4 No return value w
203. stering a device file at Device Name in the Project Setup dialog box Therefore it is not necessary to specify this option when setting options with this compiler Use Example To search C tmp dev first to read the device file describe as C cc78k0r cf1166a0 yC tmp dev User s Manual U18549EJ1VOUM 135 CHAPTER 5 COMPILER OPTIONS Memory model specification 1 m Description format mtype Interpretation when omitted mm Function The m option specifies the memory model used for compilation Multiple models cannot be specified at the same time Types must not be omitted otherwise the fatal error F0012 will occur Application By specifying a memory model whether each function and variable is allocated in the near or far area is specified Ifa__near or farqualifier is described for functions or variables in a C source specification of the near or far area that is specified by the nearor far qualifier takes precedence Description The following items are available for specifying the memory model with the m option Type Specifications Memory Model Explanation S Small model Considers the memory to consist of a code portion 64 KB max and a data portion of 64 KB max 128 KB in total and specifies the near or far area m Medium model Considers the memory to consist of a code portion of 1 MB max and a data portion 64 KB m
204. t Option dialog box An error message will appear if a defined macro name is specified twice Undefine Macro u Input into this combo box a macro name of the macro definition to be disabled For the macro name 30 macro definitions can be invalidated at once by delimiting with Up to 256 characters can be input for specifying an undefined macro name Up to 7 709 characters can be input into this combo box Can be specified using the Edit button Opens the Edit Option dialog box An error message will appear if an undefined macro name is specified twice Users Manual U18549EJ1VOUM 43 44 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Include Search Path i The folder that contains include files is input to the combo box 64 folders can be specified at once by delimiting with Up to 259 characters can be input for specifying an include file path Up to 16 639 characters can be input into this combo box Can be specified using the Edit button Opens the Edit Option dialog box Unexisted path cannot be specified An error message will appear if the same include file path is specified twice User s Manual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Memory Model tab Figure 3 8 Compiler Options Dialog Box When Memory Model Tab Is Selected Compiler Options Extend Others Startup Routine Preprocessor Memory Model Data Assign ptimize Debug Output Memory Model
205. t should return a value does not return a value Action by User If a value must be returned add a return statement If a value does not have to be returned give the function the void type E0623 Message No effective code and data cannot create output file Cause Since the code and data are not valid the output file cannot be created User s Manual U18549EJ1VOUM 189 CHAPTER 9 ERROR MESSAGES 9 2 8 Error messages for a declaration and function definition Table 9 8 Error Messages for Declaration and Function Definition lt from 0701 gt Sakae Error Message E0701 Message External definition syntax Cause The function is not correctly defined E0702 Message Too many callt functions Cause There are too many declarations of the callt function A maximum of 32 callt functions can be declared Action by User Decrease the number of callt function declarations E0703 Message Function has illegal storage class Cause The function is specified with an illegal storage class E0704 Message Function returns illegal type Cause The return value of the function is an illegal type E0706 Message Parameter list error Cause The function parameter list contains errors E0707 Message Not parameter character string Cause Something other than a parameter is declared in a function definition E0708 Message Illegal parameters in rtos_task function Cause The RTOS task
206. th can be specified by the y option Refer to the description about the search path in 5 4 Device file search path F0903 Message Cannot open overlay file file name Cause The overlay file cannot be opened F0904 Message Cannot open temp Cause The input temporary file cannot be opened F0905 Message Cannot create file name Cause A file create error was generated F0906 Message Cannot create temp Cause A create error was generated in an output temporary file Action by User Check if the environmental variable TMP is specified F0907 Message No available data block Cause A temporary file cannot be created because the drive file does not have sufficient capacity F0908 Message No available directory space Cause A temporary file cannot be created because of insufficient folder area on the drive F0909 Message R O read only disk Cause A temporary file cannot be created because the drive is read only F0910 Message R O file read only file opened read only mode Cause A write error was generated by a temporary file for the following reasons A file with the same name as a temporary file already exists on the drive and it has the read only attribute The output temporary file is opened with the read only attribute because of internal conflicts User s Manual U18549EJ1VOUM 201 CHAPTER 9 ERROR MESSAGES Table 9 10 Error Messages for Fatal File I O and Running on an Illegal Operating System from 0901 gt
207. that Action by User causes warning or an error in the CC78KOR Check whether the option specification contradicts Button OK Close the message box Message Can t read Option Information Cause Valid option information is not included in the file specified by option information read specification Action by User Check whether the specified option information file is of the 78KOR or whether the specified option information file is not destroyed Button OK Close the message box Message Cannot find path or file Make sure the path or filename Cause A non existing path or file was specified where a path or file name that actually exists such as an include file must be specified Action by User Check the target file name and the path for it and specify the correct name or path Button OK Close the message box Message Cannot find 96s shown in environment variable PATH Cause cc78kOr exe is not found Action by User Check whether the CC78KOR was installed normally or whether the PATH environment variable was set correctly Button OK Close the message box 204 User s Manual U18549EJ1VOUM CHAPTER 9 ERROR MESSAGES Table 9 11 PM Error Messages Error Type Error Message Message Multiple Include Search Path definition Cause The same include file path was specified twice Action by User Do not s
208. tic data in function Cause The area allocated for the automatic variables of the function exceeded the limit of 64 KB Action by User Decrease the variables so that 64 KB is not exceeded E0109 Message Compiler limit too much parameter of function Cause The area allocated for the parameters of the function exceeded the limit of 64 KB Action by User Decrease the parameters so that 64 KB is not exceeded E0110 Message Compiler limit too much code defined section name in file Cause The area allocated for section name exceeded the limit E0111 Message Compiler limit too much global data defined in file Cause The area allocated for the global variables in the file exceeded the limit of 64 KB User s Manual U18549EJ1VOUM 177 CHAPTER 9 ERROR MESSAGES Table 9 2 Error Messages for Internal Error and Memory from 01012 Pu Error Message E0113 Message Compiler limit too many local labels Cause Number of local labels in 1 function exceeds the process limit Action by User The function itself is too large Divide it E0116 Message Compiler limit too many function definitions in file Cause The number of function definitions in one file exceeds the processing limit Action By User Separate the function definitions into several files so as not to exceed the processing limit E0117 Message Compiler limit too many source lines in file Cause The number of source lines in o
209. tion The c option specifies the target device designated for compilation Application Be sure to specify this option The CC78KOR compiles for the specified target device and generates the object code for it Description For the target devices that can be specified by the c option and the corresponding device type refer to the user s manual of the device used or Device Files Operating Precautions When CC78KOR is used device files are required Caution The c option cannot be omitted However if the following description is in the C source the specification can be omitted from the command line pragma pc device type f different devices were specified in the C source and the command line the device in the command line has priority tis not necessary for this option to be set by the compiler option when PM is used because the setting of this option is determined by the project setting Use Example To specify in the command line that the uPD78F1166 AO is to be the target device describe as C cc78k0r cfl1166a0 prime c 94 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Specify the target device UPD78F1166 A0 in the C source prime c and start the compiler pragma pc f1166a0 define TRUE 1 define FALSE 0 define SIZE 200 char mark SIZE 1 void main void int i prime k count This allows the t
210. tion is in progress some of the computation results are disabled from being interrupted so that they are not corrupted Refer to the CC78KOR C Compiler Language User s Manual in regards to library functions and interrupt disable times Special function register Function Reserved Words Addresses Size Multiplication input data A MULA FFFFOH 16bit Multiplication input data B MULB FFFF2H 16bit Multiplication result data MULOH MULOL FFFF4H FFF6H 16bit x 2 Register configuration Multiplier A gt Multiplier B gt Product MULA bits 15 to 0 MULB bits 15 to 0 MULOH upper bits 15 to 0 MULOL lower bits 15 to 0 User s Manual U18549EJ1VOUM CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION 2 6 Uninstallation The procedure for uninstalling the files installed to the host machine is described below 1 Windows startup Power on the host machine and peripherals and start Windows 2 Deletion of CC78KOR Open Add Remove Programs or Add or Remove Programs on the Control Panel and select NEC EL CC78KOR Vx xx 3 Confirmation of files Using Windows Explorer etc check that the files installed to the host machine have been uninstalled For the details of each folder refer to 2 4 Folder Configuration User s Manual U18549EJ1VOUM 33 CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION 2 7 Environment Settings 2 7 1 Host machine Machine in which Windows 2000 XP can operat
211. to execute include Execute line kl Select this check box to execute line selected by default Add Line No and Paging kn Select this check box to add Line No and Paging selected by default To specify the preprocess list file output path input the path name in the combo box Up to 259 characters can be input into this combo box Specification is also possible using the Browse button Opens the Browse for Folder dialog box Users Manual U18549EJ1VOUM 60 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING When universal options are specified processing is always performed assuming that the path name is specified When the source file is specified processing is performed as a path name if a path exists and as a file name if no path exists Add Form Feed at End of List File If Select this check box to add the new page break code at the end of each list file Columns per Line Iw Specify the number of characters in 1 line of each type of list file The specifiable number of characters is 0 and 72 to 132 132 is set by default Lines per Page Il Specify the number of lines on 1 page of each type of list file The specifiable number of lines is 0 and 20 to 32 767 0 is set by default Expand TAB Character It Specify the range for the tab stop position of each type of list file The specifiable range for the tab stop position is O to 8 0 is set by default User s Manual U18549EJ1V
212. to the current drive Cautions To change the output destination when using PM specify the new output destination in the Output Path combo box in the Create Preprocess List File area under the Output tab When individual compiler options are specified the output file name can also be changed Specify the file name or the output destination in the Output Path combo box under the Output tab Use Example To output the preprocess list file sample ppl describe as C cc78k0r cfl166a80 prime c psample ppl 106 User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS 2 k Description format k process type Multiple specifications are possible Interpretation when omitted kfin Function The k option specifies the processing for the preprocess list Application This option is specified when comments are deleted and definition expansions are referenced when the preprocess list file is output Description The process types that can be specified by the k option are listed below Process Type Description Omitted Same as specifying kfln C Delete comments d define expansion f Conditional compilations of if ifdef and ifndef i include expansion line processing n Line number and paging processing Remark Multiple process types can be specified Ifthe p option is not specified the k option becomes
213. tput by specifying the se option Figure 3 24 C Compiler I O Files Parameter files C source module files Include files Temporary files 3 CC78KO0R Preprocess list files Assembler source module files Object module files Error list files Cross reference list files Remark If there are compiling errors a variety of files other than the error list and cross reference files cannot be output A temporary file is renamed to an appropriate name when the compiling ends without error If compiling ends in error the temporary files are deleted User s Manual U18549EJ1VOUM 83 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING 3 5 Execution Start and End Messages 3 5 1 Execution start message When the CC78KOR starts the execution start message is displayed on the console 78KO0R C Compiler Vx xx xx xxx xxxx Copyright C NEC Electronics Corporation xxxx XXXX 3 5 2 Execution end message If compiler errors were not detected in the compilation result the CC78KOR outputs the following message to the console and returns control to the operating system Target chip uPD78F1166 A0 Device file Vx xx Compilation complete 0 error s and 0 warning s found If compiler errors were detected in the compilation result the CC78KOR outputs the error messages and the number of errors to the console and returns control to the operating system prime c
214. tup routines and libraries with the same versions as the files in the executable form cc78kOr exe b For the floating point support functions sprintf vprintf and vsprintf if the result value of a conversion that is specified with the conversion specifiers f 95e E 96g or 96 G is smaller than the precision the value is rounded down f conversion is executed even if the result value of conversion that is specified with g G is greater than the precision For functions sscanf and scanf if no effective character is read during conversion that is specified with the conversion specifiers f 96e E 95g or 6G 0 is regarded as the conversion result If the conversion result is 0 is regarded as the conversion result Prevention method None Users Manual U18549EJ1VOUM 219 APPENDIX B LIST OF USE RELATED CAUTIONS Table B 1 List of Use related Cautions Number Cautions 10 When performing ROMization ROMization consists in placing initial values such as those of external variables that have an initial value in ROM and then copying these values to RAM during system operation In CC78KOR a code is generated by default for ROMization Therefore it is necessary to perform linking with the startup routine including ROMization during linking The startup routine for the small model and medium model does not include ROMization processing for the far area When variables are all
215. ual U18549EJ1VOUM CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING a Browse for Folder dialog box In the Compiler Options dialog box when the Browse button is clicked for the following path settings the following dialog box appears Only the folders can be specified in this dialog box Object module file output path under the Output tab Assembler module file output path under the Output tab Error list file output path under the Output tab Cross reference list file output path under the Output tab Preprocessor list file output path under the Output tab Temporary file path under the Others tab Figure 3 2 Browse for Folder Dialog Box Browse for Folder Object Module File Path G work Windows Media Connect 2 H Windows Media Player H Windows NT H xerox tmp WINDOWS c data C3 sample tmp c wuTemp Users Manual U18549EJ1VOUM 37 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING b ParameterFile dialog box 38 When the Browse button is clicked for the following path settings the following dialog box appears Parameter file under the Others tab This dialog box displays the following Current folder Project file folder File type Parameter files pcc Figure 3 3 ParameterFile Dialog Box ParameterFile Look in gt smp78kOr aE E a pcc Files of type Parameter files pcc Cancel User s Manual U18549EJ1VOUM
216. ulation order in an expression The calculation whose result remains in the register as valid before other calculations is executed Memory device allocation temporary variables Variables used locally are allocated to registers 14 Peephole optimization Replacement of special patterns Examples a 1 gt a a 0 gt a 15 Decrease the strength of the calculation Examples a 2 gt ata a lt lt 1 Memory device allocation register variables Data is allocated to rapidly accessible memory Examples Registers saddr only when the qr option is specified 86 Jump optimization the qj option Register allocation the qv qr rd rs options Consecutive jump instructions are combined into 1 instruction Variables are automatically allocated to registers Remark 1 to 7 14 and 15 are performed regardless of the optimization option specifications The optimizations in 8 to 13 17 and 18 are performed when optimization options are specified 16 is performed when there are register declarations in the C source program However the saddr area is only allocated when the qr option is specified For information about the optimization options see CHAPTER 5 COMPILER OPTIONS User s Manual U18549EJ1VOUM CHAPTER 4 CC78K0R FUNCTIONS 4 2 ROMization Function ROMization means that the initial values such as the initial values of extern
217. uration 28 Compiler Options Dialog Box 36 Browse for Folder Dialog Box 37 ParameterFile Dialog Box 38 Edit Option Dialog Box 39 Add Option Dialog Box 39 Compiler Options Dialog Box 41 Compiler Options Dialog Box When Preprocessor Tab Is Selected 43 Compiler Options Dialog Box When Memory Model Tab Is Selected 45 Compiler Options Dialog Box When Data Assign Tab Is Selected 46 Compiler Options Dialog Box When Integrated Recommendable Optimizing Option Is Selected 48 Compiler Options Dialog Box When Char Expression Behavior Automatic Allocation Is Selected 49 Compiler Options Dialog Box When Optimize Object Size by Calling Library Is Selected 51 Compiler Options Dialog Box When Others Is Selected 52 Compiler Options Dialog Box When Debug Tab Is Selected 53 Compiler Options Dialog Box When Object Module File Assembler Source Module File Is Selected 54 Assembler Options Dialog Box 55 Compiler Options Dialog Box When Error List File Cross reference List File Is Selected 57 Compiler Options Dialog Box When Preprocess List File List Format Is Selected 59 Compiler Options Dialog Box When Extend Tab Is Selected 61 Compiler Options Dialog Box When Others Tab Is Selected 62 Compiler Options Dialog Box When Startup Routine Tab Is Selected 64 Compiler Options Di
218. ured and then specify the value in the startup routine In the above example 73 bytes are secured in the startup routine but up to 72 bytes can actually be secured for utility functions If the specified size is too big to be stored in the RAM area errors may occur when linking In this case decrease the size specified as shown below or avoid by correcting the link directive file For correction of the link directive file see 2 Link directive file Example To decrease the specified size _ MEMTOP DS gt Change to 40 User s Manual U18549EJ1VOUM 2 CHAPTER 8 STARTUP ROUTINES Link directive file How to create a link directive file is explained Specify a file created using the d option when linking to match the actual target system Heed the following cautions when creating the file for the detailed description method for a link directive see RA78KOR Assembler Package Operation User s Manual The CC78KOR sometimes uses a portion of the short direct address area saddr area in the following compiler specific objectives Specifically this is the 44 byte area of FFEB8H to FFEDFH a register variable when the qr option is specified FFEB4H to FFEC3H b Arguments or automatic variables of norec function FFEC4H to FFED3H c Segment information FFED4H to FFED7H d Arguments of runtime library FFED8H to FFEDFH e Standard library task part of the area a and b Caution f the user does not us
219. ut W0067 Message Option option deleted ignored Cause The deleted option was specified option is ignored W0068 Message Option 1 option deleted regarded as option 2 Cause Option 1 was deleted so option 2 is enabled 176 User s Manual U18549EJ1V0UM CHAPTER 9 ERROR MESSAGES 9 2 2 Error messages for an internal error and memory Table 9 2 Error Messages for Internal Error and Memory from 01012 ous Error Message C0101 Message Internal error Cause An internal error occurred Action by User Contact support E0102 Message Too many errors Cause The total number of FATAL errors exceeded 30 Program Processing continues but subsequent error messages are not output Processing The previous errors may have caused many errors First remove these previous errors C0103 Message Intermediate file error Cause The intermediate file contains errors Action by User Contact support C0104 Message Illegal use of register Cause The register is incorrectly used E0105 Message Register overflow simplify expression Cause The expression is too complex and no more usable registers remain Action by User Simplify the complex expression causing the error C0106 Message Stack overflow overflow cause Cause The stack overflowed The cause of the overflow is the stack or heap Action by User Contact support E0108 Message Compiler limit too much automa
220. utines E OSIO Reds EA Folder storing source files 28 User s Manual U18549EJ1VOUM CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION 2 5 File Organization The table below lists the contents of each folder The folder structure and file organization are the ones obtained when the installer was used Table 2 2 File Organization Folder Name File Name Description CC78KOR Vx xx bin cc78kO0r exe Compiler cc78k0r msg Message file hip Help message file dll DLL files CC78KOR Vx xx hlp cc78k0rp chm On line help file CC78KOR Vx xx inc78kOr pNote 1 Header files for standard library CC78KOR Vx xx lib78kOr clor lib Libraries runtime and standard libraries mer Le j sOr rel Object files for startup routines CC78KOR Vx xx smp78k0r CC78KOR prime c Source program for verifying installation sample bat Batch files for verifying installation readme doc Explanation of files for verifying installation IK78kOr dr Link directive file for reference CC78KORW x xx src ce78kOr bat Note4 mkstup bat Assemble batch files for startup routines reprom bat For updating rom asm parNote5 Batch files for updating standard functions partial CC78KOR Vx xx src cc78kOr lib clOr lib Libraries runtime and standard libraries For modifications N te2 ERES SOr rel Object files for startup routines CC78KOR Vx xx sre cc78kOr src cstart asmote 4 Source files for startup routines rom asm Source fi
221. uts the specified file name module file name characters If the file type is omitted asm is attached as the enabled by OS file type extension Contents after column 80 are output beginning at column 15 on the next line A semicolon is output to column 1 7 Parameter file contents Outputs the parameter file contents Contents after column 80 are output beginning at column 15 on the next line A semicolon is output to column 1 One or more white space characters or tabs are replaced by a single white space character 8 Device type Maximum 6 This character string is specified via the c option variable 9 Debug data Maximum 8 Outputs DEBUG control Output is either variable DEBUG or NODEBUG 10 Debug information 9 fixed Outputs NODEBUGA control Output is control of assembler NODEBUGA 140 User s Manual U18549EJ1VOUM CHAPTER 6 C COMPILER OUTPUT FILES Item Number Description Number of Columns Format 11 Kanji type information Maximum 15 variable Outputs the kanji code 2 byte code type Output is KANJICODE SJIS KANJICODE EUC or KANJICODE NONE Tool information 37 fixed Outputs tool information version number error information specified options etc information starts with TOL_INF Symbol information Outputs symbol information information starts with DGS This information is output only when the debug data output
222. vw DKD yra count A INF line 20 movw _ RTARGO ax R INF 2g movw ax 08H 28 P INF Sar cl call isrem iy INF Sigs 3 or a X INF mee d bnz L0012 E INF 2 3 A movw ax 0AH 10 H INF 3 4 1l cali putchar 3 INF 4 8 L0012 line 21 movw ax D Aio w 5 7 Das INF 2 3 xchw ax bc H INF ET movw aX ocwcpodmmb wo prime F INF MET addw ax y dc H INF Tk movw Hi X oT op XX a e INF 24 L0014 movw ax hl 2 pk A INF 2 cmpw ax 4 0C8H 200 R INF 3e orl CY 3 INF 2 3 skc gt INF 2 524 bnz L0015 B INF 2 4 line 22 movw ax E e 2 Pk A INF 2g movw be ax H INF der mov mark bc 00H 0 x INF A movw ax hl 2 de R INF P xchw ax bc INF E g 210 Users Manual U18549EJ1VOUM APPENDIX A SAMPLE PROGRAMS movw ax hl 4 prime H INF 2 addw ax bc E INF Dep movw BL 2 1 gt ax ak i INF Bp ok br L0014 P INF 2 4 10015 line 24 movw ax BL He 8L H INF 2p 1l incw ax H INF doy i movw hl 6 ax Pol INF Xs d br L0006 P INF 2 4 L0007 line 25 movw ax hl count INF 1 3 push ax INF Ly movw ax loww L0017 0 F INF Seat call printf H INF 4 3 pop ax 7 INF 1 line 26 addw sp 08H INF 253 pop hl H F d cy ret E INF Lou 6 line 29 printf push hl INF d push ax E INF Ty subw sp 04H F INF 22 5 movw hl sp INF Gov line 33 movw ax y hl se 12 J HS A INF
223. y C Program Files NEC Electronics Tools dev User s Manual U18549EJ1VOUM 79 CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING Example 3 Object converting program for flash area C oc78k0r flash lmf oflash lmf y C Program Files NEC Electronics Tools dev Caution By specifying the zf option when object converting the HEX file for boot area e g flash hxb and the HEX file for flash area e g flash hxf are output The flash hxb and the boot hex that is generated when the program for boot area is built have the same contents However when the HEX file for boot area is already written and the program for flash area is built again it is recommended to confirm that there is no difference in the saved boot hex and the created flash hxb Remark When specifying multiple compiler options delimit between compiler options by a space It does not matter whether a description is written in uppercase or lowercase non case sensitive For detailed information see CHAPTER 5 COMPILER OPTIONS The i option specification b option path specification and y option specification can be omitted depending on the condition For details see CHAPTER 5 COMPILER OPTIONS and RA78KOR Assembler Package Operation User s Manual Caution When linking a library created by a user or a floating point library be sure to specify the library attached to the CC78KOR at the end of th
224. y the new output destination in the Output Path combo box in the Create Error List File area under the Output tab and select with C Source se When individual compiler options are specified the output file name can also be changed Specify the file name or the output destination in the Output Path combo box under the Output tab Users Manual U18549EJ1VOUM 119 CHAPTER 5 COMPILER OPTIONS Use Example 120 To add the C source module file prime c to the error list file prime cer describe as C cc78k0r cf1166a0 prime c se Output example 78KOR C Compiler Vx xx CC78KOR warning W0745 count if count 8 CC78KOR warning W0745 for k i prime Error List Date xXx XXX XXXX Command cf1166a0 prime c se In file prime c Err file prime cer Para file ud define TRUE i define FALSE 0 define SIZE 200 char mark SIZE 1 void main void prime i i 3 printf 6d prime Expected function prototype 0 putchar n Expected function prototype k lt SIZE k prime Time xx xXxX XxX User s Manual U18549EJ1VOUM CHAPTER 5 COMPILER OPTIONS Cross reference list file creation specification 1 x Description format x output file name Interpretation when omitted No cross reference list file is output Function The x option specifies the output of the cr
225. ystem and the user program main function This program is called the startup routine To execute a program written by a user a startup routine must be created for that program The CC78KOR provides the object files of the startup routines that include the processing required before program execution and the source files assembly source of the startup routines that the user can adapt to the system By linking the object file of the startup routine to the user program an executable program can be created even if the user does not describe the execution preprocess This chapter describes the contents uses and improvements of the startup routines 8 1 File Organization The files related to a startup routine are stored in the folder src cc78kOr of the C compiler package Program Files NEC Electronics Tools m CC78KOR Vx xx bin I CC78KOR Vx xx doc L CC 78KOR Vx xx hIp CC78KOR Vx xx inc78kOr LL CC 78KOR Vx xx lib78kOr L CC78KOR Vx xx smp78k0r CC78KOR L CC 78KOR Vx xx src cc78k0r bat s Folders that contain files related to startup routines lib src The contents of the folders under src cc78kOr are shown next User s Manual U18549EJ1VOUM 153 CHAPTER 8 STARTUP ROUTINES 8 1 1 bat folder contents A batch file in this folder cannot be used in PM Use these batch files only when the source such as for a startup routine must be modified Tabl

Download Pdf Manuals

image

Related Search

Related Contents

  FY-12PFE8D の取扱説明書  平成19年7月27日 経 済 産 業 省 消費生活用製品の重大製品事故に  RCA ANT3020X Installation Manual  User`s Manual - Walker Technologies    電動車いすの安全利用の手引き  Special Declaration - Highlight Electronics  User manual for accommodation application in Matrix  

Copyright © All rights reserved.
Failed to retrieve file