softunetm c compiler
TRANSCRIPT
-
7/25/2019 Softunetm c Compiler
1/355
FUJITSU SEMICONDUCTORCONTROLLER MANUAL
FMCTM-16 FAMILY16-BIT MICROCONTROLLER
SOFTUNETMC COMPILER
MANUAL
CM42-00328-1E
-
7/25/2019 Softunetm c Compiler
2/355
-
7/25/2019 Softunetm c Compiler
3/355
FUJITSU LIMITED
FMCTM-16 FAMILY16-BIT MICROCONTROLLER
SOFTUNETMC COMPILER
MANUAL
-
7/25/2019 Softunetm c Compiler
4/355
-
7/25/2019 Softunetm c Compiler
5/355
i
PREFACE
Objective of This Manual and Target Readers
This manual describes the SOFTUNE C compiler (hereinafter referred to as the C compiler)usage procedures and libraries.
This manual is prepared for persons who use the above-mentioned compiler and create anddevelop application programs in C language.
This manual is to be read by persons who have a basic knowledge of each MCU (MicroController Unit).
The compiler described in this manual conforms to the American National Standard forInformation Systems Programming Language C, X3.159-1989, which is abbreviated"ANSI standard" in this manual.
Notes on Trademarks
SOFTUNE is trademark of Fujitsu Ltd.
F2MC, an abbreviation of Fujitsu Flexible Microcontroller, is the registered trademark of Fujitsu Ltd.
Microsoft , Windows, Windows NT, and MS-DOS are registered trademarks of Microsoft Corp.in the USA and /or other countries.
UNIX is a registered trademark that X/Open Co., Ltd. has licensed in the United States andother countries.
Composition of Manual
This manual consists of the following 10 chapters and appendix.
Chapter 1 OVERVIEW OF SOFTUNE C COMPILER
This chapter outlines the C compiler.
Chapter 2 SETUP OF SYSTEM ENVIRONMENT BEFORE USING C COMPILER
This chapter describes the C compiler operating environment variables.
Chapter 3 OPERATION
This chapter describes the command function specifications.
Chapter 4 OBJECT PROGRAM STRUCTURE
This chapter describes the information necessary for program execution.
Chapter 5 EXTENDED LANGUAGE SPECIFICATIONS
This chapter describes the extended language specifications supported by the compilerand the limitations on compiler translation.
Chapter 6 EXECUTION ENVIRONMENT
This chapter describes the user program execution procedure to be performed in anenvironment where no operating system exists.
Chapter 7 LIBRARY OVERVIEW
This chapter outlines the C libraries by describing the organization of files provided by thelibraries and the relationship to the system into which the libraries are incorporated.
-
7/25/2019 Softunetm c Compiler
6/355
ii
Chapter 8 LIBRARY INCORPORATION
This chapter describes the processes and functions to be prepared for library use.
Chapter 9 COMPILER-DEPENDENT SPECIFICATIONS
This chapter describes the specifications that vary with the compiler.
The description is related to the JIS standard based on the ANSI standard.
Chapter 10 SIMULATOR DEBUGGER LOW-LEVEL FUNCTION LIBRARY
This chapter describes how to use the simulator debugger low-level function library.
APPENDIX
The appendix gives a list of types, macros, and functions provided by the library and the
operations specific to the libraries (A,B). Notes when F2MC-16LX CPU is used aredescribed (C). The guide to change the function call interface to the register argumentpassing is described (D). The list of the error message is described (E).
Syntax Books
For C language syntax and standard library functions, refer to commercially available ANSI
standard compliant reference books.
Reference Books
The C Programming Language
(Brian W. Kernighan & 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
(Western Electric Company, Incorporated)
UNIX System User's Manual System V
(Western Electric Company, Incorporated)
UNIX System V Programmer Reference Manual
(AT&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)
Japanese Industrial Standards Programming Language C
(Japan Standards Association)
-
7/25/2019 Softunetm c Compiler
7/355
iii
2004 FUJITSU LIMITED Printed in Japan
The contents of this document are subject to change without notice. Customers are advised toconsult with FUJITSU sales representatives before ordering.
The information, such as descriptions of function and application circuit examples, in thisdocument are presented solely for the purpose of reference to show examples of operations anduses of Fujitsu semiconductor device; Fujitsu does not warrant proper operation of the devicewith respect to use based on such information. When you develop equipment incorporating thedevice based on such information, you must assume any responsibility arising out of such use ofthe information. Fujitsu assumes no liability for any damages whatsoever arising out of the use ofthe information.
Any information in this document, including descriptions of function and schematic diagrams,shall not be construed as license of the use or exercise of any intellectual property right, such aspatent right or copyright, or any other right of Fujitsu or any third party or does Fujitsu warrantnon-infringement of any third-party' s intellectual property right or other right by using suchinformation. Fujitsu assumes no liability for any infringement of the intellectual property rights orother rights of third parties which would result from the use of information contained herein.
The products described in this document are designed, developed and manufactured ascontemplated for general use, including without limitation, ordinary industrial use, general officeuse, personal use, and household use, but are not designed, developed and manufactured ascontemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safetyis secured, could have a serious effect to the public, and could lead directly to death, personalinjury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility,aircraft flight control, air traffic control, mass transport control, medical life support system,missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e.,submersible repeater and artificial satellite).
Any semiconductor devices have an inherent chance of failure. You must protect against injury,damage or loss from such failures by incorporating safety design measures into your facility andequipment such as redundancy, fire protection, and prevention of over-current levels and otherabnormal operating conditions.
If any products described in this document represent goods or technologies subject to certainrestrictions on export under the Foreign Exchange and Foreign Trade Law of Japan, the priorauthorization by Japanese government will be required for export of those products from Japan.I
-
7/25/2019 Softunetm c Compiler
8/355
iv
-
7/25/2019 Softunetm c Compiler
9/355
v
CONTENTS
CHAPTER 1 OVERVIEW OF SOFTUNE C COMPILER......................................................1
1.1 C COMPILER FUNCTIONS ....................................................................................................................2
1.2 BASIC PROCESS OF COMMANDS.......................................................................................................3
1.3 C COMPILER BASIC FUNCTIONS.........................................................................................................5
CHAPTER 2 SETUP OF SYSTEM ENVIRONMENT BEFORE USING C COMPILER .......7
2.1 FETOOL ..................................................................................................................................................8
2.2 OPT907 ...................................................................................................................................................9
2.3 INC907 ..................................................................................................................................................10
2.4 TMP.......................................................................................................................................................11
2.5 FELANG ................................................................................................................................................12
CHAPTER 3 OPERATION .................................................................................................13
3.1 COMMAND LINE...................................................................................................................................14
3.2 COMMAND OPERANDS.......................................................................................................................15
3.3 FILE NAMES AND DIRECTORY NAMES.............................................................................................16
3.4 COMMAND OPTIONS...........................................................................................................................17
3.4.1 List of Command Options.................................................................................................................18
3.4.2 List of Command Cancel Options.....................................................................................................20
3.5 DETAILS OF OPTIONS.........................................................................................................................22
3.5.1 Translation Control Related Options ................................................................................................23
3.5.2 Preprocessor Related Options .........................................................................................................25
3.5.3 Data Output Related Options ...........................................................................................................28
3.5.4 Language Specification Related Options .........................................................................................33
3.5.5 Optimization Related Options...........................................................................................................37
3.5.6 Output Object Related Options.................................................................................................44
3.5.7 Debug Information Related Options .................................................................................................49
3.5.8 Command Related Options ..............................................................................................................50
3.5.9 Option File Related Options .............................................................................................................51
3.6 OPTION FILES......................................................................................................................................52
3.7 MESSAGES GENERATED IN TRANSLATION PROCESS..................................................................54
CHAPTER 4 OBJECT PROGRAM STRUCTURE .............................................................57
4.1 SECTION STRUCTURE........................................................................................................................58
4.2 MEMORY MODELS ..............................................................................................................................61
4.3 GENERATION RULES FOR NAMES USED BY COMPILER...............................................................634.4 BOUNDARY ALIGNMENT ....................................................................................................................64
4.5 BIT FIELD..............................................................................................................................................65
4.6 STRUCTURE/UNION............................................................................................................................67
4.7 FUNCTION CALL INTERFACE (STACK ARGUMENT PASSING).......................................................69
4.7.1 Stack Frame (stack argument passing)............................................................................................70
4.7.2 Argument (stack argument passing).................................................................................................72
4.7.3 Argument Extension Format (stack argument passing) ...................................................................73
4.7.4 Calling Procedure (stack argument passing)....................................................................................74
4.7.5 Register (stack argument passing)...................................................................................................75
http://chap_1.pdf/ -
7/25/2019 Softunetm c Compiler
10/355
vi
4.7.6 Return Value (stack argument passing)........................................................................................... 76
4.8 FUNCTION CALL INTERFACE (REGISTER ARGUMENT PASSING)............................................... 77
4.8.1 Stack Frame (register argument passing)........................................................................................ 78
4.8.2 Argument (register argument passing) ............................................................................................ 80
4.8.3 Argument Extension Format (register argument passing) ............................................................... 82
4.8.4 Calling Procedure (register argument passing) ............................................................................... 83
4.8.5 Register (register argument passing)............................................................................................... 85
4.8.6 Return Value (register argument passing) ....................................................................................... 86
4.9 INTERRUPT FUNCTION CALL INTERFACE ...................................................................................... 87
4.9.1 Interrupt Stack Frame...................................................................................................................... 88
4.9.2 Interrupt Function Calling Procedure............................................................................................... 89
CHAPTER 5 EXTENDED LANGUAGE SPECIFICATIONS ..............................................91
5.1 ASSEMBLER DESCRIPTION FUNCTIONS ........................................................................................ 92
5.2 INTERRUPT CONTROL FUNCTIONS................................................................................................. 95
5.3 I/O AREA ACCESS FUNCTION........................................................................................................... 97
5.4 direct AREA ACCESS FUNCTION....................................................................................................... 98
5.5 16-BIT/24-BIT ADDRESSING ACCESS FUNCTION......................................................................... 100
5.6 IN-LINE EXPANSION SPECIFYING FUNCTION............................................................................... 102
5.7 SECTION NAME CHANGE FUNCTION............................................................................................. 103
5.8 REGISTER BANK NUMBER SETUP FUNCTION.............................................................................. 106
5.9 INTERRUPT LEVEL SETUP FUNCTION........................................................................................... 107
5.10 SYSTEM STACK USE SPECIFYING FUNCTION ............................................................................. 108
5.11 STACK BANK AUTOMATIC DISTINCTION FUNCTION ................................................................... 109
5.12 NO-REGISTER-SAVE INTERRUPT FUNC. FUNCTION................................................................... 110
5.13 BUILT-IN FUNCTION ......................................................................................................................... 111
5.14 PREDEFINED MACROS.................................................................................................................... 116
5.15 LIMITATIONS ON COMPILER TRANSLATION................................................................................. 117
CHAPTER 6 EXECUTION ENVIRONMENT....................................................................119
6.1 EXECUTION PROCESS OVERVIEW................................................................................................ 120
6.2 STARTUP ROUTINE CREATION ...................................................................................................... 122
CHAPTER 7 LIBRARY OVERVIEW ................................................................................125
7.1 FILE ORGANIZATION........................................................................................................................ 126
7.2 RELATIONSHIP TO LIBRARY INCORPORATING SYSTEM............................................................ 129
CHAPTER 8 LIBRARY INCORPORATION.....................................................................131
8.1 LIBRARY INCORPORATION OVERVIEW......................................................................................... 132
8.2 INITIALIZATION/TERMINATION PROCESS REQUIRED FOR LIBRARY USE................................ 1338.3 LOW-LEVEL FUNCTION TYPES....................................................................................................... 134
8.4 STANDARD LIBRARY FUNCTIONS AND REQUIRED PROCESS/LOW-LEVEL FUNCTIONS....... 135
8.5 LOW-LEVEL FUNCTION SPECIFICATIONS..................................................................................... 136
8.5.1 open Function ................................................................................................................................ 137
8.5.2 close Function................................................................................................................................ 138
8.5.3 read Function................................................................................................................................. 139
8.5.4 write Function ................................................................................................................................ 140
8.5.5 lseek Function................................................................................................................................ 141
-
7/25/2019 Softunetm c Compiler
11/355
vii
8.5.6 isatty Function ................................................................................................................................142
8.5.7 sbrk Function ..................................................................................................................................143
8.5.8 _exit Function .................................................................................................................................144
8.5.9 _abort Function...............................................................................................................................145
CHAPTER 9 COMPILER-DEPENDENT SPECIFICATIONS ...........................................147
9.1 COMPILER-DEPENDENT LANGUAGE SPECIFICATION DIFFERENTIALS....................................148
9.2 FLOATING-POINT DATA FORMAT AND EXPRESSIBLE VALUE RANGE.......................................150
9.3 FLOATING-POINT OPERATION DUE TO THE RUNTIME LIBRARY FUNCTION............................151
CHAPTER 10 SIMULATOR DEBUGGER LOW-LEVEL FUNCTION LIBRARY...............155
10.1 LOW-LEVEL FUNCTION LIBRARY OVERVIEW................................................................................156
10.2 LOW-LEVEL FUNCTION LIBRARY USE............................................................................................157
10.3 LOW-LEVEL FUNC. FUNCTION.........................................................................................................160
10.4 LOW-LEVEL FUNCTION LIBRARY CHANGE....................................................................................162
APPENDIX............................................................................................................................163
Appendix A LIST OF TYPE, MACRO, VARIABLE, AND FUNCTION ..........................................................164Appendix B OPERATIONS SPECIFIC TO LIBRARIES................................................................................167
Appendix C NOTES OF SIGNED DIVISION INSTRUCTION OF F2MC-16LX CPU ....................................173
Appendix D GUIDE TO CHANGING FUNCTION-CALL INTERFACE..........................................................177
Appendix E ERROR MESSAGE...................................................................................................................185
-
7/25/2019 Softunetm c Compiler
12/355
viii
-
7/25/2019 Softunetm c Compiler
13/355
1
CHAPTER 1 OVERVIEW OF SOFTUNE C COMPILER
This chapter outlines the C compiler. The C compiler is a language processor
program which translates source programs written in C language into the assembly
language for Fujitsu-provided various microcontroller units.
1.1 C COMPILER FUNCTIONS
1.2 BASIC PROCESS OF COMMANDS
1.3 C COMPILER BASIC FUNCTIONS
-
7/25/2019 Softunetm c Compiler
14/355
2
CHAPTER 1 OVERVIEW OF SOFTUNE C COMPILER
1.1 C COMPILER FUNCTIONS
When a C source file expressed in the C language is described, the C compiler
generates an assembler source file which is expressed in assembly language.
C Compiler Functions
The processing steps for assembler source file generation are indicated below.
Preprocessing
Preprocessing is conducted by the preprocessor (cpps) which is a subcomponent of thecompiler. Preprocessing instructions (#if, #define,#include, etc.) in a C source file areinterpreted and converted to a preprocessed C source file.
Compilation
Compilation is conducted by the compiler (ccoms). The preprocessed C source file isconverted to an assembler source file.
For the use of the C compiler, the fcc907s command is to be used. This commandautomatically calls up the tools composing the C compiler (preprocessor and compiler), andprovides control over C source file compiling. The C compiler structure is shown in Figure 1.1-1.
Figure 1.1-1 C Compiler Structure
In the subsequent sections, the C compiler translation process is explained using commands.For the details of the command function specifications, see CHAPTER 3, OPERATION.
C source file
Preprocessor
(cpps)
Preprocessed
C source file
Compiler
(ccoms)
Assembler
source file
Standard
header file
Message file
Message file
Stack use
information file
-
7/25/2019 Softunetm c Compiler
15/355
3
1.2 BASIC PROCESS OF COMMANDS
1.2 BASIC PROCESS OF COMMANDS
The basic process of commands used by the C compiler is described below.
fcc907s: For F2MC-16 family
fcc907sCommand Basic Process
The fcc907s command basically generates an object file from an described C source file. Thecommand regards any file with a .c extension as a C source file.
An example of using the fcc907s command is given below, where > is the command prompt.
[Example 1]
> fcc907s -cpu MB90F553A file.c
At the input given above, the command regards file.c as a C source file and, if no error isdetected, generates an object file (file.obj) in the current directory.
[Example 2]> fcc907s -o outfile -cpu MB90F553A file.c
At the input given above, the command generates an object file (outfile). The commandoperation process can be controlled by specifying options, such as -o.
Options for Compiling Process Control
-P option
When the -P option is specified, the command calls up the preprocessor only and performspreprocessing to generate a preprocessed C source file in the current directory. Theextension of the generated file is changed to .i.
-S optionWhen the -S option is specified, the command calls up the preprocessor and compiler andperforms preprocessing and compiling to generate an assembler source file in the currentdirectory. The extension of the generated file is changed to .asm.
-o option
When the -o option is specified, the command generates the file specified in the commandline as a result of processing.
Output files generated according to the above options specifying can be used as the input filesfor the fcc907s command. The input files and output files generated by options are shown inFigure 1.2-1.
-
7/25/2019 Softunetm c Compiler
16/355
4
CHAPTER 1 OVERVIEW OF SOFTUNE C COMPILER
Figure 1.2-1 Relationship between Input Files and Output Files Generated by Options
fcc907s command file.i Compilerfile.asm
Specified file
-S
-S -o
file.c Preprocessorfile.i
Specified file
-P
-P -o
file.asm Assemblerfile.obj
Specified file-o
-
7/25/2019 Softunetm c Compiler
17/355
5
1.3 C COMPILER BASIC FUNCTIONS
1.3 C COMPILER BASIC FUNCTIONS
The C compiler functions are described below.
Header file search
Coordination with symbolic debugger
OptimizationThe symbolic debugger is a support tool for analyzing a program created in C
language.
Header File Search
The header file can be acquired using the C program #include instruction. When the absolutepathname is specified, the header file enclosed within angular brackets () is searched for inthe directory specified by absolute pathname. When the absolute pathname is not specified,the standard directory is searched.
The standard header file is supplied by the C compiler.
The header file enclosed by double quotation marks (") is searched for in a directory specifiedby the absolute pathname. If the absolute pathname is not specified, such a header file issearched for in a directory having a file containing a #include line. If the header file is not foundin 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]
> fcc907s -cpu MB90F553A -I ..\include file.c
At the input given above, the command searches for the header file enclosed within angularbrackets in the order shown below.
1. ..\include
2. Standard directory
The header file enclosed by double quotation marks is searched for in the order shown below.
1. Current directory having a file containing a #include line
2. ..\include
3. Standard directory
The -I option can be specified a desired number of times. When it is specified two or moretimes, search operations are conducted in the specified order.
-
7/25/2019 Softunetm c Compiler
18/355
6
CHAPTER 1 OVERVIEW OF SOFTUNE C COMPILER
Coordination with Symbolic Debugger
When the -g option is specified, the compiler generates the debug information to be used by thesymbolic debugger. When such information is generated, C language level debugging can beaccomplished 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, the compiler attempts to ensure good codegeneration by changing the computation target position and eliminating computations that arejudged to be unnecessary. To minimize the amount of data exchange with memory, thecompiler tries to retain data within a register. It is therefore conceivable that a break pointpositioned in a certain line may fail to cause a break or that currently monitored certain addressdata may fail to vary with the expected timing. It also well to remember that the debug data willnot be generated for an unused local variable or a local variable whose area need not bepositioned in a stack as a result of optimization.
Debugging must be conducted with the above considerations taken into account.
Optimization
When the -O option is specified, the compiler generates an object subjected to general-purposeoptimization.
-
7/25/2019 Softunetm c Compiler
19/355
7
CHAPTER 2 SETUP OF SYSTEM ENVIRONMENTBEFORE USING C COMPILER
This chapter describes the C compiler operating environment variables (for the setting
of environment variables, refer to the manual for each operating system). All theenvironment variables can be omitted.
For the supply style, refer to the C Compiler Installation Manual.
The Windows version permits the use of long file names for the directories to be set up
as environment variables. For the characters applicable to long file names, see 3.3,
FILE NAMES AND DIRECTORY NAMES.
[Setup Example]
set FETOOL=c:Fujitsu MCU tool
For directory name specified by environment variable, do not use double quotation
marks (").
2.1 FETOOL
2.2 OPT907
2.3 INC907
2.4 TMP
2.5 FELANG
-
7/25/2019 Softunetm c Compiler
20/355
8
CHAPTER 2 SETUP OF SYSTEM ENVIRONMENT BEFORE USING C COMPILER
2.1 FETOOL
Specify the installation directory for the development environment.
FETOOL
[General Format 1] For UNIX OS
setenv FETOOL Installation directory
[General Format 2] For Windows
set FETOOL=Installation directory
The command accesses the compiler, message file, include file, and other items via the pathspecified by FETOOL.
When FETOOL setup is not completed, the parent directory for the directory where the activatedcommand exists (the \.. position of the directory where the command exists) is regarded as theinstallation directory.
No more than one directory can be specified.
[Example] For UNIX OS
setenv FETOOL \usr/local\softune
[Example] For Windows
set FETOOL=c:\softune
-
7/25/2019 Softunetm c Compiler
21/355
9
2.2 OPT907
2.2 OPT907
Specify the directory for the default option file to be used by the command.
OPT907
[General Format 1] For UNIX OS
setenv OPT907 Default option file directory
[General Format 2] For Windows
set OPT907=Default option file directory
Specify the directory for the default option file to be used by the command.
If OPT907 setup is not completed, the directory placed at a relativity from the directory specifiedby FETOOL (>FETOOL>\lib\907) is regarded as the default option file directory.
No more than one directory can be specified.
[Example] For UNIX OS
setenv OPT907 \usr\local\softune\lib\907
[Example] For Windows
set OPT907=c:\softune\lib\907
-
7/25/2019 Softunetm c Compiler
22/355
10
CHAPTER 2 SETUP OF SYSTEM ENVIRONMENT BEFORE USING C COMPILER
2.3 INC907
Specify the directory where a standard header file search is to be conducted by the
command.
INC907
[General Format 1] For UNIX OS
setenv INC907 Standard include directory
[General Format 2] For Windows
set INC907=Standard include directory
Specify the directory where the standard header file is to be searched for. The directoryspecified by INC907 is regarded as the standard include directory.
If INC907C setup is not completed, the directory placed at a relativity from the directory
specified by FETOOL (>FETOOL>\lib\907\include) is regarded as the standard header filedirectory.
No more than one directory can be specified.
[Example] For UNIX OS
setenv INC907 \usr\local\softune\lib\907\include
[Example] For Windows
set INC907=c:\softune\lib\907\include
-
7/25/2019 Softunetm c Compiler
23/355
11
2.4 TMP
2.4 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 orin 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
-
7/25/2019 Softunetm c Compiler
24/355
12
CHAPTER 2 SETUP OF SYSTEM ENVIRONMENT BEFORE USING C COMPILER
2.5 FELANG
Specify the code for messages.
FELANG
[General Format 1] For UNIX OS
setenv FELANG Message code
[General Format 2] For Windows
set FELANG=Message code
Specify the message code. The following codes can be specified.
ASCII: Outputs messages in ASCII codeThe generated messages are in English.Select this code for a system without a Japanese language environment.
EUC: Outputs messages in EUC codeThe generated messages are in Japanese.
SJIS: Outputs messages in SHIFT JIS codeThe generated messages are in Japanese.
If 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
-
7/25/2019 Softunetm c Compiler
25/355
13
CHAPTER 3 OPERATION
This chapter describes the command function specifications.
3.1 COMMAND LINE
3.2 COMMAND OPERANDS
3.3 FILE NAMES AND DIRECTORY NAMES
3.4 COMMAND OPTIONS
3.5 DETAILS OF OPTIONS
3.6 OPTION FILES
3.7 MESSAGES GENERATED IN TRANSLATION PROCESS
-
7/25/2019 Softunetm c Compiler
26/355
14
CHAPTER 3 OPERATION
3.1 COMMAND LINE
The command line format is shown below.
fcc907s [options] operands
Command Line
Options and operands can be specified in the command line. They can be specified at anyposition 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 commandrecognizes the options and operands in the order shown below.
1.An entry beginning with a hyphen (-) is first recognized as an option. The subsequentcharacter 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]
>fcc907s file1.c -S -I \home\myincs file2.c -cpu MB90F553A
At first, -S and -I are regarded as options. Since the -I option has an argument, thesubsequent character string \home\myincs is regarded as the argument. The remainingentries (file1.c and file2.c) are regarded as operands.
Options : -S, -I \home\myincs
Operands : file1.c, file2.c
Command Process
The command calls up the preprocessor, compiler, assembler, and linker for all input files in theorder of their specifying and performs preprocessing, compiling, assembling, and linking. Theresults are output into files which are named by replacing the input file extensions with .obj.
[Example]
>fcc907s file1.c file2.c file3.c -cpu MB90F553A
Files named file1.c, file2.c, and file3.c are subjected to preprocessing, compiling, andassembling so that files named file1.obj, file2.obj, and file3.obj are generated.
-
7/25/2019 Softunetm c Compiler
27/355
15
3.2 COMMAND OPERANDS
3.2 COMMAND OPERANDS
One or more input files can be specified as operands.
Command Operands
The command determines the file type according to the input file extension and performs anappropriate process to suit the file type.
The extension cannot be omitted.
File Specifying
C source files, preprocessed C source files, assembler source files, and object files can bespecified as operands.
File Extension
The relationship between input file extensions and command processes is shown in Table
3.2-1.
Note: however, that the associated process may be inhibited depending on the option specifying.
[Example]
>fcc907s file1.c file2.i -cpu MB90F553A
A file named file1.c is subjected to preprocessing, compiling, and assembling. A file namedfile2.i is then subjected to compiling and assembling to generate files named file1.obj andfile2.obj.
Table 3.2-1 Relationship between Extensions and Command Processes
Extension Command Process
.cThe file having this extension is regarded as a C source file and subjected topreprocessing and subsequent processes.
.iThe file having this extension is regarded as a preprocessed C source fileand subjected to compiling and subsequent processes.
.asmThe file having this extension is regarded as a compiled assembler source fileand subjected to assembling and subsequent processes.
.obj For this type of f ile, the command does nothing.
.absThe file having this extension is regarded as a linked absolute file, and anerror output is generated. No absolute file can be specified.
-
7/25/2019 Softunetm c Compiler
28/355
16
CHAPTER 3 OPERATION
3.3 FILE NAMES AND DIRECTORY NAMES
The following characters are applicable to file names and directory names.
File Names and Directory Names
Windows version
Alphanumeric characters, symbols except \, /, :, *, ?, ", , and |, Shift-JIS kanji codes, andShift-JIS 1-byte kana codes.
When long file name is specified as option and operand, it should be enclosed by doublequotation marks ("). However, do not use double quotation marks at setup environmentvariable with this file name.
Other Versions
Underbar (_) and alphanumeric characters (however, the first character must be theunderbar or alphabetical character).
Module NameThe module name is based on a file name. It is formed by an underbar (_) andalphanumeric characters (The first character must be underbar or alphabetical character). Ifother characters are used for the file name, the characters that cannot be used for themodule name are converted to underbars. File names allowing identical module names afterconversion should not be used.
-
7/25/2019 Softunetm c Compiler
29/355
17
3.4 COMMAND OPTIONS
3.4 COMMAND OPTIONS
This section describes the command options.
Option Syntax
The option consists of a hyphen (-) and one or more characters following the hyphen. Someoptions have an argument. A blank character string must be positioned between an option andan argument. The command options cannot be grouped for purposes of specifying. Groupingis a technique of specifying which, for instance, uses a -Sg form to specify both the -S optionand -g option.
Multiple Specifying of Same Option
If the same option is specified more than one time, only the last-specified option in thecommand line is assumed to be valid.
[Example]
>fcc907s -o outfile file.c -o outobj -cpu MB90F553A
The resultant output file name will be outobj. The following options can be specified morethan one time, and they are significant by each specifications.
Options that are significant when specified more than one time
-D -f -I -INF -K -T -U -x -Y
When the above options are specified more than one time, see details of options.
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) >fcc907s -C -E file1.c file2.c -cpu MB90F553A
2) >fcc907s file1.c -E file2.c -C -cpu MB90F553A
The same processing operations are performed for cases 1) and 2).
Exclusiveness and Dependency
Some options are mutually exclusive or dependent on each other. For option exclusivenessand dependency, see details of options.
Case Sensitiveness
As regards the options, their upper-case and lower-case characters are different from eachother. For example, the -O option is different from the -o option. However, the upper- andlower-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 thecharacter strings that follow the -K option or -INF option.
-
7/25/2019 Softunetm c Compiler
30/355
18
CHAPTER 3 OPERATION
3.4.1 List of Command Options
When executed without argument specifying, the command outputs an option list to
the standard output. The options for the command are listed in Table 3.4-1and Table
3.4-2. The options listed in the tables can be recognized by the command.
List of Command Options
Table 3.4-1 List of Command Options
Specifying Format Function
-B Allows the C++ style comments(//)
-C Leaves a comment in the preprocessing result
-cmsg Outputs the compiling process end message to the standard output
-cpu MB number Specifies the MB number of the CPU to be used
-cwno Sets end code to 1 when warning given
-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
-g Adds the information necessary for debugging to the object
-H Outputs the acquired header file pathname to the standard output
-help Outputs the option list to the standard output
-I dir Specifies the directory for head file search
-INF LIST Generates the assemble list
-INF {SRCIN|LINENO} Inserts the associated C source information as a comment into the assembler source
-INF STACK[=filename] Generates the stack use amount data
-J {a|c} Specifies the specification level of the language to be interpreted by the compiler
-K {DCONST|FCONST} Specifies the type of a real constant without a suffix
-K EOPT Effects optimization for changing the arithmetic operation evaluation procedure
-K LIBRecognizes the standard function operation and implements in-l ine expansion/substitutionfor other functions
-K NOALIASEffects optimization on the presumption that different pointers do not indicate the samearea
-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 REALOS Effects in-line expansion for the ITRON system call function
-K {SIZE|SPEED} Selects optimization with emphasis placed 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} Specifies kanji code used in program
-O level Gives instructions for general-purpose optimization
-
7/25/2019 Softunetm c Compiler
31/355
19
3.4 COMMAND OPTIONS
-o pathname Outputs the result to the pathname
-P Performs preprocessing only and outputs the result to .i
-S 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 information to the standard output
-w level Specifies the warning message output level
-Xdof Inhibits the default option file read operation
-x func [, fun2 ...] Specifies the in-line expansion of functions
-xauto [size]Specifies the in-line expansion of the functions whose logical line count is not less thansize
-Y item, dir Changes the item position to dir
Table 3.4-2 List of Command Options
Specifying Format Function
-div905 Specifies the DIV/DIVW instruction is generated
-K ACCOPT The optimization of accumulator transfer code for the immediate value.
-K ADDSP Releases argument areas altogether
-K ARRAY Optimization of array element access code.
-K BITOPT Effective generation of the bit operation instruction.
-K BITFIELD_ORDER_LSB The bit-field member is arranged from the LSB side.
-K BITFIELD_ORDER_MSB The bit-field member is arranged from the MSB side.
-pack Packing of struct and union members.
-model {SMALL|MEDIUM|COMPACT|LARGE} Specifies the memory model
-ramconst Specifies that the mirror function will not be used
-varorder {SORT|NORMAL}Specifies the rule of arrangement of external variables and static variablesin section
-align {DIR1|DIR2} Specifies the boundary alignment value for _ _direct type qualified variable
-rp Specifies to change function call interface to register argument passing.
Table 3.4-1 List of Command Options(Continued)
Specifying Format Function
-
7/25/2019 Softunetm c Compiler
32/355
20
CHAPTER 3 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-3and Table 3.4-4.
List of Command Cancel Options
Table 3.4-3 List of Command Cancel Options
Specifying Format Function
-XB Cancels the -B option
-XC Cancels the -C option
-Xcmsg Cancels the -cmsg option
-Xcwno Cancels the -cwno option
-Xf Cancels the -f option
-Xg Cancels the -g option
-XH Cancels the -H option
-Xhelp Cancels the -help option
-XI Cancels the -I option
-INF NOLINENO Cancels the LINENO suboption
-INF NOLIST Cancels the LIST suboption
-INF NOSRCIN Cancels the SRCIN suboption
-INF NOSTACK Cancels the STACK subopt ion
-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 NOREALOS Cancels the REALOS suboption
-K UNROLL Cancels the NOUNROLL suboption
-K VOLATILE Cancels the NOVOLATILE suboption
-Xo Cancels the -o option
-Xs Cancels the -s option
-XT item Cancels the -T item specifying
-XV Cancels the -V option
-Xx Cancels the -x option
-Xxauto Cancels the -xauto option
-XY item Cancels the -Y item specifying
-
7/25/2019 Softunetm c Compiler
33/355
21
3.4 COMMAND OPTIONS
Table 3.4-4 List of Command Cancel Options
Specifying Format Function
-K NOACCOPT Cancels the ACCOPT suboption
-K NOADDSP Cancels the ADDSP suboption
-K NOARRAY Cancels the ARRAY suboption
-K NOBITOPT Cancels the BITOPT suboption
-Xpack Cancels the -pack option
-Xdiv905 Cancels the -div905 option
-Xramconst Cancels the -ramconst option
-Xalign Cancels the -align option
-Xrp Cancels the -rp option
-
7/25/2019 Softunetm c Compiler
34/355
22
CHAPTER 3 OPERATION
3.5 DETAILS OF OPTIONS
This section details the options.
Translation Control Related Options
The translation control related options are related to preprocessor, compiler and assembler callcontrol.
Preprocessor Related Options
The preprocessor related options are related to preprocessor operations.
Data Output Related Options
The data output related options are related to the command, preprocessor, and compiler dataoutputs.
Language Specification Related Options
The language specification related options are related to the specification of the language to berecognized by the compiler.
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.
Debug Information Related Options
The debug information related options are related to the debug information to be referred by thesymbolic debugger.
Command Related Options
The command related options are related to the other tools recalled by commands.
Option File Related Options
The option file related options are related to option files.
-
7/25/2019 Softunetm c Compiler
35/355
23
3.5 DETAILS OF OPTIONS
3.5.1 Translation Control Related Options
This section describes the options related to preprocessor, compiler and assembler
call control.
Translation Control Related Options
The priorities of the translation control related options are defined as follows. They are notrelated to the order of specifying.
-E > -P > -S
The translation control related option exclusiveness is shown in Table 3.5-1.
If the -E and -P options are specified simultaneously, see the explanation below.
-C option cannot use by the fcc907s command.
The translation control related options are detailed below.
-E
This option subjects all files to preprocessing only and outputs the result to the standard
output. The output result contains the preprocessing instruction generated by thepreprocessor, which is necessary for the compiler. The information targets for thepreprocessing instruction generated by the preprocessor are the #line and #pragmainstructions. If the -P option is specified together with the -E option, the preprocessinginstruction generated by the preprocessor is inhibited. If the input file is not a C source file, the-E option does not do anything.
[Example]
>fcc907s -E -cpu MB90F553A sample.c
The sample.c preprocessing result is output to the standard output.
-P
This option subjects a C source file to preprocessing only and outputs the result to the filewhose extension is changed to .i. Unlike the cases where the -E option is specified, the outputresult does not contain the preprocessing instruction generated by the preprocessor. If the inputfile is not a C source file, the -P option does not do anything.
[Example]
>fcc907s -P -cpu MB90F553A sample.c
The sample.c preprocessing result is output to the sample.i.
Table 3.5-1 Translation Control Related Option Exclusiveness
Specified Option Option Invalidated
-E -S
-P -S
-S None
-
7/25/2019 Softunetm c Compiler
36/355
24
CHAPTER 3 OPERATION
-S
This option performs processes up to compiling and outputs the resultant assembler source tofile extension changed to .asm. If the input file is neither a C source file nor a preprocessed Csource file, the -S option does not do anything.
[Example]
>fcc907s -S -cpu MB90F553A sample.c
The sample.c preprocessing and compiling process result are output to the sample.asm.
The relationship among file types, translation control related options, and processes is shown inTable 3.5-2.
P: PreprocessingC: CompilingA: Assembling
The fcc907s command does not call linker.
[Example]
>fcc907s -E file1.c file2.i -cpu MB90F553A
Subjects a file named file1.c to preprocessing only and outputs the result to the standard
output. Performs nothing for a file named file2.i.
>fcc907s -S file1.c file2.i file3.asm -cpu MB90F553A
Subjects a file named file1.c to preprocessing and compiling and a file named file2.i tocompiling. Performs nothing for a file named file3.asm. As a result, files named file1.asm andfile2.asm are generated in the current directory.
Table 3.5-2 Relationship Among File Types, Translation Control Related Options,
and Processes
Option File Type (Extension) -E -P -SNothing
Specified
C source file (.c) P P P and C P, C and A
Preprocessed C source file (.i) C C and A
Assembler source file (.asm) A
Object file (.obj)
-
7/25/2019 Softunetm c Compiler
37/355
25
3.5 DETAILS OF OPTIONS
3.5.2 Preprocessor Related Options
This section describes the options related to preprocessor operations. If the
preprocessor is not called, the preprocessor related options are invalid.
Preprocessor Related Options
The preprocessor related options are detailed below.
-B
-XB
The -B option allows C++ style comments. When specifying this option, // style in addition to /**/ style can be used.
The -XB option cancels the -B option.
[Using Example]/* Comment */
// Comment
-C
-XC
The -C option retains all comments except those which are in the preprocessing instruction lineas the preprocessing result. If the option is not specified, the comments are replaced by oneblank character.
The -XC option cancels the -C option.
[Output Example]
Input:
/* Comment */
void func(void){}
Operation:
fcc907s -C -E -cpu MB90F553A sample.c
Output:
# 1 "test5.c"
/* Comment */
void func(void){}
-D name [=[tokens]]
This option defines the macro name with the tokens used as the macro definition. The option isequivalent 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 isomitted, the specified lexeme is deleted from the source file. The error related to the -D optionis the same as the error related to the #define instruction. This option can be specified morethan one time.
-
7/25/2019 Softunetm c Compiler
38/355
26
CHAPTER 3 OPERATION
[Example]
>fcc907s -D os=m -D sys file.c -cpu MB90F553A
In a file named file.c, processing is conducted on the assumption that the macro definitionsfor os and sys are m and 1, respectively.
-H
-XH
The -H option outputs the header file pathnames acquired during preprocessing to the standardoutput. The pathnames are sequentially outputted, one for each line, in the order of acquisition.If there are any two exactly the same pathnames, only the first one will be outputted. When thisoption is specified, the command internally sets up the -E option to subjects all files topreprocessing only. However, the preprocessing result will not be outputted.
The -XH option cancels the -H option.
[Output Example]
Input:
#include
#include "head.h"
Operation:
fcc907s -H -cpu MB90F553A sample.c
Output:
/usr/softune/lib/907/include/stdio.h
/usr/softune/lib/907/include/stddef.h
/usr/softune/lib/907/include/stdarg.h
./head.h
-I dir
-XI
The -I option changes the rule of header file search so that the directory specified by dir will besearched prior to the standard directory. The standard directory is ${INC907}.
This option can be specified more than one time. The search will be conducted in the order ofspecifying. When the option is specified, the header file search will be conducted in thefollowing directories in the order shown below.
Header file enclosed within angular brackets (< >)
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 specified absolute pathname will be searched. If any nonexistent directory is specified, this option is invalid.
The -XI option cancels the -I option.
-
7/25/2019 Softunetm c Compiler
39/355
27
3.5 DETAILS OF OPTIONS
-U name
This option cancels the macro name definition specified by -D. The option is equivalent to thefollowing #undef instruction.
#undef name
If the same name is specified by the -D and -U options, the name definition will be canceledwithout 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]
>fcc907s -U m -D n -D m file.c -cpu MB90F553A
This will cancel the macro m definition specified by the -D option.
-
7/25/2019 Softunetm c Compiler
40/355
28
CHAPTER 3 OPERATION
3.5.3 Data Output Related Options
This section describes the options related to the command, preprocessor, and
compiler data outputs.
Data Output Related Options
-cmsg
This option outputs the compiling process completion message.
[Example]
Operation:
fcc907s -cmsg -S -cpu MB90F553A sample.c
Output:
COMPLETED C Compile, FOUND NO ERROR : sample.c
-cwno
This option sets the end code to 1 when a warning-level error occurs. When the option is notspecified, the end code is 0.
-help
-Xhelp
The -help option outputs the option list to the standard output. The -Xhelp option cancels the-help option.
[Example]>fcc907s -help
Various command option lists are outputted to the standard output.
-INF LINENO
-INF NOLINENO
The -INF LINENO option inserts C source file line numbers into the assembler source file ascomments. The LINENO suboption cannot be specified simultaneously with the SRCINsuboption.
The NOLINENO suboption cancels the LINENO suboption.
-
7/25/2019 Softunetm c Compiler
41/355
29
3.5 DETAILS OF OPTIONS
[Output Example]
Input:
void func(void){}
Operation:
fcc907s -INF lineno -S -cpu MB90F553A sample.c
Output:_func:
LINK #0
;;;; sample.c, line 1
UNLINK
RET
-INF LIST
-INF NOLIST
The -INF LIST option generates a file in the current directory and outputs the assemble list. The
name of the generated file is determined by changing the source file name extension to .lst.Since the assemble list is generated at assembling, it is not generated when assembling is notconducted. For the details of the assemble list, refer to the Assembler Manual.
The NOLIST suboption cancels the LIST suboption.
[Example]
>fcc907s -INF list -cpu MB90F553A sample.c
The sample.c preprocessing, compiling, and assembling process result are outputted to thesample.obj, and the resulting assemble list is outputted to the sample.lst.
-INF SRCIN
-INF NOSRCIN
The -INF SRCIN option inserts a 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.
[Output Example]
Input:
void func(void){}
Operation:
fcc907s -INF srcin -S -cpu MB90F553A sample.c Output:
_func:
LINK #0
;;;; void func(void){}
UNLINK
RET
-
7/25/2019 Softunetm c Compiler
42/355
30
CHAPTER 3 OPERATION
-INF STACK [=file]
-INF NOSTACK
The -INF STACK [=file] option generates the specified file in the current directory and outputsthe stack use amount data. If no file is specified, the information in all the simultaneouslycompiled files is output into files whose names are determined by changing the source fileextensions to .stk.
If the -K ADDSP option is simultaneously specified, stacks will not successively be freed so thatthe generated stack use amount data is inaccurate. In such an instance, therefore, it is well toremember that the maximum stack use amount data calculated by the SOFTUNE C ANALYZERmay be smaller than the actual maximum use amount. For stack use amount data utilizationprocedures and data file specifications, refer to the SOFTUNE C ANALYZER MANUAL.
The NOSTACK suboption cancels the STACK suboption.
[Output Example]
Input:
extern void sub(void);
void func(void){sub();}
Operation:
fcc907s -INF stack -S -cpu MB90F553A sample.c
Output:
@sample.c
# E=Extern S=Static I=Interrupt
# {Stack} {E|S|I} {function name} [A]
# -> {E_S} {call function}
# ...
# 4 E _func
-> E _sub
-o pathname
-Xo
The -o pathname option uses the pathname as the output file name. If this option is notspecified, the default for the employed file format is complied with.
The -Xo option cancels the -o option.
[Example]>fcc907s -o output.asm -S -cpu MB90F553A sample.c
The sample.c preprocessing and compiling process result are outputted to the output.asm.
-V
-XV
The -V option outputs the version information about each executed compiler tool to the standardoutput. The -XV option cancels the -V option.
-
7/25/2019 Softunetm c Compiler
43/355
31
3.5 DETAILS OF OPTIONS
[Output Example]
F2MC-16 Family SOFTUNE C Compiler V30L13
ALL RIGHTS RESERVED, COPYRIGHT (C) FUJITSU LIMITED 1986
LICENSED MATERIAL - PROGRAM PROPERTY OF FUJITSU LIMITED
-w level
This option specifies the output level of warning-type diagnostic messages. Levels 0 through 8can be specified. When level 0 is specified, no warning messages will be generated. Thegreater the level value, the more warning messages will be generated.
If the - w level option is not specified, -w 1 applies.
For the details of diagnostic messages, see 3.7, MESSAGES GENERATED IN TRANSLATIONPROCESS.
For the relationship between warning level and warning item, see Table 3.5-3.
[Output Example]
Input:
const int a; Operation:
fcc907s -w 5 -S -cpu MB90F553A sample.c
Output:
*** a.c(1) W1219C: const a is not initialized.
-
7/25/2019 Softunetm c Compiler
44/355
32
CHAPTER 3 OPERATION
Table 3.5-3 Warning item at each warning level
Warninglevel
Warning item
Level 0 Warning-type diagnostic message is not generated.
Level 1 A basic warning-type diagnostic messages are generated.
Level 2 The following warning-type diagnostic messages in addition to level 1 are generated.Warning of the variable not used in the function is generated.
Warning of the variable used before being initialized in the function is generated.Warning of the presence of the use of the Static function is generated.
Level 3 The following warning-type diagnostic messages in addition to level 2 are generated.When there is no return in the function which should return the value, warning is
generated.When the value is not specified for return by the function which should return the value,
warning is generated.Warning of pragma which cannot be recognized is generated.When the variable and the constant are compared in the comparison operation, warning of
the range for the constant value is generated.
Level 4 The following warning-type diagnostic messages in addition to level 3 are generated.When the extern function is declared in the block, warning is generated.When the struct/union is not defined in the extern declaration of the struct/union array,
warning is generated.When not the relational expression but the assignment expression, etc. are described in
the place where the conditional expression is expected, warning is generated.When the address of the auto variable is used as a return value of the function, warning is
generated.
Level 5 The following warning-type diagnostic messages in addition to level 4 are generated.When there is an implicit int type declaration, warning is generated.
When there is no prototype declaration of the function, warning is generated.When the constant is described in the condition expression, warning is generated.
When there is an implicit int type declaration of the parameter, warning is generated.When the declaration overload the declaration before, warning is generated.
When the comma continues at enum members end, warning is generated.When there is no initial value in the declaration with const, warning is generated.
When the address of the variable is compared with 0, warning is generated.When the type is defined in the cast expression, warning is generated.
When register is specified for struct, union, and the array variable declaration, warning isgenerated.
Level 6 The following warning-type diagnostic messages in addition to level 5 are generated.When there is switch statement which is not default, warning is generated.
Level 7 The following warning-type diagnostic messages in addition to level 6 are generated.When the int type is used, warning is generated.
When the bit field is neither int, signed int nor unsigned int type, warning is generated.
Level 8 The following warning-type diagnostic messages in addition to level 7 are generated.When the function is called with a pointer to the function, warning is generated.
-
7/25/2019 Softunetm c Compiler
45/355
33
3.5 DETAILS OF OPTIONS
3.5.4 Language Specification Related Options
This section describes the options related to the specifications of the language to be
recognized by the compiler.
Language Specification Related Options
-J {a|c}
This 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 standardincluding expansion specifications.
When -Jc is specified, interpretation is conducted in strict compliance with the ANSI standard.In response to the expansion specifications, a warning message is outputted.
If the option is not specified, -Ja applies.[Example]
>fcc907s -J a file1.c -J c file2.c -cpu MB90F553A
The -Jc option becomes valid so that files named file1.c and file2.c are interpreted in strictcompliance with the ANSI standard.
-K {DCONST|FCONST}
When the FCONST suboption is specified, a floating-point constant whose suffix is not specifiedwill 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.
[Output Example]
Input:
extern float f1,f2;
void func(void){ f1 = f2+1.0;}
Operation:
fcc907s -K fconst -cpu MB90F553A -S sample.c
-
7/25/2019 Softunetm c Compiler
46/355
34
CHAPTER 3 OPERATION
Output:
_func:
LINK #0
MOVL A, #1065353216
MOVL RL2, A
MOVL A, _f2 CALLP FADD
MOVL _f1, A
UNLINK
RET
-K NOINTLIB
-K INTLIB
The NOINTLIB suboption calls a normal function without effecting in-line expansion of aninterrupt related function (__DI(), __EI(), and __set_il()).
The INTLIB suboption cancels the NOINTLIB suboption.
[Output Example]
Input:
void func(void){ __DI();}
Operation:
fcc907s -K nointlib -cpu MB90F553A -S sample.c
Output:
_func:
LINK #0
CALL ___DI
UNLINK
RET
-K NOVOLATILE
-K VOLATILE
The NOVOLATILE suboption does not recognize a __io qualifier attached variable as a volatiletype. Therefore, __io qualifier attached variables will be optimized.
The VOLATILE suboption cancels the NOVOLATILE suboption.
[Example]
>fcc907s -K novolatile -S -O -cpu MB90F553A sample.c
When an __io qualifier attached variable is processed in sample.c, it is not handled as avolatile qualifier attached variable, but is treated as the optimization target.
-
7/25/2019 Softunetm c Compiler
47/355
35
3.5 DETAILS OF OPTIONS
-K {UCHAR|SCHAR}
This 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 neither of the above two suboptions is specified, -K UCHAR applies.
[Output Example]
Input:
extern int data;
char c = -1;
void func(void){ data = c;}
Operation:
fcc907s -K schar -cpu MB90F553A -S sample.c
Output:
MOVX A, _c
MOVW _data, A
-K REALOS
-K NOREALOS
The REALOS suboption effects in-line expansion of the ITRON system call function. It can beused in cases where a program running under REALOS is to be prepared. For the ITRONsystem call function, refer to the REALOS/907 Kernel Manual.
When specifying the REALOS suboption, be sure to include the system call declaration headerfile provided by the REALOS. If the REALOS suboption is specified without including thesystem call declaration header file and system call in-line expansion is initiated, the operation isnot 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 "scdef_w.h"
void func(void){ ext_tsk();}
Operation:
fcc907s -K realos -cpu MB90F553A -S sample.c
Output:
INTP ext_tsk
BRA *
-K {UBIT|SBIT}
This option specifies whether or not to treat the most significant bit as a sign bit in situationswhere the char, short int, int, or long int type is selected as the bit field. When the UBITsuboption is specified, the most significant bit will not be treated as a sign bit. When the SBITsuboption 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.
-
7/25/2019 Softunetm c Compiler
48/355
36
CHAPTER 3 OPERATION
[Output Example]
Input:
extern int data;
struct tag { int bf:1;}st = {-1};
void func(void){ data = st.bf;}
Operation:fcc907s -K sbit -cpu MB90F553A -S sample.c
Output:
MOVB A, _st:0
EXT
MOVW _data, A
-
7/25/2019 Softunetm c Compiler
49/355
37
3.5 DETAILS OF OPTIONS
3.5.5 Optimization Related Options
This section describes the options related to optimization by the compiler.
Optimization Related Options
-K SIZE
This option selects an appropriate optimization combination with emphasis placed upon theobject size. The available options are shown below.
-O 3
-K EOPT
-K NOUNROLL
If any option (e.g, -O0) contradictory to the these options is specified after the SIZE suboption,such a contradictory option takes effect.
The -K SIZE option not only offers the optimization combination selection function, but alsomakes it possible to issue a generation instruction for object size minimization and effect objectpattern switching.
-K SPEED
This option selects an appropriate optimization combination with emphasis placed upon thegenerated object execution speed. The available options are shown below.
-O 4
If any option (e.g, -O0) contradictory to the these options is specified after the SPEEDsuboption, such a contradictory option takes effect.
The -K SPEED option not only offers the optimization combination selection function, but alsomakes it possible to issue a generation instruction for execution speed maximization and effectobject pattern switching.
-O [level]
This option specifies the optimization level. Levels 0, 1, 2, 3, and 4 can be specified. Thehigher the optimization level performs, the shorter the generated object execution time becomes,but the longer the compilation time takes. Note that higher optimization level contains loweroptimization level functions.
One of the following levels is to be specified. When no level is specified, -02 applies.
-0: Optimization Level 0
No optimization will be effected. This level is equivalent to cases where the -0 is notspecified.
-1: Optimization Level 1
Optimization will be effected in accordance with detailed analyses of a program flow.
-2: Optimization Level 2
The following optimization feature is exercised in addition to the feature provided byoptimization level 1.
-
7/25/2019 Softunetm c Compiler
50/355
38
CHAPTER 3 OPERATION
Loop Unrolling
Loop unrolling is performed to increase the execution speed by decreasing the loop countwhen 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
-
7/25/2019 Softunetm c Compiler
51/355
39
3.5 DETAILS OF OPTIONS
[Output Example]
Input:
extern int i;
extern void sub(int);
void func(void){
sub(i); sub(i);
}
Operation:
fcc907s -K addsp -cpu MB90F553A -S sample.c
Output:
MOVW A, _i
PUSHW A
CALL _sub
MOVW A, _i
PUSHW A
CALL _sub
ADDSP #4; Releasing argument areas synthesized
-K EOPT
-K NOEOPT
The EOPT suboption effects optimization by changing the arithmetic operation evaluation typeat the compilation stage. When this option is specified, there may be side effects on the
execution results. This option takes effect only when it is specified simultaneously with the -Ooption.
The NOEOPT suboption cancels the EOPT suboption.
[Output Example]
Input:
extern int i;
void func(int a, int b){
i=a-100+b+100;
}
Operation:
fcc907s -K eopt -O -cpu MB90F553A -S sample.c
Output:
MOVW A, @RW3+4
ADDW A, @RW3+6 ; Order of arithmetic operation replaced
MOVW _i, A
-
7/25/2019 Softunetm c Compiler
52/355
40
CHAPTER 3 OPERATION
-K LIB
-K NOLIB
The LIB suboption recognizes the standard function operation and replaces the standardfunction with a higher-speed standard function which effects standard function in-line expansionand performs the same operation as the original standard function. When this option isspecified, there may be side effects on the execution results. Since standard function in-line
expansion is implemented, the code size may increase. This option takes effect only when it isspecified simultaneously with the -O option.
The NOLIB suboption cancels the LIB suboption.
[Output Example]
Input:
extern int i;
void func(void){
i=strlen("ABC");
}
Operation:
fcc907s -K lib -O -cpu MB90F553A -S sample.c
Output:
MOVN A, #3 ; Processing equivalent to strlen expanded
MOVW _i, A
-K NOALIAS
-K ALIAS
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. This option takeseffect only when it is specified simultaneously with the -O option. The language specificationpermits the pointer to point to the same area as any other variable or pointer. Therefore, whenusing 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;
j=i+1;
}
Operation:
fcc907s -K noalias -O -cpu MB90F553A -S sample.c
-
7/25/2019 Softunetm c Compiler
53/355
41
3.5 DETAILS OF OPTIONS
Output:
MOVW A, _i
MOVN A, #1
ADDW A
MOVW RW4, A
MOVW A, @RW3+4 MOVW @AL, AH
MOVW A, RW4
MOVW _j, A ; Value of *p=i+1 reused
-K NOUNROLL
-K UNROLL
The NOUNROLL suboption inhibits loop unrolling optimization. Use this option when loopunrolling optimization is to be inhibited with the -O2 to -O4 options specified.
The UNROLL suboption cancels the NOUNROLL suboption.
-x function name 1 [, function name 2, ...]
-Xx
The -x option effects in-line expansion, instead of function calling, of functions defined by a Csource. However, recursively called functions will not be subjected to in-line expansion. Itshould also be noted that functions may not be subjected to in-line expansion depending onasm statement use, structure/union type argument presence or absence, setjmp functioncalling, and other conditions. The option takes effect only when it is specified simultaneouslywith the -O option.
The -Xx option cancels the -x option.
[Output Example]
Input:
extern int a;
static void sub(void){ a=1; }
void func(void){ sub(); }
Operation:
fcc907s -cpu MB90F553A -O -x sub -S sample.c
Output:
_func: MOVN A, #1
MOVW _a, A
RET
-
7/25/2019 Softunetm c Compiler
54/355
42
CHAPTER 3 OPERATION
-xauto [size]
-Xxauto
The -xauto option effects in-line expansion, instead of function calling, of functions whose logicalline 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 expansiondepending on asm statement use, structure/union type argument presence or absence, setjmp
function calling, and other conditions.If the size entry is omitted, the value 30 is assumed to be specified. The option takes effect onlywhen it is specified simultaneously with the -O option.
The -Xxauto option cancels the -xauto option.
-K ARRAY
-K NOARRAY
The ARRAYsuboption optimizes the array element access code(e.g. a[i]++;). This option takeseffect only when it is specified simultaneously with the -Ooption. However, a part ofoptimization (e.g. deletion of dead variable) might be not effective when the option is specifiedand the code worsen according to the source program.
The NOARRAYsuboption cancels the ARRAYsuboption.
-K ACCOPT
-K NOACCOPT
The ACCOPTsuboption, continuous substitution of the same constant, is optimization ofaccumulator transfer code for the immediate value. The option takes effect only when it isspecified simultaneously with the -O option.
The NOACCOPTsuboption cancels the ACCOPTsuboption.
[Output Example]
Input:
extern int a,b,c;
void func(void){a=b=c=0;}
Operation:
fcc907s -K accopt -S -cpu MB90F553A -O sample.c
Output:
_func:
MOVN A, #1
MOVW _c, A MOVW _b, A
MOVW _a, A
-
7/25/2019 Softunetm c Compiler
55/355
43
3.5 DETAILS OF OPTIONS
-K BITOPT
-K NOBITOPT
The BITOPTsuboption does effective generation of the bit operation instruction. The optiontakes effect only when it is specified simultaneously with the -O option.
The NOBITOPTsuboption cancels the BITOPTsuboption.
[Output Example] Input:
extern int a;
void func(void){a|=0x80;}
Operation:
fcc907s -K bitopt -S -cpu MB90F553A -O sample.c
Output:
_func:
SETB _a:7
-
7/25/2019 Softunetm c Compiler
56/355
44
CHAPTER 3 OPERATION
3.5.6 Output Object Related Options
This section describes the options related to output object formats.
Output Object Related Options
-cpu MB number
In this option, the MB number of the CPU actually used is specified in the CPU information file.If the MB number not described in the CPU information file is specified, the compiler becomesan error because series information on the CPU is taken from the CPU information file.
This option cannot be omitted.
[Example]
>fcc907s -S -cpu MB90F553A sample.c
-div905
-Xdiv905
The -div905option and the -Xdiv905option are the options concerning the CPU bug of "DIVA,Ri" and "DIVW A,RWi" instructions of MB90500 series. This CPU bug is described to
Appendix C "NOTES OF SIGNED DIVISION INSTRUCTION OF F2MC-16LX CPU".
The -div905option and the -Xdiv905option can be specified only for the fcc907scommand.And, only when the MB number of MB90500 seriesis specified by the -cpu option, thesebecome effective.
The -div905option generates signed division instruction (DIV and DIVW). Please specify thisoption only when there is no problem even if the signed division instruction (DIV and DIVW) isused.
The -Xdiv905option cancels the -div905option.
When the -div905option and the -Xdiv905option are omitted to the specification for the MBnumber of MB90500 seriesfor the -cpu option, the -Xdiv905option is applied.
When the -Xdiv905option is specified, not the signed division instruction (DIV and DIVW) butLibrary Calls generated. Therefore, the amount of the stack use increases occasionally.Moreover, __mul(), __div(), and __mod() which is a built-in function are generated as notmachine instructions but Library Calls.
-model {SMALL|MEDIUM|COMPACT|LARGE}
This option specifies memory model. For the details of memory models, see 4.2, MEMORY
MODELS.
-ramconst
-Xramconst
Specify this option (-ramconst) when the mirror function is not to be used. When specified, theoption will position const-qualified static variables in the RAM.
When this option is specified, the compiler generates the CINIT section corresponding to theCONST section, so that ROM data can be accessed with 16-bit symbols. The startup routinemust copy the CONST internal data to the CINIT.
-
7/25/2019 Softunetm c Compiler
57/355
45
3.5 DETAILS OF OPTIONS
This option does not work on CONST_module name sections that are generated relative tolarge models, compact models, or __far-qualified variables.
The -Xramconst option cancels the -ramconst option.
[Output Example]
Input:
const int a=0x10;
Operation:
fcc907s -ramconst -S -cpu MB90F553A sample.c
Output:
.SECTION CONST, CONST, ALIGN=2
.ALIGN 2
.DATA.H 16
.SECTION CINIT, DATA, ALIGN=2
.ALIGN 2
.GLOBAL _a
_a:
.RES.H 1
-s defname=newname [, attr [, address]]
-Xs
The -s option changes the compiler output section name from defname to newname, andchanges section type to attr.
Large models, compact models, medium models, and __far-qualified variable or functionsection names can be specified by attaching FAR_ to the start.
The arrangement address can also be specified in the address position.
For compiler output section names, see 4.1, SECTION STRUCTURE. For selectable sectiontypes, refer to the Assembler Manual.
If the arrangement address is specified, the arrangement address cannot be specified relative tothe associated section at linking.
The -Xs option cancels the -s option.
The operation is not guaranteed when the section having the location address is specifiedand the section having the location address is not specified exist together the same
section name.[Output Example]
Input:
void func(void){}
Operation:
fcc907s -s CODE=PROGRAM, CODE, 0x1000 -S -cpu MB90F553A sample.c
Output:
-
7/25/2019 Softunetm c Compiler
58/355
46
CHAPTER 3 OPERATION
.SECTION PROGRAM, CODE, LOCATE=H0:H1000
;-------begin_of_function
.GLOBAL _func
_func:
LINK #0
UNLINK RET
-varorder {SORT|NORMAL}
This option specifies how external variables and static variables in a section are aligned. WhenSORTsuboption is specified, to except the gap, external variables and static variables arealigned by the size of alignment. This has an effect to reduce the memory use amount. WhenNORMALsuboption is specified, external variables and static variables are aligned by theorder of description. Variables specified __io qualifier are always aligned to the IO section bythe order of description.
If neither of the above two suboptions is specified, -varorder SORTapplies.
[Output Example]
Input:
int i1;
char c;
int i2;
Operation:
fcc907s -varorder NORMAL -S -cpu MB90F553A sample.c
Output:
.SECTION DATA, DATA, ALIGN=2
.ALIGN 2
_i1: .RES.B 2
_c: .RES.B 1
.ALIGN 2
_i2: .RES.B 2
-pack
-Xpack
The -pack option packs the struct and union members.The -Xpack option cancels the -pack option.
[Output Example]
Input:
struct tag {
char a;
int b;
char c;
-
7/25/2019 Softunetm c Compiler
59/355
47
3.5 DETAILS OF OPTIONS
} s;
f() {s.b=0;}
Operation:
fcc907s -cpu MB90F553A -S -pack sample.c
Output:
MOVN A, #0 MOVW _s+1, A
-K BITFIELD_ORDER_LSB
-K BITFIELD_ORDER_MSB
The BITFIELD_ORDER_LSBsuboption arranges bit-field members direction of arrangementfrom the LSB side. The BITFIELD_ORDER_MSBsuboption arranges bit-field membersdirection of arrangement from the MSB side. When the BITFIELD_ORDER_MSBsuboption isspecified,__BITFIELD_ORDER_MSB__is defined as a predefined macro. Please do not linkobjects which specify the BITFIELD_ORDER_MSB suboption with an object not so because bit-field members direction of arrangement is different.
-align {DIR1|DIR2}
-Xalign
The -align option changes the boundary alignment value of __direct qualified variables. Whenthe DIR1 suboption is specified, the boundary alignment value of __direct qualified variables is1. When the DIR2 suboption is specified, the boundary alignment value of __direct qualifiedvariables is 2.
If neither of the above two suboptions is specified, the -align DIR2 is applied.
The -Xalign option cancels the -align option.
[Output Example]
Input:
__direct int a;
__direct char b;
Operation:
fcc907s -align DIR1 -cpu MB90F553A, -S sample.c
Output:
.SECTION DIRDATA, DIR, ALIGN=1
.GLOBAL _a
_a:
.RES.B 2
.GLOBAL _b
_b:
.RES.B 1
-
7/25/2019 Softunetm c Compiler
60/355
48
CHAPTER 3 OPERATION
-rp
-Xrp