Home
FR-V/FR FAMILY SOFTUNE C/C++ COMPILER MANUAL
Contents
1. nennen inns sn nnns 160 CHAPTER 8 LIBRARY OVERVIEW uoce an c coit ono nn nn tai e ds te na ect n 163 Sal Organizatiob a 164 8 2 Relationship to Library Incorporating System ssssssssssssssseeeeeeenneen nennen 166 9 LIBRARY INCORPORATION ne nen en nnn nnn nnns 167 9 1 Library Incorporation Overview 168 vi 9 2 Initialization Termination Process Necessary for Library Use 169 9 3 Low level Function Types a a nennen 170 9 4 Standard Library Functions and Required Processes Low level Functions 171 9 5 Low level Function Specifications sssssssssssssssessseeeeee nennen nennen nnne nnne nnns 172 9 55 open Functions aci ete du RE PH E ex hubo n d xui ferax ci ober tu dies 173 9 5 2 close FUNCTION 2 5 oct die ie et ee Let en ebd in Teteres 174 9 5 3 read FU rictiOri iita Gu tp e OA e tan t te gu tabem tane ee ede Ote 175 S MEUSE 176 9 5 5 Is ek Furictlon ret m ee 177 9
2. 139 media dual multiplication 140 media dual multiplication halfword dual instruction MSTOCHON 139 media dual saturation addition 138 media halfword expand instruction M instruction 146 media halfword pack unpack dual instruction M 147 media halfword pack unpack instruction M instruction 146 media instruction built in function 133 media logical operation word instruction M instruction eeeenn 135 media mean operation halfword dual instruction M instruction eeeenne 137 media 143 media quad complex product sum operation halfword quad instruction M instruction 144 media quad cross multiplication halfword quad instruction M instruction 142 media quad multiplication halfword quad instruction M instruction 142 media quad saturation addition 141 media rotate word instruction M instruction 136 media saturation operation halfword dual instruction M instruction 138 media shift halfword dual instruction M instruction 137 media trap instruction M instruction 149 media word CUT instruction M
3. FUJITSU SEMICONDUCTOR CM81 00205 2E M AL FR V FR FAMILY SorruNE C C COMPILER MANUAL for V5 FUJITSU FR V FR FAMILY SorruuE C C COMPILER MANUAL for V5 FUJITSU LIMITED PREFACE B Objective of This Manual and Target Readers This manual describes the Sofutune C C compiler hereinafter referred to as the C C compiler usage procedures and libraries This manual is prepared for persons who use the above mentioned compiler and create and development application programs in C and C language Read this manual thoroughly before starting This manual is to be read by persons who have a basic knowledge of each MCU Micro Controller Unit The compiler described in this manual conforms about C language to the American National Standard for Information Systems Programming Language X3 159 1989 which is abbreviated ANSI standard in this manual Part of ISO IEC 14882 1998 is used to explain C B Trademarks Softune is a trademark of Fujitsu Ltd FR stands for FUJITSU RISC Controller developed by Fujitsu Ltd Microsoft Windows Windows NT MS DOS are registered trademarks of Microsoft Corporation in the USA and or other countries DOS is a registered trademark of Microsoft Corp UNIX is a registered trademark that X Open Co Ltd has licensed in the United States and other countries Other trademarks or registered trademarks are the property of their respective owners The or mark
4. no for int diff warning Cancel the for init diff warning option 26 3 5 Details of Options 3 5 Details of Options This section details the options B Translation control related options The translation control related options are related to preprocessing compiler assembler and linker call control B Preprocessor related options The preprocessor related options are related to preprocessing operations E Data output related options The data output related options are related to the command preprocessing and compiler data outputs B Language specification related options The language specification related options are related to the specification of the language to be recognized by the compiler B Optimization related options The optimization related options are related to the optimization to be effected by the compiler Output object related options The output object related options are related to the output object format B Debug information related options The debug information related options are related to the debug information to be referenced by the symbolic debugger B Command related options The command related options are related to the other tools recalled by commands B Linkage related options The linkage related options are related to linkage B Option file related options The option file related options are associated with option files 27 CHAPTER 3 C C COMPILER OPERATION
5. Mcop2 FRi FRj FRk unsigned long Mcop2 unsigned long unsigned long B Media Trap Instruction M Instruction Assembler notation Operation of the instruction Media built in function prototype void MTRAP void unsigned long a b c _Mcop2 b LDFI FP 8 FRO LDFI FP 12 FR1 Mcop2 FRO FR1 FR2 STFI FR2 FP 4 Usage example Expansion example 149 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 6 8 2 Integer Operation Built in Function This function can be used for the fcc935s command only This function is used to use the integer operation instructions supported by the FR V family CPU To use the integer operation built in function always include the header file builtin h for integer operation built in function When the header file is not included the function cannot be recognized as the built in function B Integer Operation Built in Function Function prototype Usage example Expansion example long long a long b c a SMUL b signed long long LDI FP 8 GR4 __SMUL signed long signed long LDI FP 12 GR5 SMUL GR4 GR5 GR6 STI GR6 FP 0 STI GR7 FP 4 Unsigned long long a unsigned long b c a UMUL b c LDI FP 8 GR4 UMUL unsigned long unsigned long LDI FP 12 GR5 UMUL GR4 GR5 GR6 STI GR6 FP 0 STI GR7 FP 4 unsigned long long 150
6. 90 4 6 fcc911s Command Function Call Interface fcc911s Command Register This section states the register guarantee and register setup regulations in the standard linkage regulations B fcc911s Command Register Guarantee The callee function guarantees the following registers of the caller function General purpose registers R8 to R11 R14 and R15 The register guarantee is provided when the callee function acquires a new area from the stack and saves the register value in that area Note however that registers remaining unchanged within the function are not saved If such registers are altered using the ASM statement etc no subsequent operations will be guaranteed B fcc911s Command Register Setup The register regulations for function call and return periods are indicated in Table 4 6 2 Register Regulations for fcc911s Command Function Call and Return Periods Table 4 6 2 Register Regulations for fcc911s Command Function Call and Return Periods Register Call Period Return period R4 Argument return value area address 1 Return value 2 R5 Argument register 1 Return value 3 R6 and R7 Argument register 1 Not stipulated RO to R3 Not stipulated Not stipulated R12 and R13 Not stipulated Not stipulated R8 to R11 Not stipulated Call period value guaranteed R14 Frame pointer FP Call period value guaranteed R15 Stack pointer SP Call period value guaranteed 1 There are
7. E Floating point Data Format and Expressible Value Range Table 10 2 1 Type of Floating point Data and Range of Representable Values Type of floating point data Range of Representable Values float type The exponent part is a value between 126 and 127 Base 2 The fractional portion of the mantissa the integer portion is normal ized to 1 is binary and has 24 digit accuracy The exponent part is value between 1022 and 1023 Base 2 double type The exponent part is a value between 1022 and 1023 Base 2 The fractional part of the mantissa the integer part is normalized to 1 is binary and has 53 digit accuracy long double type The fractional part of the mantissa the integer part is normalized to 1 is binary and has 53 digit accuracy 186 10 3 Dissimilarities between C Specifications for C C Compiler and ISO 10 3 Dissimilarities between C Specifications for C C Compiler and ISO This section explains the dissimilarities between the C specifications for the C C compiler and ISO IEC 14882 1998 B Modifications to C Specifications for C C Compiler from ISO Differences between the C specifications for the C C compiler and ISO IEC 14882 1998 are explained below There is no support for the name solving function in temp res Section 14 6 and temp dep Section 14 6 2 mentioned in the ISO IEC 14882 1998 Specification There is no support for the template argument fun
8. 1 An entry beginning with a hyphen is first recognized as an option The subsequent character string is interpreted to determine the option type 2 As regards an option having an argument the subsequent character string is regarded as the argument 3 The remaining entries in the command line are recognized as operands Example gt fcc911s file1 c S I home myincs file2 c cpu MB91100 gt fcc935s file1 c S I home myincs file2 c cpu MB93500 At first S and I are regarded as options Since the I option has an argument the subsequent character string home myincs is regarded as the argument The remaining entries file1 c and file2 c are regarded as operands Options S I home Wmyincs Operands file1 c file2 c B Command Process The command calls a compiler assembler and linker for each input file in the order they are specified to compile assemble and link The result of each module is output to a file having the same file name as an input file name with its extension replaced by obj The result after linking is output to a file having the same file name with its extension replaced by abs The linking result unless changed by the o option is output to files with abs extensions to which the extensions of the files first specified are changed Example gt fcc91 1s file1 c file2 c file3 c cpu MB91100 fcc935s file1 c file2 c file3 c cpu MB93500 Files named file1 c file2 c and file3 c are su
9. 124 interrupt stack frame 94 interrupt vector table generation function 125 isatty function 178 196 iseek function 177 195 L language specification related option 27 40 9 library use process and function must be prepared TOT esses edi tet 168 limitation on compiler translation 153 limitations on use of C template 189 limits h for fcc911s Command 201 limits h for fcc935s command 201 linkage related 27 65 low level function library overview 192 low level function specification 172 low level function 166 170 INDEX M math hic ete ec HE demde deeper eun curn 202 media accumulator clear instruction M instruction eeeene 148 media accumulator 148 media byte halfword conversion instruction M instruction 147 media custom instruction M instruction 149 media CUT instruction M instruction 145 media dual complex multiplication 143 media dual cross multiplication halfword dual instruction M instruction
10. The in line expansion specifying is invalid if the O option is not specified 129 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 6 5 Section Name Change Function This function is used to change the section name or section attribute and sets the section arrangement address B Section Name Change Function General format pragma section DEFSECT NEWNAME attr SECTATTR locate ADDR Explanation Change the section name to be output by the compiler from DEFSECT and NEWNAME and the section type to SECTATTR The locate address may also be specified as ADDR For the section name to be output by the compiler see section 4 1 Section Structure of fcc911s or section 5 1 Section Structure of fcc935s for the section type that can be output refer to the Assembler Manual When the locate address is given it cannot be specified for the section at linking Caution The pragma section affects the entire source regardless of the location If DEFSECT is specified many times the last one is valid If DEFSECT is specified by the s option it takes priority over the others The EXT CTOR DTOR section cannot be specified and its output is fixed Output Example Input pragma section CODE program attr CODE locate Oxff void main void fcc911s command output SECTION program CODE LOCATE H 000000FF i begin of function GLOBAL main main ST RP SP ENTEH 4 L main LEAVE LD SP RP RET fcc935s command
11. If the function has a variable count of arguments it saves all argument registers in the argument register save area If the function has a variable count of arguments it saves all argument registers in the argument register save area Caution In a C program arguments that do not appear in the source program may be passed The order and location in which arguments are stacked may or may not be as desired Example 1 double d sub d The high order words of d are delivered by R4 and the low order words of d are delivered by R5 Example 2 int a b C double d sub a b c d ais delivered by R4 b by R5 and c by R6 The high order words of d are delivered by R7 and the low order words of d are delivered by the stack When a structure union is to be delivered as an argument the caller copies the structure to the local variable area and passes the address of that area to the callee In this case if the structure union size is less than 4 bytes or is not divisible by 4 the less than 4 byte fraction is handled as one 4 byte unit 85 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 86 Example 3 struct A st Low sub st High Example 4 struct A char a st Low 4 3 Unoccupied 2 1 High When a function receiving a variable count of arguments is to be called the arguments are placed in registers in the same manner as for transfer Th
12. Selects 1 as definition 151 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS B Macros predefined by fcc935s command The fcc935s command predefines the following macros Macro Description COMPILER FCC935 1 is defined CPU MB number The MB number specified by the cpu option is defined CPU FR500 1 is defined 152 6 10 Limitations on Compiler Translation 6 10 Limitations on Compiler Translation Table 6 10 1 List of Translation Limitations shows the translation limitations to be imposed when the compiler is used The table also indicates the minimum ANSI requirements to be met E Limitations on Compiler Translation Table 6 10 1 List of Translation Limitations Function ANSI Compiler Standard Count of nesting levels for a compound statement infinity repetition control structure and selection control structure Count of nesting levels for condition incorporation infinity Count of pointers arrays and function declarators any infinity combinations of these for qualifying one arithmetic type structure type union type or incomplete type in a declaration Count of nests provided by parentheses for one complete infinity declarator Count of nest expressions provided by parentheses for one infinity complete expression Count of valid leading characters of internal identifier or infinity macro name Count of valid leading characters of external identifier in
13. Usage example Expansion example unsigned long a a _MRDACC ACC1 MRDACC ACC1 FR1 STFI FR1 FP 4 MWTACC FRi ACCk ACCk Fri void __MWTACCiint unsigned long The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h unsigned long b MRDACC ACC2 b FP 8 FRO MWTACC FRO ACC2 MRDACCG ACCGi FRk FRk ACCGi 148 unsigned long __MRDACCGiint The first argument must be ACCG to ACCG7 ACCGO to ACCG7 are list constants defined in media h unsigned long a a _MRDACCG ACCG1 MRDACCG ACCG1 FR1 STFI FR1 FP 4 Assembler notation Operation of the instruction MWTACCG FRi ACCGk ACCGk Fri Media built in function prototype void MWTACCG nt unsigned long The first argument must be ACCG to ACCG7 ACCGO to ACCG7 are list constants defined in media h B Media Custom Instruction M Instruction Assembler notation Operation of the instruction Mcop1 FRi FRj FRk Media built in function prototype unsigned long Mocopt unsigned long unsigned long 6 8 Built in Function Usage example Expansion example unsigned long b MRDACCG ACCGe b LDFI FP 8 FRO MWTACCG FRO ACCG2 Usage example Expansion example unsigned long a b c _Mcop1 b LDFI FP 8 FRO LDFI FP 12 FR1 Mcop1 FRO FR1 FR2 STFI FR2 FP 4
14. Example long long a b fscanf stdin Ylld lln amp a amp b O Interpretation of a single character appearing at a position other than the start and end 207 APPENDIX B Operations Specific to C Libraries 208 of the scan list relative to format conversion A string of consecutive characters beginning with the character placed to the left of and ending with the character placed to the right of is handled Example is equal to abc abort function operation relative to an open file Closing takes place after flushing of all streams Status returned by the exit function when the actual argument value is other than 0 EXIT SUCCESS and EXIT FAILURE The status to be returned is the same as for EXIT FAILURE Floating point number limit values FLT MAX 7F7F FFFF DBL MAX 7FEF FFFF FFFF FFFF FLT EPSILON 3400 0000 DBL EPSILON 3CB0 0000 0000 0000 FLT MIN 0080 0000 DBL MIN 0010 0000 0000 Limitations on setjmp function The interrupt environment is not supported by the libraries Therefore the interrupt handler cannot achieve environment saving and the return to the interrupt handler cannot be made Limitations on va start macro Do not use the following variable definitions for va start macro first argument char type unsigned char type short type or unsigned short type however the pointer type for these types can be used Type having the register storage area class Function typ
15. General format jo Variable declaration Explanation The fcc911s command enables the declaration of variables operating the I O area defined between addresses 0x00 and Oxff by specifying the io type qualifier The fcc911s command makes variables available up to address Ox3ff depending on their type Since a highly efficient dedicated instruction is provided for I O area access a higher speed more compact object can be generated This instruction cannot be used for variables operating an I O area positioned at addresses higher than Oxff To define a variable that accesses such an area use the volatile type qualifier The fcc935s command outputs the variables with io type qualifier specified to the IO section The initial value cannot be specified for variables for which the X io type qualifier is specified When the specified variable is for a structure or union it is assumed that all members are positioned in the I O area The variable cannot be specified for structure or union members For the variable for which the io type qualifier is specified compilation is conducted on the assumption that the volatile type qualifier is specified When the K NOVOLATILE option is specified the volatile type qualifier is not assumed to be specified for the variable for which the io type qualifier is specified 127 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS Output Example Input pragma section IO IOA attr lO loca
16. HI FRk 1 USAT HI FRi 1 HI FRj 1 LO FRk 1 USAT LO FRi 1 LO FRj 1 unsigned long long MSUBHUS unsigned long long unsigned long long unsigned long long a b c a _MSUBHUS b LDDFI FP 16 FRO LDDFI FP 24 FR2 MQSUBHUS FRO FR2 FR4 STDFI FR4 FP 8 141 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS B Media Quad Multiplication Halfword Quad Instruction M Instruction Assembler notation Operation of the instruction MQMULHS FRi FRj ACCk ACCGk ACCk HI FRi HI FRj ACCGk 1 ACCk 1 LO FRI LO FRj ACCGk 2 ACCk 2 HI FRi 1 HI FRi 1 ACCGk 3 ACCk 3 LO FRi 1 LO FR 1 Media built in function prototype void MQMULHS int signed long long signed long long The first argument must be ACCO or ACCA ACCO and ACCA are list constants defined in media h Usage example Expansion example signed long long b c MQMULHS ACOO b LDDFI FP 16 FRO LDDFI FP 24 FR2 MQMULHS FRO FR2 ACCO MQMULHU FRi FRj ACCk ACCGk ACCk HI FRi HI FRj ACCGk 1 ACCk 1 LO FRI LO FRj ACCGk 2 ACCk 2 HI FRi 1 HI FRI 1 ACCGk 3 ACCk 3 LO FRi 1 LO FR 1 void MQMULHU int unsigned long long unsigned long long The first argument must be ACCO or ACCA ACCO and ACCA are list constants defined in media h unsigned long long b c MQMULHU ACCA b LDDFI FP 16 FRO LDDFI FP 24 FR2 MQMULHU FRO
17. Register GRO Call period Zero register Return period 0 GR1 Stack pointer SP Call period value guaranteed GR2 Frame pointer FP Call period value guaranteed GR3 Argument return value area address 1 Return value 2 GR4 GR7 Not stipulated Not stipulated GR8 GR9 Argument Return value 2 GR10 GR13 Argument register 1 Not stipulated GR14 GR15 Not stipulated Not stipulated GR16 GR31 Not stipulated Call period value guaranteed GR32 GR47 Not stipulated Not stipulated GR48 GR63 Not stipulated Call period value guaranteed FRO FR15 Not stipulated Not stipulated FR16 FR31 114 Not stipulated Call period value guaranteed 5 6 fcc935s Command Function Call Interface Table 5 6 2 Register Regulations for f c935s Command Function Call and Return Periods Continued Call period Return period FR32 FR47 Not stipulated Not stipulated FR48 FR63 Not stipulated Call period value guaranteed 1 There are no rules for unused registers in situations where the argument is smaller than 4 words 2 There are no rules for situations where a function without the return value is called or a function with a structure union type return value is called 115 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 6 6 fcc935s Command Return Value Table 5 6 3 fcc935s command return value interface
18. 6 9 Predefined Macros 6 9 Predefined Macros Macro names predefined by the compiler are explained below B Macros Stipulated by ANSI Standard The ANSI standard stipulates the macros listed in Table 6 9 1 Macros stipulated by the ANSI standard Table 6 9 1 Macros stipulated by the ANSI standard Defines line number of current source line Defines source file name Defines source file translation date Defines source file translation time Macro indicating that the processing system meets requirements When the Ja option is specified 0 is selected as the definition When the Jc option is specified 1 is selected as the definition In addition to the macros listed in Table 6 9 1 Macros stipulated by the ANSI standard C has the macros listed in Table 6 9 2 C macros in addition to the macros stipulated by the ANSI standard Table 6 9 2 C macros in addition to the macros stipulated by the ANSI standard Macro Description cplusplus 1 is defined c plusplus 1 is defined Nothing is defined when the Jc option is specified embedded cplusplus 1 is defined only when the default Je option is specified B Macros Predefined by fcc911s Command The fcc911s command predefines the following macros Macro Description COMPILER FCC911 Selects 1 as definition CPU MB number The MB number specified by the cpu option is defined CPUFR
19. Header file enclosed within angular brackets lt gt 1 Directory specified by the I option 2 Standard directory Header file enclosed by double quotation marks 1 Directory having a file containing the include line 2 Directory specified by the I option 3 Standard directory If a header file is specified by specifying its absolute path name only the directory specified by the specified absolute path name will be searched If any nonexistent directory is specified this option is invalid The XI option cancels the lI option 3 5 Details of Options O U name option Cancels the macro name definition formulated by D This option is equivalent to the following undef instruction undef name If the same name is specified by the D and U options the name definition will be canceled without regard to the order of option specifying This option can be specified more than one time The error related to the U option is the same as the error related to the undef instruction Example fcc911s U m D n D m file c cpu MB91100 fcc935s U m D n D m file c cpu MB93500 This will cancel the macro m definition formulated by the D option 33 CHAPTER 3 C C COMPILER OPERATION 3 5 3 Data Output Related Options This section deals with the options related to the command preprocessor and compiler data outputs B Data Output Related Options 34 O cmsg Option Outputs the compiling proces
20. K L l ra ro sc T U x Y When the above options are specified more than one time see details of options B Position within Command Line The option s position within the command line does not have a special meaning Options are interpreted in the same manner no matter where in the command line they are specified Example 1 gt fcc911s C E file1 c file2 c cpu MB91100 gt fcc935s C E file1 c file2 c MB93500 2 fcc911s filet c E file2 c C cpu MB91100 gt fcc935s filet c E file2 c C cpu MB93500 The same processing operations are performed for cases 1 and 2 B Exclusiveness and Dependency Options may be mutually exclusive or mutually dependent For information on the exclusivity and dependence of options see option descriptions E Case Sensitiveness As regards the options their upper case and lower case characters are different from each other For example the O option is different from the o option However the upper and lower case characters of suboptions are not differentiated from each other For example the K eopt option is considered in the same as the K EOPT option The suboptions are the character strings that follow the K option or INF option CHAPTER 3 C C COMPILER OPERATION 3 4 1 List of Command Options When executed without argument specifying the command outputs an option list to the standard output Table 3 4 1 List of Command Options to Table 3 4 5 List of
21. LO FRj 1 LO FRi 1 LO FRj 1 Media built in function prototype void MQCPXRS int signed long long signed long long The first argument must be ACCO ACC2 ACCA or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h Usage example Expansion example signed long long b c _MQCPXRS ACCO b c LDDFI FP 16 FRO LDDFI FP 24 FR2 MQCPXRS FRO FR2 ACCO MQCPXRU FRi FRj ACCk ACCGk ACCk HI FRi LO FRj LO FRi LO FRj ACCGk 1 ACCk 1 HI FRi 1 LO FRj 1 LO FRi 1 LO FRj 1 void __MQCPXRU int unsigned long long unsigned long long The first argument must be ACCO ACC2 ACCA or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h unsigned long long b c MQCPXRU ACC2 b c LDDFI FP 16 FRO LDDFI FP 24 FR2 MQCPXRU FRO FR2 ACC2 MQCPXIS FRi FRj ACCk 144 void MQCPXIS int signed long long signed long long signed long long b c _MQCPXIS ACC4 b Assembler notation Operation of the instruction ACCGk ACCk HI FRi LO FRj LO FRi LO FRj ACCGk 1 ACCk 1 HI FRi 1 LO FRj 1 LO FRi 1 LO FRj 1 Media built in function prototype The first argument must be ACCO ACC2 or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h 6 8 Built in Function Usage example Expansion example LDDFI FP 16 FRO LDDFI FP 24
22. a MROTRI b 3 LDFI FP 8 FRO MROTRI FRO 3 FR1 STFI FR1 FP 4 Usage example Expansion example unsigned long a c unsigned long long b a MWOUT b MWCUT b 4 LDDFI FP 12 FRO FP 16 FR2 MWCUT FRO FR2 FR3 STFI FR3 FP 4 LDDFI FP 12 FRO MWCUTI FRO 4 FR3 STFI FR3 FP 4 B Media Mean Operation Halfword Dual Instruction M Instruction Assembler notation Operation of the instruction MAVEH FRi FRj FRk Media built in function prototype Unsigned long HI FRk HI FRi HI FRj gt gt 1 LO FRk LO FRi LO FRj gt gt 1 MAVEH unsigned long unsigned long B Media Shift Halfword Dual Instruction M Instruction Assembler notation Operation of the instruction MSLLHI FRi 56 FRk HI FRk HI FRi lt lt s6 LO FRk LO FRi lt lt s6 Media built in function prototype unsigned long MSLLHlI unsigned long int The second argument must be an immediate value The second argument is masked by Ox3F 6 8 Built in Function Usage example Expansion example unsigned long a b c MAVEH b LDFI FP 8 FRO LDFI FP 12 FR1 MAVEH FRO FR1 FR2 STFI FR2 FP 4 Usage example Expansion example unsigned long a b a MSLLHI b 4 8 FRO MSLLHI FRO 4 FR2 STFI FR2 FP 4 MSRLHI FRi s6 FRk HI FRk HI FRi gt gt s
23. double d sub d The high order words of d are delivered by GR8 and the low order words of d are delivered by GR9 Example 2 int a b c d e double f sub a b c d e f b and e are delivered by GR8 GR9 GR10 GR1 1 and GR12 The high order words of f are delivered by GR13 and the low order words of f are delivered by the stack When a structure union is to be delivered as an argument the caller copies the structure to the local variable area and passes the address of that area to the callee In this case the structure union size that is less than 4 bytes or cannot be divided by 4 is rounded up in 4 byte increments Example 3 struct A st sub st High 109 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE Example 4 struct A char a st Low 4 3 Unoccupied 2 High FP When a function receiving the variable number of arguments is to be called the arguments are placed in registers in the same manner as for transfer The called function stores all of the register delivered arguments in the argument register save area in the stack The actual argument area is allocated deallocated by the caller function whereas the argument register save area is allocated deallocated by the called function Figure 5 6 2 9355 Command Argument Format Stated in Standard Linkage Regulations shows the argument format prescribed in the standard linkag
24. 5 6 isatty FUNCION eap dedere uidet Cen Dip tid waive nade ae ents 178 TET SbrKAFUFICLOTI coerente tueri irc Eee a tt er eeu e LEER ERR oeuvres 179 9 5 8 inira nage sek actes sua eee oet 180 9 5 97 xabortlF nctions aao etr ein ah Ay temen o taie takin Ghia 181 CHAPTER 10 COMPILER DEPENDENT SPECIFICATIONS 183 10 1 Compiler dependent C Language Specification Differentials sese 184 10 2 Type of Floating point Data and Range of Representable Values 186 10 3 Dissimilarities between C Specifications for C C Compiler ISO 187 10 4 Specifications for C C Compiler and EC Specifications 188 10 5 Limitations on Use of C Template sssssssssssssseseeeeeee enne enne rentrer senten 189 CHAPTER 11 SIMULATOR DEBUGGER LOW LEVEL FUNCTION LIBRARY 191 11 1 Low level Function Library Overview en rent nennen nnn rens 192 11 2 Low level Function Library Use nennt trn 193 11 3 Low level Func Function cuocere reete epe eue opto er AA co de E c apt a dee aeg 195 11 4 Low level Function Library Change sssssssssssssesseseeeneee
25. ACCk HI FRi LO FRj ACCGk 1 ACCk 1 LO FRi HI FRj ACCGk 2 ACCk 2 HI FRi 1 HI FRj 1 ACCGk 3 ACCk 3 LO FRi 1 LO FRj 1 The first argument must be ACCO or ACC4 ACCO and ACC4 are list constants defined in media h Usage example Expansion example signed long long b c _MMACHS ACCO b c LDDFI FP 16 FRO LDDFI FP 24 FR2 MQMACHS FRO FR2 ACCO MQMACHU FRi FRj ACCk void __MQMACHU int unsigned long long unsigned long long ACCGk ACCk HI FRi LO FRj ACCGk 1 ACCk 1 LO FRi HI FRj ACCGk 2 ACCk 2 HI FRi 1 HI FRj 1 ACCGk 3 ACCk 3 LO FRi 1 LO FRj 1 The first argument must be ACCO or ACC4 ACCO and ACC4 are list constants defined in media h unsigned long long b c MOMACHU ACCA b LDDFI FP 16 FRO LDDFI FP 24 FR2 MQMACHU FRO FR2 ACC4 B Media Dual Complex Multiplication and Addition Operation Halfword Dual Instruction M Instruction Assembler notation Operation of the instruction MCPXRS FRi FRj ACCk ACCGk ACCk HI Fri LO FRj LO Fri LO FRi Media built in function prototype void MCPXRS int signed long signed long The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h Usage example Expansion example signed long b c _MCPXRS ACC1 b LDFI FP 8 FRO LDFI FP 12 FR2 MCPXRS FRO FR2 ACC1 MCPXRU FhRi FRj
26. Data Size and Boundary Alignment Example 1 to Figure 4 5 3 fcc911 Command Structure Union Data Size and Boundary Alignment Example 3 show examples concerning structure union data size and boundary alignment Figure 4 5 1 fcc911 Command Structure Union Data Size and Boundary Alignment Example 1 struct st1 char gt Sizeof st1 1 BYTE struct st2 short gt sizeof st2 2 BYTE struct st8 char A short B gt Ssizeof st3 4 BYTE struct st4 char A int B gt sizeof st4 8 BYTE struct st3 char A short B 31 MSB 23 15 0 LSB Figure 4 5 2 fcc911 Command Structure Union Data Size and Boundary Alignment Example 2 struct tag4 char A int B 31 MSB 23 0 LSB Unoccupied 80 4 5 fcc911s Command Structure Union Figure 4 5 3 fcc911 Command Structure Union Data Size and Boundary Alignment Example 3 struct tag5 char A struct tag6 short A char B S6 sizeof tag5 6 BYTES sizeof tag6 4 BYTES 31 MSB 23 15 0 LSB S6 B Unoccupied 81 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 4 6 fcc911s Command Function Call Interface The general rules for control transfer between functions are established as standard regulations for individual architectures and are called standard linkage regulations A module written in C language can be combined with a module written using a different method e g assembler language w
27. Order of arthmatic operation replaced LDI 32 _i R12 ST R4 R12 Operation fcc935s K eopt O cpu MB93500 S sample c K noschedule add gr 0 gr11 gr4 Order of arthmatic operation replaced sethi hi _i gr5 setlo lo _i gr5 st gr4 gr5 gro O K LIB option and K NOLIB option The LIB suboption recognizes the standard function operation and replaces the standard function with a higher speed standard function which effects standard function in line expansion and performs the same operation as the original standard function When this option is specified side effects may be produced on the execution results Since standard function inline expansion is implemented the code size may increase This option takes effect only when an optimization level of 1 or higher is specified by the O option The NOLIB suboption cancels the LIB suboption 48 3 5 Details of Options Output Example Input extern inti void func void i strlen ABC Operation fcc911s K lib O cpu MB91100 S sample c Output LDI 3 RO Processing equivalent to strlen LDI 32 1 R12 expanded ST RO R12 Input extern char s void func void strcpy s ABC Operation fcc935s K lib O cpu MB93500 S sample c K noschedule Output sethi hi _s gr4 setlo flo s gr4 sethi hi LS 0 gr5 setlo 0 15 0 gr5 mov gr4 gr8 mov gr5 gr9 setlos 4 gr10 call cmov Processing equivalent to strlen expande
28. PREDICATE suboption 53 CHAPTER 3 C C COMPILER OPERATION Output Example Input extern int a void func int flag if flag a 1 Operation fcc935s cpu MB93500 O K predicate S sample c K noschedule Output _ func L 20 subi sp 40 sp mov gf8 gr10 L 21 910 grO iccO setlos 1 gr4 sethi hi a gr5 setlo lo _a gr5 ckeq iccO cc4 cst 09 4 gr5 grO cc4 0 L 24 addi sp 440 sp ret O K NEO NE1 NE2 option The K NEO option specifies that Non Excepting instructions are not output The K NE1 option specifies that a Non Excepting instruction be output beyond a conditional jump instruction The K NE2 option specifies that a Non Excepting instruction be output beyond a conditional jump instruction and loop This option can be used for the fcc935s command only Because an exception may occur replacing the instruction that cannot be transferred beyond the branch with a Non Excepting instruction can move the instruction beyond the branch This may allow instruction scheduling enabling the generation of code with higher execution speed However because the instruction in the path that is not actually executed is transferred beyond the branch the execution speed may become slower than without a Non Excepting instruction This option takes effect only when an optimization level of 1 or higher is specified simultaneously with the O option This option defaults to K NEO 54 Output
29. Provided The usage purpose of each section and the relationship of the section to C C are explained below O Code section The code section stores machine codes This section corresponds to the procedure section for C O Initialized section The initialized section stores the area for variables with initial values For C this section corresponds to the area for external variables without the const attribute static external variables and static internal variables O Constant section The constant section stores the area for write protected variables with initial values For C this section corresponds to the area for external variables with const attribute static external variables and static internal variables 98 5 1 Section Structure of fcc935s O Data section The data section stores the area for variables without initial value For C this section corresponds to the area for external variables including variables with const attribute static external variables and static internal variables section The I O section stores the area for variables with the _ io type modifier For C this section corresponds to the area for external variables that have the io type modifier including variables with the const attribute static external variables and static internal variables The default section name is IO C Init section The C Init section stores the table that points to the entry of
30. SP MDH LDM R12 R13 RETI B Interrupt Vector Table Generation Function fcc911s command general format pragma intvect Interrupt function name Vector number 125 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 126 pragma defvect Interrupt function name Explanation This function can only be used in the fcc911s command pragma intvect generates an interrupt vector table for which the interrupt function is set pragma defvect specifies the default interrupt function to be set for interrupt vectors not specified by pragma intvect The interrupt vector table is generated in an independent section named INTVECT All interrupt vector tables must be defined using the same translation unit file If pragma intvect or pragma defvect is specified using two or more translation units no subsequent operations will be guaranteed The definition cannot be formulated two or more times for the same vector number However no error occurs if the definitions are identical No value other than an integer constant may be specified as the vector number Specify a vector number between 0 and 255 Reset vectors must always be assigned to OxFFFFC For this reason to set TBR to other than OxFFCOO use the asm statement to define reset vectors separately 6 3 I O Area Access Function 6 3 I O Area Access Function The I O area operation variable can be declared by specifying the _ io type qualifier B Area Access Function
31. Standard Linkage Regulations shows the stack frame prevailing at calling in compliance with the standard linkage regulations Figure 4 6 4 fcc911s Stack Frame Prevailing at Calling in Compliance with fcc911s Command Standard Linkage Regulations Low Caller function SP Actual argument area Local variable area Caller function FP High The callee function saves the caller function frame pointer FP in the stack and then stores the prevailing stack pointer value in the stack as the new frame pointer value Subsequently the local variable area and caller function register save area are acquired from the stack to save the caller register Figure 4 6 5 Stack Frame Created by Callee Function in Compliance with fcc911s Command Standard Linkage Regulations shows the stack frame that is created by the callee function in compliance with the standard linkage regulations 89 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE Figure 4 6 5 Stack Frame Created by Callee Function in Compliance with fcc911s Command Standard Linkage Regulations Low Callee function SP Actual argument area Local variable area Callee function FP Old FP Return address storage area Register save area Hidden parameter save area Argument register save area Caller function SP Virtual argument area Local variable area Caller function FP High
32. When INC911 or INC935 is not defined the directory at the corresponding relative position with respect to the FETOOL directory YFETOOL lib 91 1Ninclude or FETOOL lib 935 include is regarded as the standard header file directory Two or more directories can be specified separated by a delimiter The delimiter is a colon for the UNIX OS and a semicolon for Windows Example For UNIX OS setenv INC911 usr local softune5 lib 91 1 include setenv INC935 usr local softune5 lib 935 include Example For Windows set INC911 c softune5S lib 9 1 1 include set INC935 c softuned lib 935 include CHAPTER 2 SETTING ENVIRONMENT VARIABLES IN SYSTEM BEFORE STARTING 2 5 TMP Specify the directory for the temporary file to be used by the C compiler TMP General Format 1 For UNIX OS setenv TMP Temporary directory General Format 2 For Windows set TMP Temporary directory Specify the working directory for creating the temporary file to be used by the C compiler If TMP setup is not completed the temporary file is created in the tmp directory for UNIX OS or in the current directory for Windows No more than one directory can be specified Example For UNIX OS setenv TMP usr tmp Example For Windows set TMP c tmp 2 6 FELANG 2 6 FELANG Specify the code for messages E FELANG General Format 1 For UNIX OS setemv FELANG Message code General Format 2 For Windows set FELANG Message code Spec
33. Xra option cancels the ra option For details of the option refer to the Linkage Kit Manual O ro name start end option and Xro option The ro option specifies the ROM area at linking The Xro option cancels the ro option For details of the option refer to the Linkage Kit Manual O sc param option and Xsc option The sc option specifies the section arrangement at linking 65 CHAPTER 3 C C COMPILER OPERATION 66 The Xsc option cancels the sc option If the option is not specified sc IOPORT 0 0x1000 is selected automatically For details of the option refer to the Linkage Kit Manual startup filename option and Xstartup option The startup option selects filename as the object file name of the startup routine to be linked at linking If this startup option is not specified FETOOLJ Mib 91 1 startup obj is selected in the fcc911s command and FETOOLJ ib 935 tartup obj is selected in the fcc935s command automatically The Xstartup option cancels the startup option For details of the startup routine see CHAPTER 7 EXECUTION ENVIRONMENT 3 5 Details of Options 3 5 10 Option File Related Options This section describes the option file related options B Option File Related Options O f filename option and Xf f filename option used to read the specified option file filename If the option file name does not have an extension an opt extension will be added The command options can
34. and Subtraction Halfword Dual Instruction M Instruction Assembler notation Operation of the instruction Usage example Media built in function prototype Expansion example MADDHSS FRi FRj FRk HI FRk SSAT HI FRi HI FRj LO FRk SSAT LO FRi LO FRj signed long a b c a _MADDHSS b signed long __MADDHSS signed long signed long LDFI FP 8 FRO LDFI FP 12 FR1 MADDHSS FRO FR1 FR2 STFI FR2 FP 4 MADDHUS FRi FRj FRk HI FRk USAT HI FRi HI FRj LO FRk USAT LO FRi LO FRj unsigned long a b c a MADDHUSY b unsigned long MADDHUS unsigned long unsigned long LDFI FP 8 FRO LDFI FP 12 FR1 MADDHUS FRO FR1 FR2 STFI FR2 FP 4 MSUBHSS FRi FRj FRk HI FRk SSAT HI FRi HI FRj LO FRk SSAT LO FRi LO FRj STFI FR2 FP 4 138 signed long a b c a MSUBHSS b signed long __MSUBHSS signed long signed long LDFI FP 8 FRO FP 12 FR1 MSUBHSS FRO FR1 FR2 Assembler notation Operation of the instruction MSUBHUS FRi FRj FRk Media built in function prototype 6 8 Built in Function Usage example HI FRK USAT HI FRi HI FRj LO FRKk USAT LO FRi LO FRj Expansion example unsigned long a b c _MSUBHUS b unsigned long MSUBHUS unsigned long unsigned long B Media Dual Multiplication Halfword Dual Instru
35. c gt fcc935s S cpu MB93500 sample c O s defname newname attr address option and Xs option Changes the compiler output section name from defname to newname and changes section type to attr An arrangement address can be specified in the address option For compiler output section names see section 4 1 Section Structure of fcc911s For selectable section types refer to the Assembler Manual If the arrangement address is specified the arrangement address cannot be specified relative to the associated section at linking The Xs option cancels the s option 57 CHAPTER 3 C C COMPILER OPERATION 58 Output Example Input Operation Output Operation Output void func void fcc911s fcc935s func L 20 s CODE PROGRAM CODE 0x1000 S cpu MB91100 sample c SECTION PROGRAM CODE LOCATE H 00001000 begin_of_function GLOBAL func ST RP SP ENTER 4 LEAVE LD SP RP RET s CODE PROGRAM CODE 0x1000 S cpu MB93500 sample c section PROGRAM CODE LOCATE H 00001000 global _func subi sp 16 sp st fp sp 9 0 mov sp fp movsg LR gr4 sti gr4 fp 8 Idi fp 8 gr4 movgs gr4 LR addi fp 16 sp ld fp grO fp ret O splitsection option and Xsplitsection option The splitsection option generates CODE sections having different names for different functions This option can only be used with the 9355 command The section naming c
36. current directory The name of the generated file is determined by changing the source file name extension to Ist Since the assemble list is generated at assembling it is not generated when assembling is not conducted For the details of the assemble list refer to the Assembler Manual The NOLIST suboption cancels the LIST suboption Example fcc911s INF list c cpu MB91100 sample c gt fcc935s INF list c cpu MB93500 sample c The sample c preprocessing compiling and assembling process result are output to the sample obj and the resulting assemble list is output to the sample Ist O INF SRCIN option and INF NOSRCIN option INF SRCIN option inserts a C or C source file into the assembler source file as a comment The NOSRCIN suboption cancels the SRCIN suboption The SRCIN suboption cannot be specified simultaneously with the LINENO suboption 35 CHAPTER 3 C C COMPILER OPERATION Output Example Input void func void Operation fcc911s INF srcin S cpu MB91100 sample c Output func ST RP SP ENTER 44 n void func void L func LEAVE LD SP RP RET Operation fcc935s INF srcin S cpu MB93500 sample c K Output _func L 20 D void func void subi sp 16 sp st fp sp gr0 mov sp fp movsg LR gr4 sti gr4 fp 8 L 21 L 22 Idi fp 8 gr4 movgs gr4 LR addi fp 16 sp Id fp grO fp ret O INF STACK fileJoption and INF NOSTACK option INF
37. file names specified by the open function must be written as the standard input output and standard error output names For the closing process use the fclose function 169 CHAPTER 9 LIBRARY INCORPORATION 9 3 Low level Function Types This section outlines the standard library functions and necessary low level functions The standard library functions require the following six types of low level functions e File opening and closing open close e Input and output relative to file read write e File position change Iseek e File inspection isatty Memory area dynamic acquisition sbrk Program abnormal end and normal end abort exit The above processes are called from the associated standard libraries to manipulate the system s actual files or exercise program execution control B Low level Function Types 170 O File Opening and Closing All functions that open the fopen function and other files call the open function to open an actual file on the system Similarly all functions that close the fclose function and other files call the close function to close an actual file on the system Input and Output Relative to File The scanf printf and other input output functions perform input output operations relative to the system s actual files when the read and write functions are called File Position Change The fseek and other file position manipulation functions acquire or change the system s actual
38. file positions when the Iseek function is called Memory Area Dynamic Acquisition The malloc and other memory area dynamic acquisition functions acquire or free specific memory areas when the sbrk function is called Program Abnormal End and Normal End The abort function and exit function call the abort function and _ exit function respectively as the termination process 9 4 Standard Library Functions and Required Processes Low level Functions 9 4 Standard Library Functions and Required Processes Low level Functions This section describes the standard library functions and associated initialization termination processes and low level functions B Standard Library Functions and Required Processes Low level Functions Table 9 4 1 Standard Library Functions and Required Processes Low level Functions lists the standard libraries that use low level functions related initialization and termination processes and low level functions Table 9 4 1 Standard Library Functions and Required Processes Low level Functions Standard Library Low level Function Initialization Termination Process Function assert open close Stream area initialization process standard abort 1 read write input output and standard error output opening Iseek isatty and closing sbrk abort All stdio h file operation open close Stream area initialization process standard functions read write
39. include Prevention Function The file can have pragma once at its beginning to prevent the header file from being re included B Re include Prevention Function The file can have pragma once at its beginning to prevent the header file from being re included Example file1 h pragma once include file2 h file2 h pragma once include file1 h file3 c include file1 h file1 h file2 h are included one each 155 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 6 12 Function for Controlling Instantiation of C Template pragma instantiate forces instantiation pragma do_not_instantiate does not provide instantiation pramga can_instantiate provides instantiation if possible B Function for Controlling Instantiation of C Template 156 Instantiation of a C template can be controlled depending on the following settings pragma instantiate template name pragma do not instantiate template name pramga can_instantiate template name The types that can be specified as template names are given below Template class name A lt int gt Template class declaration class A lt int gt Member function name A lt int gt f Static data member name A lt int gt i Static data member declaration int A lt int gt i Member function declaration void A lt int gt f int char Template function declaration char f int float O pragma instantiate The specified
40. input from the file is not successfully done the value 1 must be returned If the file ends in the middle of the input sequence a value smaller than size can be returned as the input character count 175 CHAPTER 9 LIBRARY INCORPORATION 9 5 4 write Function The write function should be generated according to the specifications in this section int write int fileno char buf unsigned int size B write Function Explanation To the file specified by fileno size byte data in the area specified by buf must be outputted If the file is opened in the append mode the output must always be appended to the end of the file If the text file new line character is other than n in the system environment at this time the output must be generated with the system environment new line character converted to n by the write function Return value When the output to the file is successfully done the output character count must be returned If it is not successfully done the value 1 must be returned 176 9 5 Low level Function Specifications 9 5 5 seek Function The Iseek function should be generated according to the specifications in this section include lt unistd h gt long int Iseek int fileno long int offset int whence B iseek Function Explanation The file specified by fileno must be moved to a position that is offset bytes away from the position specified by whence The file position is determined a
41. instruction 136 modification to C specification for C C compiler from ISO 187 OPEN TUNGO eret 173 195 arent irt 10 Optimization ion coiere e pete 6 optimization related option 27 46 213 INDEX option file erect tnt aee 68 option file limitation cesses 68 option file related 27 67 option file acceptable comment entry 68 option synak qe 19 output object related option 27 56 P pragma instruction description by 121 preprocessing related 31 preprocessor related option 27 PIOCOSS i eei tein n eret d ose ee tubes 168 R read function lees 175 195 re include prevention function 155 required process low level function 171 rule for name generation with the fcc91 1 76 S same option multiple specifying of 19 sbrk 179 196 section name change function 130 202 simulator debugger 193 special ont 195 standard
42. int a void func int flag ifflag a 1 else 2 fcc935s cpu MB93500 O K gs S sample c func add p gro fp gr5 Global scheduling on the assumption subi sp 40 sp that if flag is established sti p gr5 sp 0 addi sp 0 fp subcc p gr8 grO grO iccO addi gro 1 gr3 sethi p 4HI a gr4 setlo p LO a gr4 beq iccO 0 L_26 st gr3 gr4 L 27 add fp sp Idi p fp 0 fp addi p sp 40 sp ret L 26 addi grO 2 gr5 Because this section is processed only when if sethi p amp HI a gr6 flag is established the execution speed becomes du We Slower when if flag is not established bra L 27 K PREDICATE option and K NOPREDICATE option The K PREDICATE option specifies that a conditional instruction be output This option can be used for fcc935s command only When this option is specified a conditional jump instruction and subsequent instructions are replaced by conditional instructions Because this eliminates a branch instruction scheduling may be performed enabling generation of code with higher execution speed However because the system always executes the instructions on both paths of the conditional jump the execution speed may become slower than without using conditional instructions This option takes effect only when an optimization level of 1 or higher is specified simultaneously with the O option The NOPREDICATE suboption cancels the
43. labels This option can only be used with the fcc935s command The option is valid only when instruction scheduling is performed When the FUNC8 LABEL8 LOOP8 or INNERLOOP8 suboption is specified the compiler suffixes CODE section names with 8 and selects 8 as the section boundary value When the FUNC16 LABEL16 LOOP16 or INNERLOOP16 suboption is specified the compiler suffixes CODE section names with _16 and selects 16 as the section boundary value When the s option or pragma section is used to specify a section arrangement address it overrides the align option The FUNC8 suboption aligns the beginnings of functions on 8 byte boundaries while the FUNC16 suboption aligns them on 16 byte boundaries The LABEL8 suboption aligns branch labels on 8 byte boundaries while the LABEL16 suboption aligns them on 16 byte boundaries The LOOP8 suboption aligns the beginnings of loops recognized by the compiler on 8 byte boundaries while the LOOP16 suboption aligns them on 16 byte boundaries The INNERLOOP8 suboption aligns the beginnings of innermost loops recognized by the compiler on 8 byte boundaries while the INNERLOOP16 suboption aligns them on 16 byte boundaries An innermost loop is the loop at the deepest level in a nested loop structure The Xalign option disables the align value specified for labels When both align and Xalign options are omitted the Xalign option is used Remarks With the FR500 VLIW instruction
44. long a b c a MXOR b o LDFI FP 8 FRO LDFI FP 12 FR1 MXOR FRO FR1 FR2 STFI FR2 FP 4 MNOT FRi FRk FRk Fri unsigned long __MNOT unsigned long unsigned long a b MNOT b LDFI FP 8 FRO MNOT FRO FR1 STFI FR1 FP 4 135 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS B Media rotate Word instruction M instruction Assembler notation Operation of the instruction MROTLI FRi 56 FRk FRk left rotate FRI s6 Media built in function prototype unsigned long __MROTLI unsigned long int The second argument must be an immediate value The second argument is masked by OxSF Usage example Expansion example unsigned long a b MROTLI b 2 LDFI FP 8 FRO MROTLI FRO 2 FR1 STFI FR1 FP 4 MROTRI FRi 56 FRk FRk right rotate FRi s6 unsigned long __MROTRI unsigned long int The second argument must be an immediate value The second argument is masked by OxSF B Media Word CUT Instruction M Instruction Assembler notation Operation of the instruction MWOUT FRj FRk MWOUTI FRi 56 FRk FRk CUT FRi FRj FRk CUT FRi s6 136 Media built in function prototype Unsigned long MWOUT unsigned long long unsigr If the second argument is an immediate value it is masked by to generate the mwcuti instruction unsigned long a b
45. message outputs generated by tools other than the compiler refer to the respective manuals for the tool B Messages Generated in Translation Process A diagnostic message output example is shown in Figure 3 7 1 Diagnostic Message Example Figure 3 7 1 Diagnostic Message Example test c 4 E4020B O E4020B Source logical line number 4 Tool identifier Source file name Error number 4 digit Error level B Tool Identifier The tool identifier indicates the tool that has detected the error D Driver B Compiler e S Scheduler Internal tool for compiler A Assembler L Linker B Error Level The error level represents the diagnostic check result type Table 3 7 1 Relationship between Error Levels and Return Codes describes the relationship between various error levels and return codes and their meanings Table 3 7 1 Relationship between Error Levels and Return Codes Error Level Return Code Meaning Indicates a condition which does not constitute an error but requires attention Indicates a minor error Process execution continues without being interrupted The return code can be changed by the cwno option 70 3 7 Messages Generated in Translation Process Table 3 7 1 Relationship between Error Levels and Return Codes Continued Indicates a serious error Process execution stops Indicates a fatal error which is related to quantitative limitations or system failure Process e
46. no stipulations for unused registers in situations where the argument is less than 4 words 2 There are no stipulations for situations where a function without the return value is called or a function with a structure union type return value is called 8 There are no stipulations for situations where the function to be called has a return value other than a double or long double type 91 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 4 6 6 fcc911s Command Return Value The return value interface stated in the standard linkage regulations is indicated in Table 4 6 3 fcc911 Command Return Value Interface Stated in Standard Linkage Regulations B fcc911s Command Return Value Table 4 6 3 fcc911 Command Return Value Interface Stated in Standard Linkage Regulations void None char R4 signed char R4 unsigned char R4 short R4 unsined short R4 int R4 unsigned int R4 long R4 unsigned long R4 float R4 double R4 and R5 1 long double R4 and R5 1 Pointer address R4 Structure union R4 2 Class R4 3 1 The 4 high order bytes of a total of 8 bytes are stored in R4 and the remaining 4 low order bytes are stored in R5 2 When a structure union is used as the return value the caller function stores the start address of the return value storage area into R4 and then passes it to the callee function The callee function interprets R4 as the start address of the retur
47. oe die dee adel 74 4 2 Rules for Name Generation with the 9115 76 4 3 fcc911s Command Boundary Alignment 77 4 4 9115 Command Bit Field aE dae 78 4 5 fcc911s Command Structure Union sssssssssssssesseneeeeeeenn nennen nentes 80 4 6 fcc911s Command Function Call Interface ssssssssssssssesese enne eene nennen nennen nennen 82 4 6 1 fcc911s Command Stack Frame sse ener sentent nnn sin nenr enne 83 4 6 2 fcc911s Command Argument nente entr si nnns entren 85 4 6 3 1 9115 Command Argument Extension Format 88 4 6 4 1 9115 Command Calling Procedure sse ennemi 89 4 6 5 fcc911s Command Register 91 4 6 6 fcc911s Command Return Value sse 92 4 7 fcc911s Command Interrupt Function Call Interface ssssseeeeneneeeennenn nnns 93 4 7 1 fcc911s Command Interrupt Stack Frame ssssssssssssssseseeee eee nennen nenne 94 4 7 2 fcc911s Command Interrupt Function Calling Procedure 95 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 97 5 1 Secti
48. open Function The open function finds an unused I O port area and then returns as the file number the area s offset from the beginning of the I O section In such an instance the file name and open mode are not to be specified Even if files are opened using the same file name differing file numbers are assigned to them Files No 0 1 and 2 are initialized to the opened state Therefore the open function begins allocation with file No 3 unless files 0 1 and 2 are subjected to the close process B read Function The read function reads data from the I O port area specified by the address which is determined by adding the specified file number to the I O section start address The input from file No 0 is treated as a line input When the new line character n is entered the read function terminates even if the required character count is not reached Further this input is output to the standard output file No 1 The input from a file numbered other than 0 is treated as a block input Reading continues until the required character count is reached B write Function The write function writes data to the I O port area specified by the address which is determined by adding the specified file number to the I O section start address Unlike the input the operation does not vary with the I O port area address B iseek Function The file position cannot be specified in the simulator debugger Therefore the value 1 which indicates an uns
49. output section program CODE locate 0x000000ff global main main L 20 ret 130 6 6 Interrupt Level Setup Function 6 6 Interrupt Level Setup Function This function is used to set the function interrupt level B interrupt Level Setup Function General format pragma ilm NUM pragma noilm Explanation This function can only be used in the fcc911s command pragma ilm specifies the interrupt level for the subsequently defined function pragma noilm clears the interrupt level specifying At fcc 911s command an integer constant between 0 and 31 can be specified in the NUM position A hexa decimal octal or decimal number can be described Although the interrupt level is changed at the beginning of the specified function remember that the new interrupt level does not revert to the previous level at completion of function execution Always specify pragma ilm and pragma noilm as a set Nesting is not possible Output Example Input pragma ilm 1 void func void pragma noilm fcc911s command output func STILM 1 ST RP SP ENTER 4 L func LEAVE LD SP RP RET 131 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 6 7 Branch Probability Specification Function This function is used to specify a branch probability for a conditional branch B Branch Probability Specification Function General format pragma statement if true percentage Explanation This function specifies a pro
50. sample c Output func LDI 1 RO LDI 32 a R12 RET D ST RO R12 Operation fcc935s cpu MB93500 O x sub S sample c K noschedule Output _ func setlos 1 gr4 sethi hi _a gr5 setlo lo _a gr5 st gr4 gr5 grO ret 51 CHAPTER 3 C C COMPILER OPERATION 52 xauto size option and Xxauto option The xauto option effects in line expansion instead of function calling of functions whose logical line count is not less than size However recursively called functions will not be subjected to in line expansion It should also be noted that functions may not be subjected to in line expansion depending on asm statement use structure union type argument presence setjmp function calling and other conditions If the size entry is omitted the value 30 is assumed to be specified The values from 1 to 127 are valid for size The xauto option takes effect only when level 1 or more optimization is specified simultaneously with the O option The Xxauto option cancels the xauto option Output Example Input extern int a static void sub void a 1 void func void sub Operation fcc911s cpu MB91100 O xauto S sample c Output _ func LDI 1 RO LDI 32 R12 RET D ST RO R12 Operation fcc935s cpu MB93500 O xauto S sample c K noschedule Output _ func setlos 1 gr4 sethi hi _a gr5 setlo lo _a gr5 st gr4 gr5 gr0 ret K GS option and K NOGS op
51. stated in standard linkage regulations lists the return value interface stated in the standard linkage regulations B fcc935s Command Return Value Table 5 6 3 fcc935s command return value interface stated in standard linkage regulations fcc935s command return value interface stated in standard linkage regulations Table 5 6 3 fcc935s command return value interface stated in standard linkage regulations Return value type Return value interface void None char GR8 signed char GR8 unsigned char GR8 short GR8 unsigned short GR8 int GR8 unsigned int GR8 long GR8 unsigned long GR8 long long GR8 GR9 unsigned long long GR8 GR9 float GR8 double GR8 GR9 1 long double GR8 GRO9 1 Pointer address GR8 Structure union GR3 2 1 The 4 high order bytes of a total of 8 bytes are stored in GR8 and the 4 low order bytes are stored in 2 When a structure union is used as the return value the caller function stores the start address of the return value storage area in GR3 and then passes it to the called function The called function interprets GR3 as the start address of the return value storage area When this address needs to be saved in memory the called function allocates the hidden parameter save area and saves the address in that area 116 CHAPTER6 EXTENDED LANGUAGE SPECIFICATIONS This chapter explains about the extended language spec
52. system B System dependent Processes File input output memory management and program termination procedures are the processes dependent on the system When such system dependent processes are needed the libraries issue a call as a low level function For the details of low level functions see CHAPTER 9 LIBRARY INCORPORATION When using the libraries prepare such low level functions in accordance with the system B Low level Function System dependent Process Types The low level function types and their roles are summarized below For the detailed feature descriptions of low level functions see section 9 5 Low level Function Specifications open Function for opening a file in the system close Function for closing a file in the system read Function for reading characters from a file write Function for writing characters into a file seek Function for changing the file position isatty Function for checking whether a file is a terminal file sbrk Function for dynamically acquiring changing the memory e exit Function for normal program ending e _abort Function for abnormal program ending 166 CHAPTER9 LIBRARY INCORPORATION This chapter describes the processes and functions to be prepared for library use 9 1 Library Incorporation Overview 9 2 Initialization Termination Process Necessary for Library Use 9 3 Low level Function Types 9 4 Standard Library Functions and Required Proce
53. template is forcibly instantiated in the module Instantiation requires a complete template definition O pragma do_not_instantiate The specified template is not instantiated in the module O pramga can_instantiate The specified template is instantiated in the module if possible The possibility of instantiation is determined automatically by the compiler system Note that when the no_auto_instantiation option is specified instantiation is not performed lt Caution gt When executing modules pragma instantiate is specified only for one template in one module In other modules pragma do_not_instantiate must be specified The default is pramga can_instantiate If no specification is made the object is instantiated automatically by the compiler system CHAPTER7 EXECUTION ENVIRONMENT User programs are executed with or without the existence of an operating system In an environment in which the operating system exists it is necessary to prepare the setup process suitable for the environment This chapter describes the user program execution procedure to be performed in an environment where no operating system exists 7 1 Execution Process Overview 7 2 Startup Routine Creation 157 CHAPTER 7 EXECUTION ENVIRONMENT 7 1 Execution Process Overview In an environment where no operating system exists it is necessary to prepare the startup routine which initiates user program execution B Exec
54. the NOUNROLL suboption K VOLATILE Cancels the NOVOLATILE suboption Cancels the o option Cancels the s option XT item Cancels the T item specifying 3 4 Command Options Table 3 4 5 List of Command Cancel Options Continued Specifying Format Function Cancels the V option Cancels the x option Xxauto Cancels the xauto option XY item Cancels the Y item specifying Cancels the e option Cancels the L option Cancels the I option Cancels the m option Xra Cancels the ra option Xro Cancels the ro option Xsc Cancels the sc option Xstartup Cancels the startup option Table 3 4 6 List of Command Cancel Options For fcc911s K NOREALOS Cancels the REALOS suboption Table 3 4 7 List of Command Cancel Options For fcc935s Xalign Cancels the align option K NOGS Cancels the K GS option K SCHEDULE Cancels the K NOSCHEDULE option K NOPREDICATE Cancels the K PREDICATE option K SWPL Cancels the K NOSWPL option Xsplitsection Cancels the splitsection option 25 CHAPTER 3 C C COMPILER OPERATION Table 3 4 8 List of Command Cancel Options For C Source Specifying Format Function no alternative tokens Cancel the alternative tokens option auto instantiation Cancel the no auto instantiation option new for int Cancel the old for init option
55. to sample obj The relationship among file types translation control related options and processes is shown in Table 3 5 2 Relationship Among File Types Translation Control Related Options and Processes Table 3 5 2 Relationship Among File Types Translation Control Related Options and Processes Option File Type Nothing Specified C C source file P C andA P C AandL Preprocessed C C source file CandA Assembler source file A and L Object file L P Preprocessing C Compiling A Assembling L Linking Example gt fcc911s E file1 c file2 i cpu 91100 gt fcc935s E filet c file2 i cpu MB93500 Subjects files named file1 c to preprocessing and outputs the result to the standard output No processing is performed for file2 i 29 CHAPTER 3 C C COMPILER OPERATION gt fcc911s S file1 c file2 i file3 asm cpu MB91100 gt fcc935s S file1 c file2 i file3 asm cpu MB93500 Subjects a file named file1 c to preprocessing and compiling and a file named file2 i to compiling Performs nothing for a file named file3 asm As a result files named file1 asm and file2 asm are generated in the current directory 30 3 5 Details of Options 3 5 2 Preprocessing Related Options This section deals with the options related to preprocessing operations If the preprocessing is not called the preprocessing related options are invalid B Preprocessing Related Options The pr
56. tokens option and no alternative tokens option The alternative tokens option enables alternative representation For the specifications for alternative representation refer to ISO ICE 14882 1988 The no alternative tokens option cancels the alternative tokens option for init option and new for init option The old for init option makes a change so that the scope of variables declared in the initialize statement in the for statement is interpreted as being within the old specifications The new for init option cancels the old for init option 3 5 Details of Options Example Input extern void func int int main for int i20 i lt 10 i func i func i Possible only for old specifications return 0 Operationfcc911s S old for init sample cpp cpu MB91100 fcc935s S old for init sample cpp cpu MB93500 45 CHAPTER 3 C C COMPILER OPERATION 3 5 5 Optimization Related Options This section deals with the options related to optimization by the compiler E Optimization Related Options 46 O K SIZE option Selects an appropriate optimization combination with emphasis placed upon the object size The selected options in the fcc911s command are indicated below e 03 KEOPT KNOUNROLL K SHORTADDRESS The options for the fcc935s command are indicated below e 03 e KEOPT KNOUNROLL To change the above combination specify for example the 01 opti
57. used for a module name are an underbar and alphanumeric characters The first character of the name must be an underbar and an alphabetic character When other characters are used for a file name a character that cannot be used for a module name is converted to an underbar A file name that will be identical to a module name after conversion should not be used Example abc c and abc c will have the same module name abc 3 4 Command Options 3 4 Command Options The command options are explained below B Option Syntax The option consists of a hyphen and one or more characters following the hyphen Some options have an argument A blank character string must be positioned between an option and an argument The command options cannot be grouped for purposes of specifying Grouping is a technique of specifying which for instance uses a Sg form to specify both the S option and g option B Multiple Specifying of Same Option If the same option is specified more than one time only the last specified option in the command line is assumed to be valid Example gt fcc911s o outfile file c o outobj cpu MB91100 gt fcc935s o outfile file c o outobj cpu MB93500 The name of a file to be output is outobj The options listed below can be specified more than once for the same command and are different in meaning each time Options that are significant when specified more than one time D f l
58. 3 5 1 Translation Control Related Options The translation control related options are related to preprocessor compiler assembler and linker call control B Translation Control Related Options 28 The priorities of the translation control related options are defined as follows They are not related to the order of specifying E gt P gt S gt c The translation control related option exclusiveness is shown in Table 3 5 1 Translation Control Related Option Exclusiveness Table 3 5 1 Translation Control Related Option Exclusiveness Specified Option Option Invalidated If the E and P options are specified simultaneously see the explanation below E Option E Option is subjects all files to preprocessing and outputs the result to the standard output The output result contains the preprocessing instruction generated by the preprocessor which is necessary for the compiler The information targets for the preprocessing instruction generated by the preprocessor are the line and pragma instructions If the P option is specified together with the E option the preprocessing instruction generated by the preprocessor is inhibited If the input file is not a C source file or C source file the E option does not do anything Example fcc911s E cpu MB91100 sample c gt fcc935s E cpu MB93500 sample c The sample c preprocessing result is output to the standard output P Option P option su
59. 35s command register setup 114 fcc935s command sbrk c source program list 198 fcc935s command section structure 98 fcc935s command stack frame 107 fcc935s command structure Union 104 fcc935s command macro predefined 152 TODU Bi eicit scl ene iar 204 FEEAN 5 ai iere e ERI HD 13 EETOQONHL 5 need etes 8 TO NAME inier esc e EN EE ER 18 Illo type eet etie numm 164 file system 192 onere nece A 201 floating point data 186 G generation rule for name used by fcc935s 100 H header file search 5 l I O area access function 127 INC911 1NC935 ssssseeenee 11 MIAN ZATION e ether th rere 193 initialization termination process 169 in line expansion specifying function 129 integer operation built in function 150 interrupt function calling procedure 95 interrupt function description function 125 interrupt level setup function 125 131 interrupt mask disable function 124 interrupt mask setup function
60. 4 GLOBAL a a RES B 4 119 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 120 fcc935s Command Output Example Input Output When written inside the function extern int temp sample asm setlos 1 gr4 __asm sethi hi _temp gr5 __asm setlo lo _temp gr5 _ asm st gr4 gr5 gr0 When written outside the function __asm SECTION DATA DATA ALIGN 8 __asm GLOBAL __asm _a __asm RES B 4 section CODE CODE align 4 global sample _sample L 20 subi sp 16 sp st fp sp gr0 mov sp fp movsg LR gr4 sti gr4 fp 8 L 21 setlos 1 gr4 sethi hi _temp gr5 setlo lo _temp gr5 st gr4 gr5 gr0 L 22 Idi fp 8 gr4 movgs gr4 LR addi fp 16 sp Id fp gr0 fp ret L 23 SECTION DATA DATA ALIGN 8 GLOBAL _a _ RES B 4 6 1 Assembler Description Functions B Description by Pragma Instruction Expands the description between pragma asm and pragma endasm directly as the assembler instruction This function makes it possible to write the statement inside and outside the function General format pragma asm Assembler description pragma endasm Explanation When the statement is written inside the function the assembler is expanded at the written position When the statement is written outside the function it is expanded as an independent section Therefore if the statement is to be written outside the function be sure to writ
61. 6 LO FRk LO FRi gt gt s6 unsigned long __MSRLHI unsigned long int The second argument must be an immediate value The second argument is masked by Ox3F unsigned long a b a MSRLHI b 4 FP 8 FRO MSRLHI FRO 4 FR2 STFI FR2 FP 4 MSRAHI FRi s6 FRk HI FRk HI FRi gt gt s6 LO FRk LO FRi gt gt s6 signed long MSRAHI signed long int The second argument must be an immediate value The second argument is masked by Ox3F signed long a b MSRAHl b 4 LDFI FP 8 FRO MSRAHI FRO 4 FR2 STFI FR2 FP 4 137 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS B Media Saturation Operation Halfword Dual Instruction M Instruction Assembler notation Operation of the instruction MSATHS FRi FRj FRk HI FRK SSAT HI FRi HI FRj LO FRk SSAT LO FRi LO FRj Media built in function prototype signed long MSATHS signed long signed long Usage example Expansion example signed long a b c a MSATHS b LDFI FP 8 FRO LDFI FP 12 FR1 MSATHU FRO FR1 FR2 STFI FR2 FP 4 MSATHU FRi FRj FRk HI FRK USAT HI FRi H FRj LO FRk USAT LO FRi LO FRi unsigned long __MSATHU unsigned long unsigned long unsigned long a b c a MSATHS b LDFI FP 8 FRO LDFI FP 12 FR1 MSATHU FRO FR1 FR2 STFI FR2 FP 4 B Media Dual Saturation Addition
62. ACCk HI Fri LO FRj LO Fri LO FRi void __MCPXRU int unsigned long unsigned long The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h unsigned long b c _MCPXRU ACC3 b LDFI FP 8 FRO FP 12 FR2 MCPXRU FRO FR2 ACC3 143 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS Assembler notation Operation of the instruction MCPXIS FRi FRj ACCk Media built in function prototype void MCPXIS int signed long signed long ACCGk ACCk HI Fri LO FRi LO Fri LO FR The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h Usage example Expansion example signed long b c _MCPXIS ACCS5 b c LDFI FP 8 FRO FP 12 FR2 MCPXIS FRO FR2 ACC5 MCPXIU FRi FRj ACCk void MCPXIU int unsigned long unsigned long ACCGk ACCk HI Fri LO FRj LO Fri LO FRj The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h unsigned long b c MCPXIU ACCT b c LDFI FP 8 FRO FP 12 FR2 MCPXIU FRO FR2 ACC7 B Media Quad Complex Product Sum Operation Halfword Quad Instruction M Instruction Assembler notation Operation of the instruction MQCPXRS FRi FRj ACCk ACCGk ACCk HI FRi LO FRj LO FRi LO FRj ACCGk 1 ACCk 1 HI FRi 1
63. C6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h LDFI FP 8 FRO FP 12 FR1 MMULXHS FRO FR1 ACC4 139 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS Assembler notation Operation of the instruction MMULXHU FRi FRj ACCk ACCGk ACCk HI FRi LO FRj ACCGk 1 ACCk 1 LO FRi HI FRj Media built in function prototype Usage example void MMULXHU int unsigned long unsigned long Expansion example unsigned long b c MMULXHU ACCS b c The first argument must be ACCO ACC2 ACCA or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h FP 8 FRO LDF FP 12 FR1 MMULXHU FRO FR1 ACC6 B Media Dual Multiplication and Addition Operation Halfword Dual Instruction M instruction Assembler notation Operation of the instruction MMACHS FRi FRj ACCk ACCGk ACCk HI FRi LO FR ACCGk 1 ACCk 1 LO FRi HI FRj Media built in function prototype void MMACHS int signed long signed long The first argument must be ACCO ACC2 ACCA or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h Usage example Expansion example signed long b c _MMACHS ACCO b c LDFI FP 8 FRO LDFI FP 12 FR1 MMACHS FRO FR1 ACCO MMACHS FRi FRj ACCk ACCGk ACCk HI FRi LO FRj ACCGk 1 ACCk 1 LO FRi HI FRj void _ MMACHU int unsigned l
64. Command Cancel Options list the command options Options listed in the tables are recognized by the command B List of Command Options 20 Specifying Format Table 3 4 1 List of Command Options Function Allow a C style comment Leaves a comment in the preprocessing result Perform processing up to assembling and output the result to obj cmsg Outputs the compiling process end message to the standard output cpu MB number Specify the MB number of the CPU used Cwno Set the end code for warning to 1 D name tokens Defines the macro name E Performs preprocessing only and outputs the result to the standard output f filename Specifies the option file Adds to the object the information necessary for debugging Outputs the acquired header file pathname to the standard output help Outputs the option list to the standard output dir Specifies the directory for head file search INF LIST Generates the assemble list INF LONGMESSAGE Details a message at translating INF SRCIN LINENO Insert the associated C source information as a comment into the assembler source INF STACK filename Generates the stack use amount data J a Specifies the specification level of the language to be interpreted by the compiler 3 4 Command Options Table 3 4 1 List of Command Optio
65. Example 3 5 Details of Options Input extern int a b void func int flag if flag a b 1 else a b 2 Operation fcc935s Output X func L 20 L 21 cpu MB93500 O K ne1 S sample c K noschedule subi sp 40 sp mov gr8 gr10 gr10 grO iccO sethi hi b gr10 setlo lo _b gr10 nld gr10 90 gr11 nld Q gr10 grO gr10 beq iccO 40 L 23 clrgr gr10 commitgr gr11 addi gr11 1 gr4 sethi hi _a gr5 setlo lo _a gr5 st gr4 gr5 910 bra L 25 clrgr grit commitgr gr10 addi gr10 2 gr6 sethi hi _a gr7 setlo lo _a gr st gr6 gr7 gro addi sp 40 sp ret O K NOSWPL option and K SWPL option The K NOSWPL option specifies that instruction rearrangement based on instruction parallelization is not conducted for optimization of loop unrolling This option can be used for the fcc935s command only This option takes effect only when an optimization level of 2 or higher is specified simultaneously with the O option This option is ignored when the K NOUNROLL option is specified The SWPL suboption cancels the NOSWPL suboption 55 CHAPTER 3 C C COMPILER OPERATION 3 5 6 Output Object Related Options This section describes the options related to output object formats Output Object Related Options 56 O align FUNC8 FUNC16 LABEL8 LABEL16 LOOP8 LOOP16 INNERLOOPS INNERLOOP16 option and Xalign option The align option aligns branch
66. FR2 FP 4 Usage example Expansion example unsigned long a unsigned short b c MPACKH b LDHFI FP 6 FRO LDHFI FP 8 FR1 MPACKH FRO FR1 FR2 STFI FR2 FP 4 MUNPACKH Fri FRk HI FRk HI FRi LO FRk HI FRi HI FRk 1 LO FRi LO FRk 1 LO FRi 146 unsigned long long MUNPACKH unsigned long Unsigned long long a Unsigned long b MUNPACKH b LDFI FP 12 FRO MUNPACKH FRO FR1 STDFI FR1 FP 8 B Media Halfword Pack Dual Instruction M Instruction Assembler notation Operation of the instruction MDPACKH FRi FRj FRk HI FRk LO FRi LO FRk LO FRj HI FRk 1 LO FRI 1 LO FRk 1 LO FR 1 Media built in function prototype unsigned long long MDPACKH unsigned short unsigned short unsigned short unsigned short B Media Byte Halfword Conversion Instruction M Instruction 6 8 Built in Function Usage example Expansion example unsigned long long a unsigned short b c d e a _MDPACKH b c d e LDHFI FP 10 FRO LDHFI FP 12 FR1 LDHFI FP 14 FR2 LDHFI FP 16 FR3 MDPACKH FRO FR2 FR4 STDFI FR4 FP 8 Assembler notation Operation of the instruction MBTOH FRi FRk HI FRk unsignedshort BYTE3 FRi LO FRk unsigned short BYTE2 FRi HI FRk 1 unsigned short BYTE1 FRi 1 unsigned short BYTEO FRi LO FRk Media built in function prot
67. FR2 ACC4 B Media Quad Cross Multiplication Halfword Quad Instruction M Instruction Assembler notation Operation of the instruction MQMULXHS FRi FRj ACCk ACCGk ACCk HI FRi LO FRj ACCGk 1 ACCk 1 LO FRi HI FR ACCGk 2 ACCk 2 HI FRi 1 LO FR 1 ACCGk 3 ACCk 3 LO FRi 1 HI FRj 1 Media built in function prototype void MQMULXHS int signed long long signed long long The first argument must be ACCO or ACCA ACCO and ACCA are list constants defined in media h Usage example Expansion example signed long long b c _MMULXHS ACCO b c LDFI FP 8 FRO LDFI FP 12 FR2 MMULXHS FRO FR2 ACCO MQMULXHU FRi FRj ACCk ACCGk ACCk HI FRi LO FRj ACCGk 1 ACCk 1 LO FRi HI FRj ACCGk 2 ACCKk 2 HI FRi 1 LO FRj 1 ACCGk 3 ACCk 3 LO FRi 1 HI FRj 1 142 void MQMULXHU int unsigned long long unsigned long long The first argument must be ACCO or ACCA ACCO and ACCA are list constants defined in media h unsigned long long b c _MMULXHU ACC4 b LDFI FP 8 FRO LDFI FP 12 FR2 MMULXHU FRO FR2 ACC4 6 8 Built in Function B Media Quad Multiplication and Addition Operation Halfword Quad Instruction M Instruction Assembler notation Operation of the instruction MQMACHS FRi FRj ACCk Media built in function prototype void MQOMACHS int signed long long signed long long ACCGk
68. FR2 MQCPXIS FRO FR2 ACC4 MQCPXIU FRi FRj ACCk ACCGk ACCk HI FRi LO FRj LO FRi LO FRj ACCGk 1 ACCk 1 HI FRi 1 LO FRj 1 LO FRi 1 LO FRj 1 void MQCPXIU int unsigned long long unsigned long long The first argument must be ACCO ACC2 or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h B Media CUT Instruction M Instruction Assembler notation Operation of the instruction ACCi FRj FRk MCUTI ACCi s6 FRk Media built in function prototype unsigned long MCUT int unsigned long FRk 2CUT ACCGi ACCI FRj FRk CUT ACCGi ACCi s6 The first argument must be ACCO to ACC7 media h is masked by Ox3F unsigned long long b c MQCPXIU ACCS b c ACCO to ACC7 are list constants defined in If the second argument is an immediate value it LDDFI FP 16 FRO LDDFI FP 24 FR2 MQCPXIU FRO FR2 ACC6 Usage example Expansion example unsigned long a c a _MCUT ACCO c a _MCUT ACC1 4 LDFI FP 8 FRO ACCO FRO FR1 STFI FR1 FP 4 MCUTI ACC1 4 FR1 STFI FR1 FP 4 MCUTSS ACCi FRj FRk MCUTSSI ACCi s6 FRk unsigned long __MCUTSSiint signed long FRk SSAT CUT ACCGi ACCi FRj FRk SSAT CUT ACCGi ACCi s6 The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h is masked by Ox3F If the second argument is a
69. FUJITSU SEMICONDUCTOR CONTROLLER MANUAL FR V FR FAMILY SOFTUNE C C COMPILER MANUAL for V5 January 2001 the second edition Published FUJITSU LIMITED Electronic Devices Edited Technical Communication Dept
70. LEVEL FUNCTION LIBRARY 11 1 Low level Function Library Overview The low level function library is outlined below B Low level Function Library Overview The low level function library offers the functions that are necessary when the standard library is used with the simulator debugger The main functions are as follows File manipulation functions based on I O port simulation open close read write Iseek isatty Dynamic memory allocation function sbrk In the simulator debugger the program executed cannot terminate its own execution Therefore prepare the abort and _ exit functions B File System Overview The low level function library uses the I O port simulation function of the simulator debugger to carry out standard input output operations and input output operations relative to files These operations are completed by performing input output operations relative to one I O port area which is regarded as one file When the open function is called it allocates a 1 byte area of the I O port simulation area I O section defined by the low level function library and returns as the file number the offset from the beginning of the allocated area The read function and write function perform input output operations relative to the 1 byte area allocated by the open function Input output operations can be performed relative to the standard input output and files when such standard input output and files are alloc
71. MB91100 gt fcc935s D os m D sys file c cpu MB93500 In a file named file c processing is conducted on the assumption that the macro definitions for os and sys are m and 1 respectively H option and XH option H option outputs to the standard output the header file pathnames acquired during preprocessing The pathnames are sequentially output one for each line in the order of acquisition If there are any two exactly the same pathnames only the first one will be output When this option is specified the command internally sets up the E option to subjects all files to preprocessing only However the preprocessing result will not be output The XH option cancels the H option Output Example Input include lt stdio h gt include head h Operation fcc911s H cpu MB91100 sample c Output usr softune5 lib 91 1 include stdio h head h Operation fcc935s H cpu MB93500 sample c Output usr softuneb5 lib 935 include stdio h head h l dir option and XI option Changes the manner of header file search so that the directory specified by dir will be searched prior to the standard directory The standard directory is INC911 for the fcc911s command and INC935 for the fcc935s command This option can be specified more than one time The search will be conducted in the order of specifying When this option is specified the header file search will be conducted in the following directories in the order indicated below
72. NTER 4 LDI 1 RO LDI 32 temp R12 ST RO R12 L sample LEAVE LD SP RP RET SECTION DATA DATA ALIGN 4 GLOBAL a _ RES B 4 122 6 1 Assembler Description Functions fcc935s Command Output Example Input Output When written inside the function extern int temp sample pragma asm setlos 1 gr4 sethi hi _temp gr5 setlo lo _temp gr5 st gr4 gr5 gr0 pragma endasm When written outside the function pragma asm SECTION DATA DATA ALIGN 8 GLOBAL _a _ RES B 4 pragma endasm section CODE CODE align 4 global sample sample L 20 Subi sp 16 sp st fp sp gr0 mov sp fp movsg LR gr4 sti gr4 fp 8 L 21 setlos 1 gr4 sethi hi _temp gr5 setlo lo _temp gr5 st gr4 gr5 gr0 L 22 Idi fp 8 gr4 movgs gr4 LR addi fp 16 sp ld fp gr0 fp ret L 23 SECTION DATA DATA ALIGN 8 GLOBAL a _ RES B 4 123 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 6 2 Interrupt Control Functions Interrupt Control Functions e Interrupt mask setup function Interrupt mask disable function Interrupt level setup function Interrupt function description function Interrupt vector table generation function B interrupt Mask Setup Function General format void Dl void Explanation This function can only be used in the fcc911s command Expands the interrupt masking code Output Example Input _ _DI fcc911s Command Outpu
73. O V option and XV option V option outputs the version information about each executed compiler tool to the standard output The XV option cancels the V option fcc911 Command Output Example FR Family Softune C C Compiler V50L01 ALL RIGHTS RESERVED COPYRIGHT C FUJITSU LIMITED 1998 LICENSED MATERIAL PROGRAM PROPERTY OF FUJITSU LIMITED fcc935 Command Output Example FR V Family Softune C C4 4 Compiler V50L01 37 CHAPTER 3 C C COMPILER OPERATION 38 Input ALL RIGHTS RESERVED COPYRIGHT C FUJITSU LIMITED 1986 LICENSED MATERIAL PROGRAM PROPERTY OF FUJITSU LIMITED W level option w level option specifies the output level of warning type diagnostic messages The level can be specified between 0 and 8 but there is no difference between levels 1 and 8 This level specification is provided to ensure compatibility between the Softune C compiler and option When level 0 is specified no warning messages will be generated If the level description is omitted level 0 is assumed When the w level option itself is omitted w 1 applied For the details of diagnostic messages see section 3 7 Messages Generated in Translation Process Output Example const unsigned int a 1 _ Operation fcc911s w 5 S cpu 91100 sample c 9355 w 5 S cpu MB93500 sample c Output sample c 1 W1068B warning integer conversion resulted in a change of sign Operation fcc911s w S cpu MB91100 sample
74. O Area Access Function a ensis nrte nennen aa senten sens 127 6 4 In line Expansion Specifying Function sssssssssseseseeeeeeeeeneeen nennen nennen enne 129 6 5 Section Change nennen intret enne 130 6 6 Interrupt Level Setup Function 131 6 7 Branch Probability Specification Function sess 132 6 8 Built in PUM Ct Orbe cerei teo eter uri Gites aha SERRE MESH PER ge ERE REDDE 133 6 8 1 Media Instruction Built in Function 2 0 eee eee eenne eee eeeeaaeeeeeeaaeeeeeeeaaeeeeeeeaaaeeeeeeeaaeeeeeeeaaeeeeeeeeaaes 135 6 8 2 Integer Operation Built in Function eene rnnt nnne 150 6 9 Predefined Macros usa eO Re EE RESO etu ase 151 6 10 Limitations on Compiler Translation renis 153 6 11 Re include Prevention Function 155 6 12 Function for Controlling Instantiation of C Template 156 CHAPTER 7 EXECUTION ENVIRONMENT nennen nennen nennen nante 157 7 1 Execution Process Overview ssssssssssssssssssseseeee eee entenn 158 7 2 5
75. ORTADDRESS CODE DATA LONGADDRESS CODE DATA Specifies the method for handling external symbols Table 3 4 3 List of Command Options For fcc935s Specification format align FUNC8 FUNC16 LABELS LABEL16 LOOP8 Function Specifies that branch labels are to be aligned LOOP16 INNERLOOPS INNERLOOP16 K A1 A4 A8 Specifies the minimum boundary alignment value for static data KGS Specifies that global scheduling is to be applied for instruction transfer beyond the branch K NOSCHEDULE Specifies that optimization for instruction scheduling is not effected K PREDICATE Specifies that a conditional instruction is output K NEO NE1 NE2 Specifies the output method for the Non excepting instruction 3 4 Command Options Table 3 4 3 List of Command Options For fcc935s Continued K NOSWPL Specifies that software pipelining is not performed splitsection Specifies that CODE sections having different names are generated for different functions Table 3 4 4 List of Command Options for C Source Specifying Format Function t none used all local Specify the type of template instantiation alternative tokens Enable an alternative keyword no auto instrantiation Suppress automatic instantiation of a template old for init Use the ANSI or earlier specifications for the scope of declaration in the for initialize expr
76. Options 24 3 5 Details of Options dp ee ERE Ep e etos pe ou d debe RUE io eds 27 3 5 1 Translation Control Related Options sssssssssssssssssseeneeennee nennen nnne nene 28 3 5 2 Preprocessing Related Options nennen nensi nnne nene 31 3 5 8 Data Output Related Options nennen entente 34 3 5 4 Language Specification Related Options sse enne 40 3 5 5 Optimization Related Options sssssssssssssssssesseeeee nennen nennen snnt inns nnn 46 3 5 6 Output Object Related Options sse eene nnn enne 56 3 5 7 Debug Information Related Options sssssssssssssssessseeseeennen enne nnn 63 3 5 8 Command Related OplOrS creto eet tart ee i Ped HE a tate or c peii ee 64 3 5 9 Linkage Related Options sse eee nennen nennen entretenir inns nennen nene 65 3 5 10 Option File Related Options 67 3 6 Option FSS ODE ERR 68 3 7 Messages Generated in Translation Process sssssssssssssseeeee eene enne nnne nnn 70 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 73 4 1 Section Structure of fcc91 Ts iced esee ne eae dae
77. STACK fileJoption outputs the stack use amount data Generates the specified file in the current directory and outputs the stack use amount data If no file is specified the information in all the simultaneously compiled files is output into files whose names are determined by changing the source file extensions to stk For stack use amount data utilization procedures and data file specifications refer to the Softune C C analyzer Manual The NOSTACK suboption cancels the STACK suboption 36 3 5 Details of Options Output Example Input extern void sub void void func void sub Operation fcc911s INF stack S cpu MB91100 sample c Output sample c E Extern S Static I Interrupt Stack E S I function name A gt EIS call function 8 E _ func gt E _ sub Operation fcc935s INF stack S cpu MB93500 sample c Output S Static I Interrupt Stack 5 1 function name A gt EIS call function 40 E _ func gt E _ sub O o pathname option and Xo option pathname option uses the pathname as the output file name If this option is not specified the default for the employed file format is complied with The Xo option cancels the o option Example gt fcc911s o output asm S cpu MB91100 sample c gt fcc935s o output asm S cpu MB93500 sample c The sample c preprocessing and compiling process result are output to the output asm
78. TA DATA ALIGN 4 GLOBAL _c2 _C2 RES B 4 Aligned on 4 byte bou GLOBAL c1 ct RES B 4 Aligned on 4 byte bou O K SARG DARG option Specifies type of acquisition of area required for argument delivery to function 59 CHAPTER 3 C C COMPILER OPERATION 60 This option can only be used in the fcc911s command When the DARG suboption is specified dynamic allocation is achieved at function calling This effectively decreases the stack consumption On the other hand when the SARG suboption is specified allocation is performed at the beginning of the caller function In this case the code size generally decreases with an increase in execution speed However stack use tends to increase If this option is not specified K SARG is applied Output Example Input extern void sub int int int int int void func void sub 1 2 3 4 5 Operation fcc911s K darg S cpu MB91100 sample c Output LDI 1 R4 LDI 2 R5 LDI 3 R6 LDI 4 R7 LDI 5 RO ST RO SP The argument area is allocated dynamically CALL32 _ sub R12 ADDSP 4 The argument area is allocated dynamically varorder sort normal option The varorder normal option causes static variables to be stored in memory in the order in which they are described in the source Variables with an initial value and those without initial value are stored in different sections so description with these sections mixed prevents the variables from being
79. XP DBL MANT DIG LDBL DIG FLT MIN 10 EXP DBL MAX EXP LDBL MAX 10 EXP FLT EPSILON DBL MIN UCHAR MAX UINT MAX LONG MAX UCHAR MAX UINT MAX LONG MAX 201 APPENDIX A List of Types Macros Functions and Variables Provided by C Libraries math h O Macros HUGE VAL EDOM ERANGE O Function acos asin atan atan2 cos sin tan cosh sinh tanh exp frexp Idexp log log10 modf pow sqrt ceil fabs floor fmod B setjmp h O Type jmp buf O Macros setjmp O Function longjmp E stdarg h O Type va list O Macros va start va arg va end B stddef h O Type ptrdiff t size_t O Macros NULL _ offsetof 202 APPENDIX A List of Types Macros Functions and Variables Provided by C Libraries B stdio h O Type ptrdiff t O Macros NULL _IONBF stdout getc O Function putchar fflush fprintf sscanf fgets ungetc fsetpos ferror stdlib h O Type ptrdiff t O Macros NULL size t EOF _IOLBF stderr offsetof putc fopen fscanf vfprintf fputc fread ftell size t offsetof FILE SEEK SET _IOFBF putchar getchar freopen printf vprintf fputs fwrite rewind div t EXIT FAILURE fpos t SEEK CUR BUFSIZ putc getc setbuf scanf vsprintf gets fgetpos clearerr Idiv t EXIT SUCCESS SEEK END stdin getchar fclose setvbuf sprintf fgetc puts fseek feof RAND MAX 203 APPENDIX A List of Types Macros Functions and Variable
80. alignment value char type signed char type unsigned char type short int type unsigned short int type int type unsigned int type long int type unsigned long int type long long int type unsigned long long int type float type double type long double type Pointer type Related Section in the JIS Standard 6 5 2 1 Structure specifier and union specifier This Compiler 1 byte 1 byte 1 byte 2 byte 2 byte 4 byte 4 byte 4 byte 4 byte 8 bytes for fcc935s command 8 bytes for fcc935s command 4 byte 8 byte 8 byte 4 byte Character constant expression code system for preprocessor ASCII code Registers that can be specified within asm statement RO R1 R2 R3 R12 R13 for fcc911s command 3 GR4 to GR7 GR32 to GR47 FRO to FR15 FR82 to FR47 for fcc935s command 3 ANSI compliant standard library function support 1 Alterable through option use Refer to the volume entitled Libraries 2 See section 11 2 Low level Function Library Use Floating point Data Format and Expressible Value Range 8 The other registers can be used when they are saved and recovered by the user 185 CHAPTER 10 COMPILER DEPENDENT SPECIFICATIONS 10 2 Type of Floating point Data and Range of Representable Values Table 10 2 1 Type of Floating point Data and Range of Representable Values lists the floating point data types and the range of values that can be expressed for each type
81. and library files The four fcc911s command library files below are provided ib911 lib Standard C library lib911if lib Simulator debugger low level function library lib911e lib EC library lib911p lib C library having the same contents as lib911e lib O fcc935s command library files The four fcc935s command library files below are provided lib935 lib Standard C library lib935if lib Simulator debugger low level function library lib935e lib EC library lib935p lib C library having the same contents as lib935e lib B fcc911s Command Library Section Names Table 8 1 1 fcc911s Command Library Section Names show the section names used by the fcc911s command libraries Table 8 1 1 fcc911s Command Library Section Names Section Type Small Code section Data section Initialized section Constant section B fcc935s Command Library Section Names Table 8 1 2 fcc935s Command Library Section Names show the section names used by the fcc935s command libraries Table 8 1 2 fcc935s Command Library Section Names Code section LIBCODE function name 16 Data section DATA 164 8 1 File Organization Table 8 1 2 fcc935s Command Library Section Names Continued Initialized section Constant section 165 CHAPTER 8 LIBRARY OVERVIEW 8 2 Relationship to Library Incorporating System This section describes the relationship between the libraries and library incorporating
82. ar unsigned char short unsigned short int unsigned int long unsigned long long long unsigned long long float double AJ olo A AJ HR HR MY AJo o A AJ HR HR MY long double Pointer address 4 4 Structure union Explained later Explained later Note Some variables are aligned on 4 byte boundaries when the K A4 option is specified or aligned on 8 byte boundaries when the K A8 option is specified The K A4 and K A8 option do not affect structure union member boundary alignment 101 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 4 fcc935s Command Bit Field The fcc935s command bit field data size and boundary alignment are explained below The bit field data is assigned to a storage unit that has an adequate size for bit field data retention and is located at the smallest address B fcc935s Command Bit Field Consecutive bit field data is packed at consecutive bits having the same storage unit beginning with LSB and continuing toward the MSB regardless of the type An example is shown in Figure 5 4 1 fcc935s Command Bit Field Data Size and Boundary Alignment Example Figure 5 4 1 fcc935s Command Bit Field Data Size and Boundary Alignment Example 1 struct tagl 31 MSB 21 16 O LSB If a field for assignment lies beyond bit field type boundary its assignment is completed by aligning it with a bou
83. ar c 1 void func void data c Operation fcc911s K schar cpu MB91100 S sample c Output LDI 32 c R12 LDUB R12 RO EXTSB RO Code extended 10 32 data R12 ST RO R12 Operation fcc935s K schar cpu MB93500 S sample c K noschedule Output sethi hi _c gr4 setlo lo _c gr4 Idsb gr4 gr0 gr5 Code extended sethi hi _data gr6 setlo lo _data gr6 st gr5 gr6 grO O K REALOS option and K NOREALOS option The REALOS suboption effects in line expansion of the ITRON system call function It can be used in cases where a program running under REALOS is to be prepared This option can only be used in the fcc911s command For the ITRON system call function refer to the REALOS FR Kernel Manual When specifying the REALOS suboption be sure to include the system call declaration header file furnished by the REALOS If the REALOS suboption is specified without including the system call declaration header file and system call inline expansion is initiated the operation is not guaranteed because it is possible that an adequate argument type check has not been completed The NOREALOS suboption cancels the REALOS suboption Output Example Input include itron h include realos h void func void ext tsk Operation fcc911s K realos cpu MB91100 S sample c Output LDI 8 21 R12 EXTSB R12 INT 64 O K UBIT SBIT option Specifies whether or not to treat the most significant bit as a
84. arranged in the order in which they are described in the source The varorder sort option sorts the order of storing static variables in memory according to the order of variable alignment Specifying this option reduces the size of unused static variable areas 3 5 Details of Options Example Input Source long a char b long c char d Operation fcc911s S varorder normal cpu MB91100 sample c fcc935s S varorder normal cpu MB93500 sample c Output ALIGN 4 GLOBAL a RES B 4 ALIGN 1 GLOBAL b RES B 1 ALIGN 4 GLOBAL c RES B 4 ALIGN 1 GLOBAL _d RES B 1 O t none used all local option This option is valid only for the C source It specifies the type of template instantiation The t none option provides instantiation at object generation Instantiation is done at linking The t used option instantiates only the parameter type template functions and template member functions used in the module The t all option instantiates even unused member functions if they are of parameter type and template class used in the module The t local option generates template functions and template member functions used in the module as the in module local functions Note that overlapping instantiation by the used and all options is not allowed when more than one template is linked For information on the template see section 10 5 Limitations on Use of C Template The default is t none O no auto
85. ated to the above mentioned area prior to program execution using simulator debugger commands set inport and set outport The close function frees an already allocated area to render it reusable Since the file position cannot be changed in the simulator debugger the value 1 is always returned for the Iseek function B Area Management 192 An already acquired external variable area is used as the area returned by the sbrk function When the sbrk function is called area allocation begins with the lowest address of the area 11 2 Low level Function Library Use 11 2 Low level Function Library Use This section describes the load module creation and simulator debugger setup procedures to be performed for low level function library use E Initialization No initialization is required except for steam init function calling When creating the startup routine in accordance with the system call the stream init function prior to main function calling B Load Module Creation After completing creating of the necessary program compile and link all the necessary modules No special option specifying is needed The following libraries and startup routine are linked e startup obj Standard library lib911 lib e Low level function library lib911if lib lib935if lib The sections are arranged at the following addresses e OPORT Address 0 STACK Address 0x100000 Other Address 0x1000 To change the IOPORT section arran
86. ation 160 1 Register initial setup Set the stack pointer SP to the top of the stack stack top Data area initialization The C andC language specification guarantees the initialization of external variables without the initial value and static variables to 0 Therefore initialize the DATA section to 0 Initialization data area duplication When incorporating constant data or program into ROM the data positioned in the ROM area needs to be copied to the RAM area However this duplication step is unnecessary if such a data rewrite operation will not performed within the user program The area to be incorporated into ROM is usually positioned in the INIT section When incorporation into ROM is specified the linker automatically generates the following symbols for the specified section name ROM specified section name RAM specified section name The above symbols indicate the ROM and RAM area start addresses respectively An example specifying of incorporation into ROM for the INIT section is shown below gt fcc911s ro ROM ROM address range ra RAM RAM address range sc INIT ROM INIT RAM gt fcc935s ro ROM ROM address range ra RAM RAM address range sc INIT ROM INIT RAM For the details of incorporation into ROM refer to the Linkage Kit Manual Library initial setup When using the libraries open a file for standard input output For details see section 8 2 Relationship to Library Inco
87. bability that the condition for a conditional branch is true This function can only be used with the fcc935s command The function is valid only when instruction scheduling is performed pragma statement if specifies the probability that the conditional expression of the if statement that follows is true Once an appropriate branch probability is set the hint bit for a branch instruction is set properly When the K gs option is specified tracing for scheduled instructions is selected accordingly true percentage is the percentage of the probability that the conditional expression is true An integer from 0 to 100 can be specified for the percentage A value outside this range or an expression cannot be coded in true percentage Output Example Input int foo int a pragma statement if 20 if a 8 10 else a 20 return a fcc935s command output foo cmp gr8 grO iccO beq iccO 3 L 23 The hint bit is taken setlos p 10 gr10 bra L 25 L 23 setlos 20 gr10 L 25 mov gr10 gr8 ret 132 6 8 Built in Function 6 8 Built in Function The following built in functions are available e wait nop e Media instruction built in function Integer operation built in function B wait nop Built in Function General format void wait nop void Explanation To properly time I O access and interrupt generation formerly the NOP instruction was inserted using the asm statement However when suc
88. be written in an option file For the details of an option file see section 3 6 Option Files The Xf option cancels the f option O Xdf option Xdf option specifies that the default option file will not be read For the default option file see section 3 6 Option Files 67 CHAPTER 3 C C COMPILER OPERATION 3 6 Option Files This section explains option files for commands By writing options in a file a group of options can be specified This feature also permits you to put startup options to be specified in a file B Option File Option file reading takes place when an associated option is specified This assures that the same result is obtained as when an option is specified at the f specifying position in the command line If the option file name is without an extension an opt extension will be added O Option File General Format All entries that can be made in a command line can be written in an option file A line feed in an option file is replaced by a blank A comment in an option file is replaced by a blank Example I usr include Include specifying D F2MC16 Macro specifying g Debug data generation specifying S Execution of processes up to compiling B Option File Limitations The length of a line that can be written in an option file is limited to 4 095 characters The f option can be written in an option file However nesting is limited to 8 levels E Acceptable Comment Entry in Opt
89. bjected to compiling and assembling so that files named file1 obj file2 obj and file3 obj are generated 3 2 Command Operands 3 2 Command Operands One or more input files can be specified as operands E Command Operands The command determines the file type according to the input file extension and performs an appropriate process to suit the file type The extension cannot be omitted File specifying C source files preprocessed C source files C source files preprocessed C source files assembler source files and object files File extension The relationship between input file extensions andcommand processes is shown in Table 3 2 1 Relationship between Extensions and Command Processes Table 3 2 1 Relationship between Extensions and Command Processes Extension Command Process Files having this extension are compiled and subjected to subsequent processes as C source files Files having this extension are compiled and subjected to subsequent processes as C source files that have been preprocessed Regard files as the C source files to perform processing subsequent to compiling Regard files as the C source files to perform processing subsequent to compiling Regard files as the C source files to perform processing subsequent to compiling Regard files as the preprocessed C source files to perform processing subsequent to compiling Files having this extension are assemble
90. bjects a C source file or C source file to preprocessing and outputs the result to the file whose extension is changed to i or ipp Unlike the cases where the E option is specified the output result does not contain the preprocessing instruction generated by the preprocessing If the input file is not a C source file the P option does not do anything Example fcc911s P cpu MB91100 sample c gt fcc935s P cpu MB93500 sample c 3 5 Details of Options The sample c preprocessing result is output to the sample i Example fcc911s P cpu MB91100 sample cpp gt fcc935s P cpu MB93500 sample cpp The result of preprocessing for sample cpp is output to sample ipp O S Option S option performs processes up to compiling and outputs the resultant assembler source to file extension changed to asm If the input is neither a C source file nor a preprocessed C source file the S option does not do anything Example gt fcc911s S cpu MB91100 sample c gt fcc935s S cpu MB93500 sample c The sample c preprocessing and compiling process result are output to the sample asm c Option Performs processes up to assembling and outputs the resultant object to file extension changed to obj If the input file is an object file the c option does not do anything Example fcc911s c cpu MB91100 sample c gt fcc935s c cpu MB93500 sample c The results of preprocessing compiling and assembling to sample c are output
91. c fcc935s w S cpu MB93500 sample c Output None Input for init diff warning option and no for init diff warning option The init diff warning option is valid only when the input file is a C source file This option is ignored when the old for init option is specified The for init diff warning option specifies that a warning message is output if the initialize statement in the for statement is interpreted differently between the old and new C specifications The no_for_init_diff_warning option cancels the for_init_diff_warning option Output Example void func int int i main for int i20 i lt 10 i func i func i Operation fcc911s S cpu MB91100 for_init_diff_warning sample cpp Output fcc935s S cpu MB93500 for init diff warning sample cpp sample cpp 7 W1780B warning reference is to variable i declared at line 2 under old for init scoping rules it would have been variable i declared at line 5 3 5 Details of Options O INF LONGMESSAGE option and INF SHORTMESSAGE option The INF LONGMESSAGE option details the diagnostic message of the compiler The mark indicates where an error occurs Note that an incorrect location may be indicated depending the error type It should also be noted that if the diagnostic message is displayed in a proportional font the indicated location seems displaced The INF SHORTMESSAGE option cancels th
92. ccording to the byte count from the beginning of the file The following three positions are to be specified by whence SEEK CUR Adds the offset value to the current file position SEEK END Adds the offset value to the end of the file SEEK SET Adds the offset value to the beginning of the file Return value When the file position is successfully changed the new file position must be returned If it is not successfully changed 1L must be returned 177 CHAPTER 9 LIBRARY INCORPORATION 9 5 6 isatty Function The isatty function should be generated according to the specifications in this section int isatty int fileno B isatty Function Explanation The file specified by fileno is to be checked to see whether it is a terminal file When the file is a terminal file true must be returned If not false must be returned Return value When the specified file is a terminal file true must be returned If not false must be returned 178 9 5 Low level Function Specifications 9 5 7 sbrk Function The sbrk function should be generated according to the specifications in this section char sbrk int size B sbrk Function Explanation The existing area must be enlarged by size bytes If size is a negative quantity the area must be reduced If the sbrk function has not been called furnish a size byte area The area varies as shown in Figure 9 5 1 Area Change Brought About by sbrk Function Cal
93. ch as o the command can control the file generation process E Options for Compiling Process Control O P option When the P option is specified the command calls up the compiler only and performs preprocessing to generate a preprocessed C C source file in the current directory Files to be generated include files with extensions changed to i for C and with extensions changed to ipp for C O FS option When the S option is specified the command calls up the compiler to compile and thus generate an assembler source file in the current directory The extension of the generated file is changed to asm O c option When the c option is specified the command calls up the compiler and assembler and performs compilation and assembling to generate an object file in the current directory The extension of the generated file is changed to obj CHAPTER 1 SOFTUNE C C COMPILER option When the o option is specified the command generates the file specified in the command line as a result of processing 1 3 C C Compiler Basic Functions 1 3 C C Compiler Basic Functions The C C compiler three functions are described below e Header file search Coordination with symbolic debugger Optimization The symbolic debugger is a support tool for analyzing a program created in C language or C language B Header File Search The header file can be acquired using the C or C program include ins
94. cpu MB93500 The Jc option becomes valid so that files named file1 c and file2 c are interpreted in strict compliance with the ANSI specifications K DCONST FCONST Option When the FCONST suboption is specified a floating point constant whose suffix is not specified will be handled as a float type When the DCONST suboption is specified a floating point constant whose suffix is not specified will be handled as a double type If neither of the above two suboptions is specified K DCONST applies 3 5 Details of Options Output Example Input extern float f1 f2 void func void f1 f2 1 0 Operation fcc911s K fconst cpu MB91100 S sample c Output X func ST RP SP ENTER 4 LDI 32 f2 R12 LD R12 R4 LDI H 3F800000 R5 CALL32 addf R12 LDI 32 _f1 R12 ST R4 R12 L func LEAVE LD SP RP RET Operation fcc935s K fconst cpu MB93500 S sample c K noschedule Output _ func L 20 subi sp 16 sp st fp sp mov sp fp movsg LR gr4 sti gr4 fp 8 L 21 sethi hi _f2 gr4 setlo lo _f2 gr4 vgr4 grO fri sethi hi 1065353216 gr5 setlo 0 1065353216 gr5 movgf gr5 fr2 fadds fr1 fr2 fr3 sethi hi _f1 gr6 setlo lo _f1 gr6 stf fr3 gr6 gro L 22 Idi fp 8 gr4 movgs gr4 LR addi fp 16 sp Id fp grO fp ret O K NOINTLIB option and K INTLIB option The NOINTLIB suboption calls a normal function without effecting in line expansion of an
95. ction M Instruction LDFI FP 8 FRO LDFI FP 12 FR1 MSUBHUS FRO FR1 FR2 STFI FR2 FP 4 Assembler notation Operation of the instruction MMULHS FRi FRj ACCk Media built in function prototype void MMULHS int signed long signed long ACCGk ACCk HI FRI HI FRj ACCGk 1 ACCk 1 LO FRi LO FR The first argument must be ACCO ACC2 ACCA or ACC6 ACCO ACC2 ACC4 and ACC6 are list constants defined in media h Usage example Expansion example signed long b c _MMULHS ACCO b c LDFI FP 8 FRO LDF FP 12 FR1 MMULHS FRO FR1 ACCO MMULHU FRi FRj ACCk void __MMULHUi int unsigned long unsigned long unsigned long b c _MMULHU ACC2 b ACCGk ACCk HI FRi HI FRj ACCGk 1 ACCk 1 LO FRi LO FR The first argument must be ACCO ACC2 or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h LDFI FP 8 FRO LDFI FP 12 FR1 MMULHS FRO FR1 ACC2 B Media Dual Cross Multiplication Halfword Dual Instruction M Instruction Assembler notation Operation of the instruction MMULXHS FRi FRj ACCk ACCGK ACCK HI FRi LO FRj ACCGk 1 ACCKk 1 LO FRI HI FRj Media built in function prototype Usage example void MMULXHS int signed long signed long Expansion example signed long b c MMULXHS ACCA b c The first argument must be ACCO ACC2 or AC
96. ction in temp arg template Section 14 3 3 mentioned in the ISO IEC 14882 1998 Specification There is no support for the international character set function such as uabcd There is no support for the export keyword and export function There is no support for the runtime type identification function including dynamic cast and typeid operators There is no support for the exception handling function including try catch and throw Only the C standard and EC libraries are provided Libraries containing templates such as STL are not available 187 CHAPTER 10 COMPILER DEPENDENT SPECIFICATIONS 10 4 C Specifications for C C Compiler and EC Specifications This section describes the C specifications for the C C compiler and the EC specifications B C Specifications for C C Compiler and EC Specifications At default the C C compiler operates to the EC specifications A warning message is output at description of specifications outside the EC range To delete just this warning specify the Ja option including extended specifications or the Jc option stringent specifications For details of the EC specifications refer to http Awww caravan net ec2plus 188 10 5 Limitations on Use of C Template 10 5 Limitations on Use of C Template This section deals with the limitations on use of the C template B Limitations on Use of C Template O Options specified when usi
97. d K LONGADDRESS CODE DATA SHORTADDRESS CODE DATA loption The SHORTADDRESS suboption generates code on the presumption that the address of a symbol to be loaded within the program is within the 20 bit expression range This option can be specified only for fcc911s commands When CODE or DATA is specified only the program code section CODE symbols or data section DATA INIT or CONST symbols are to be processed If the address exceeds the range that can be expressed by 20 bits an error occurs during linking Operation is normal even if symbols other than those loaded in the program are positioned outside the range of the addresses that can be expressed by 20 bits The LONGADDRESS suboption enables handling symbol addresses as 32 bit addresses If the SHORTADDRESS suboption or LONGADDRESS suboption is omitted K LONGADDRESS is applied 49 CHAPTER 3 C C COMPILER OPERATION Output Example Input extern int i extern void sub void void func void i 10 sub Operation fcc911s K shortaddress O S cpu MB91100 sample c Output LDI 20 1 R12 20 bit symbol used LDI 10 RO ST RO R12 CALL20 sub R12 20 bit symbol used O K NOALIAS option and K ALIAS option The NOALIAS suboption optimizes the data specified by the pointer on the assumption that the pointer does not specify the same area as the other variables or pointers These options are enabled only when level 1 or more optimizatio
98. d and subjected to subsequent processes as assembler source files that have been compiled Files having this extension are assembled and subjected to subsequent processes as object files that have been assembled The file having this extension is regarded as a linked absolute file and an error output is generated No absolute file can be specified Note however that the associated process may be inhibited depending on the option specifying Example gt fcc911s file1 c file2 asm cpu MB91100 gt fcc935s file1 c file2 asm cpu MB93500 The file1 c file is compiled and assembled and the file2 asm file is assembled Linking is then performed to generate the file1 abs file CHAPTER 3 C C COMPILER OPERATION 3 3 File Names and Directry Names The following characters are applicable to file names and directory names B File Names and Directry Names O Windows Alphanumeric characters symbols except lt gt and Shift JIS kanji codes and Shift JIS 1 byte kana codes Enclose a long file name in double quotation marks when the file is specified as an option or operand The double quotation marks however cannot be used when the file is specified as an environment variable UNIX OS Underbar and alphanumeric characters However the first character must be the underbar or alphabetical character Module name A module name is generated from a file name The characters that can be
99. d linkage regulations 112 5 6 fcc935s Command Function Call Interface Figure 5 6 4 Stack Frame Created by Called Function in Compliance with fcc935s Command Standard Linkage Regulations Called function SP Actual argument area Called function FP Local variable area Old FP Hidden parameter save area Return value address storage area Argument register save area Caller function SP Virtual argument area 113 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 6 5 fcc935s Command Register This section describes the register assurance and register setup regulations in the standard linkage regulations B fcc935s Command Register The called function assures the following registers of the caller function General purpose registers GR1 GR2 GR16 to GR31 GR48 to GR63 FR16 FR31 and FR48 to FR63 The register assurance is provided when the called function acquires a new area from the stack and saves the register value in that area However the contents of registers that has not changed through the function are not saved If such registers are altered using the ASM statement subsequent operation is not assured B fcc935s Command Register Setup Table 5 6 2 Register Regulations for fcc935s Command Function Call and Return Periods lists the register regulations for function call and return periods Table 5 6 2 Register Regulations for fcc935s Command Function Call and Return Periods
100. document are subject to change without notice Customers are advised to consult with FUJITSU sales representatives before ordering The information and circuit diagrams in this document are presented as examples of semiconductor device applications and are not intended to be incorporated in devices for actual use Also FUJITSU is unable to assume responsibility for infringement of any patent rights or other rights of third parties arising from the use of this information or circuit diagrams The contents of this document may not be reproduced or copied without the permission of FUJITSU Ltd FUJITSU semiconductor devices are intended for use in standard applications computers office automation and other office equipment industrial communications and measurement equipment personal or household devices etc CAUTION Customers considering the use of our products in special applications where failure or abnormal operation may directly affect human lives or cause physical injury or property damage or where extremely high levels of reliability are demanded such as aerospace systems atomic energy controls sea floor repeaters vehicle operating controls medical devices for life support etc are requested to consult with FUJITSU sales representatives before such use The company will not be responsible for damages arising from such use without prior approval Any semiconductor devices have an inherent chance of failure You must prot
101. duling will be conducted When the NON SCHEDULE suboption is specified the command will not conduct instruction scheduling This option is only valid when an optimization level of 1 or higher is specified by the O option The K GS option determines whether to perform large area scheduling in which instruction that exceed the branch are transferred O K NOUNROLL option and K UNROLL option The NOUNROLL suboption inhibits loop unrolling optimization Use this option when loop unrolling optimization is to be inhibited with the O2 to O4 options specified The UNROLL suboption cancels the NOUNROLL suboption When 00 or 01 is specified these options are invalid because loop unloading is not optimized O x function name 1 function name 2 option and Xx option The x option effects in line expansion instead of function calling of functions defined by a C source However recursively called functions will not be subjected to in line expansion It should also be noted that functions may not be subjected to in line expansion depending on asm statement use structure union type argument presence setjmp function calling and other conditions The x option takes effect only when level 1 or more optimization is specified simultaneously with the O option The Xx option cancels the x option Output Example Input extern int a static void sub void 1 void func void sub Operation fcc911s cpu MB91100 O x sub S
102. e Array type Type different from the type derived from existing actual argument extension File types Files that can be handled by the libraries are divided into two types text files and binary files The libraries treat the text files and binary files in the same manner except for the difference in the second argument of the open function called upon file opening When a binary file is specified O BINARY is added to the second argument of the open function For the open function argument see section 9 5 1 open Function div t type and Idiv_t type It is equivalent to an undermentioned structural body APPENDIX B Operations Specific to C Libraries div t struct int quot int rem E Idiv t struct long int quot long int rem h O abort function operations When the abort function is called all the open output streams are flushed and then all the open streams are closed Finally the abort function is called O Maximum count of functions that can be registered by the atexit function Up to 20 functions can be registered O exit function operations When the exit function is called all the functions registered by the atexit function are called in the reverse order of registration all the open output streams are flushed and then all the open streams are closed Finally the exit function is called with the status value which is delivered as the argument retained When the status value is 0 or EXIT SUCCESS
103. e INF LONGMESSAGE option Example Input int a b void func Operation fcc911s S cpu MB91100 INF LONGMESSAGE sample c fcc935s S cpu MB93500 INF LONGMESSAGE sample c Output sample c 1 E4065B expected a int a b 39 CHAPTER 3 C C COMPILER OPERATION 3 5 4 Language Specification Related Options This section deals with the options related to the specifications of the language to be recognized by the compiler B Language Specification Related Options 40 O J a c e Option Specifies the language specification level to be interpreted by the compiler preprocessor included When Ja is specified interpretation is conducted in compliance with the ANSI specifications including expansion specifications When Jc is specified interpretation is conducted in strict compliance with the ANSI specifications In response to the expansion specifications a warning message is output When the Je option is specified the C source file is interpreted as being based on the EC language specifications In addition to a normal warning a warning message is output at description of specifications outside the range of the EC language specifications The C source file has exactly the same meaning as that when the Ja option is specified If omit J this option is not specified Ja applies Example fcc91 1s J a file1 c J c file2 c cpu MB91100 gt fcc935s J a file1 c J c file2 c
104. e Type char Assignment Size Byte Boundary Alignment Byte signed char unsigned char short unsined short int unsigned int long unsigned long float double long double pointer address Ri CO oO A BR MY Dw AR BR ATITA AJ BR DY Structure union class Explained later Explained later Note Some variables are aligned on 4 byte boundaries when the K A4 option is specified The K A4 option does not affect structure union member boundary alignment 77 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 4 4 fcc911s Command Bit Field The bit field data size and boundary alignment is explained below The bit field data is assigned to a storage unit that has an adequate size for bit field data retention and is located at the smallest address B fcc911s Command Bit Field Consecutive bit field data are packed at consecutive bits having the same storage unit without regard to the type beginning with the LSB and continuing toward the MSB An example is shown in Figure 4 4 1 fcc911s Command Bit Field Data Size and Boundary Alignment Example T4 Figure 4 4 1 fcc911s Command Bit Field Data Size and Boundary Alignment Example 1 struct tag1 int A 10 short B 3 char C 2 k 31 MSB 21 18 16 0 LSB If a field to be assigned lies over a bit field type boundary its assignment is completed by aligning it
105. e called function stores all the register delivered arguments in the argument register save area in the stack The actual argument area is allocated deallocated by the caller function whereas the argument register save area is allocated deallocated by the callee function Figure 4 6 2 fcc911s Command Argument Format Stated in Standard Linkage Regulations and Figure 4 6 3 Argument Format for fcc911s Command Structure Union Return Function Calling show the argument formats prescribed in the standard linkage regulations 4 6 fcc911s Command Function Call Interface Figure 4 6 2 fcc911s Command Argument Format Stated in Standard Linkage Regulations First argument Second argument gt Third argument Fourth argument Low Fifth argument Note Two argument registers are required for 8 byte type arguments Figure 4 6 3 Argument Format for fcc911s Command Structure Union Return Function Calling Return value area address R4 First argument gt R5 Second argument R6 Third argument gt R7 Low Fourth argument Note Two argument registers are required for 8 byte type arguments 87 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 4 6 3 fcc911s Command Argument Extension Format When an argument is to be stored in the stack its type is converted to an extended type in accordance with the individual argument type The argument is freed by the caller function after the return from the callee
106. e regulations Figure 5 6 2 fcc935s Command Argument Format Stated in Standard Linkage Regulations First argument GR8 Fourth argument GR11 Second argument GR9 Fifth argument GR12 Third argument GR10 Sixth argument GR13 Low Seventh argument Note Two argument registers are required for 8 byte arguments Y nth argument High 110 5 6 fcc935s Command Function Call Interface 5 6 3 fcc935s Command Argument Extension Format When an argument is to be stored in the stack its type is converted to an extended type in accordance with the individual argument type The argument is released by the caller function after control is returned from the called function B fcc935s Command Argument Extension Format Table 5 6 1 fcc911 Command Argument Extension Format lists the argument extension format Table 5 6 1 fcc935s Command Argument Extension Format Actual argument type Extended type 1 Stack storage size byte A char int signed char int unsigned char int short int unsigned short int int No extension unsigned int No extension long No extension unsigned long No extension long long No extension unsigned long long No extension float Double double No extension long double No extension 4 4 4 4 4 4 4 4 8 8 8 8 8 4 pointer address No extension N Structure
107. e the section definition pseudo instruction to define the section If the section is not defined no subsequent operations will be guaranteed When using a general purpose register within the asm statement in the function during fcc911 command execution the user is responsible for register saving and restoration However the user need not to be conscious of general purpose registers RO to R3 R12 and R13 because saving and restoring are performed by the compiler When using a general purpose register within the asm statement in the function during fcc935s command execution the user is responsible for register saving and restoration However the user need not recognize general purpose registers GR4 to GR7 GR32 to GR47 FRO to FR15 and FR32 to FR47 because the compiler saves and restores them If during the C source program provided by pragma asm endasm exists in the function various optimization features are inhibited even when the O optimization option is specified 121 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS fcc911s Command Output Example Input When written inside the function extern int temp sample pragma asm LDI 1 RO LDI 32 _temp R12 ST RO R12 pragma endasm When written outside the function pragma asm SECTION DATA DATA ALIGN 4 GLOBAL a RES B 4 pragma endasm Output SECTION CODE CODE ALIGN 2 begin of function GLOBAL sample sample ST RP SP E
108. ea Argument register save area Virtual argument area High The following area size is rounded up each 8 bytes due to 8 byte boundary alignment Actual argument area virtual argument area Register save area Local variable area Argument register save area O Actual argument area virtual argument area When a function is called this area is used for argument transfer This area is referred to as an actual argument area when the caller function is used to set an argument and referred to as a virtual argument area when the argument is referenced via the called function This area is created when not all arguments cannot be stored in an argument register during argument transfer For details see Section 5 6 2 Fcc935s Command Argument O Local variable area This area is used for local variables and temporary variables 107 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 108 O Old FP This area stores the frame pointer FP value of the caller function Return address storage area This area saves the LR The LR stores the address for a return to the caller function for the purpose of function calling Register save area This area saves the register that must be guaranteed for the caller function When the register need not be saved this area is not allocated Hidden parameter save area This area stores the start address of the return value storage area for a structure union re
109. eader file builtin h for integer operation built in function beforehand When the header file is not included the function cannot be recognized as the built in function 6 8 1 Media Instruction Built in Function 6 8 Built in Function This function can be used for the fcc935s command only This function is used to use the media instructions The built in functions are available for each media instruction supported by the FR V family CPU To use the media instruction built in function always include the header file media h for media instruction built in function beforehand When the header file is not included the function cannot be recognized as the built in function B Media and Logical Operation Word Instruction M Instruction Assembler notation Operation of the instruction FRi FRj FRk FRk FRi amp FRj Media built in function prototype unsigned long MAND unsigned long unsigned long Usage example Expansion example unsigned long a b c a MAND b LDFI FP 8 FRO LDFI FP 12 FR1 MAND FRO FR1 FR2 STFI FR2 FP 4 MOR _ FRi FRj FRk FRk FRi FRj unsigned long MORhR unsigned long unsigned long unsigned long a b c MOR b c LDFI FP 8 FRO LDFI FP 12 FR1 MOR FRO FR1 FR2 STFI FR2 FP 4 MXOR FRi FRk FRk FRi FRj unsigned long MXOR unsigned long unsigned long unsigned
110. ect against injury damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy fire protection and prevention of over current levels and other abnormal operating conditions If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan the prior authorization by Japanese government will be required for export of those products from Japan 2001 FUJITSU LIMITED Printed in Japan How To Read This Manual B Symbols in This Manual This manual uses the following symbols Symbol Meaning item Items can be omitted item 1 item 2 One of either item 1 or item 2must be specified The same also applies to teh case where theree or more items are specified item Items can be specified any number of times in succession Most example in this manual are base on the UNIX OS format B Abbreviated Name Each product name in this manual is abbreviated as follows Window 95 for Microsoft Windows 95 operating system Windows 98 for Microsoft Windows 98 operating system Windows NT for Microsoft Windows NT Server network operating system Version 3 51 Microsoft Windows NT Workstation operating system Version 3 51 Microsoft Windows NT Server network operating system Version 4 0 Microsoft Windows NT Workstation operating s
111. ed in pragma intvect The default section name is INTVECT C Init section This section is where tables for indicating the entry of functions constituting and destroying static objects are stored It must be used at start up For information on specifying the startup program see section 7 2 Startup Routine Creation 75 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 4 2 Rules for Name Generation with the fcc911s The rules for the names used by the compiler are explained below B Rules for Name Generation with the fcc911s Table 4 2 1 Label Generation Rules shows the relationship between the names generated by the compiler and the C language Table 4 2 1 Label Generation Rules C Language Counterpart Label Generated by Compiler Function name function name External variable name external variable name Static variable name LI no Local variable name Virtual argument name Character string derived type Automatic variable initial value Target location label Note The compiler internal generation number is placed at the no position 76 4 3 fcc911s Command Boundary Alignment fcc911s Command Boundary Alignment The standard data type and boundary alignment is explained below Table 4 3 1 fcc911s Command Variable Assignment Rules shows the assignment rules B fcc911s Command Boundary Alignment Table 4 3 1 fcc911s Command Variable Assignment Rules Variabl
112. efined no subsequent operations will be guaranteed When using a general purpose register within the asm statement in the function during fcc911s command execution the user is responsible for register saving and restoration However the user need not to be conscious of general purpose registers RO to R3 R12 and R13 because saving and restoring are performed by the compiler When using a general purpose register within the asm statement in the function during fcc935s command execution the user is responsible for register saving and restoration However the user need not recognize general purpose registers GR4 to GR7 GR32 to GR47 FRO to FR15 and FR32 to FR47 because the compiler saves and restores them If the asm statement exists in a C C source program various optimization features are inhibited even when the O optimization option is specified 6 1 Assembler Description Functions fcc911s Command Output Example Input Output When written inside the function extern int temp sample asm LDI 1 RO asm LDI 32 temp R12 asm ST RO R12 When written outside the function asm SECTION DATA DATA ALIGN 4 asm GLOBAL asm a7 asm RES B 4 SECTION CODE CODE ALIGN 2 P begin of function GLOBAL sample sample ST RP SP ENTER 4 LDI 1 RO LDI 32 _temp R12 ST RO R12 L_sample LEAVE LD SP RP RET SECTION DATA DATA ALIGN
113. en nennen enne en rentrer nennt nnns 197 APPENDUIDC scs 199 APPENDIX A List of Types Macros Functions and Variables Provided by C Libraries 200 APPENDIX B Operations Specific to C Libraries ssssssssssseenenee eene 206 INDEX ree 211 vii viii CHAPTER1 SOFTUNE C C COMPILER This chapter outlines the C C compiler The C C compiler hereinafter referred to as the compiler is a language processor program which translates source programs written in C or C language into the assembly language for Fujitsu provided various microcontroller units or microprocessor units 1 1 Softune C C Compiler Functions 1 2 Basic Process of Commands 1 3 C C Compiler Basic Functions CHAPTER 1 SOFTUNE C C COMPILER 1 1 Softune C C Compiler Functions The C C compiler generates an assembler source file from a C or C source file B C C Compiler Functions The C C compiler generates an assembler source file using the procedures described below O Compilation Compiling is performed by the compiler cpcoms The compiler translates C or C source files into assembler source files To operate the C C compiler use the fcc911s or fcc935s command This command automatically sets the environment of the C C compiler such as the setting of an include directory and controls compiling of C or C source files Figure 1 1 1 Configuration of t
114. eprocessing related options are detailed below O B option and XB option The B option regards items following in the C source as comments The XB option cancels the B option This option is ignored even if it is specified in the C source Example input void func empty function operation fcc911s S B cpu MB91100 sample c fcc935s S B cpu MB93500 sample c O C option and XC option C options are All comments except those which are in the preprocessing instruction line will be retained as the preprocessing result If the option is not specified the comments are replaced by one blank character The XC option cancels the C option Output Example Input Comment void func void Operation fcc911s C E cpu MB91100 sample c fcc935s C E cpu MB93500 sample c Output 1 test5 c Comment void func void O D name tokens Option Defines the macro name with the tokens used as the macro definition This option is equal to the following define instruction define name tokens If tokens entry is omitted the value 1 is given as the tokens value If the tokens entry is omitted the specified lexis is deleted from the source file The error related to the D option is the same as the error related to the define instruction 31 CHAPTER 3 C C COMPILER OPERATION 32 This option can be specified more than one time Example fcc911s D os m D sys file c cpu
115. error output file close 169 standard error output file open 169 standard input output 169 standard library 171 214 startup routine creation 160 Std arg Ns cioe ie Ut a 202 Stadef Ns auci ues 202 SUGIO hr cce eet Tecno 203 SUD pm EX 203 stream area initialization 169 String is ret m eie ot ue to 204 subtraction halfword dual instruction M 138 subtraction halfword quad instruction M instruction 141 subtraction operation halfword dual instruction M 140 symbolic debugger coordination with 5 SyS types Tiziana lend 205 system dependent 166 T torsit Oe terrains 12 tool identifler aee tes 70 translation control related option 27 28 translation process message generated in 70 U nista h t te ttr tnter e cte 204 wait nop built in function 133 write function esseseseeernnrne 176 195 write instruction M instruction 148 CM81 00205 2E
116. ession for init diff warning Control a warning on different interpretations between old for init and new for init suppress vtbl Suppress definition of a virtual function table force vtbl Force definition of a virtual function table 23 CHAPTER 3 C C COMPILER OPERATION 3 4 2 List of Command Cancel Options The listed options are used to cancel command options on an individual basis The cancel options for the command are listed in Table 3 4 6 List of Command Cancel Options For fcc911s to Table 3 4 7 List of Command Cancel Options For fcc935s B List of Command Cancel Options 24 Table 3 4 5 List of Command Cancel Options Specifying Format Function Cancel the B option Cancels the C option Cancels the cmsg option Cancel the cwno option Cancels the f option Cancels the g option Cancels the H option Xhelp Cancels the help option XI Cancels the l option INF NOLINENO Cancels the LINENO suboption INF NOLIST Cancels the LIST suboption INF NOSRCIN Cancels the SRCIN suboption INF NOSTACK Cancels the STACK suboption INF SHORTMESSAGE Cancel the LONGMESSAGE suboption K ALIAS Cancels the NOALIAS suboption K INTLIB Cancels the NOINTLIB suboption K NOEOPT Cancels the EOPT suboption K NOLIB Cancels the LIB suboption K UNROLL Cancels
117. finity Count of external identifiers of one translation unit infinity Count of identifiers having the block valid range in one infinity block Count of macro names that can be simultaneously defined infinity by one translation unit Count of virtual arguments in one function definition infinity Count of actual arguments for one function call infinity Count of virtual arguments in one macro definition infinity Count of actual arguments in one macro call infinity Maximum count of characters in one logical source line infinity Count of characters in a linked byte character string literal infinity or wide angle character string literal terminal character included 153 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS Table 6 10 1 List of Translation Limitations Continued Function ANSI Compiler Standard Count of bytes of one arithmetic unit infinity Count of nesting levels for include file infinity Count of case name cards in one switch statement infinity excluding nested switch statements Count of members of one structure or union infinity Count of enumerated type constants in one enumerated infinity type Count of structure or union nesting levels for one structure infinity declaration array The infinity in the above table indicates the dependence on the memory size available for the system 154 6 11 Re include Prevention Function 6 11 Re
118. function is made B fcc911s Command Argument Extension Format Table 4 6 1 fcc911 Command Argument Extension Format shows the argument extension format Table 4 6 1 fcc911 Command Argument Extension Format Actual Argument Type Extended Type 1 Boundary Strage Size Byte char int 4 signed char int 4 unsigned char int 4 short int 4 unsined short int 4 int No extension 4 unsigned int No extension 4 long No extension 4 unsigned long No extension 4 float double 8 double No extension 8 long double No extension 8 pointer address No extension 4 Structure union 4 2 Class 4 3 1 The extended type represents an extended type that is provided when no argument type is given When a prototype declaration is made it is complied with 2 When a structure union is to be delivered as an argument the caller copies it to the local variable area and delivers the address of that area 8 Passing of a class as an argument depends on the availability and contents of a copy constructor Without the copy constructor the class is passed in the same manner as the structure 88 4 6 fcc911s Command Function Call Interface 4 6 4 fcc911s Command Calling Procedure The caller function initiates branching to the callee function after argument storage B fcc911s Command Calling Procedure Figure 4 6 4 fcc911s Stack Frame Prevailing at Calling in Compliance with fcc911s Command
119. functions creating and deleting static class objects This section must be used at startup For information on specifying the startup program see Section 7 2 Startup Routine Creation 99 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 2 Generation Rules for Names Used by fcc935s The rules for the names used by fcc935s are explained below B Generation Rules for Names Used by fcc935s Table 5 2 1 Label Generation Rules shows the relationship between the names generated by the compiler and C Table 5 2 1 Label Generation Rules Corresponding item in C Label generated by compiler Function name function name External variable name external variable name Static external variable name _ static external variable name Static variable name LI no Local variable name Virtual argument name Character string derived type Automatic variable initial value Target location label Note The compiler internal generation number is inserted in place of no 100 5 3 fcc935s Command Boundary Alignment 5 3 fcc935s Command Boundary Alignment The standard data types and boundary alignment are explained below Table 5 3 1 fcc935s Command Variable Assignment Rules shows the assignment rules B fcc935s Command Boundary Alignment Table 5 3 1 fcc935s Command Variable Assignment Rules Assignment size Boundary alignment Variable type byte byte char signed ch
120. gement specify the sc IOPORT address option at compling Describe the section arrangement address at the address position B Simulator Debugger Setup Setup for Standard Input Output Use set inport ascii IOPORT Oxff TERMINAL set outport ascii IOPORT 1 TERMINAL Enter the address where the IOPORT section was positioned at linking in the above IOPORT position If the sc option is not specified at linking the following results set inport ascii 0 Oxff STERMINAL set outport ascii 1 STERMINAL Since the first three areas of the IOPORT section are used for standard input standard output and standard error output the other files are allocated to the fourth and subsequent areas The offset from the beginning of the IOPORT section is 3 In other words allocation is performed sequentially in the order of file opening offset 3 offset 4 etc Therefore perform setup accordingly using the set inport and set outport commands To open a doc as the input file and then open b doc as the output file setup as indicated below set inport ascii IOPORT 3 h ff a doc 193 CHAPTER 11 SIMULATOR DEBUGGER LOW LEVEL FUNCTION LIBRARY B Example 194 set outport ascii IOPORT 4 h ff b doc Create a program that displays the character string Hello and initiate execution with the simulator debugger main Create a C source file named test c as indicated above printf Hello An Compile using the foll
121. generated according to the specifications in this section void _abort void B abort Function Explanation The _ abort function must bring the program to an abnormal end Return value The _abort function does not return to the caller 181 CHAPTER 9 LIBRARY INCORPORATION 182 CHAPTER 10 COMPILER DEPENDENT SPECIFICATIONS This chapter describes the specifications that vary with the compiler Descriptions are related to JIS standards that are created based on ANSI standards 10 1 10 2 10 3 10 4 10 5 Compiler dependent C Language Specification Differentials Type of Floating point Data and Range of Representable Values Dissimilarities between C Specifications for C C Compiler and ISO C Specifications for C C Compiler and EC Specifications Limitations on Use of C Template 183 CHAPTER 10 COMPILER DEPENDENT SPECIFICATIONS 10 1 Compiler dependent C Language Specification Differentials Table 10 1 1 Compiler dependent Language Specification Differentials lists the compiler dependent C language specification differentials B Compiler dependent Language Specification Differentials Table 10 1 1 Compiler dependent Language Specification Differentials Specification Differentials Japanese language process support and code system Related Section in the JIS Standard 5 2 1 Character sets 6 1 2 Identifiers This Compiler No support EUC or SJIS entries can be made o
122. h a method is used the asm statement may occasionally inhibit various forms of optimization and greatly degrade the file object efficiency When the __ wait nop built in function is written the compiler outputs one NOP instruction to the function call entry position If the function call entry is performed a count of times until all the issued NOP instructions are covered timing control is exercised to minimize the effect on optimization Output Example Input void sample void wait fcc911s Command Output sample ST RP Q SP ENTER 4 NOP L sample LEAVE LD SP RP RET fcc935s Command Output sample nop L 20 ret B Media instruction built in function This function can be used for the fcc935s command only This function is used to use the media instructions The built in functions are available for each media instruction supported by the FR V family CPU 133 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS To use the media instruction built in function always include the header file media h for media instruction built in function When the header file is not included the function cannot be recognized as the built in function B Integer operation built in function 134 This function can be used for the fcc935s command only This function is used to use the integer operation instructions supported by the FR V family CPU To use the integer operation built in function always include the h
123. he C C compiler shows the configuration of the C C compiler Figure 1 1 1 Configuration of the C C compiler Header file Assembler file In the subsequent sections the C C compiler translation process is explained using commands For the details of the command function specifications see CHAPTER 3 C C COMPILER OPERATION 1 2 Basic Process of Commands 1 2 Basic Process of Commands This section describes the basic function of commands used in the C C compiler The C C compiler uses the following command e fcc911s FR family command fcc935s FR V family command Command Basic Process The basic function of the command is to generate an absolute file from a C or C source file The command recognizes files with the c extension as C source files and files with the cc Cpp or cxx extension as C source files A command use example is given below gt is the command prompt Example gt 9115 cpu MB91100 file c gt fcc935s cpu MB93500 file c When the above entry is made the command assumes that file c is a C source file As far as no error is detected an absolute file file abs is generated in the current directory Example gt fcc911s o outfile cpu 91100 file c gt fcc935s o outfile cpu MB93500 file c With the parameters set as indicated in the above example the command generates an absolute file outfile By specifying options su
124. hen the standard linkage regulations are complied with B fcc911s Command Function Call Interface 82 Stack frame The stack frame construction is stipulated by the standard linkage regulations Argument Argument transfer relative to the callee function is effected via a stack or register Argument extension format When an argument is to be stored in a stack the argument type is converted to an extended format in accordance with the argument type Calling procedure The caller function initiates branching to the callee function after argument storage Register The register guarantee stated in the standard linkage regulations and the register setup regulations are explained later Return value The return value interface stated in the standard linkage regulations is explained later 4 6 fcc911s Command Function Call Interface 4 6 1 fcc911s Command Stack Frame The standard linkage regulations prescribe the stack frame construction B fcc911s Command Stack Frame The stack pointer SP always indicates the lowest order of the stack frame Its address value always represents the work boundary Figure 4 6 1 fcc911s Command Stack Frame shows the standard function stack frame status Figure 4 6 1 fcc911s Command Stack Frame Low SP Actual argument area Local variable save area FP Old FP Return address storage area Register save area Hidden parameter save area Argume
125. hey are executed Output Example Input int add int a int b return a b int sub int a int b return a b Operation fcc935s S Kgs cpu MB93500 sample c splitsection Output section CODE add 4 CODE align 4 Section for function add global add add gr8 gr9 gr8 ret section CODE sub 4 CODE align 4 Section for function sub global sub _ sub sub p gr8 gr9 gr8 ret O K A1 A4 A8 option Specifies the minimum allocation boundary for external and static variables The A4 suboption selects the 4 byte minimum allocation boundary The A8 suboption selects the 8 byte minimum allocation boundary The A8 suboption can only be used with the fcc935s command When the 4 or 8 byte minimum allocation boundary is used more efficient code may be generated through inline expansion of a character string manipulation function when K lib is specified This code malfunctions if boundary alignment is incorrect Therefore objects for which different allocation boundaries are specified must not be linked If such objects are linked unnecessary areas are generated as a result of consistent boundary alignment causing an increase in the number of objects The A1 suboption selects the 1 byte minimum allocation boundary When this option is omitted K A1 is used Output Example Input char c1 c2 Operation fcc911s K A4 S cpu MB91100 sample c fcc935s K A4 S cpu MB93500 sample c Output SECTION DA
126. ifications supported by the compiler The limitations on compiler translation are also described in this chapter 6 1 Assembler Description Functions 6 2 Interrupt Control Functions 6 3 I O Area Access Function 6 4 In line Expansion Specifying Function 6 5 Section Name Change Function 6 6 Interrupt Level Setup Function 6 7 Branch Probability Specification Function 6 8 Built in Function 6 9 Predefined Macros 6 10 Limitations on Compiler Translation 6 11 Re include Prevention Function 6 12 Function for Controlling Instantiation of C Template 117 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS 6 1 Assembler Description Functions There are the following two assembler description functions e asm statement Pragma instruction B Description by asm Statement 118 When the asm statement is written the character string literal is expanded as the assembler instruction This function makes it possible to write the asm statement inside and outside the function General format asm Character string literal Explanation When the asm statement is written inside the function the assembler is expanded at the written position When the statement is written outside the function it is expanded as an independent section Therefore if the statement is to be written outside the function be sure to write the section definition pseudo instruction to define the section If the section is not d
127. ify the message code The following codes can be specified ASCII Outputs messages in ASCII code The generated messages are in English Select this code for a system without a Japanese language environment EUC Outputs messages in EUC code The generated messages are in Japanese SJIS Outputs messages in SHIFT JIS code The generated messages are in Japanese lf FELANG setup is not completed the ASCII code is considered to be selected Example For UNIX OS setenv FELANG EUC Example For Windows set FELANG SJIS CHAPTER 2 SETTING ENVIRONMENT VARIABLES IN SYSTEM BEFORE STARTING CHAPTER3 C C COMPILER OPERATION This chapter describes the command function specifications 3 1 3 2 3 3 3 4 3 5 3 6 3 7 Command Line Command Operands File Names and Directry Names Command Options Details of Options Option Files Messages Generated in Translation Process CHAPTER 3 C C COMPILER OPERATION 3 Q1 CommandLine The command line format is shown below fcc911s fcc935s options operands options operands B Command Line Options and operands can be specified in the command line Options and operands can be specified at any position within the command line Two or more options and operands can be specified Options can be omitted Option and operand entries are to be delimited by a blank character string The command recognizes the options and operands in the order indicated below
128. ing Buffering is conducted for each output line No buffering File input output is implemented in compliance with the input output request made by input output function calling Unlike the other buffering operations no data will be saved into the memory O p format conversion output for fprintf function The number of digits is less than 8 at 8 digit hexadecimal notation preceding Os are padded Uppercase alphabetical characters are used O p format conversion input format for fscanf function If less then 8 digits in hexadecimal notation are used in upper or lower case alphabetic characters the leading Os are padded If the specified number of digits is exceeded only the low order part is valid O Conversion of long long type value of fprintf function for fcc935s command To convert a long long type value specify 11 or q immediately before the format converter The same conversion result is obtained regardless of whether 11 or q is specified 11 or q can be specified for conversion specifications 96d 96i 960 and Example long long a 10LL fprintf stdout lld n a O Conversion of long long type value of fscanf function for 9355 command To convert a long long type integer value specify 11 or q immediately before the format converter The same conversion result is obtained regardless of whether 11 or q is specified 11 can be specified for conversion specifications 96i 0 Yu and x
129. input output and standard error output opening Iseek isatty and closing Sbrk calloc sbrk malloc realloc free exit 1 open close Stream area initialization process standard read write input output and standard error output opening seek isatty and closing sbrk exit 1 Then the abort function and exit function are called they perform the closing process for open files Therefore the file manipulation related low level functions open close read write Iseek and sbrk and stream area initialization and like processes are required In a program that is not using a file the _abort function can be directly called instead of the abort function In a program for which function registration is not completed using the atexit function the exit function can be directly called instead of the exit function while no file is being used In the above instances file manipulation related low level function use and stream area initialization are not required 171 CHAPTER 9 LIBRARY INCORPORATION 9 5 Low level Function Specifications There are various low level functions The open close read write Iseek and isatty functions provide file processing The sbrk function provides memory area dynamic allocation The exit or abort function is used to terminate a program by calling the exit or abort function These low level functions must be created to suit the system B Low
130. instantiation option and auto instantiation option These options are valid only for the C source The no auto instantiation option provides manual template instantiation Instantiation must be controlled by the t used option t all option or pragma For information on using pragma to control instantiation see section 6 12 Function for Controlling Installation of C Template O supress vtbl option and force vtbl option These options are valid only for the C source They change the generation type of a virtual 61 CHAPTER 3 C C COMPILER OPERATION 62 function table The supress vtbl option causes the virtual function table to be referenced from other modules without being generated in a module The force vtbl option causes the virtual function table to be generated in a module for reference from other modules These options are valid only when the member functions specified as being virtual are in the class and all of them are defined inline If these options are not given under this condition a virtual function table is generated locally for each module Example Cases for option class FOO int a public FOO 0 virtual void memfunc int x a x Allthe member functions are defined inline The force vtbl option must be specified for at least one module Note that overlapping table definition is not allowed when specifying the option for more than one module 3 5 Details of Optio
131. interrupt related function DI EI set il The INTLIB suboption cancels the NOINTLIB suboption Interrupt related functions can be used only for fcc911s commands 41 CHAPTER 3 C C COMPILER OPERATION 42 Example Input void func void DI Operation 9115 K nointlib cpu MB91100 S sample c Output _ func ST RP SP ENTER 4 CALL32 DI R12 L func LEAVE LD SP RP RET O K NOVOLATILE option and K VOLATILE option The NOVOLATILE suboption does not recognize a io qualifier attached variable as a volatile type Therefore io qualifier attached variables will be optimized The VOLATILE suboption cancels the NOVOLATILE suboption Example fcc911s K novolatile S O cpu MB91100 sample c gt fcc935s K novolatile S O cpu MB93500 sample c When an io qualifier attached variable is processed in sample c it is not handled as a volatile qualifier attached variable but is treated as the optimization target K UCHAR SCHAR option K UCHAR SCHAR option specifies whether or not to treat the char type most significant bit as a sign bit When the UCHAR suboption is specified the most significant bit will not be treated as a sign bit When the SCHAR suboption is specified the most significant bit will be treated as a sign bit If omit K UCHAR SCHAR option neither of the above two suboptions is specified K UCHAR applies 3 5 Details of Options Output Example Input extern int data ch
132. ion operations performs standard function inline expansion and performs identical operations When this option is specified there may be side effects on the execution results Since standard function inline expansion is implemented the code size may increase Performs optimization to change arithmetic operation evaluation type at compilation stage When this option is specified there may be side effects on the execution results e Standard function expansion change same as effected by K LIB specifying Switches to a higher speed standard function that recognizes standard function operations performs standard function inline expansion and performs identical operations When this option is specified there may be side effects on the execution results Since standard function inline expansion is implemented the code size may increase O K EOPT option and K NOEOPT option The EOPT suboption effects optimization by changing the arithmetic operation evaluation type at the compilation stage When this option is specified side effects may occasionally be produced on the execution results This option takes effect only when an optimization level of 1 or higher is specified by the O option The NOEOPT suboption cancels the EOPT suboption 47 CHAPTER 3 C C COMPILER OPERATION Output Example Input extern int i void func int a int b 100 0 100 Operation fcc911s K eopt O cpu MB91100 S sample c Output ADD R5 R4
133. ion File A comment can be started from any column A comment is to begin with a sharp it The entire remaining portion of the line serves as the comment In addition the following comments can also be used Comment Comment Comment 68 3 6 Option Files Example usr include Include specifying D F2MC16 Macro specifying g Debug data generation specifying S Execution of processes up to compiling Default Option File A preselected option file can be read to initiate command execution The obtained result will be the same as when an option is specified prior to another option specified in the command line The default option file name is predetermined as follows For UNIX OS OPT911 fcc911 0pt OPT935y fcc935 0pt For Windows 911 911 OPT9I35 fcc935 opt The fcc911s command default option file name is fcc91 1 opt The fcc935s command default option file name is fcc935 opt If the default option file does not exist in the specified directory such a specifying is ignored To inhibit the default option file feature specify the Xdof option in the command line 69 CHAPTER 3 C C COMPILER OPERATION 3 Messages Generated in Translation Process When an error is found in a source program or a condition which does not constitute a substantial error but requires attention is encountered diagnostic messages may be generated at the time of translation For
134. is chapter describes environment variables in the system used to run the C C compiler For information on setting variables refer to the manual for the respective operating system All environment variables can be omitted For information on the supply style refer to the C C Compiler Installation Manual See Section 3 3 File Names and Directry Names for details about the characters that can be used for the directories to be set up as environment variables in the Windows95 Windows98 WindowsNT version Setup Example set TMPzc Fujitsu MCU tool For environment variable setup do not use double quotation marks 2 1 FETOOL 2 2 LIB911 LIB935 2 3 OPT911 OPT935 2 4 INC911 INC935 2 5 TMP 2 6 FELANG CHAPTER 2 SETTING ENVIRONMENT VARIABLES IN SYSTEM BEFORE STARTING 2 1 FETOOL Specify the directory where the development environment is installed E FETOOL General Format 1 For UNIX OS setenv FETOOL Installation directory General Format 2 For Windows set FETOOL Installation directory The driver accesses the compiler message file include file and other items via the path specified by FETOOL When FETOOL setup is not completed the parent directory for the directory where the activated driver exists the position of the directory where the driver exists is regarded as the installation directory No more than one directory can be specified Example For UNIX OS setenv FETOOL usr local softu
135. is not used within this manual B Structure of This Manual This manual consists of 11 chapters and an Appendix CHAPTER 1 SOFTUNE C C COMPILER This chapter gives a general description of the C C compiler CHAPTER 2 SETTING ENVIRONMENT VARIABLES IN SYSTEM BEFORE STARTING This chapter describes the environment variables in the system for operating the C C compiler CHAPTER 3 C C COMPILER OPERATION This chapter explains the functional specifications of commands CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE This chapter explains the requirements for FR family program execution CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE This chapter explains the requirements for FR V family program execution CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS This chapter deals with the extended language specifications supported by the compiler It also explains the restrictions on translation by the compiler CHAPTER 7 EXECUTION ENVIRONMENT This chapter relates to the procedures for execution in the environment without an operating system CHAPTER 8 LIBRARY OVERVIEW The chapter outlines the library on the configuration of files supplied by the library and the relationship between the library and the system where the library is installed CHAPTER 9 LIBRARY INCORPORATION This chapter discusses the operations and functions required for use of the library CHAPTER10 COMPILER DEPENDENT SPECIFICATIONS This chapter describe
136. it indicates successful termination When the status val ue is EXIT FAILURE it indicates the unsuccessful termination 209 APPENDIX B Operations Specific to C Libraries 210 INDEX INDEX The index follows on the next page This is listed in alphabetic order 211 INDEX Index A abort function 181 addition operation halfword dual instruction M instruction 140 143 addition sum operation halfword quad instruction M instruction eeseseseeses 143 ANSI standard macro stipulated by 151 area 192 asm statement description by 118 ASSO ee 200 B branch probability specification function 132 C C library operation specific to 206 C specification for C C compiler and EC specification 188 C template limitation on use of 189 C C compiler function 2 case sensitiveness 19 close function 174 196 command basic process 3 command cancel option list 24 command 16 com
137. language are explained below O Code section Code section stores machine codes This section corresponds to the procedure section for the C language O Initialized section Initialized section stores the initial value attached variable area For the C language this section corresponds to the area for external variables without the const attribute static external variables and static internal variables O Constant section Constant section stores the write protected initial value attached variable area For the C 74 4 1 Section Structure of fcc911s language this section corresponds to the area for const attribute attached external variables static external variables and static internal variables Data section Data sectio stores the area for variables without the initial value For the C language this section corresponds to the area for external variables including those which are with the const attribute static external variables and static internal variables section section stores the area for the io qualified variables For the C language this section corresponds to the area for io qualified external variables including those which are provided with the const attribute static external variables and static internal variables The default section name is IO Vector section This section is where interrupt vector tables are stored In C a vector table is generated only when its generation is specifi
138. ler and the directory where the C C compiler is installed When compiling at multiple points in the UNIX environment the true directory name not including a symbolic link must be the same Linking is delayed depending on how to use a template Awarning of errors in the template syntax is issued at linking B Circumventing limitations on the use of the C template To circumvent the above problems simply specify the t local option for all the modules This specification causes template data in each module resulting in an increased code size for the runtime object To solve the code size problem specify the no auto instantiation option to embed pragma in the source program thereby controlling template instantiation For information on using pragma to control instantiation see section 6 12 Function for Controlling Instantiation of C Template 189 CHAPTER 10 COMPILER DEPENDENT SPECIFICATIONS 190 CHAPTER 11 SIMULATOR DEBUGGER LOW LEVEL FUNCTION LIBRARY The simulator debugger low level function library is a library of the low level functions which are necessary when the standard library is used with the simulator debugger This chapter describes how to use the simulator debugger low level function library 11 1 Low level Function Library Overview 11 2 Low level Function Library Use 11 3 Low level Func Function 11 4 Low level Function Library Change 191 CHAPTER 11 SIMULATOR DEBUGGER LOW
139. level Function Specifications Create the low level functions in compliance with the specifications stated in this section 172 9 5 Low level Function Specifications 9 5 1 open Function The open function should be generated according to the specifications in this section include lt fcntl h gt int open char fname int fmode int p B open Function Explanation In the mode specified by fmode open the file having the name specified by fname For fmode specifying a combination of the following flags logical OR is used The value 0777 is always delivered as p O RDONLY Opens a read only file WRONLY Opens a write only file O RDWR Opens a read write file The above three flags are to be exclusively specified CREAT Create this flag when the specified file does not exist If the specified file already exists ignore this flag O TRUNC If any data remains in the file discard such data to empty the file O APPEND Selects the append mode for file opening The file position prevailing at the time of opening must be set so as to indicate the end of the file When writing into a file placed in this mode start writing at the end of the file without regard to the current file position O BINARY Specifies a binary file Therefore the file opened must be treated as a binary file Files for which this is not specified must be treated as text files When the name for standard input output and standard erro
140. ling by calling the sbrk function Figure 9 5 1 Area Change Brought About by sbrk Function Calling After a change After a change effected by a effected by a Before change plus size value minus size value Low Existing area size byte 1 size byte High Return value 1 the end address of the area prevailing before the area change 1 Return value When the area change is successfully made the value to be returned must be determined by adding the value 1 to the end address of the area prevailing before the area change If the sbrk function has not been called the start address of the acquired area must be returned If the area change is not successfully made the value char 1 must be returned 179 CHAPTER 9 LIBRARY INCORPORATION 9 5 8 exit Function The exit function should be generated according to the specifications in this section include lt stdlib h gt void _ exit int status B exit Function Explanation The exit function must bring the program to a normal end When the status value is 0 or in the case of EXIT SUCCESS the successful end state must be returned to the system environment In the case of EXIT FAILURE the unsuccessful end state must be returned to the system environment Return value The exit function does not return to the caller 180 9 5 Low level Function Specifications 9 5 9 abort Function The __ abort function should be
141. mand Function Call Interface 106 Stack frame The stack frame construction is stipulated by the standard linkage regulations Argument Argument transfer relative to the called function is effective via a stack or register Argument extension format When an argument is to be stored in a stack the argument type is converted to an extended format in accordance with the argument type Calling procedure The caller function initiates branching to the called function after argument storage Register The register assurance stated in the standard linkage regulations and the register setup regulations are explained later Return value The return value interface stated in the standard linkage regulations is explained later 5 6 fcc935s Command Function Call Interface 5 6 1 fcc935s Command Stack Frame The standard linkage regulations stipulate the stack frame construction B fcc935s Command Stack Frame The stack pointer SP always points to the lowest order of the stack frame Its address value always represents the 8 byte boundary Figure 5 6 1 fcc935s Command Stack Frame shows the standard function stack frame status The following area size is rounded up in 8 byte increments due to 8 byte boundary alignment Figure 5 6 1 fcc935s Command Stack Frame Low SP Actual argument area Register save area Local variable area FP Old FP Hidden parameter save area Return address storage ar
142. mand line position within 19 command operand 17 command option list of sss 20 command 16 command related 27 64 compiler translation limitation 153 compiler dependent language specification differential 184 compiling process control option for 3 controlling instantiation of C template UNCION in ette 156 coordination with symbolic debugger 5 Cpe Miori i Y 200 D data output related option 27 34 debug information related option 27 63 default option file 69 arrori ranr aaa EETA nnns 19 212 directry name cenio e 18 dynamic alocation area change 197 E npe ead 200 amp rrorleveli eiii fane e ricas 70 example E A epi onere c seg 194 19 execution process 158 exit function rere d 180 expressible value 186 F fcc907s command section structure 74 fcc911 command macr
143. mation to the standard output varorder SORT NOR MAL Specify the allocation type of static variables w level Specifies the warning message output level Xdof Inhibits the default option file read operation x func func2 Specifies the in line expansion of functions xauto size Specifies the in line expansion of the functions whose logical line count is not less than size Y item dir Changes the item position to dir 21 CHAPTER 3 C C COMPILER OPERATION 22 Table 3 4 1 List of Command Options Continued Specifying Format e name Function Specifies the entry of a program L path1 path2 Specifies the library path 1 lib1 lib2 Specifies the library file name mM Outputs a map file at the time of linking ra name start end Specifies the RAM area ro name start end Specifies the ROM area sc param Specifies the section arrangement startup file Specifies the startup file name Table 3 4 2 List of Command Options For fcc911s Specification format K A1 A4 Function Specifies the minimum boundary alignment value for static data K REALOG Performs in line expansion for the ITRON system call function K SCHEDULE NOSCHEDULE Specifies the recall of the scheduler K SARG DARG Specifies the method for argument area acquisition K SH
144. n accordance with detailed analyses of a program flow 2 Optimization level 2 The following optimization feature is exercised in addition to the feature provided by optimization level 1 Loop unrolling Loop unrolling is performed to increase the execution speed by decreasing the loop count when loop count detection is possible However it tends to increase object size Therefore this optimization should not be used in situations where object size is important Before unrolling for i 0 i lt 3 i a i 0 After unrolling 0 0 1 0 a 2 0 3 Optimization level 3 The following optimization features are exercised in addition to the features provided by optimization level 2 Loop unrolling extended Loops including branch instructions that have not been the target of optimization level 2 loop unrolling are the target of this extended loop unrolling Optimization function repeated execution In optimization function repeated execution the optimization features except the loop unrolling feature will be repeatedly executed until no more optimization is needed However the translation time will increase A4 Optimization level 4 The following optimization features are exercised in addition to the features provided by optimization level 3 Arithmetic operation evaluation type change same as effected by K EOPT specifying Switches to a higher speed standard function that recognizes standard funct
145. n immediate value it unsigned long a signed long c _MCUTSS ACCO _MCUTSS ACC1 4 LDFI FP 8 FRO MCUTSS FRO FR1 STFI FR1 FP 4 MCUTSSI ACC 4 FR1 STFI FR1 FP 4 145 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS B Media Halfword Expand Instruction M Instruction Assembler notation Operation of the instruction MEXPDHW FRi s6 FRk HI FRk EXPAND FRi s6 LO FRk EXPAND FRi s6 Media built in function prototype unsigned long MEXPDHW unsigned long int The second argument must be an immediate value The second argument is masked by OxSF Usage example Expansion example unsigned long a b a MEXPDHWY b 4 LDFI FP 8 FRO MEXPDHW FRO 4 FR1 STFI FR1 FP 4 MEXPDHD FRi s6 FRk HI FRk EXPAND FRi s6 LO FRk EXPAND FRi s6 HI FRk 1 EXPAND FRi s6 LO FRk 1 EXPAND FRi s6 unsigned long long __MEXPDHDv unsigned long int The second argument must be an immediate value The second argument is masked by OxSF B Media Halfword Pack Unpack Instruction M Instruction Assembler notation Operation of the instruction MPACKH FRi FRj FRk HI FRk LO FRi LO FRk LO FR Media built in function prototype unsigned long MPACKH unsigned short unsigned short unsigned long b unsigned long long a a _MEXPDHD b 4 LDFI FP 8 FRO MEXPDHW FRO 4 FR2 STDFI
146. n is specified in the O option The language specification permits the pointer to point to the same area as any other variable or pointer Therefore when using this option check the program carefully The ALIAS suboption cancels the NOALIAS suboption Output Example Input extern int i extern int j void func9 int p p i 1 1 Operation fcc911s noalias O 91100 S sample c Output LDI 32 i R12 LD R12 RO LDI 32 j R12 ADD 1 RO ST RO R4 ST RO R12 Value of p i 1 reused Operation fcc935s K O cpu MB93500 S sample c K noschedule Output sethi hi _i gr4 setlo lo _i gr4 ld gr4 9 0 gr5 addi gr5 1 gr6 st gr6 gr10 grO sethi hi _j gr7 setlo lo _j gr7 st gr6 gr7 gro Value of p i 1 reused 50 3 5 Details of Options O K SCHEDULE NOSCHEDULE option K SCHEDULE NOSCHEDULE option specifies whether or not to implement instruction scheduling When the SCHEDULE suboption is specified for the fcc911s command instruction scheduling will be conducted When the NOSCHEDULE suboption is specified the command will not conduct instruction scheduling If this option is omitted the operation conforms to the contents specified in the O option When an optimization level of 1 or higher is specified by the O option K SCHEDULE is assumed to be specified When the SCHEDULE suboption is specified for the fcc935s instruction sche
147. n value storage area When this address needs to be saved in memory the callee function secures the hidden parameter save area and saves the address in that area 8 Passing of a class as a return value depends on the availability and contents of a copy constructor Without the copy constructor the class is passed in the same manner as the structure 92 4 7 fcc911s Command Interrupt Function Call Interface 4 7 fcc911s Command Interrupt Function Call Interface The interrupt function can be written using the interrupt type qualifier If the interrupt function is called by a method other than an interrupt no subsequent operations will be guaranteed The function call interface within the interrupt function is the same as stated in the standard linkage regulations B fcc911s Command Interrupt Function Call Interface O Interrupt stack frame When an interrupt occurs the stack is changed to the interrupt stack O Argument No argument can be specified for the interrupt function If any argument is specified for the interrupt function no subsequent operations will be guaranteed O Interrupt function calling procedure The interrupt function is called by an interrupt via the interrupt vector table If the interrupt function is called by any other method no subsequent operations will be guaranteed O Register As regards the interrupt function all registers are guaranteed O The return value Interrupt function does not usuall
148. nation with Symbolic Debugger When the g option is specified the compiler generates the debug information to be used by the symbolic debugger When such information is generated C C language level debugging can be accomplished within the symbolic debugger Two types of symbol debuggers are available simulator debugger and emulator debugger When the optimization option O 1 4 is specified debugging should be performed noting the CHAPTER 1 SOFTUNE C C COMPILER following points When the optimization option is specified the compiler attempts to ensure good code generation by changing the computation target position and eliminating computations that are judged to be unnecessary To minimize the amount of data exchange with memory the compiler tries to retain data within a register It is therefore conceivable that a break point positioned in a certain line may fail to cause a break or that currently monitored certain address data may fail to vary with the expected timing It also well to remember that the debug data will not be generated for an unused local variable or a local variable whose area need not be positioned in a stack as a result of optimization Debugging must be conducted with the above considerations taken into account B Optimization When the O option is specified the compiler generates an object subjected to general purpose optimization CHAPTER2 SETTING ENVIRONMENT VARIABLES IN SYSTEM BEFORE STARTING Th
149. ndary suitable for the field type An example is shown in Figure 5 4 2 fcc935s Command Bit Field Data Size and Boundary Alignment Example Figure 5 4 2 fcc935s Command Bit Field Data Size and Boundary Alignment Example 2 struct tag2 int A 12 4 byte boundary data short B 5 2 byte boundary data chart C 5 l byte boundary data When a bit field having a bit length of 0 is declared it is forcibly assigned to the next storage unit An example is shown in Figure 5 4 3 fcc935s Command Bit Field Data Size and Boundary Alignment Example 3 102 5 4 fcc935s Command Bit Field Figure 5 4 3 fcc935s Command Bit Field Data Size and Boundary Alignment Example 3 struct tag3 int A 10 int Bio int 0 int C 6 Unoccupied Unoccupied 103 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 5 fcc935s Command Structure Union The fcc935s command structure union data size and boundary alignment are explained below The structure union data size is a multiple of the maximum boundary alignment size of the members Boundary alignment for the area itself is accomplished by means of member maximum boundary alignment The individual members are subjected to boundary alignment in accordance with the member type B fcc935s Command Structure Union Figure 5 5 1 fcc935s Command Structure union Data Size and Boundary Alignment Example 1 Figure 5 5 2 fcc935s Command Structure uni
150. ne5 Example For Windows set FETOOL c softune5 2 2 LIB911 LIB935 2 2 LIB911 LIB935 Specify the directory that contains the library to which the fcc911s commands are linked by default as LIB911 Specify the directory that contains the library to which the fcc935s commands are linked by default as LIB935 B LIB911 LIB935 General Format 1 For UNIX OS setenv LIB911 library directory directory 2 setenv LIB935 library directory directory 2 General Format 2 For Windows set LIB911 library directory directory 2 set LIB935 library directory directory 2 Specify the directory to which linking is effected by default When LIB911 and LIB935 are not set up the directory placed at the respective location relative to the FETOOL directory FETOOL lib 911 or FETOOL ib 935 is regarded as the default library directory Two or more directories can be specified separated by a delimiter The delimiter is a colon for the UNIX OS and a semicolon for Windows Example For UNIX OS setenv LIB911 usr local softune5 lib 91 1 setenv LIB935 usr local softuneb5 lib 935 Example For Windows set LIB911 c softune5 lib 91 1 set LIB935 c softuned lib 935 CHAPTER 2 SETTING ENVIRONMENT VARIABLES IN SYSTEM BEFORE STARTING 2 3 OPT911 OPT935 Specify the directory for the default option file to be used by the fcc911s command as OPT911 Specify the directory for the default option file to be used by
151. ng template Specify the Ja option or the Jc option If this option is not given description of specifications is outside the range of the EC specifications and the warning message is output O Limitations When instantiation is not controlled by pragma or anything other than local default none is selected in the t option the following limitations apply Linking is impossible just with the generated object file The source files and simultaneously generated files with ii extensions are needed in pairs Do not move delete or rewrite the generated files with ii extensions Do not change the directories and names of the generated object and source files and do not link object files after deletion In this case always perform recompiling Recompiling is needed for changes alone between the UNIX and Windows environments When the S option is specified always generate object files with obj extensions with the same module name in the same directories as those of the generated assembler files Datainthe assembler files generated by the S option is not rewritten Do not generate libraries with a librarian For development by more than one operator carry out tasks from compiling to linking at a single point Compiling at multiple points requires conformity in the positions of directories of source and object files including the name of a network drive when used the environment variables related to the C C compi
152. nly in the comment can not be mixed Recognized character count of an identifier with an external binding 6 1 2 Identifiers No limitation Differentiation between upper and lower case alphabetical characters of an identifier with an external binding 6 1 2 Identifiers Treated as different characters Character set element expression code system 6 1 3 Numerical constants ASCII code Char type treatment and expressible value range 6 2 1 1 Character type and integer type Unsigned 1 0 to 255 Floating point data formats and sizes float type double long double type 6 1 2 5 Data types IEEE type 2 4 bytes 8 bytes Whether or not to treat the start bit as signed bit when following types specified as bit field char short int long and long long type 6 5 2 1 Structure specifier and union specifier Not treated as a sign 1 Types that can be specified as bit field 184 6 5 2 1 Structure specifier and union specifier char type signed char type unsigned char type short type unsigned short type int type unsigned int type long type unsigned long type long long type fcc 935s only unsigned long long type fcc 935s only 10 1 Compiler dependent C Language Specification Differentials Table 10 1 1 Compiler dependent Language Specification Differentials Continued Specification Differentials Structure or union member boundary
153. ns 3 5 7 Debug Information Related Options This section describes the options related to the debug information to be referenced by the symbolic debugger B Debug Information Related Options O g option and Xg option Adds debug data to the object file When the optimization option O 1 4 is specified debugging should be performed noting the following points If the optimization option is specified the compiler tries to assure better code output by changing the arithmetic operation target position and omitting any arithmetic operations that are judged to be unnecessary To minimize the amount of data exchange with memory the compiler tries to retain data within a register It is therefore conceivable that a break point positioned in a certain line may fail to cause a break or that currently monitored certain address data may fail to vary with the expected timing It also well to remember that the debug data will not be generated for an unused local variable or a local variable whose area need not be positioned in a stack as a result of optimization Debugging must be conducted with the above considerations taken into account The Xg option cancels the g option 63 CHAPTER 3 C C COMPILER OPERATION 3 5 8 Command Related Options This section describes the options related to the other tools called by the command B Command Related Options 64 O Y item dir option and XY option Changes the item position
154. ns Continued Specifying Format K DCONST FCONST Function Specifies the type of a real constant without a suffix K EOPT Effects optimization for changing the arithmetic operation evaluation procedure K LIB Recognizes the standard function operation and implements in line expansion substitution for other functions K NOALIAS Effects optimization on the presumption that differing pointers do not indicate the same area K NOINTLIB Effects no in line expansion for interrupt related functions K NOUNROLL Inhibits loop unrolling K NOVOLATILE Does not consider io qualifier variables to be volatile K SIZE SPEED Selects optimization based on the size and execution speed K UCHAR SCHAR Specifies the mere char sign handling K UBIT SBIT Specifies the mere int bit field sign handling kanji SJIS EUC Specify the kanji code used in a program O level Gives instructions for general purpose optimization pathname Outputs the result to the pathname Performs preprocessing only and outputs the result to i Performs processes up to compiling and outputs the result to asm s defname newname attr address Changes the section name T item arg1 arg2 Passes arguments to the tool U name Cancels the macro name definition V Outputs the executed compiler tool version infor
155. nt register save area Virtual argument area High O Actual argument area virtual argument area When a function is called this area is used for argument transfer This area is referred to an actual argument area when the caller function is used to set up an argument and to a virtual argument area when the argument is referenced by the caller function This area is created when all arguments cannot be contained in an argument register during the transfer of an argument For details see section 4 6 2 fcc911s Command Argument O Local variable area This is the area for local variables and temporary variables O Old FP This area stores the frame pointer FP value of the caller function O Return address storage area This area saves the RP The RP stores the address of a return to the caller function for the purpose of function calling 83 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 84 O Register save area This is a register save area that must be guaranteed for the caller function This area is not secured when the register save operation is not needed Hidden parameter save area This area stores the start address of the return value storage area for a structure union return function When a structure union is used as the return value the caller function stores the return value storage area start address in register R4 and passes it to the caller function The callee function inter
156. o predefined by 151 fcc911 rule for name generation 76 fcc911s command 85 fcc911s command argument extension format 88 fcc911s command bit field 78 fcc911s command boundary alignment 77 fcc911s command calling procedure 89 fcc911s command function call interface 82 fcc911s command interrupt function call interface 93 fcc911s command library section name 164 fcc911s command register guarantee 91 fcc911s command register setup 91 fcc911s command return value 92 fcc911s command sbrk c source program list 197 fcc911s command stack frame 83 fcc911s command structure union 80 fcc935 generation rules for names used by 100 fcc935s command 109 fcc935s command argument extension format 111 fcc935s command bit field 102 fcc935s command boundary alignment 101 fcc935s command calling procedure 112 fcc935s command function call interface 106 fcc935s command library section name 164 fcc935s command 114 fcc9
157. on Data Size and Boundary Alignment Example 2 and Figure 5 5 3 fcc935s Command Structure union Data Size and Boundary Alignment Example 3 show examples concerning structure union data size and boundary alignment Figure 5 5 1 fcc935s Command Structure union Data Size and Boundary Alignment Example 1 struct stl char A sizeof stl 1 BYTE struct st2 short A sizeof st2 2 BYTE struct st3 char A short B sizeof st3 4 BYTE struct st4 char A int B sizeof st4 8 BYTE struct st3 Q har A hort B 31 MSB 23 15 0 LSB 5 Figure 5 5 2 fcc935s Command Structure union Data Size and Boundary Alignment Example 2 struct tag4 chart A int B Unoccupied 104 5 5 fcc935s Command Structure Union Figure 5 5 3 fcc935s Command Structure union Data Size and Boundary Alignment Example 3 struct tag5 char A struct tag short A char B sizeog tag5 sizeog tag6 15 105 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 6 fcc935s Command Function Call Interface The general rules for control transfer between functions are established as standard regulations for individual architectures and are called standard linkage regulations A module written in C can be combined with a module coded using a different method e g assembler language when the standard linkage regulations are complied with B fcc935s Com
158. on Structure of fec935s ooo ce eecccescceeeecececeeeeeeaaeeeeeaaeesaaeeeeaaaeesaaeeeeaaaesaaaeesaeeseeaaeesseeeseaaeseeneaeeens 98 5 2 Generation Rules for Names Used by 9355 2 100 5 3 fcc935s Command Boundary Alignment sess esee ener 101 5 4 fcc935s Command Bit Field a tenen nnn snnt 102 5 5 fcc935s Command Structure Union sess enne nsns nennen snnt 104 5 6 fcc935s Command Function Call Interface ssssssssssssssseeneennee ennemis 106 5 6 1 9355 107 5 6 2 fcc935s Command Arguments sse eene nen nennen rentrer nnns nnn 109 5 6 3 9355 Command Argument Extension Format sese 111 5 6 4 fcc935s Command Calling Procedure sssssssssssese eene 112 5 6 5 fcc935s Command Register sse eene enne nennen nennen ener snnt nnn 114 5 6 6 9355 Command Return Value sse eene enne nnns 116 CHAPTER6 EXTENDED LANGUAGE SPECIFICATIONS 117 6 1 Assembler Description amp 118 6 2 Interrupt Control Functions ii a dde cae dee ere oia enne depre 124 6 3 I
159. on following the SIZE sub option The K SIZE option not only offers the optimization combination selection function but also makes it possible to issue a generation instruction for object size minimization and effect object pattern switching K SPEED option Selects an appropriate optimization combination with emphasis placed upon the generated object execution speed The selected options in the fcc911s command are indicated below e 04 KSHORTADDRESS The option for the fcc935s command is indicated below e 04 To change the above combination specify for example the K LONGADDRESS option following the SIZE sub option The K SPEED option not only offers the optimization combination selection function but also makes it possible to issue a generation instruction for execution speed maximization and effect object pattern switching O level option O level specifies the optimization level Levels 0 1 2 3 and 4 can be specified The higher the optimization level the shorter the generated object execution time but the longer the compilation time Note that each optimization level contains lower optimization level functions One of the following levels is to be specified When no level is specified O2 applies 3 5 Details of Options O Optimization level 0 No optimization will be effected This level is equivalent to cases where the O is not specified e Optimization level 1 Optimization will be effected i
160. ong unsigned long The first argument must be ACCO ACC2 ACC4 or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h unsigned long b c _MMACHU ACC2 b LDFI FP 8 FRO LDFI FP 12 FR1 MMACHU FRO FR1 ACC2 B Media Dual Multiplication and Subtraction Operation Halfword Dual Instruction M Instruction Assembler notation Operation of the instruction MMRDHS FRi FRj ACCk Media built in function prototype Usage example void MMRDHU int unsigned long unsigned long Expansion example signed long b c _MMRDHS ACC4 b 140 Assembler notation Operation of the instruction ACCGk ACCk HI FRi LO FRj ACCGk 1 ACCk 1 LO FRI HI FRj Media built in function prototype The first argument must be ACCO ACC2 ACCA or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h 6 8 Built in Function Usage example Expansion example LDFI FP 8 FRO LDFI FP 12 FR1 MMRDHS FRO FR1 ACC4 MMRDHU FRi FRj ACCk void MMRDHU int unsigned long unsigned long unsigned long b c MMRDHU ACCS b ACCGk ACCK HI FRi LO FRj ACCGk 1 ACCk 1 LO FRi HI FRj The first argument must be ACCO ACC2 ACCA or ACC6 ACCO ACC2 ACCA and ACC6 are list constants defined in media h LDFI FP 8 FRO LDFI FP 12 FR1 MMRDHU FRO FR1 ACC6 B Media Quad Satura
161. onventions are as follows base section name function name boundary value base section name is the section name assigned when neither the splitsection nor the align option is specified The default section name is CODE When the s option or pragma section is used to specify a section name the section name is used as the base section name function name is the name of the function defined in the file boundary value is the boundary alignment value for the section The default is 4 When the align option is specified its value is used as the boundary value If functions having the same name are contained in different files sections are generated under the same name Note that these sections are allocated in adjacent areas at the linking time The splitsection option is ignored when the s option or pragma section is used to specify an arrangement address The Xsplitsection option generates a single CODE section for each file When both 3 5 Details of Options splitsection and Xsplitsection are omitted the Xsplitsection option is used Remarks The splitsection option can be used to control the allocation order on a function by function basis at linking time With the FR500 an increase in the number of cache misses largely affects the performance Two functions known to be frequently executed in succession may reduce instruction cache misses when they are allocated in contiguous areas in the order in which t
162. otype unsigned long long MBTOH unsigned long Usage example Expansion example unsigned long long a unsigned long b a _MBTOH b LDFI FP 12 FRO MBTOH FRO FR2 STDFI FR2 FP 8 MHTOB FRi FRk BYTE1 FRk unsigned char USAT HI FRi BYTEO FRK unsigned char USAT LO FRi BYTE3 FRk unsigned char USAT HI FRi 1 BYTE2 FRk unsigned char USAT LO FRi 1 unsigned long MHTOB unsigned long long unsigned long a unsigned long long b MHTOB b LDDFI FP 12 FRO MHTOB FRO FR2 STFI FR2 FP 4 147 CHAPTER 6 EXTENDED LANGUAGE SPECIFICATIONS B Media Accumulator Clear Instruction M Instruction Assembler notation Operation of the instruction MCLRACC ACCk A IF A 0 ACCGk ACCk 0 JELSE FOR k 0 kcACCmax k ACCGk ACCk 0 Media built in function prototype void __MCLRACC int The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h void _MCLRACCA void B Media Accumulator Read Write Instruction M Instruction Assembler notation Operation of the instruction MRDACC ACCi FRk FRk 2ACCi Media built in function prototype unsigned long MRDACC int The first argument must be ACCO to ACC7 ACCO to ACC7 are list constants defined in media h Usage example Expansion example MCLRACC ACOO MCLRACCA MCLRACC ACCO 0 MCLRACC ACCO 1
163. ource Program List The source program required for changing the dynamic area is shown below The file name must be sbrk c define SIZE 16 1024 static long brk siz 0 if HEEP_SIZE typedef int _heep_t define ROUNDUP s S sizeof heep t 1 amp sizeof _heep_t 1 static _heep t heep ROUNDUP HEEP SIZEy sizeof heep t define _heep_ size ROUNDUP HEEP_ SIZE else extern char heep extern long _heep_size endif extern char X sbrk int size siz size gt _heep_size siz size lt 0 return char 1 brk siz size return char heep siz size 197 CHAPTER 11 SIMULATOR DEBUGGER LOW LEVEL FUNCTION LIBRARY B fcc935s Command sbrk c Source Program List The source program required for changing the dynamic area is shown below The file name must be sbrk c define SIZE 16 1024 static long brk siz 0 if HEEP SIZE typedef long long _heep_t define ROUNDUP s s sizeof heep 1 1 amp sizeof heep t 1 static heep t _heep ROUNDUP HEEP_SIZE sizeof _heep_t define _heep_size ROUNDUP HEEP_ SIZE else extern char heep extern long heep size endif extern char sbrk int size siz size gt _heep_size brk siz size lt 0 return char 1 brk siz size return char heep siz size 198 APPENDIX The appendix gives a list of types macros functions and variables provided by the lib
164. owing command fcc911s test c cpu MB91100 gt fcc935s test c cpu MB93500 At completion of the preceding step test abs is created Execute the created file with the simulator debugger After startup input following commands gt set inport ascii h 0 h ff STERMINAL gt set outport ascii h 1 h ff STERMINAL go end Since standard input is not involved in the above example the set inport command can be omitted 11 3 Low level Func Function 11 3 Low level Func Function This section describes the function specific to the simulator debugger low level functions B Special I O Port As far as the low level functions are concerned the first three bytes of the I O section are specified to function as the standard input standard output and standard error output respectively For such bytes files No 0 1 and 2 are allocated They are initialized to the opened state Table 11 3 1 Predefined I O Port show the predefined I O port Table 11 3 1 Predefined I O Port Address File Number File Type IOPORT Standard input IOPORT 1 Standard output IOPORT 2 Standard error output The input from the standard input file No 0 is output to the standard output file No 1 The input to the standard input file No 0 is discontinued if the new line character n is entered However when the input is fed from some other port the input continues until the required number of characters are read E
165. prets the address stored in the R4 as the return value storage area start address When register R4 needs to be saved into memory the callee function saves it in the hidden parameter save area This area is not secured when the save operation is not needed Argument register save area This area saves the argument register This area is not secured when the save operation is not needed For details see section 4 6 2 fcc911s Command Argument 4 6 fcc911s Command Function Call Interface 4 6 2 fcc911s Command Argument Arguments the count of which equals the count of argument registers 4 words are positioned in registers R4 to R7 and delivered to the callee function When a structure union return function is called three argument registers R5 to R7 are used because the return value area address is stored in register R4 Arguments not placed in the argument registers will be stored in the stack actual argument area for transfer purposes When an 8 byte type argument is to be delivered using registers it is divided into two and placed in two registers for transfer B fcc911s Command Argument When argument registers must be saved to memory the callee function secures an argument register save area in the stack In this case a continuous argument register save area must be established in the virtual argument area The argument register save area must be allocated as needed to cover the size of the argument register to be saved
166. r to z isprint 040 to 176 isupper A to Z Mathematical function return value upon definition area error occurrence e Whether the mathematical function sets up the macro ERANGE value for errno upon underflow condition occurrence ERANGE The detectable result value must be 0 or 0 The undetectable result value is undefined It depends on the function When the second actual argument for the fmod function is 0 The definition area error must occur or the value 0 must be returned File buffering characteristics Input file buffering characteristics OLBF IOFBF Full buffering APPENDIX B Operations Specific to C Libraries ONBF No buffering Output file buffering characteristics OFBF Full buffering e OLBF Line buffering ONBF No buffering Full buffering Buffering is conducted using all the preset buffer areas When the input function is called at the time of input from a file any data remaining in the buffer is returned as the input from the file If the buffer is emptied of data or does not have sufficient data the input from the file is received until the buffer is filled up and then only the necessary amount is returned as the input At the time of output to a file the output function writes into the buffer instead of outputting into the file When the buffer is filled up by the write operation the buffer outputs its entire contents to the file Line buffer
167. r output which is determined for system environment setup is specified as the file name for the first argument allocate the standard input output and standard error output to the file to be opened Return value When file opening is successfully done the file number must be returned If file opening is not successfully done on the other hand the value 1 must be returned 173 CHAPTER 9 LIBRARY INCORPORATION 9 5 2 close Function The close function should be generated according to the specifications in this section int close int fileno B close Function Explanation The closing process must be performed for the file specified by fileno Return value When file closing is successfully done the value 0 must be returned If file closing is not successfully done the value 1 must be returned 174 9 5 Low level Function Specifications 9 5 3 read Function The read function should be generated according to the specifications in this section int read int fileno char buf unsigned int size E read Function Explanation From the file specified by fileno size byte data must be input into the area specified by buf If the text file new line character is other than n in the system environment at this time perform setup with the new line character converted to n by the read function Return value When the input from the file is successfully done the input character count must be returned If the
168. raries and describes the operations specific to the libraries APPENDIX A List of Types Macros Functions and Variables Provided by C Libraries APPENDIX B Operations Specific to C Libraries 199 APPENDIX A List of Types Macros Functions and Variables Provided by C Libraries APPENDIX AList of Types Macros Functions and Variables Provided by C Libraries The types macros functions and variables provided by the C libraries are listed below B assert h O Function assert B ctype h O Macros isalnum islower isxdigit B errno h O Macros EDOM O Variable errno 200 iscntrl isdigit ispunct isspace toupper isgraph isupper B float h APPENDIX A List of Types Macros Functions and Variables Provided by C Libraries O Macros FLT_MAX DBL_MAX LDBL_MAX DBL_EPSILON LDBL_EPSILON FLT_MIN LDBL_MIN E limits h for fcc911s command O Macros MB LEN MAX CHAR BIT SCHAR MIN SCHAR MAX CHAR MIN CHAR MAX INT MIN INT MAX SHRT MIN SHRT MAX MAX LONG MIN ULONG MAX E limits h for fcc935s Command O Macros MB LEN MAX CHAR SCHAR MIN SCHAR MAX CHAR MIN CHAR MAX INT MIN INT MAX SHRT MIN SHRT MAX USHRT MAX LONG MIN ULONG MAX LONG LONG MIN LONG LONG MAX ULONG LONG MAX FLT RADIX LDBL NANT DIG FLT MIN EXP DBL MIN 10 EXP LDBL MAX EXP FLT ROUNDS FLT DIG DBL MIN EXP LDBL MIN 10 EXP FLT MAX 10 EXP FLT MANT DIG DBL DIG LDBL MIN EXP FLT MAX EXP DBL MAX 10 E
169. rporating System Initialization Termination Process Necessary for Library Use Initialization unique to C In the C specifications when external or static objects are used a constructor must be called followed by the main function Because four byte pointers to the main function are stored in the EXT_CTOR_DTOR section call a constructor sequentially from the lower address of the four addresses in that section In a program requiring normal termination use the atexit function to register the address of call dtors function as the function to be called from the exit function Then call the exit function after the end of the main function User program calling Call the user program 7 2 Startup Routine Creation 7 Program shutdown process The close process must be performed for opened files The normal end and abnormal end processes must be prepared in accordance with the system 161 CHAPTER 7 EXECUTION ENVIRONMENT 162 CHAPTER8 LIBRARY OVERVIEW This chapter outlines the C libraries by describing the organization of files furnished by the libraries and the relationship to the system into which the libraries are incorporated 8 1 File Organization 8 2 Relationship to Library Incorporating System 163 CHAPTER 8 LIBRARY OVERVIEW 8 1 File Organization This section describes the files furnished by the libraries B File Types The following library files are provided O fcc911s comm
170. rupt is generated the vector table corresponding to the interrupt vector number is referenced according to the following calculation TBR x 3FC 4 vector number For the details of interrupts refer to the FR20 Architecture Manual 95 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 96 CHAPTER5 9355 COMMAND OBJECT PROGRAM STRUCTURE This chapter explains the requirements for program execution 5 1 5 2 5 3 5 4 5 5 5 6 Section Structure of fcc935s Generation Rules for Names Used by fcc935s fcc935s Command Boundary Alignment fcc935s Command Bit Field fcc935s Command Structure Union fcc935s Command Function Call Interface 97 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 1 Section Structure of fcc935s The fcc935s command has the following six sections Code section e lnitialized section Constant section e Data section section C Init section B fcc935s Command Section Structure Table 5 1 1 9355 Command Section List lists the sections to be generated by the compiler and their meanings Table 5 1 1 fcc935s Command Section List Boundary Section type Section name alignment Initial value in bytes Cide section Disabled Provided Initialized section Enabled Provided Constant section Disabled Provided Data section Enabled Not provided I O section Enabled Not provided C Init section EXT CTOR DTOR Disabled
171. s O e name option and Xe option The e option sets the entry symbol to name at linking The Xe option cancels the e option Since the option definition is usually provided in the startup routine this option does not have to be specified For details of the option refer to the Linkage Kit Manual O L path option and XL option The L option adds path to the library path used at linking to search for a library to be linked If the option is not specified LIB911 is selected in the fcc911s command and LIB935 is selected in the fcc935s command automatically The XL option cancels the L option For details of the option refer to the Linkage Kit Manual O Ilib 1 lib 2 option and XI option The l option specifies the name lib of the library to be linked at linking If the extension entry is omitted the lib extension is added automatically The XI option cancels the I option For the objects output by the compiler by default in fcc911s command lib911lib in fcc935s command lib935 lib are set as the names of the libraries to be linked For the details of the option refer to the Linkage Kit Manual O m option and Xm option The m option generates a map file at linking A map file output with a file name with the map extension is generated in the current directory The Xm option cancels the m option O ra name start end option and Xra option The ra option specifies the RAM area at linking The
172. s Provided by C Libraries O Function atof atoi atol strtoul rand srand malloc realloc abort besearch qsort abs Idiv B string h O Type ptrdiff_t size t O Macros NULL offsetof O Function memopy memmove strcpx strncat memcmp strcmp strchr strcspn strpbrk strstr strtok memset WB fcntl h O Macros O RDONLY O WRONLY O RDWR O TRUNC O BINARY B unistd h O Macros SEEK SET SEEK CUR 204 strtod strtol calloc free atexit exit div labs strncpy strcat strncmp memchr strrchr strspn strlen O APPEND O CREAT SEEK END APPENDIX A List of Types Macros Functions and Variables Provided by C Libraries B sys types h O Type off t 205 APPENDIX B Operations Specific to C Libraries APPENDIX BOperations Specific to C Libraries The operations specific to the C libraries are described below B Operations Specific to C Libraries 206 O Diagnostic information printed out by the assert function and assert function termination operation Diagnostic information KKK lt Program Diagnosis information of fail expression gt file File name expanded by FILE __ line Line number expanded by LINE __ expression Expression Termination operation Same as the abort function calling Inspection character sets for isalnum isalpha iscntrl islower isprint and isupper functions isalnum 0 to 9 a to z or A to Z isalpha a to z or A to Z iscntrl 100 to 037 or M77 islowe
173. s are fetched on 16 byte boundaries in units of 16 bytes When a branch occurs the first VLIW instruction at the branch destination is fetched If this VLIW instruction is allocated across a 16 byte boundary however the instruction needs to be fetched twice generating an extra fetch cycle The align option can be used to avoid this extra fetch cycle Note that branch labels aligned on boundaries increase the code size thus possibly reducing the hit rate of the instruction cache When a program that uses only integer arithmetic operations is to be compiled aligning VLIW instructions on 8 byte boundaries may prevent them from crossing 16 byte boundaries This is because most of them are paired in parallel If an increase in the code size becomes a bottleneck specify 8 byte boundary alignment 3 5 Details of Options Output Example Input void foo int a int b int c for a b a Operation fcc935s cpu MB93500 O K gs S sample c align loop16 Output section CODE 16 CODE align 16 The section name is changed global foo align 16 _ foo subcc p gr8 gr9 grO icc1 fnop p nop is inserted to achieve 16 byte nop boundary alignment bge icc1 0 L 35 L 36 smul 018 gr10 gr4 subi gr5 1 gr8 subcc gr8 gr9 grO iccO blt iccO 3 L 36 L 35 ret O cpu MB number option Specifies MB number of CPU to be used This option cannot be omitted Example gt fcc911s S cpu MB91100 sample
174. s completion message Example Operation fcc911s cmsg S cpu MB91100 sample c fcc935s cmsg S cpu MB93500 sample c Output COMPLETED C Compile CFOUND NO ERROR sample c cwno Option Set the end code to 1 when a warning level error occurs When this option is not given the end code is 0 help option and Xhelp option Outputs the option list to the standard output The Xhelp option cancels the help option Example gt fcc911s help fcc935s help Various command option lists are output to the standard output INF LINENO option and INF NOLINENO option INF LINENO option inserts C or C source file line numbers into the assembler source file as comments The LINENO suboption cannot be specified simultaneously with the SRCIN suboption The NOLINENO suboption cancels the LINENO suboption 3 5 Details of Options Output Example Input void func void Operation fcc911s INF lineno S cpu MB91100 sample c Output func ST RP SP ENTER 4 xs sample c line 1 L func LEAVE LD SP RP RET Operation fcc935s INF lineno S cpu MB93500 sample c K Output func L 20 optl c line 1 subi sp 16 sp st fp sp gro mov Sp fp movsg LR gr4 sti gr4 Q fp 8 L 21 L 22 Idi fp 8 gr4 movgs gr4 LR addi fp 16 sp Id fp gr0 fp ret O INF LIST option and INF NOLIST option INF LIST option outputs the assemble list Generates a file in the
175. s the specifications depending on the compiler The description is related to the JIS standards based on the ANSI standards CHAPTER 11 SIMULATOR DEBUGGER LOW LEVEL FUNCTION LIBRARY This chapter explains how to use the low level function library for a simulator debugger APPENDIX The Appendix lists the types macros and functions supplied by the library and covers operations that are unique to the library B Grammer Books For C language syntax and standard library functions refer to commercially available standard compliant reference books B Reference Books THE C PROGRAMMING LANGUAGE Brian W Kernighan amp Dennis M Ritchie Japanese edition entitled Programming Language C UNIX Type Programming Method and Procedure Translated by Haruhisa Ishida Kyoritsu Shuppan American National Standard for Information Systems Programming Language C X3 159 1989 UNIX system User s Manual system V Western Electric Company Clncorporated UNIX system V Programmer Reference Manual AT amp T Bell Laboratories User Reference Manual UTS 5 Release 0 1 Western Electric Company Incorporated and Amdahl Corporation UTS Command Reference Manual UTS 5 Release 0 1 Western Electric Company Incorporated and Amdahl Corporation The Annotated Reference Manual Addison Wesley Publishing Company nc The Programing Language C Third Edition Addison Wesley Publishing Company nc ISO IEC 14882 1998 The contents of this
176. section For required functions see section 9 4 Standard Library Functions and Required Processes Low level Functions B Stream Area Initialization The stream init function initializes the stream area This function must be called by the startup routine to initialize the stream area void stream init void B Standard Input Output and Standard Error Output File Opening and Closing Because the standard input output and standard error output do not open or close files during the execution of programs files must be opened before the main function is called and must be closed when the main function is completed Use the startup routine to perform the opening process before main function calling and the closing process after main function execution However the stream init function correlates the file numbers 0 1 and 2 to the stdin stdout and stderr streams Therefore the opening process need not be performed when the system s standard input standard output and standard error output are opened as the file numbers 0 1 and 2 If the system s standard input output and standard error output are not opened or the file numbers do not match perform the following process to open the system s files freopen Standard input name r stdin freopen Standard output name w stdout freopen Standard error output name w stderr Error detection concerning the above process should be conducted as needed Further the
177. set as the stack 158 7 1 Execution Process Overview pointer Further when the startup routine returns from the user program the register status is as shown in Table 7 1 1 fcc911s Command Register Status Prevailing at Return from User Program This is because the employed interface is the same as for register guarantee at the time of function calling For register guarantee see section 4 6 5 fcc911 Command Register If the guarantee of a register is called for by the system while the value of that register is not guaranteed by the user program it is necessary to guarantee the value by the startup routine to initiate calling Table 7 1 1 fcc911s Command Register Status Prevailing at Return from User Program Register Value Guarantee at Return RO to R7 Not provided R12 to R13 Not provided R8 and R11 Provided R14 FP Provided R15 SP Provided Table 7 1 2 fcc935s Command Register Status Prevailing at Return from User Program Register Value guarantee at return GR1 SP Provided GR2 FP Provided GR3 GR15 Not provided GR16 GR31 Provided GR32 GR47 Not provided GR48 GR63 Provided FRO FR15 Not provided FR16 FR31 Provided FR32 FR47 Not provided FR48 FR63 Provided 159 CHAPTER 7 EXECUTION ENVIRONMENT 7 2 Startup Routine Creation The processes necessary for startup routine creation are described below B Startup Routine Cre
178. sign bit in situations where the char short int or long int type is selected as the bit field When the UBIT suboption is specified the most significant bit will not be treated as a sign bit When the SBIT suboption is specified the most significant bit will be treated as a sign bit If neither of the above two suboptions is specified K UBIT applies 43 CHAPTER 3 C C COMPILER OPERATION 44 Output Example Input extern int data struct tag int bf 1 st 1 void func void data st bf Operation fcc911s K sbit cpu MB91100 S sample c Output LDI 32 4 st R12 LDUB R12 RO EXTSB RO Code extended ASR 7 RO LDI 32 data R12 ST RO R12 Operation fcc935s K sbit cpu MB93500 S sample c K noschedule Output sethi hi _st gr4 setlo lo _st gr4 Id gr4 gr0 gr5 srai gr5 31 gr6 Code extended sethi ithi data gr7 setlo stlo data gr7 st gr6 gr7 gro kanji SJIS EUC option If Japanese words are entered in a program the code system for the used Japanese words is specified Japanese words including half size kana can be entered in program comments and character strings The compiler identifies the code system for Japanese description based on this option SJIS means that the Shift JIS code system is used and EUC means that the EUC code system is used When this option is omitted kanji EUC is used for Solaris and kanji SJIS is used for HP UX and Windows alternative
179. sses Low level Functions 9 5 Low level Function Specifications 167 CHAPTER 9 LIBRARY INCORPORATION 9 1 Library Incorporation Overview This section outlines library incorporation B Processes and Functions must be prepared for Library Use 168 File input output memory management and program termination procedures are the processes dependent on the system Therefore when such system dependent processes are needed such processes are separated from the standard library and whenever such processes are needed they will be called as a low level function Further the stream area initialization and other processes are necessary for library use The following processes and functions must be prepared for library use Stream area initialization Standard input output and standard error output file open and close processes Low level function creation At the time of library incorporation the above processes and functions must be prepared in accordance with the system 9 2 Initialization Termination Process Necessary for Library Use 9 2 Initialization Termination Process Necessary for Library Use This section describes the initialization termination process required for library use E initialization Termination Process Some standard library functions require the following processes Steam area initialization Standard input output and standard error output file opening and closing Detailed in this
180. t ANDCCR 0xef B Interrupt Mask Disable Function General format void X El void Explanation This function can only be used in the fcc911s command Expands the interrupt masking disable code Output Example Input El fcc911s Command Output ORCCR 70x10 124 6 2 Interrupt Control Functions B interrupt Level Setup Function General format void set il int level Explanation This function can only be used in the fcc911s command Expands the code for changing the interrupt level to the specified level Output Example Input set il 2 fcc911s Command Output STILM 2 B Interrupt Function Description Function General format1 interrupt void Interrupt function void General format2 extern interrupt void Interrupt function void Explanation This function can only be used in the fcc911s command The interrupt function can be written by specifying the interrupt type qualifier Since the interrupt function is called by an interrupt it is impossible to set up an argument or obtain a return value If a function declared or defined by the interrupt type qualifier is called by performing the normal function calling procedure no subsequent operations will be guaranteed Output Example Input interrupt void sample void fcc911s Command Output func STM R12 R13 ST MDH SP ST MDL SP ST RP SP ENTER 4 L func LEAVE LD SP RP LD SP MDL LD
181. te 0x10 _ jo int a void func void a 1 fcc911s command output SECTION IOA IO LOCATE H 00000010 GLOBAL a a RES B 4 SECTION CODE CODE ALIGN 2 begin of function GLOBAL func func ST RP SP ENTER 4 LDI 1 RO MOV RO R13 DMOV R13 _a L func LEAVE LD SP RP RET fcc935s command output section IOA IO locate 0x00000010 global a align 4 a res b 4 section CODE CODE align 4 global func _ func L 20 subi sp 16 sp st fp sp gr0 mov sp fp movsg LR gr4 sti gr4 fp 8 L 21 setlos 1 gr4 sethi hi _a gr5 setlo lo _a gr5 st gr4 gr5 gr0 L 22 Idi fp 8 gr4 movgs gr4 LR addi fp 16 sp Id fp grO fp ret 128 6 4 In line Expansion Specifying Function 6 4 In line Expansion Specifying Function This function specifies the user definition function for in line expansion In line expansion can be specified with the x option B In line Expansion Specifying Function General format pragma inline Function name Function name Explanation Recursively called functions cannot be subjected to in line expansion It should also be noted that functions may not be subjected to in line expansion depending on asm statement use structure union type argument presence setjmp function calling and other conditions When there are two or more descriptions for the same translation unit or in line expansion is specified by an option all the specified function names are valid
182. the fcc935s command as OPT935 B OPT911 OPT935 General Format 1 For UNIX OS setenv OPT911 Default option file directory setenv OPT935 Default option file directory General Format 2 For Windows set OPT911 Default option file directory set OPT935 Default option file directory Specify the directory for the default option file to be used by the driver When OPT911 and OPT935 are not set up the directory at the corresponding relative position with respect to the FETOOL directory YFETOOL lib 911 or FETOOL lib 935 is regarded as the default option file directory No more than one directory can be specified Example For UNIX OS setenv OPT911 usr local softune5 lib 91 1 setenv OPT935 usr local softune5 lib 935 Example For Windows set OPT911 c softunedS lib 91 1 set OPT935 2c softune5Vib 935 2 4 INC911 INC935 2 4 INC911 INC935 Specify the directory where fcc911s commands search for standard header files as INC911 Specify the directory where fcc935s commands search for standard header files as INC935 B INC911 INC935 General Format 1 For UNIX OS setenv INC911 Standard include directory setenv INC935 Standard include directory General Format 2 For Windows set INC911 Standard include directory set INC935 Standard include directory Specify the directory where the compiler searches for standard header files The directory specified as INC911 or INC935 is regarded as the standard include directory
183. tion The K GS option specifies that global scheduling is to be applied for instruction transfer beyond the branch This option can be used for the fcc935s command only When the K GS option is specified the compiler searches the most probable route to be executed and performs instruction transfer beyond the branch via this route However code is also provided to cancel instruction transfer beyond the branch when the compiler predicted execution route differs from the actually executed route The resulting execution speed may be lower than when scheduling beyond the branch is not performed When this option is specified compilation time may become extremely long This option takes effect only when an optimization level of 1 or higher is specified simultaneously with the O option The K GS option is ignored when the source file meets any of the following conditions The source file contains a pragma asm pragma endasm or an asm statement Asingle function performs 10 000 or more calculations Moreover the number of operations increases or decreases depending on the optimization by the compiler For example when loop unrolling is performed the number of operations increases The source file contains an infinite null loop Input Operation Output 3 5 Details of Options This option is also ignored when the K NOSCHEDULE option is specified The NOGS suboption cancels the GS suboption Output Example extern
184. tion Addition and Subtraction Halfword Quad Instruction M Instruction Assembler notation Operation of the instruction Media built in function prototype Usage example Expansion example MQADDHSS FRi FRj FRk HI FRk SSAT HI FRi HI FRj LO FRk SSAT LO FRi LO FRj HI FRk 1 SSAT HI FRi 1 HI FRj 1 LO FRk 1 SSAT LO FRi 1 LO FRj 1 signed long long MQADDHSS signed long long signed long long signed long long a b c _MQADDHSS b LDDFI FP 16 FRO LDDFI FP 24 FR2 MQADDHSS FRO FR2 FR4 STDFI FR4 FP 8 MQADDHUS FRi FRj FRk HI FRk USAT HI FRi HI FRj LO FRk USAT LO FRi LO FRj HI FRk 1 USAT HI FRI 1 HI FRi 1 LO FRk 1 USAT LO FRI 1 LO FR 1 unsigned long long __MQADDHUS unsigned long long unsigned long long unsigned long long a b c _MADDHUS b LDDFI FP 16 FRO LDDFI FP 24 FR2 MQADDHUS FRO FR2 FR4 STDFI FR4 FP 8 MQSUBHSS FRi FRj FRk HI FRk SSAT HI FRi HI FRj LO FRk SSAT LO FRi LO FRj HI FRk 1 SSAT HI FRi 1 HI FRj 1 LO FRk 1 SSAT LO FRi 1 LO FRj 1 signed long long MQSUBHSS signed long long signed long long signed long long a b c _MSUBHSS b LDDFI FP 16 FRO LDDFI FP 24 FR2 MQSUBHSS FRO FR2 FR4 STDFI FR4 FP 8 MQSUBHUS FRi FRj FRk HI FRk USAT HI FRi HI FRj LO FRk USAT LO FRi LO FRj
185. to the dir directory The XY option cancels the Y option The item is one of the following p Left for compatibility with the previous version but does not provide anything c Changes the compiler pathname to dir a Changes the assembler pathname to dir Changes the linker pathname to dir Example gt fcc911s file c Y c home newlib cpu MB91100 gt fcc935s file c Y c home newlib cpu MB93500 Calls the compilar using home newlib cpp as the path name T item arg1 arg2 option and XT option Passes arg to item as an individual compiler tool argument The XT option cancels the T option Use a comma to separate arguments To describe a comma as an argument position a backslash immediately before the comma The comma positioned after the backslash will not be interpreted as a delimiter To write a blank as an argument describe a comma in place of a blank For the options for various commands refer to the associated manuals The following can be specified as the item a Assembler Linker Example gt fcc911s T l asmlist file c cpu MB91100 gt fcc935s T l asmlist file c cpu MB93500 Sequentially passes arguments and asmlist to the assembler Therefore the assemble list asmlist will be generated as a result of command execution 3 5 Details of Options 3 5 9 Linkage Related Options The linkage related options are related to linkage B Linkage Related Option
186. truction When the absolute pathname is specified the header file enclosed within angular brackets lt gt is searched for in the directory defined by that pathname When the absolute pathname is not specified the compiler standard directory is searched The standard header file is supplied by the C C compiler The header file enclosed by double quotation marks is searched for in a directory specified by the absolute pathname If the absolute pathname is not specified such a header file is searched for in a directory having a file containing a include line If the header file is not found in a directory having a file containing a include line the standard directory is searched next The I option makes it possible to add a directory for header file search Example gt fcc911s cpu MB91100 I include file c gt fcc935s cpu MB93500 I include file c When the above entry is made the command searches for the header file enclosed within angular brackets in the order indicated below 1 include 2 Compiler standard include file directory The header file enclosed by double quotation marks is searched for in the order indicated below 1 Current directory having a file containing a include line 2 include 3 Compiler standard include file directory The I option can be specified a desired number of times When it is specified two or more times search operations are conducted in the specified order Coordi
187. turn function When a structure union is used as the return value the caller function stores the start address of the return value storage area in register GR3 and passes it to the called function The called function interprets the address stored in GR3 as the start address of the return value storage area When the register GR3 number be saved into memory the called function saves itin the hidden parameter save area Argument register save area This area saves the argument register This area is not allocated when the save operation is not needed For details see Section 5 6 2 Fcc935s Command Argument 5 6 fcc935s Command Function Call Interface 5 6 2 fcc935s Command Arguments Arguments are placed in registers GR8 to GR13 and passed to the called function for the number of argument registers 6 words Arguments not placed in the argument registers will be stored in the stack actual argument area for transfer purposes When an 8 byte argument is to be passed using registers it is divided into two and placed in two registers for transfer B fcc935s Command Arguments When argument registers must be saved to memory the called function allocates the argument register save area in the stack In this case a continuous argument register save area must be established in the virtual argument area The function that has a variable count of arguments saves all of the argument registers in the argument register save area Example 1
188. uccessful file position change is always returned 195 CHAPTER 11 SIMULATOR DEBUGGER LOW LEVEL FUNCTION LIBRARY B isatty Function In the case of file No 0 1 or 2 true is returned In the other cases false is returned B close Function The close funciton releases the port related to the specified file number E sbrk Function The simulator debugger does not provide a means of dynamic memory allocation Therefore the sbrk func tion acquires a fixed area and uses it To change the area or its size create an alternative function and substitute it for the sbrk function with a librarian For details see section 11 4 Low level Function Library Change 196 11 4 Low level Function Library Change 11 4 Low level Function Library Change This section shows how to change the dynamic allocation area B Dynamic Allocation Area Change Locate the following line in the sbrk c source program list Change the value in this line to the dynamic allocation area size in bytes define HEEP SIZE 16 1024 Use the following commands to compile and update the library gt fcc911s O c sbrk c cpu MB91100 gt 1109115 r sbrk obj lib911if lib cpu MB91100 gt fcc935s O c sbrk c cpu MB93500 gt flib935s r sbrk obj lib935if lib cpu MB93500 When the above change is made the dynamic allocation area is secured as the sbrk c static external variable without being positioned at the beginning of the stack B fcc911s Command sbrk c S
189. union 1 The extended type represents an extended type that is provided when no argument type is given When a prototype declaration is made it is complied with 2 When a structure union is to be delivered as an argument the caller copies it to the local variable area and delivers the address of that area 111 CHAPTER 5 fcc935s COMMAND OBJECT PROGRAM STRUCTURE 5 6 4 fcc935s Command Calling Procedure The caller function initiates branching to the called function after argument storage B fcc935s Command Calling Procedure Figure 5 6 3 Stack Frame Prevailing at Calling in Compliance with 9355 Command Standard Linkage Regulations shows the stack frame prevailing at calling in compliance with the standard linkage regulations Figure 5 6 3 Stack Frame Prevailing at Calling in Compliance with fcc935s Command Standard Linkage Regulations Low Caller function SP Actual argument area The called function saves the caller function frame pointer FP in the stack and then stores the prevailing stack pointer value in the stack as the new frame pointer value Subsequently the local variable area and the caller function register save area are acquired from the stack to save the caller register Figure 5 6 4 Stack Frame Created by Called Function in Compliance with fcc935s Command Standard Linkage Regulations shows the stack frame that is created by the called function in compliance with the standar
190. ution Process Overview The main functions to be incorporated into the startup routine are as follows O Environment initialization necessary for program operation This initialization must be described by the assembler and completed before user program execution O User program calling The main function which is normally used as the function that the startup routine calls in the program start process is to be called O Shutdown process After a return from the user program is made the shutdown process necessary for the system is to be performed to accomplish program termination The relationship between the startup routine and user function calling is shown in Figure 7 1 1 Relationship between Startup Routine and User Function Calling Figure 7 1 1 Relationship between Startup Routine and User Function Calling Startup routine Main function Environment initial setup User program User program calling Shutdown process Library The precautions to be observed in startup routine preparation are described below O Stack When the user program is executed the stack is used for return address argument storage area automatic variable area and register saving etc The stack must therefore be provided with an adequate space O Register When the startup routine calls the user program it is essential that stack pointer setup be completed The user program operates on the presumption that the stack top is
191. with a boundary suitable for the type An example is shown in Figure 4 4 2 fcc911s Command Bit Field Data Size and Boundary Alignment Example 2 Figure 4 4 2 fcc911s Command Bit Field Data Size and Boundary Alignment Example 2 struct tag2 int A 12 4 byte boundary data short B 5 2 byte boundary data char C 5 1 byte boundary data ji 31 MSB 2 O LSB 19 15 10 7 HON When a bit field having a bit length of 0 is declared it is forcibly assigned to the next storage unit An example is shown in Figure 4 4 3 fcc911s Command Bit Field Data Size and Boundary Alignment Example 78 4 4 fcc911s Command Bit Field Figure 4 4 3 fcc911s Command Bit Field Data Size and Boundary Alignment Example struct tag3 int A A 10 int B 5 int 0 int C 6 31 MSB 0 LSB Unoccupied Unoccupied 79 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 4 5 fcc911s Command Structure Union The structure union of fcc911s command data size and boundary alignment are explained below The structure union data size is a multiple of the maximum boundary alignment size of the members Boundary alignment for the area itself is accomplished by means of member maximum boundary alignment The individual members are subjected to boundary alignment in accordance with the member type B fcc911s Command Structure Union Figure 4 5 1 fcc911 Command Structure Union
192. xecution stops 71 CHAPTER 3 C C COMPILER OPERATION 72 CHAPTER4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE This chapter explains about the information necessary for program execution 4 1 4 2 4 3 4 4 4 5 4 6 4 7 Section Structure of fcc91 1s Rules for Name Generation with the fcc91 1s fcc911s Command Boundary Alignment fcc911s Command Bit Field fcc911s Command Structure Union fcc911s Command Function Call Interface fcc911s Command Interrupt Function Call Interface 73 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 41 Section Structure of fcc911s The fcc911s command has the following seven sections Code section e lnitialized section Constant section Data section section e Vector section C Init section B fcc911s Command Section Structure Table 4 1 1 fcc911s Command Section List shows the sections to be generated by the compiler and their meanings Table 4 1 1 fcc911s Command Section List Boundary Alignment Initial Value Byte Section Section Type Nama Code section Disabled Provided Initialized section Enabled Provided Constant section Disabled Provided Data section Enabled Not provided I O section IO Enabled Not provided Vector section INTVECT Disabled Provided C Init section EXT_CTOR_ Disabled Provided DTOR The purpose of each section use and the relationship to the C C
193. y have a return value 93 CHAPTER 4 fcc911s COMMAND OBJECT PROGRAM STRUCTURE 4 7 1 fcc911s Command Interrupt Stack Frame When an interrupt occurs the stack is changed to the interrupt stack B Interrupt Stack Frame When an interrupt occurs the stack pointer SP is replaced by the interrupt stack pointer SSP Within the interrupt function the interrupt stack pointer is used as the normal stack pointer Figure 4 7 1 fcc911 Command Interrupt Stack Frame shows the interrupt stack frame status prevailing immediately after interrupt generation Figure 4 7 1 fcc911 Command Interrupt Stack Frame Low SP SSP PC prevailing at interrupt generation PS prevailing at interrupt generation High 94 4 7 fcc911s Command Interrupt Function Call Interface 4 7 2 fcc911s Command Interrupt Function Calling Procedure The interrupt function is called by an interrupt via the interrupt vector table If the interrupt function is called by any other method no subsequent operations will be guaranteed B interrupt Function Calling Procedure Figure 4 7 2 fcc911 Command Interrupt Vector Table shows an example interrupt vector table Figure 4 7 2 fcc911 Command Interrupt Vector Table Low TBR Interrupt function address 255 Vector No 255 t Interrupt function address 1 Vector No 1 Interrupt function address 0 Vector No 2 High When an inter
194. ystem Version 4 0 Windows for both Windows 95 Windows 98 and Windows NT MS DOS for Microsoft MS DOS operating system Version 6 2 CONTENTS CHAPTER 1 SOFTUNE C C COMPILER eee eeree eere nnn nnn nnn 1 1 4 Softune C C Compiler Functions sessi enne en nennt s intense nin nrnnis 2 1 2 Basic Process of GCommiands toa rie t EE PEE e Enea eoe Fondo du oboe Deua 3 1 8 Compiler Basic Functions ssssssssssssseseseseeeeeen rennen nennen nensi nnns 5 CHAPTER2 SETTING ENVIRONMENT VARIABLES IN SYSTEM BEFORE STARTING 7 23 u EETOGOBD teretes duae imei 8 2 2 FIBS T JEIB9357 ne oer mL E cues TEL 9 2 9 OPTO9TT OPT9935 iren qc md eee oe ee a eoe as 10 2 4 AING9STT IINGS935 PRU Eee iue dm atus 11 2 5 TMP ciue RR HH on De et apt d aa duet pose uL To t RUD ge ay ede e dudit dde 12 2 6 SPEEANG 4 tere eret tue Ed ae tr ica t de Eh RER 13 C C COMPILER OPERATION nnne nnn 15 ch eroe EET 16 292 Command Op rands crecer soy teg ne ee a eene a eae eae 17 3 9 File Names and Directry Names emere eren eene tea eae lhe 18 3 4 v Command OpUORS c3 sese uelle e ote tetris 19 B44 bistofGommand ODplioris e rre the B e pe EE CC Ea POOL MS EG FU o EE ET EL FARE gi 20 3 4 2 List of Command Cancel
Download Pdf Manuals
Related Search
Related Contents
Folheto de instruções 取扱説明書 - 三菱電機 Copyright © All rights reserved.
Failed to retrieve file