ETC CC78K4

User’s Manual
CC78K4
C Compiler
Operation
CC78K4 V.2.20 and later
Document No. U11572EJ3V0UMJ1 (3rd edition)
Date Published October 2000 N CP(K)
©
Printed in Japan
1997
[MEMO]
2
User’s Manual U11572EJ3V0UM00
MS-DOS and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United
States and/or other countries.
PC/AT and PC DOS are trademarks of International Business Machines Corporation.
i386 is a trademark of Intel Corporation.
UNIX is a registered trademark licensed by X/Open Company Limited in the United States and other
countries.
SPARCstation is a trademark of SPARC International, Inc.
SunOS is a trademark of Sun Microsystems, Inc.
HP9000 Series 700 and HP-UX are trademarks of Hewlett-Packard Company.
NEWS and NEWS-OS are trademarks of Sony Corporation.
• The information in this document is current as of October, 2000. The information is subject to
change without notice. For actual design-in, refer to the latest publications of NEC's data sheets or
data books, etc., for the most up-to-date specifications of NEC semiconductor products. Not all
products and/or types are available in every country. Please check with an NEC sales representative
for availability and additional information.
• No part of this document may be copied or reproduced in any form or by any means without prior
written consent of NEC. NEC assumes no responsibility for any errors that may appear in this document.
• NEC does not assume any liability for infringement of patents, copyrights or other intellectual property rights of
third parties by or arising from the use of NEC semiconductor products listed in this document or any other
liability arising from the use of such products. No license, express, implied or otherwise, is granted under any
patents, copyrights or other intellectual property rights of NEC or others.
• Descriptions of circuits, software and other related information in this document are provided for illustrative
purposes in semiconductor product operation and application examples. The incorporation of these
circuits, software and information in the design of customer's equipment shall be done under the full
responsibility of customer. NEC assumes no responsibility for any losses incurred by customers or third
parties arising from the use of these circuits, software and information.
• While NEC endeavours to enhance the quality, reliability and safety of NEC semiconductor products, customers
agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize
risks of damage to property or injury (including death) to persons arising from defects in NEC
semiconductor products, customers must incorporate sufficient safety measures in their design, such as
redundancy, fire-containment, and anti-failure features.
• NEC semiconductor products are classified into the following three quality grades:
"Standard", "Special" and "Specific". The "Specific" quality grade applies only to semiconductor products
developed based on a customer-designated "quality assurance program" for a specific application. The
recommended applications of a semiconductor product depend on its quality grade, as indicated below.
Customers must check the quality grade of each semiconductor product before using it in a particular
application.
"Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances, machine tools, personal electronic equipment
and industrial robots
"Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed
for life support)
"Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life
support systems and medical equipment for life support, etc.
The quality grade of NEC semiconductor products is "Standard" unless otherwise expressly specified in NEC's
data sheets or data books, etc. If customers wish to use NEC semiconductor products in applications not
intended by NEC, they must contact an NEC sales representative in advance to determine NEC's willingness
to support a given application.
(Note)
(1) "NEC" as used in this statement means NEC Corporation and also includes its majority-owned subsidiaries.
(2) "NEC semiconductor products" means any semiconductor product developed or manufactured by or for
NEC (as defined above).
M8E 00. 4
User’s Manual U11572EJ3V0UM00
3
Regional Information
Some information contained in this document may vary from country to country. Before using any NEC
product in your application, pIease contact the NEC office in your country to obtain a list of authorized
representatives and distributors. They will verify:
•
Device availability
•
Ordering information
•
Product release schedule
•
Availability of related technical literature
•
Development environment specifications (for example, specifications for third-party tools and
components, host computers, power plugs, AC supply voltages, and so forth)
•
Network requirements
In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary
from country to country.
NEC Electronics Inc. (U.S.)
NEC Electronics (Germany) GmbH
NEC Electronics Hong Kong Ltd.
Santa Clara, California
Tel: 408-588-6000
800-366-9782
Fax: 408-588-6130
800-729-9288
Benelux Office
Eindhoven, The Netherlands
Tel: 040-2445845
Fax: 040-2444580
Hong Kong
Tel: 2886-9318
Fax: 2886-9022/9044
NEC Electronics Hong Kong Ltd.
Velizy-Villacoublay, France
Tel: 01-30-67 58 00
Fax: 01-30-67 58 99
Seoul Branch
Seoul, Korea
Tel: 02-528-0303
Fax: 02-528-4411
NEC Electronics (France) S.A.
NEC Electronics Singapore Pte. Ltd.
Madrid Office
Madrid, Spain
Tel: 91-504-2787
Fax: 91-504-2860
United Square, Singapore
Tel: 65-253-8311
Fax: 65-250-3583
NEC Electronics (France) S.A.
NEC Electronics (Germany) GmbH
Duesseldorf, Germany
Tel: 0211-65 03 02
Fax: 0211-65 03 490
NEC Electronics (UK) Ltd.
Milton Keynes, UK
Tel: 01908-691-133
Fax: 01908-670-290
NEC Electronics Taiwan Ltd.
NEC Electronics Italiana s.r.l.
NEC Electronics (Germany) GmbH
Milano, Italy
Tel: 02-66 75 41
Fax: 02-66 75 42 99
Scandinavia Office
Taeby, Sweden
Tel: 08-63 80 820
Fax: 08-63 80 388
Taipei, Taiwan
Tel: 02-2719-2377
Fax: 02-2719-5951
NEC do Brasil S.A.
Electron Devices Division
Guarulhos-SP Brasil
Tel: 55-11-6462-6810
Fax: 55-11-6462-6829
J00.7
4
User’s Manual U11572EJ3V0UM00
Major Revisions in This Edition (1/2)
Page
Description
Throughout
Deletion of description regarding the symbol name case specification (-CA, -NCA), ROM storage
specification (-R, -NR), and optimization specification (-QO)
Throughout
Addition of Note for distinction of startup routine (B: for boot area, E: for flash area)
Throughout
Addition of on-line help file
pp.55, 56 of old
edition
Deletion of 3.1 Before Starting Tools, 3.1.1 Starting from command line, and 3.1.2 Parameter files
pp.37, 38
Updating screen in 2.3.1 Installing CC78K4 in Windows
p.51
Modification of Table 2-4 Library Files
p.55
Modification of description in 3.1.1 Position of CC78K4P.DLL (Tools DLL)
p.57
Updating screen in 3.1.3 (2) Option setting dialog box
pp.58 to 67
Addition of description and setting screen when each option is selected in 3.1.4 Description of each
part of option setting dialog box
p.77 of old edition
Deletion of 4.3 Runtime Error Checking, 4.3.1 Error processing routine, and 4.3.2 Error check
library name
pp.68 to 90
Addition of 3.2 Procedure from Compiling to Linking (when Self Rewrite Mode of Flash Memory Is
Not Used) and 3.3 Procedure from Compiling to Linking (when Self Rewrite Mode of Flash
Memory Is Used)
p.98
Modification of description in 4.2.1 Linking
p.100
Deletion of -QS, -QJ, and -L from Table 5-1 Precedence of Compiler Options
pp.102 to 145
Modification of description of options in 5.3 Descriptions of Compiler Options
p.106
Addition of [Caution] in 5.3 (2) Object module file creation specification (-O/-NO)
pp.111, 112
Modification of Table 5-2 Optimization Types
p.151 of old edition
Deletion of Table 8-7 Using Appropriate Startup Routines
p.146
Addition of [Caution] in 5.3 (20) Device file search path (-Y)
p.147
Modification of description in 6.2 Assembler Source Module Files
pp.168 to 171 of old
edition
Deletion of 8.4 Error Processing Routines
p.164
Modification of Table 8-2 SRC Directory Contents
pp.165, 166
Modification of description in 8.2.1 Batch files for creating startup routines
p.168
Modification of Table 8-4 Startup Routine Overview
pp.186, 187
Addition of 8.4 ROM Processing in Startup Module for Flash Area, Table 8-10 ROM Area Section
for Initialization Data, and Table 8-11 RAM Area Section for Copy Destination
pp.192 to 211
9.3 List of Error Messages
Deletion of W026 and W844, addition of W043, W046, F113, F336, W337, F788, F789, F790, F791,
W792, W793, F858, F859, F860, F861, F862, F863, F864, F865, F866, F867, F868, W869, W870, and
W871, modification of description in W034, W725, and F772
pp.224 to 226 of old
edition
Deletion of Restrictions 13, 15, and 16
User’s Manual U11572EJ3V0UM00
5
Major Revisions in This Edition (2/2)
Page
Description
pp.217 to 221
Modification of A.3 (1) Assembler source module file
p.228
p.229
p.233
p.233
APPENDIX B
Modification of description in Number 4 [Cautions with -QC compiler option]
Modification of description in Number 7 [Creating link directive file]
Addition of Number 16 [Cautions when source debugging with ID78K4]
Addition of Number 17 [Cautions when source debugging with SM78K4]
The mark
6
shows major revised points.
User’s Manual U11572EJ3V0UM00
INTRODUCTION
The purpose of this manual is to enable complete understanding of the functions and operation of the CC78K4
(78K/IV Series C Compiler).
This manual does not explain how to write CC78K4 source programs. Therefore, before reading this manual,
please read “CC78K4 C Compiler User’s Manual Language (U11571E)” (hereinafter called the “Language
manual”).
[Target Devices]
Software for 78K/IV Series microcontrollers can be developed by using CC78K4. To use, RA78K4 (78K/IV Series
Assembler Package) and the target model’s device file (sold separately) are required.
[Target Users]
This manual is written for users who have the knowledge gained by reading through the user’s manual for the
device once and have software programming experience. However, since knowledge about C compilers and the C
language are not particularly needed, first-time users of C compilers can use this manual.
[Organization]
The organization of this manual is described below.
CHAPTER 1 OVERVIEW
This chapter describes the role and position of the CC78K4 in microcontroller development.
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
This chapter describes how to install the CC78K4, the file names of the supplied programs, and the operating
environment for programs.
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
This chapter uses sample programs to describe how to run CC78K4 and presents examples showing the
processes from compiling to linking.
CHAPTER 4 CC78K4 FUNCTIONS
This chapter describes optimization and ROM functions in CC78K4.
CHAPTER 5 COMPILER OPTIONS
This chapter describes the functions of the compiler options, the setting methods, and the precedence.
CHAPTER 6 C COMPILER OUTPUT FILES
This chapter describes the output of various list files output by CC78K4.
CHAPTER 7 USING C COMPILER
This chapter introduces techniques to skillfully use this compiler.
CHAPTER 8 STARTUP ROUTINES
CC78K4 provides startup routines as samples. This chapter describes the contents and uses of the startup
routines, and suggestions on how to improve the startup routines.
User’s Manual U11572EJ3V0UM00
7
CHAPTER 9 ERROR MESSAGES
This chapter describes the error messages output by CC78K4.
APPENDICES
The appendices provide an execution example of a sample program, a list of the cautions encountered during
use, and a list of the restrictions.
[How To Use this Manual]
First, those who want to see how to actually use CC78K4, read CHAPTER 3
PROCEDURE FROM
COMPILING TO LINKING.
Users with a general knowledge of C compilers or users who have read the Language manual can skip
CHAPTER 1 OVERVIEW.
[Related Document]
The document (such as user’s manual) related to this manual is introduced.
Document Name
Document No.
English
CC78K4 C Compiler Language User’s Manual
U11571E
Japanese
U11571J
[Conventions]
The meanings of the symbols used in this manual are explained.
RTOS :
78K/IV Series Real-time Operating System RX78K/IV
…:
Repeat in the same format.
[]:
The contents enclosed by [ ] are optional.
 :
Characters enclosed by 
“”:
Characters enclosed by “ ”
‘’:
Characters enclosed by ‘ ’
Bold character : The character itself
_:
Underlining at important locations or in examples is the input character sequence.
∆:
At least one space
::
Indicates an omission in a program description
():
Characters enclosed by ( )
/:
Delimiter
\:
Backslash
In PC DOS™ and UNIX™, the ‘¥’ becomes ‘\’ (backslash).
8
User’s Manual U11572EJ3V0UM00
[File Name Conventions]
The conventions for specifying the input files which are designated in the command line are shown below.
(1) Specifying disk file names
[drive-name] [\] [[path-name]...] primary-name [.[file-type]]
<1>
<2> <3>
<4>
<5>
<1> Specifies the name of the drive (A: to O:) storing the file.
<2> Specifies the name of the root directory.
<3> Specifies the name of the subdirectory.
<4> Character string of 8 or fewer characters
Characters that can be used:
First character in the string (A to Z, a to z)
Other characters (A to Z, a to z, 0 to 9, _, @, ?)
<5> Character string of 3 or fewer characters
Characters that can be used:
(A to Z, a to z, 0 to 9, /)
Example: A:\nectools\smp78k4\CC78k4\prime.C
Remarks 1. A space cannot be specified before and after ‘:’, ‘.’, or ‘\’.
2. Uppercase and lowercase letters are not distinguished.
3. For PC DOS or UNIX, a ‘¥’ becomes a ‘\’ (backslash).
(2) Specifying device file names
The following logical devices are available.
Logical Device
Description
CON
Output to the console.
PRN
Output to the printer.
AUX
Output to an auxiliary output device.
NUL
Dummy output (Nothing is output.)
User’s Manual U11572EJ3V0UM00
9
[MEMO]
10
User’s Manual U11572EJ3V0UM00
CONTENTS
CHAPTER 1 OVERVIEW ........................................................................................................................... 19
1.1 Microcontroller Application Product Development and Role of CC78K4 ............................... 20
1.2 Development Procedure Using CC78K4 ..................................................................................... 22
1.2.1 Using editor to create source module files .................................................................................. 23
1.2.2 C compiler.................................................................................................................................... 24
1.2.3 Assembler.................................................................................................................................... 25
1.2.4 Linker ........................................................................................................................................... 26
1.2.5 Object converter .......................................................................................................................... 27
1.2.6 Librarian....................................................................................................................................... 28
1.2.7 Debugger ..................................................................................................................................... 29
1.2.8 System simulator ......................................................................................................................... 30
1.2.9 Project Manager .......................................................................................................................... 31
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION .................................................................... 33
2.1 Host Machine and Supplied Formats.......................................................................................... 33
2.2 Before Installing ............................................................................................................................ 34
2.2.1 Cautions when installing in Windows .......................................................................................... 34
2.2.2 Cautions when installing in DOS ................................................................................................. 34
2.3 Installation Procedures ................................................................................................................ 35
2.3.1 Installing CC78K4 in Windows .................................................................................................... 35
2.3.2 Installing CC78K4 in DOS ........................................................................................................... 44
2.3.3 Installing CC78K4 on workstation................................................................................................ 46
2.4 Environment Settings ................................................................................................................... 48
2.4.1 Host machine (for PC-9800 Series and IBM PC/AT and compatibles)........................................ 48
2.4.2 Environment variables ................................................................................................................. 49
2.4.3 File organization .......................................................................................................................... 50
2.4.4 Library files .................................................................................................................................. 51
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING................................................................. 55
3.1 Project Manager ............................................................................................................................ 55
3.1.1 Position of CC78K4P.DLL (Tools DLL)........................................................................................ 55
User’s Manual U11572EJ3V0UM00
11
3.1.2 Execution environment................................................................................................................ 55
3.1.3 CC78K4 option setting menu ...................................................................................................... 56
(1)
Option menu items ..................................................................................................................... 56
(2)
Option setting dialog box............................................................................................................ 57
3.1.4 Description of each part of option setting dialog box................................................................... 58
(1)
Setting screen when “Preprocess” is selected ........................................................................... 60
(2)
Setting screen when “Memory Arrange” is selected................................................................... 61
(3)
Setting screen when “Optimize” is selected ............................................................................... 62
(4)
Setting screen when “Debug/Output” is selected....................................................................... 64
(5)
Setting screen when “Others” is selected .................................................................................. 66
3.2 Procedure from Compiling to Linking
(when Self Rewrite Mode of Flash Memory Is Not Used) ..........................................................68
3.2.1 Compiling to linking via Project Manager .................................................................................... 68
3.2.2 Compiling to linking in command line (for DOS and EWS) ......................................................... 74
(1)
When parameter file is not used ................................................................................................ 74
(2)
When parameter file is used ...................................................................................................... 75
3.3 Procedure from Compiling to Linking
(when Self Rewrite Mode of Flash Memory Is Used) .................................................................76
3.3.1 Compiling to linking via Project Manager .................................................................................... 76
(1)
Compiling to linking program for boot area ................................................................................ 76
(2)
Compiling to linking program for flash area................................................................................ 82
3.3.2 Compiling to linking in command line (for DOS and EWS) ......................................................... 88
(1)
When parameter file is not used ................................................................................................ 88
(2)
When parameter file is used ...................................................................................................... 90
3.4 Input/Output Files of C Compiler.................................................................................................91
3.5 Execution Start and End Messages.............................................................................................93
CHAPTER 4 CC78K4 FUNCTIONS ...........................................................................................................95
4.1 Optimization Method.....................................................................................................................95
4.2 Functions on ROM ........................................................................................................................98
4.2.1 Linking ......................................................................................................................................... 98
CHAPTER 5 COMPILER OPTIONS...........................................................................................................99
5.1 Specifying Compiler Options .......................................................................................................99
5.2 Precedence of Compiler Options...............................................................................................100
12
User’s Manual U11572EJ3V0UM00
5.3 Descriptions of Compiler Options............................................................................................. 102
(1)
Device type specification (-C) ...................................................................................................103
(2)
Object module file creation specification (-O/-NO)....................................................................106
(3)
Memory assignment specification (-R/-NR, -RD/-NR, -RS/-NR) ...............................................107
(4)
Optimization specification (-Q/-NQ) ..........................................................................................110
(5)
Debugging information output specification (-G/-NG) ...............................................................114
(6)
Preprocess list file creation specification (-P, -K)......................................................................115
(7)
Preprocess specification (-D, -U, -I)..........................................................................................118
(8)
Assembler source module file creation specification (-A, -SA) .................................................121
(9)
Error list file creation specification (-E, -SE) .............................................................................125
(10) Cross-reference list file creation specification (-X)....................................................................129
(11) List format specification (-LW, -LL, -LT, -LF, -LI) ......................................................................131
(12) Warning output specification (-W).............................................................................................136
(13) Execution state display specification (-V) .................................................................................137
(14) Parameter file specification (-F) ................................................................................................138
(15) Temporary file creation directory specification (-T)...................................................................139
(16) Help specification (--/-?/-H) .......................................................................................................140
(17) Memory model specification (-MS/-MM/-ML) ............................................................................141
(18) Location function specification (-CS) ........................................................................................142
(19) Function expansion specification (-Z/-NZ) ................................................................................144
(20) Device file search path (-Y).......................................................................................................146
CHAPTER 6 C COMPILER OUTPUT FILES ........................................................................................... 147
6.1 Object Module Files .................................................................................................................... 147
6.2 Assembler Source Module Files................................................................................................ 147
6.3 Error List File............................................................................................................................... 151
6.3.1 Error list file with C source ......................................................................................................... 151
6.3.2 Error list file with error messages only....................................................................................... 153
6.4 Preprocess List File .................................................................................................................... 154
6.5 Cross-Reference List File........................................................................................................... 156
CHAPTER 7 USING C COMPILER.......................................................................................................... 159
7.1 Efficient Operation (EXIT Status Function) .............................................................................. 159
7.2 Setting Up Development Environment (Environment Variables) ........................................... 160
7.3 Interrupting Compilation ............................................................................................................ 160
User’s Manual U11572EJ3V0UM00
13
CHAPTER 8 STARTUP ROUTINES ........................................................................................................161
8.1 File Organization .........................................................................................................................161
8.1.1 BAT directory contents .............................................................................................................. 163
8.1.2 SRC directory contents ............................................................................................................. 164
8.2 Batch File Description ................................................................................................................165
8.2.1 Batch files for creating startup routines ..................................................................................... 165
8.3 Startup Routines .........................................................................................................................167
8.3.1 Overview of startup routines...................................................................................................... 167
(1)
Function ................................................................................................................................... 167
(2)
Configuration............................................................................................................................ 168
(3)
Uses of startup routines ........................................................................................................... 169
8.3.2 Description of sample program (cstart.asm) ............................................................................. 170
(1)
Preprocessing .......................................................................................................................... 170
(2)
Initial settings ........................................................................................................................... 173
(3)
ROM processing ...................................................................................................................... 176
(4)
Starting main function and postprocessing .............................................................................. 179
8.3.3 Revising startup routines........................................................................................................... 183
(1)
When revising startup routine .................................................................................................. 183
(2)
Link directive file....................................................................................................................... 185
8.4 ROM Processing in Startup Module for Flash Area .................................................................186
CHAPTER 9 ERROR MESSAGES...........................................................................................................189
9.1 Error Message Format ................................................................................................................189
9.2 Types of Error Messages............................................................................................................189
9.3 List of Error Messages................................................................................................................190
14
(1)
Error message for command line <from 001>.......................................................................... 191
(2)
Error message for internal errors and memory <from 101> ..................................................... 193
(3)
Error message for characters <from 201> ............................................................................... 195
(4)
Error message for configuration elements <from 301> ............................................................ 195
(5)
Error message for conversion <from 401>............................................................................... 197
(6)
Error message for expressions <from 501> ............................................................................. 198
(7)
Error message for statements <from 601>............................................................................... 200
(8)
Error message for declarations and function definitions <from 701>....................................... 202
(9)
Error message for preprocessing directives <from 801> ......................................................... 207
User’s Manual U11572EJ3V0UM00
(10) Error message for fatal file I/O and running on illegal operating system <from 901> ...............212
9.4 List of Error Messages in Project Manager .............................................................................. 213
APPENDIX A SAMPLE PROGRAMS...................................................................................................... 215
A.1 C Source Module File.................................................................................................................. 215
A.2 Execution Example ..................................................................................................................... 216
A.3 Output List ................................................................................................................................... 217
(1)
Assembler source module file...................................................................................................217
(2)
Preprocess list file.....................................................................................................................222
(3)
Cross-reference list file .............................................................................................................224
(4)
Error list file...............................................................................................................................225
APPENDIX B LIST OF USE-RELATED CAUTIONS............................................................................... 227
APPENDIX C LIST OF RESTRICTIONS ................................................................................................. 235
C.1 Details about Restrictions and Prevention Methods............................................................... 236
APPENDIX D INDEX ................................................................................................................................ 245
User’s Manual U11572EJ3V0UM00
15
LIST OF FIGURES
Figure No.
16
Title
Page
1-1
Development Process for Microcontroller Application Products ..................................................... 20
1-2
Software Development Process ..................................................................................................... 21
1-3
Program Development Procedure Using CC78K4 ......................................................................... 22
1-4
Creating Source Module Files ........................................................................................................ 23
1-5
C Compiler Function ....................................................................................................................... 24
1-6
Assembler Function ........................................................................................................................ 25
1-7
Linker Function ............................................................................................................................... 26
1-8
Object Converter Function .............................................................................................................. 27
1-9
Librarian Function ........................................................................................................................... 28
1-10
Debugger Function ......................................................................................................................... 29
1-11
Simulator Function.......................................................................................................................... 30
1-12
Project Manager Function............................................................................................................... 31
3-1
C Compiler Input/Output Files ........................................................................................................ 92
8-1
ROM Processing........................................................................................................................... 178
User’s Manual U11572EJ3V0UM00
LIST OF TABLES
Table No.
Title
Page
2-1
Host Machine and Supplied Formats ..............................................................................................33
2-2
Environment Variables ....................................................................................................................49
2-3
File Organization (* = letters and numbers) ....................................................................................50
2-4
Library Files.....................................................................................................................................51
3-1
C Compiler Input/Output Files.........................................................................................................91
4-1
Optimization Methods .....................................................................................................................96
5-1
Precedence of Compiler Options ..................................................................................................100
5-2
Optimization Types .......................................................................................................................111
5-3
Process Types of -K Option ..........................................................................................................116
5-4
Warning Message Levels..............................................................................................................136
5-5
Address of Location Function Specification ..................................................................................142
5-6
Type Specifications of -Z Option ...................................................................................................144
8-1
BAT Directory Contents ................................................................................................................163
8-2
SRC Directory Contents................................................................................................................164
8-3
INC Directory Contents .................................................................................................................164
8-4
Startup Routine Overview .............................................................................................................168
8-5
Differences Between Startup Routine Sources.............................................................................169
8-6
Correspondence Between Source Files and Object Files ............................................................169
8-7
ROM Area for Initial Values...........................................................................................................178
8-8
RAM Area for Initial Values (Copy Destination) ............................................................................178
8-9
Symbols Used in Library Functions ..............................................................................................183
8-10
ROM Area Section for Initialization Data ......................................................................................186
8-11
RAM Area Section for Copy Destination .......................................................................................186
User’s Manual U11572EJ3V0UM00
17
[MEMO]
18
User’s Manual U11572EJ3V0UM00
CHAPTER 1 OVERVIEW
The CC78K4 C compiler program translates C source programs written in ANSI-C
Note
or the C language for the
78K/IV Series into the machine language for the 78K/IV Series.
CC78K4 can be run on Windows™ 3.1 or Windows 95 when using the Project Manager included in the assembler
package for the 78K/IV Series. If the Project Manager is not used, the compiler can be run on MS-DOS™ or PC
DOS (for the PC version).
Note ANSI-C is the C language that conforms to the standard set by the American National Standards Institute.
User’s Manual U11572EJ3V0UM00
19
CHAPTER 1 OVERVIEW
1.1 Microcontroller Application Product Development and Role of CC78K4
The position of CC78K4 in product development is shown below.
Figure 1-1. Development Process for Microcontroller Application Products
Product Planning
System Design
Production
Coding
Bugs
Errors
Software Design
Mistakes
Hardware Design
Compile/Assemble
CC78K4
C Compiler
Inspection
Debugging
System Evaluation
Product Creation
20
User’s Manual U11572EJ3V0UM00
CHAPTER 1 OVERVIEW
The software development process is shown below.
Figure 1-2. Software Development Process
Software Development
Write Program Specification
Create Flow Chart
… Depends on 78K Series C language or ANSI-C
Coding
Edit Source Modules
… Use the editor to create the C source module files.
… Create the object module files.
Compile
YES
Errors?
NO
… Link to the reference library and function library.
Link
File Conversion
… Convert the file to the hexadecimal format.
… Use the hardware debugger (in-circuit emulator,
etc.) to verify the operation.
Debug
NO
OK
YES
System Evaluation
User’s Manual U11572EJ3V0UM00
21
CHAPTER 1 OVERVIEW
1.2 Development Procedure Using CC78K4
The development procedure using CC78K4 is shown below.
Figure 1-3. Program Development Procedure Using CC78K4
C source
Structured
assembler
source
Include file
Structured assembler
C compiler
Assembler source
Assembler source
Assembler
Real-time OS
Object module file
Library file
Librarian
Assemble list
Library file
Linker
Load module file
List converter
System
simulator
Object converter
Integrated debugger
Dedicated parallel
interface
Absolute assemble list
Hexadecimal
object
IE-784000-R
RS-232-C
PROM programmer
22
User’s Manual U11572EJ3V0UM00
In-circuit emulator
CHAPTER 1 OVERVIEW
1.2.1 Using editor to create source module files
One program is divided into several functional modules.
One module is the coding unit and becomes the input unit to the compiler. A module that is the input unit to the C
compiler is called a C source module.
After each C source module is coded, use the editor to save the source module to a file. A file created in this way
is called a C source module file.
The C source module files become the CC78K4 input files.
Figure 1-4. Creating Source Module Files
Program
Source Module
Source Module
END
Source Module
END
END
Source Module
Write to file (editor)
END
Source Module File
User’s Manual U11572EJ3V0UM00
23
CHAPTER 1 OVERVIEW
1.2.2 C compiler
The C compiler inputs the C source modules and converts the C language into machine language. If description
errors are detected in the C source module, compiling errors are output.
If there are no compiling errors, the object module files are output. And to correct and check the programs at the
assembly language level, assembler source module files can be output. If you want to output these files, specify the
-A or -SA option in the specification for creating assembler module files when compiling (For information about the
options, see CHAPTER 5 COMPILER OPTIONS).
Figure 1-5. C Compiler Function
C source module file
C Compiler
Object module file
24
Assembler source module file
User’s Manual U11572EJ3V0UM00
CHAPTER 1 OVERVIEW
1.2.3 Assembler
The assembler uses the assembler included in the RA78K4 Assembler Package (sold separately).
The assembler is the program that inputs an assembler source module file and translates assembly language into
machine language. If description errors were discovered in the source module, the assemble errors are output. If
there are no assemble errors, the output is the object module file which includes machine language information and
location information such as at which address each machine language code should be placed in memory.
In
addition, information during assembly is output as an assemble list file.
Figure 1-6. Assembler Function
Assembler source module file
Assembler
Assemble list file
Object module file
User’s Manual U11572EJ3V0UM00
25
CHAPTER 1 OVERVIEW
1.2.4 Linker
The linker uses the linker included in the RA78K4 Assembler Package (sold separately).
The linker inputs multiple object module files output by the compiler or object module files output by the
assembler, and links them to the library files (Even if there is one object module, linking must be performed). One
load module file is output.
In this case, the linker determines the location addresses of relocatable segments in the input module. This
determines the values of relocatable symbols and external reference symbols, and embeds the correct values in the
load module file.
The linker outputs the linking information as a link map list.
Figure 1-7. Linker Function
Multiple object module files
Library file
....
Linker
Link map file
26
Load module file
User’s Manual U11572EJ3V0UM00
CHAPTER 1 OVERVIEW
1.2.5 Object converter
The object converter uses the converter included in the RA78K4 Assembler Package (sold separately).
The object converter inputs a load module file output by the linker and converts its file format. The result is output
as a hexadecimal object module file.
By using the object converter options, the following hexadecimal formats can be selected.
• Intel standard hexadecimal format
• Intel extended hexadecimal format
• Extended Tektronix format
• Motorola S-type format (standard address)
• Motorola S-type format (32-bit address)
Symbol information is output as a symbol table file.
Figure 1-8. Object Converter Function
Load module file
Object Converter
Hexadecimal object module file
User’s Manual U11572EJ3V0UM00
Symbol table file
27
CHAPTER 1 OVERVIEW
1.2.6 Librarian
Clearly defined modules having a general interface are formed into a library for convenience. By creating the
library, many object modules form one file and become easy to handle.
The linker has functions to extract only the needed modules from the library file and link them. Therefore, if
multiple modules are registered in one library file, the names of the module files needed when linking no longer have
to be individually specified.
The librarian is used to create and update library files. The librarian uses the librarian included in the RA78K4
Assembler Package (sold separately).
Figure 1-9. Librarian Function
Object module files output by compiler
Object module file output by assembler
...
Librarian
Library file
28
User’s Manual U11572EJ3V0UM00
CHAPTER 1 OVERVIEW
1.2.7 Debugger
Source debugging using a graphical user interface becomes possible by loading the load module files output by
the linker into the IE (in-circuit emulator) by using the ID78K4 (78K/IV Series integrated debugger).
To debug, the -G option specifying the output of debugging information is specified when the target source
program is compiled (-G is the default option). By making this specification, the symbols and line numbers needed in
debugging are added to the object module. For information on the compiler options, see CHAPTER 5 COMPILER
OPTIONS.
Figure 1-10. Debugger Function
• Object information
• Debugging information
Integrated Debugger
Parallel interface
In-circuit emulator
User’s Manual U11572EJ3V0UM00
29
CHAPTER 1 OVERVIEW
1.2.8 System simulator
Source debugging using a graphical user interface becomes possible by downloading the load module files output
from the linker by using the SM78K4 (78K/IV Series system simulator).
SM78K4 is software that has the same operating image as the ID78K4 and performs simulations on the host
machine. In addition to simulating machine instructions in the SM78K4, the built-in peripherals for the devices and
the interrupts can be simulated.
Since external parts and procedures are provided to construct dummy target
systems, the programs including the operation of the target system are debugged at an early stage independent of
hardware development.
Figure 1-11. Simulator Function
Load module file
• Object information
• Debugging information
Simulator
30
User’s Manual U11572EJ3V0UM00
CHAPTER 1 OVERVIEW
1.2.9 Project Manager
The Project Manager is software that uses the DLL files added to CC78K4 and is able to start CC78K4 on
Windows 3.1, Windows 95, or Windows NT.
Editing the source, automatically creating the MAKE FILE, and
compiling to linking can be performed from the startup screen of the Project Manager. Thus, editing to debugging
can be performed using GUI images.
The Project Manager is added to the RA78K4 Assembler Package. The installer for the RA78K4 Assembler
Package is used to install and to make the settings. If CC78K4 will be started from the Project Manager, install the
RA78K4 Assembler Package before installing the compiler.
Figure 1-12. Project Manager Function
Development Tools
Project Manager
Editor
Remark
C Compiler
Assembler
Linker
Integrated Debugger
Simulator
Build
Build analyzes and executes the make file to create the executable file. The dependency relationships
described in the make file basically remove unused assembling, compiling, and linking and can create
efficient executable files.
User’s Manual U11572EJ3V0UM00
31
[MEMO]
32
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.1 Host Machine and Supplied Formats
CC78K4 is shipped with the media and recording formats shown in Table 2-1 for each host machine.
Table 2-1. Host Machine and Supplied Formats
Host Machine
Operating System (Version)
Shipped Media
Recording Format
PC-9800 Series
MS-DOS (3.30/5.00 and later),
Note
Japanese Windows (3.1/95)
3.5” 2HD FD
MS-DOS
IBM PC/AT™ and
compatibles
PC DOS (5.00 and later),
Japanese Windows (3.1/95)/
Note
English Windows (3.1/95)
3.5” 2HC FD
PC DOS
HP9000 Series 700™
HP-UX™ (Rel 9.05 and later)
DAT
tar
SPARCstation™
SunOS™ (Rel 4.1.3 and later)
1/4” CGMT
3.5” 2HC FD
tar
NEWS™ (RISC)
NEWS-OS™ (Rel 4.2/6.1 and later)
1/4” CGMT
3.5” 2HC FD
tar
Note If the Project Manager will not be used, Windows is not needed. Note that the Japanese Windows and
English Windows versions are separate products.
User’s Manual U11572EJ3V0UM00
33
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.2 Before Installing
2.2.1 Cautions when installing in Windows
Heed the following cautions when installing in Windows.
(1) Install after exiting all other applications that are currently running.
(2) If the installation is interrupted, since Windows sometimes becomes unstable, reset the personal computer and
restart.
(3) If CC78K4 will be used from the Project Manager in Windows, always use the installer (setupxx.exe) to install.
Do not install by using the DOS batch file (dosinst.bat).
(4) If CC78K4 will be used in Windows, since the Project Manager (prjtman.exe) included in the RA78K4 Assembler
Package is needed, before installing CC78K4, install the Project Manager by using the installer included in the
RA78K4 Assembler Package.
If the Assembler Package and the Project Manager have not been installed beforehand, CC78K4 cannot be
installed by the installer (an error occurs).
(5) If setupxx.exe is used to install in Windows 95, do not use long directory names with nine or more characters.
(Examples A:\nectools /* 8 characters are OK */, A:\78k4tools /* 9 characters are WRONG */)
2.2.2 Cautions when installing in DOS
Heed the following cautions when installing in DOS.
(1) If dosinst.bat is used to install CC78K4, the directory structure differs from the structure when installed by the
Windows installer (setupxx.exe). For details, see 2.3.1 (10) File organization after installation.
(2) If dosinst.bat is used for installation at the DOS prompt in Windows 95, do not use long directory names with
nine or more characters.
(Examples A:\nectools /* 8 characters are OK */, A:\78k4tools /* 9 characters are WRONG */)
34
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.3 Installation Procedures
The three installation procedures for CC78K4 are given below.
1. Installing on Windows
Start setupxx.exe
xx: 31 for Windows 3.1, 95 for Windows 95 or Windows NT
2. Installing on DOS
Start dosinst.bat
3. Installing on workstation
Use the tar command.
The installers (setupxx.exe, dosinst.bat) included in CC78K4 only install the compiler. If RA78K4 has not been
installed previously, an error results.
Caution
A ‘¥’ used in the description becomes a backslash ‘\’ on the PC DOS or UNIX.
2.3.1 Installing CC78K4 in Windows
An execution example is described which reads CC78K4 from drive A: and installs the executable form in
C:\nectools\bin. Windows is assumed to already be running. An example is shown that starts setup95.exe in the
Japanese Windows version. In the English Windows version, the messages and labels are in English.
(1) Start the installer.
<1> Insert “CC78K4 SETUP DISK #1” in the floppy disk drive.
<2> Use the Explorer in Windows 95 or the File Manager in Windows 3.1 to start setupxx.exe on the floppy disk.
<3> After the setup initialization, the installer starts.
User’s Manual U11572EJ3V0UM00
35
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
<4> To continue the installation, select “Yes.”
To exit the installation, select “No” (Refer to (9) If the installer was interrupted).
The installation items are displayed. To continue the installation select “Continue.” To exit, select “Exit”
(Refer to (9) If the installer was interrupted).
36
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
(2) Specify the install directories.
<1> The dialog box for specifying the installation destination is displayed.
<2> After typing the installation directory in the text box, select “Continue.”
<3> Select “Back” to return to the selection dialog box for the installation options.
<4> If “Original” is selected, the root is changed to the default directory. The default for root in the installation
destination is \nectools on the drive where Windows is installed. If other 78K Series tools have already been
installed by the installer, that root is used. If root is edited, the directories under it are linked and changed.
<5> If “Exit” is selected, the installation exits (Refer to (9) If the installer was interrupted).
User’s Manual U11572EJ3V0UM00
37
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
(3) Start the file copy.
<1> The File Copy Start dialog box appears.
<2> If “Continue” is selected, the file copy starts.
If “Back” is selected, return to the dialog box for specifying the installation destination.
If “Exit” is selected, the installation exits (Refer to (9) If the installer was interrupted).
(4) The file copy starts.
38
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
If “Cancel” is selected, the following message appears.
If “Yes” is selected, the installation exits.
If “No” is selected, the file copy restarts.
(5) Exchange the disk.
<1> When the following message is displayed, insert “CC78K4 SETUP DISK #2” in the floppy disk drive.
(6) Modify AUTOEXEC.BAT.
<1> Use the radio buttons to select “Auto Modify by the Installer” or “Modify by yourself.”
User’s Manual U11572EJ3V0UM00
39
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
<2> If “Auto Modify by the Installer” is selected, AUTOEXEC.BAT in the drive containing the Windows directory is
modified and the original file is saved with the name AUTOEXEC.OLD.
<3> If “Modify by yourself” is selected, AUTOEXEC.SMP is created in the root directory as the modify sample.
If AUTOEXEC.SMP already exists, the following contents are added.
REM --- nec tools installer xx/xx/xx xx:xx:xx --PATH c:\nectools\bin;%PATH%
(7) Exit the installation.
<1> The following message is output.
<2> If “OK” is selected, the installer ends.
<3> Restart the computer.
40
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
(8) CC78K4 can be started from the Project Manager after its installation was completed.
Caution
If CC78K4 will be started from Windows, install the Project Manager in the RA78K4 Assembler
Package V1.30 beforehand.
In addition, if the C compiler will be run, device files (sold
separately) are required.
(9) If the installer was interrupted
<1> The following message appears.
<2> If “Continue” is selected, the dialog box where “Exit” was selected returns.
User’s Manual U11572EJ3V0UM00
41
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
<3> If “Exit” is selected, the following message appears.
<4> If “OK” is selected, the installer ends.
42
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
(10) File organization after installation
The file organization after the installation is shown below (* = letters and numbers).
(nectools)\
bin\
cc78k4.exe,
cc78k4p.dll,
cc78k4p.hlp, etc.
inc78k4\
*.h
Executable form of compiler
Project Manager tools DLL
Help files for tools DLL
Header files for standard library
src\cc78k4
bat\
mkstup.bat
*.bat
Note 1
Assemble batch files for startup routines
inc\
*.inc, etc.
Include files for startup routines
src\
cstart*.asm
rom.asm
errstk.asm, etc.
Source files for startup routines
Source files for routines on ROM
Sample source programs for error processing routines
Note 2
(For modifications)
lib\
cl4*.lib
Libraries (runtime and standard libraries)
s4*.rel
Object files for startup routines
smp78k4\CC78K4\
prime.c
sample.bat
readme.doc
Source program for verifying installation
Batch file for verifying installation
lib78k4\
lib\
Note 2
(For linking)
cl4*.lib
s4*.rel
hlp\
cc78k4*.hlp
Libraries (runtime and standard libraries)
Object files for startup routines
On-line help file
Notes 1. This batch file cannot be used in the Project Manager. If the batch file will be used, run in MS-DOS, PC
DOS, or at the DOS prompt in Windows 3.1 or 95.
2. The startup routines and libraries in the lib78k4 directory are identical to those in the src\cc78k4 directory.
If a startup routine is modified, change the source in the src\cc78k4 directory. Since assembled files by
the batch file are in src\cc78k4\lib, copy lib in lib78k4 and link.
User’s Manual U11572EJ3V0UM00
43
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.3.2 Installing CC78K4 in DOS
An execution example is described which reads CC78K4 from drive A: and installs the executable form in
C:\nectools\bin.
The “dosinst.bat” batch file performs the installation.
Based on this batch file, the “\nectools” directory and
directories under it are automatically created. If you want to install in a directory other than the “\nectools” directory,
the installation destination directory is also specified.
The description format is shown below (∆: represents one or more spaces).
> dosinst.bat∆installation-source-drive∆installation-destination-drive [∆installation-destination-directory]
Execution Example
C>A:
Change the current drive to the installation source drive.
A>dosinst.bat A: C:
Run the batch file.
To exit the installation, after the message “Press any key to continue...” appears, press “CTRL key + C key” or
“ALT key + C key.”
The following message appears.
Exit the batch file (Y/N)?
If “Y” is typed, the batch file exits.
If “N” is typed, the batch file continues.
The following message appears during installation.
Please change to DISK-2.
Change to the second disk and press any key to continue the installation.
If the installation exits normally, the following message appears.
Installation completed.
Since the executable form of the C compiler is copied to c:\nectools\bin in the above example, add this directory to
the PATH environment variable. To run the C compiler, device files (sold separately) are required. The device files
(d4xxx.78k) are specified by the -y option which specifies the directory (i.e., -yc:\nectools\dev) or are copied to the
directory (i.e., c:\nectools\bin) containing the executable form of the compiler.
The information added to AUTOEXEC.BAT is saved as CC78K4.ADD in the installation directory (i.e., c:\nectools).
In this example, the following message appears.
Please add contents as below to the bottom of your AUTOEXEC.BAT.
PATH C:\NECTOOLS\bin;%PATH%
SET INC78K4=C:\NECTOOLS\INC78K4
SET LIB78K4=C:\NECTOOLS\LIB78K4\LIB
(saved as C:\NECTOOLS\CC78K4.ADD)
44
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
The file organization when installed by dosinst.bat is shown below (* = letters and numbers).
(nectools)\
bin\
cc78k4.exe, etc.
Executable form of compiler
inc78k4\
*.h
Header files for standard library
lib78k4\
bat\
Note
mkstup.bat
*.bat
Assemble batch files for startup routines
inc\
*.inc, etc.
Include files for batch files
src\
cstart*.asm
rom.asm
errstk.asm, etc.
Source files for startup routines
Source files for routines on ROM
Sample source programs for error processing routines
lib\
cl4*.lib
s4*.rel
Libraries (runtime and standard libraries)
Object files for startup routines
smp78k4\cc78k4\
prime.c
sample.bat
readme.doc
hlp\
cc78k4*.hlp
Source program for verifying installation
Batch file for verifying installation
On-line help file
Note This batch file cannot be used in the Project Manager. If the batch file will be used, run in MS-DOS, PC DOS,
or at the DOS prompt in Windows 3.1, 95, or NT.
User’s Manual U11572EJ3V0UM00
45
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.3.3 Installing CC78K4 on workstation
How to install CC78K4 on the HP9000 Series 700, SPARCstation, and NEWS (RISC) is described.
Change the current directory to the directory where CC78K4 is installed.
Use the tar command to copy the files for each directory structure. If multiple disks are provided, repeat this
operation and read the files from all of the provided disks.
Execution Example
$ cd /nectools
Change the current directory to the installation destination directory (i.e., /nectools).
$ tar -xfv /dev/rct/c0 Read the files from the installation source device (i.e., /dev/rct/c0).
Since the executable form of the C compiler is copied to /nectools/bin in the above example, add this directory to
the PATH environment variable. To run the C compiler, device files (sold separately) are required. The device files
(d4xxx.78k) are specified by the -y option which specifies the directory (i.e., -y/nectools/dev) or are copied to the
directory (i.e., /nectools/bin) containing the executable form of the compiler.
46
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
The file organization when the tar command was used for installation on a workstation is shown below (* = letters
and numbers).
(nectools) /
bin /
cc78k4, etc.
Executable form of compiler
inc78k4 /
*.h
Header files for standard library
lib78k4 /
bat /
mkstup.sh
*.sh
Assemble batch files for startup routines
inc /
*.inc, etc.
Include files for batch files
src /
cstart*.asm
rom.asm
errstk.asm, etc.
Source files for startup routines
Source files for routines on ROM
Sample source programs for error processing routines
lib /
cl4*.lib
s4*.rel
Libraries (runtime and standard libraries)
Object files for startup routines
smp78k4 / cc78k4 /
prime.c
sample.sh
readme.doc
hlp /
cc78k4*.hlp
Source program for verifying installation
Batch file for verifying installation
On-line help file
User’s Manual U11572EJ3V0UM00
47
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.4 Environment Settings
2.4.1 Host machine (for PC-9800 Series and IBM PC/AT and compatibles)
CC78K4 handles 32 bits and runs on models equipped with the i386™ CPU or later versions.
Since handling 32 bits is implemented by using DOS Extender, it is designed to run on the following operating
systems.
MS-DOS/PC DOS
Windows 3.1 and DOS prompt in Windows 3.1
Windows 95 and DOS prompt in Windows 95
At least 7 MB of protected memory are required to run.
The restrictions in the environment for each operating system are given below.
• When MS-DOS 3.30 or 5.0 is used, remove EMM386.
• When MS-DOS 6.2 is used, add the /DPMI option to EMM386. If the DOS DPMI server was included, the
operation is not guaranteed.
• If Windows 3.1 is used, include windpmi.386 as shown below. If the installer performs the installation, this is
automatically included.
Copy windpmi.386 to the system directory in Windows. Add the line in the example below to the [386Enh]
section in the system.ini file in the windows directory.
Example device=a:\windows\system\windpmi.386
48
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.4.2 Environment variables
Set the following environment variables for operation.
Table 2-2. Environment Variables
Environment Variable
Description
PATH
Specifies the directory where the executable form of the compiler is located.
TMP
Specifies the directory where temporary files are created
(only valid for PC-9800 Series and IBM PC/AT and compatibles).
LANG78K
Specifies the kanji code (2-byte code) in the source files.
sjis Shift JIS (Default for PC-9800 Series, HP9000 Series 700, NEWS (RISC))
euc EUC (Default for SPARCstation)
none No 2-byte codes (Default for IBM PC/AT and compatibles)
INC78K
Specifies the directory where the standard header files of the compiler are located.
LIB78K4
Specifies the directory where the compiler’s libraries are located.
[Specification Example]
For PC-9800 Series and IBM PC/AT and compatibles
PATH=%PATH%;A:\nectools\bin
set TMP=A:\
set LANG78K=sjis
set INC78K=A:\nectools\inc78k4
set LIB78K4=A:\nectools\lib78k4\lib
For HP9000 Series 700, SPARCstation, and NEWS (RISC)
Example using csh
set path=( $path /nectools/bin )
setenv LANG78K euc
setenv INC78K
/nectools/inc78k4
setenv LIB78K4 /nectools/lib78k4/lib
Example using sh
PATH=$PATH:/nectools/bin
LANG78K=euc
INC78K=/nectools/inc78k4
LIB78K4=/nectools/lib78k4/lib
export PATH LANG78K INC78K LIB78K4
User’s Manual U11572EJ3V0UM00
49
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.4.3 File organization
The table below lists the contents of each directory. The PC-9800 Series and IBM PC/AT and compatible files are
described. The directory structure and file organization are the ones obtained when the installer was used.
Remark Some of the file extensions differ in UNIX.
Table 2-3. File Organization (* = letters and numbers)
Directory Name
BIN\
Note 1
File Name
Description
CC78K4.EXE
Compiler
CC78K4.MSG
Message file
*.HLP
Help files
*.DLL
DLL files
Note 2
INC78K4\
*.H
Header files for standard library
SRC\CC78K4\
Note 3
BAT\
MKSTUP.BAT
Assemble batch files for startup routines
REPERRST.BAT
Batch files for updating error processing routines
REPROM.BAT
For updating OM.ASM
Note 4
*.BAT
SRC\CC78K4\SRC
CSTART*.ASM
Batch files for updating standard functions (partial)
Note 5
ROM.ASM
Note 6
*.ASM
Source files for startup routines
Source files for routines on ROM
Source files for standard functions (partial)
SRC\CC78K4\INC
*.INC
Include files for startup routines and routines on ROM
HLP
*.HLP
On-line help file
Notes 1. If dosinst.bat was used to install, place the windpmi.386 file in this directory.
2. See 10.2 Header Files in the Language (U11571E) manual.
3. The batch files in this directory cannot be used in the Project Manager. Use these batch files only when
the source must be revised.
4. Refer to the contents in Table 8-1 BAT Directory Contents.
5. * = B | E | N (B: when boot area is specified, E: when flash area is specified, N: when the standard libraries
are not used)
6. Refer to the contents in Table 8-2 SRC Directory Contents.
Remark A command file (EXE file type) is the file first read into memory when the program starts.
50
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
2.4.4 Library files
• These files consist of standard libraries, runtime libraries, and startup routines.
• The floppy disk is configured with a directory shown below.
LIB
Provides the standard libraries and startup routines required when linking the object files.
Table 2-4 lists the directory contents.
Table 2-4. Library Files
Directory Name
File Name
Normal
LIB78K4 \ LIB \
Boot Area
File Role
Flash Area
CL4S.LIB
CL4SO.LIB
CL4SR.LIB
CL4.LIB
CL4M.LIB
CL4MR.LIB
CL4O.LIB
CL4OP.LIB
CL4P.LIB
CL4PR.LIB
CL4R.LIB
CL4SF.LIB
CL4SFR.LIB
CL4F.LIB
CL4FR.LIB
CL4MF.LIB
CL4MFR.LIB
CL4S.LIB
CL4SO.LIB
CL4SR.LIB
CL4.LIB
CL4M.LIB
CL4MR.LIB
CL4O.LIB
CL4OP.LIB
CL4P.LIB
CL4PR.LIB
CL4R.LIB
CL4SF.LIB
CL4SFR.LIB
CL4F.LIB
CL4FR.LIB
CL4MF.LIB
CL4MFR.LIB
CL4SE.LIB
CL4SOE.LIB
CL4SRE.LIB
CL4E.LIB
CL4ME.LIB
CL4MRE.LIB
CL4OE.LIB
CL4OPE.LIB
CL4PE.LIB
CL4PRE.LIB
CL4RE.LIB
CL4SFE.LIB
CL4SFRE.LIB
CL4FE.LIB
CL4FRE.LIB
CL4MFE.LIB
CL4MFRE.LIB
Libraries (runtime libraries and standard
libraries)Note 1
S4.REL
S4C.REL
S4CL.REL
S4CLP.REL
S4CP.REL
S4L.REL
S4LP.REL
S4M.REL
S4MC.REL
S4MCL.REL
S4ML.REL
S4P.REL
S4S.REL
S4SL.REL
S4B.REL
S4CB.REL
S4CLB.REL
S4CLPB.REL
S4CPB.REL
S4LB.REL
S4LPB.REL
S4MB.REL
S4MCB.REL
S4MCLB.REL
S4MLB.REL
S4PB.REL
S4SB.REL
S4SLB.REL
S4E.REL
S4CE.REL
S4CLE.REL
S4CLPE.REL
S4CPE.REL
S4LE.REL
S4LPE.REL
S4ME.REL
S4MCE.REL
S4MCLE.REL
S4MLE.REL
S4PE.REL
S4SE.REL
S4SLE.REL
Object files for startup routinesNote 2
User’s Manual U11572EJ3V0UM00
51
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
Notes 1. The rule for naming libraries is given below.
lib\cl4<<1>model><<2>i/f><<3>align ><<4>float><<5>pascal>.lib
<1> <model>
Nothing
Large model (when the -ML compiler option is specified)
m
Medium model (when the -MM compiler option is specified)
s
Small model (when the -MS compiler option is specified)
<2> <i/f>
Nothing
Use the function interface that conforms to the CC78K4 V2.00 specification (when the -ZO
compiler option is not specified)
o
Use the function interface that conforms to the CC78K4 V1.00 specification (when the -ZO
compiler option is specified)
Remark This is only valid for the large and small models. Nothing for the medium model.
<3> <align>
Nothing
When the -RP or -RA compiler option is not specified
p
When the -RP or -RA compiler option is specified
Remark This is only valid for the large model. Nothing for the small and medium models.
<4> <float>
Nothing
Standard libraries, runtime libraries (when floating-point numbers are not used)
f
For the floating-point library
<5> <pascal>
Nothing
When the normal function interface is used
r
When the pascal function interface is used (when the -ZR compiler option is specified)
Notes 2. The rule for naming startup routines is given below.
lib\s4<<1>model><<2>loc><<3>lib><<4>align>.rel
<1> <model> (memory model)
Nothing
Large model (when the -ML compiler option is specified)
m
Medium model (when the -MM compiler option is specified)
s
Small model (when the -MS compiler option is specified)
<2> <loc>
Nothing
When the -CS15 compiler option is specified
c
When the -CS0 compiler option is specified
Remark This is only valid for the large and medium models. Nothing for the small model.
52
User’s Manual U11572EJ3V0UM00
CHAPTER 2 PRODUCT OVERVIEW AND INSTALLATION
<3> <lib>
Nothing
When standard library functions are not used
I
When standard library functions are used
<4> <align>
Nothing
When the -RP or -RA compiler option is not specified
p
When the -RP or -RA compiler option is specified
Remark This is only valid for the large model. Nothing for the small and medium models.
User’s Manual U11572EJ3V0UM00
53
[MEMO]
54
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
This chapter uses the CC78K4 and the RA78K4 Assembler Package to describe the procedure from compiling to
linking.
By actually performing the processes from compiling to linking of the ‘prime.c’ sample program following the
execution procedure given in this chapter, you can become familiar with the operations of compiling, assembling, and
linking (See APPENDIX A SAMPLE PROGRAMS for information about the sample program).
How to execute on the Project Manager is described for the PC-9800 Series and IBM PC/AT versions. For other
versions, how to execute from the command line is described (For information on installation, see 2.3 Installation
Procedures).
3.1 Project Manager
This section describes the user interface when CC78K4 is started in the Project Manager included in the RA78K4
Assembler Package.
If CC78K4 is started from the Project Manager, CC78K4P.DLL included in CC78K4 is
referenced.
3.1.1 Position of CC78K4P.DLL (Tools DLL)
The tools DLL file, such as the CC78K4P.DLL file, is needed to run the Windows version of the 78K/IV Series C
compiler (CC78K4) from the Project Manager in Windows 3.1, 95, or NT.
3.1.2 Execution environment
This environment conforms to the Project Manager.
User’s Manual U11572EJ3V0UM00
55
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.1.3 CC78K4 option setting menu
(1) Option menu items
The following items are added to the [Option] menu in the Project Manager by the tools DLL file included in the
CC78K4 C Compiler Package.
[Compiler Options…]
Place the mouse cursor on this part to display the following character string in the status line of the Project
Manager.
Setup Compiler Options.
56
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(2) Option setting dialog box
Select the [Compiler Options…] menu under [Option] in the Project Manager, or select the [Option] button in the
[Source List] dialog box under [Option] to call the option setting function for the tools DLL.
The Compiler Options Setup dialog box is shown below.
User’s Manual U11572EJ3V0UM00
57
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.1.4 Description of each part of option setting dialog box
This section describes each part of the option setting dialog box. The options set in the Compiler Options Setup
dialog box are stored in the source-file-name.PCC (parameter file).
Title bar
(*2)
(*1)
[OK] button
[Delete source option] button
[Cancel] button
[Help] button
• [OK] button
The settings edited in this dialog box are set, and the Compiler Options Setup dialog box closes. If a source
file is selected in this source list, the options are set for this file. If nothing is selected, the options are set for all
of the source files. If the return key is pressed when the focus is on the option input combo box (*2), this
considered to be the same as pressing the [OK] button.
• [Cancel] button
The options are not set, and the dialog box closes. The ESC key has the same effect as the [Cancel] button no
matter where the focus is in the dialog box.
• [Delete source option] button
This button is enabled only when a source file is selected. Each option set in the source file unit is deleted. All
of the options are valid for a source file where each option was deleted.
• [Help] button
The help file for this dialog box opens.
58
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
• [Compiler Options] text box
(*1) Display area for the option character string
The currently set option character string is displayed.
The option character string input in (*2) is reflected and displayed in real time.
Nothing can be input in this display area. Even though the default option of this compiler is in the specified state
(check box is checked) from the beginning, it is not displayed in this area.
(*2) Option input combo box
The option character string is input here.
The device file is specified in the project setting. This specification is not needed here.
In the tools DLL, the correctness of the option descriptions is not checked. If the option description contains
errors, errors occur during the build.
• Setting of compiler options
The compiler options are divided into the following five options and set respectively. Each setting screen is
displayed by clicking the corresponding radio button at the top of the dialog box.
Preprocess (default)
Memory Arrange
Optimize
Debug/Output
Others
User’s Manual U11572EJ3V0UM00
59
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(1) Setting screen when “Preprocess” is selected
All options specified at other option setting dialog boxes are displayed in the option character string display area
of the Preprocess Setup dialog box.
• Define Macro[-d]
The macro name and definition name specified by the -D option is input to the combo box.
For the macro name, multiple macro definitions can be performed at once by delimiting with ‘,’.
• Undefine Macro[-u]
The macro name specified by the -U option is input to the combo box.
For the macro name, multiple macro definitions can be invalidated at once by delimiting with ‘,’.
• Include Search Path[-i]
The directory that contains include files specified by the -I option is input to the combo box.
Multiple directories can be specified at once by delimiting with ‘,’.
60
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(2) Setting screen when “Memory Arrange” is selected
Options specified in the following option setting dialog boxes (i.e., Optimize, Debug/Output, and Others) are also
displayed in the option character string display area of the Memory Arrange Setup dialog box.
• Memory Model
Select a memory model option -MS/-MM/-ML (small/medium/large) to be used by checking a radio button.
• Change Location of SFR and Around Area
Select a location option -CS0/-CS15/-CSA (LOCATION0/0FH/0AH) to be used by checking a radio button, and
indicate the location of saddr area to the compiler.
• Control Data Arrangement
Assign External Variable to SADDR
Check the check box to validate the -RD option.
The type of an external variable to be assigned to the saddr area is selected by checking the radio button.
Assign Static Variable to SADDR
Check the check box to validate the -RS option.
The type of a static variable to be assigned to the saddr area is selected by checking the radio button.
Align External Variable [except for SREG] to 2-Byte boundaries [Large][-ra]
Check the check box to validate the -RA option.
Align Structure-Member to 2-Byte boundaries[-rp]
Check the check box to validate the -RP option.
Assign Bit Field from MSB[-rb]
Check the check box to validate the -RB option.
User’s Manual U11572EJ3V0UM00
61
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(3) Setting screen when “Optimize” is selected
Options specified in the following option setting dialog boxes (i.e., Debug/Output and Others) are also displayed in
the option character string display area of the Optimize Setup dialog box.
• Integrated Recommendable Optimizing Option
The Integrated Recommendable Optimizing Option integrates optimization options according to purpose,
instead of specifying them individually. Accordingly this option makes the optimization option easier to set.
There are four settings: “Exec Time[-qx1]”, “Default[-qx2]”, “Code Size[-qx3]”, and “Code Size[limited][-qx4]”.
Their meanings are as follows.
Exec Time[-qx1]
-QX1 option. Select this option when the efficiency of executing speed is important.
Default[-qx2]
-QX2 option. Select this option when both the efficiency of executing speed and
the efficiency of object code size are equally important.
Code Size[-qx3]
Code Size[limited][-qx4]
-QX3 option. Select this option when the efficiency of object code size is important.
-QX4 option. Select this option when the efficiency of object code size is important.
This option is used when the code size needs to be reduced more than the -QX3
option, but there may be some debugging limitations in code optimization. Check
the check box to validate the -QX option and select the above pattern by checking
a radio button.
62
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
• Char Expression Behavior
Assign char Without Sign Expand
Check this check box to validate the -QC option (do not execute integrate promotion).
Change Plain char to unsigned char[-qu]
Check this check box to validate the -QU option.
• Automatic allocation
Use SADDR for norec+Register Variable
Check this check box to validate the -QR option and select a variable to be assigned by checking a radio
button.
Use Register for Auto Variable
Check this check box to validate the -QV option and select a register to be assigned by checking a radio
button.
• Others
Jump Optimization[-qj]
Check this check box to validate the -QJ option.
Use SP to Access to Auto[-qf]
Check this check box to validate the -QF option.
Treat Offset as Unsigned[-qh]
Check this check box to validate the -QH option.
Optimize Object Size by Calling lib
Check this check box to validate the -QL option and specify the level of the object size priority optimization by
checking a radio button. When the number n of -QLn becomes greater, the object code size becomes
smaller, and accordingly the executing speed becomes slower. A device may have some limitations in
debugging operation if -QL4 is specified.
Aggressive Optimization[-qw]
Check this check box to validate the -QW option.
Assume No Aliasing[-qy]
Check this check box to validate the -QY option.
Use String instructions[-qn]
Check this check box to validate the -QN option.
User’s Manual U11572EJ3V0UM00
63
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(4) Setting screen when “Debug/Output” is selected
Options specified in the Others Setup dialog box is also displayed in the option character string display area of the
Debug/Output Setup dialog box.
• Output Debugging Information
Check this check box to validate the -G option and select a file that should output debug information by
checking a radio button.
• Create Assembler Source File
Check this check box to validate the -A/-SA/-LI options and select information to be added to an assembler
source module file (i.e., whether C source exists or not, whether include files exist or not) by checking a radio
button.
• Create Cross Reference List File[-x]
Check this check box to validate the -X option.
• Add Form Feed at End of List File[-lf]
Check this check box to validate the -LF option.
64
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
• List setting
The list is output in the following format specified when the output option of each list is set.
Columns per Line[-lw]:
Specifies the number of characters in one line by using the -LW option. To increase/decrease the number of
characters in the box, click
button.
Lines per Page[-ll]:
Specifies the number of lines in one page by using the -LL option. To increase/decrease the number of
characters in the box, click
button.
Expand TAB Character[-lt]:
Specifies the length of tab character by using the -LT option. To increase/decrease the number of characters
in the box, click
button.
• Create Error List File
Check this check box to validate the -E/SE options and select whether C source is added or not to the error list
by checking a radio button.
• Create Preprocess List File
Check this check box to validate the -P option and the specification for the next preprocess list file.
Delete Comment[-kc]
Check this check box to validate the -KC option.
Execute #define[-kd]
Check this check box to validate the -KD option.
Execute #if, #ifdef, #ifndef[-kf]
Check this check box to validate the -KF option.
Execute #include[-ki]
Check this check box to validate the -KI option.
Execute #line[-kl]
Check this check box to validate the -KL option.
Add Line No. and Paging[-kn]
Check this check box to validate the -KN option.
User’s Manual U11572EJ3V0UM00
65
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(5) Setting screen when “Others” is selected
• Change Source Regulation
Disable Extensions [ANSI standard only][-za]
Check this check box to validate the -ZA option.
Output Old Calling Sequence[-zo]
Check this check box to validate the -ZO option.
Regard All Function as _ _pascal Except Varargs [-zr]
Check this check box to validate the -ZR option.
Output the Object for Flash Memory[-zf]
Check this check box to validate the -ZF option.
Enable C++ Comment, Ignore from // Till End of Line[-zp]
Check this check box to validate the -ZP option.
Comment Can Nest[-zc]
Check this check box to validate the -ZC option.
Not Expand Argument and Return Value[-zb]
Check this check box to validate the -ZB option.
• Verbose Compile Messages[-v]
Check this check box to validate the -V option.
• Temporary Directory[-t] :
Input the directory in which a temporary file that is specified with the -T option has been stored in the combo
box.
66
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
• Other Options :
Input options in the combo box when a compiler option other than each option specification item needs to be
specified.
• Warning Level[-w] :
To change the level of the -W option, click
button.
User’s Manual U11572EJ3V0UM00
67
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.2 Procedure from Compiling to Linking (when Self Rewrite Mode of Flash Memory Is Not Used)
3.2.1 Compiling to linking via Project Manager
The Project Manager is used on the PC-9800 Series and the IBM PC/AT and compatibles to illustrate the MAKE
technique.
(1) Set the project.
Select “New” in the “Project” menu to set the project.
(2) Set each item in the Project Setup dialog box.
• Project File Name: Specify the file name (*.prj) to be saved as the project.
• Title:
Specify the project title.
• Project Directory:
Specify the directory where the source and output files are input in the directory created by
the user.
• Series Name:
Specify the series name of the target device to be used.
• Device Name:
Specify the name of the target device to be used.
An example of the settings is shown below. The target device is assumed to be the µPD784038.
If the “OK” button is pressed, the Source Files Setup dialog box appears.
68
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(3) Add the source files.
Press the [Add...] button in the Source Files Setup dialog box to open the Source Files dialog box.
If the sources are displayed in (1), click the sources for MAKE (all of the sources to be linked). In the state where
the target sources are displayed in File Name, press the [Add] button. Next, press the [Close] button to return
to the Source Files Setup dialog box.
Remark To create a new source, type in the source name in File Name and press the [Add] button.
User’s Manual U11572EJ3V0UM00
69
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
After confirming that all of the sources for MAKE are displayed in the Source File List, press the [OK] button
and return to the Project Manager window. A state is then entered where operations such as editing and building
(MAKE) the source are possible (the default MAKE file can be automatically created at this time).
Project Manager window
Buttons
Displays the source file list dialog box.
Starts the standard editor in the Project Manager.
Runs build (MAKE).
The Project Manager window becomes the tool box display.
70
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(4) Edit the source file.
Press the
button or the edit button for the source file list to revise the source in the standard editor. The
changes are saved by [Save] in the [File] menu.
(5) Set the compiler and linker options.
If the [Compiler Options…] in the [Option] menu are selected, the Compiler Options Setup dialog box appears.
User’s Manual U11572EJ3V0UM00
71
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
An example changing the Optimize option from Default [-QX2] to Code Size [-QX3] is shown below.
If the [Linker options] in the [Option] menu are selected, the Linker Options Setup dialog box appears.
Remark Copying the startup routines and libraries (files to be used) provided by this compiler to the project
directory is recommended. If they are not copied, the path must be specified.
The example shown here uses the s4l.rel (startup routine) and cl4.lib (library). For information about the startup
routines and libraries, see 2.4.4 Library files.
Specify the startup routine and libraries to be linked, the stack symbol automatic creation option -S, and the
output file name specification option -O, and then press the [OK] button.
Caution When linking a library created by a user or a floating-point library, be sure to specify the library
attached to the compiler at the end of the library line.
The following shows the library file specification order when linking.
1. Library file of user program (specified by -B option)
2. Library file for floating point attached to C compiler (specified by -B option)
3. Library file attached to C compiler (specified by -B option)
72
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(6) Make the created source.
Press the
button to build (MAKE).
Rebuild unconditionally remakes the target (object file).
If the target exists, build omits the compiler or linker execution. If not, they are executed.
Remark For details about the Project Manager functions, refer to “Help” in the Project Manager window.
User’s Manual U11572EJ3V0UM00
73
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.2.2 Compiling to linking in command line (for DOS and EWS)
(1) When parameter file is not used
The command below is used to start the C compiler, assembler, and linker in a command line. Assembling is not
needed when there is no assembler description in C source. In this case, link the object module file output from
a C compiler (∆: space).
>[path name]CC78K4[∆ option] ∆ C source name[∆ option]
>[path name]RA78K4[∆ option] ∆ assembler source name[∆ option]
>[path name]LK78K4 ∆ object module name[∆ option]
Caution When linking a library created by a user or a floating-point library, be sure to specify the library
attached to the compiler at the end of the library line. Also, be sure to specify the startup
routine, which is also attached to the C compiler, at the start of the user program.
The following shows the library and object module file specification orders when linking.
Library specification order
1. Library file of user program (specified by -B option)
2. Library file for floating point attached to C compiler (specified by -B option)
3. Library file attached to C compiler (specified by -B option)
Specification order of other files
1. Object file of startup routine attached to C compiler
2. Object module file of user program
The following shows an example of linking C source s1.c and assembler source s2.asm.
Example
A> cc78k4
-c4038
s1.c
A> ra78k4
-c4038
s2.asm
A> lk78k4
Remark
s4l.rel
-e
-a
-iA:\nectools\inc78k4
-e
s1.rel
s2.rel
-bcl4.lib -s -osample.lmf
When specifying multiple compiler options, delimit between compiler options by a space. It does not
matter whether a description is written in uppercase or lowercase (non case sensitive). For detailed
information, see CHAPTER 5 COMPILER OPTIONS.
74
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(2) When parameter file is used
When multiple options are input in starting a compiler, assembler, or linker, the same specification may be
repeated several times if sufficient information for startup has not been specified in the command line. In such
cases, a parameter file should be used.
Specify the parameter file specification option in the command line when using a parameter file.
Caution Parameter files cannot be specified by means of the option setting of Project Manager.
The following shows the startup method for a compiler, assembler, and linker by using a parameter file.
>[path name]CC78K4 ∆ -F parameter file name
>[path name]RA78K4 ∆ -F parameter file name
>[path name]LK78K4 ∆ -F parameter file name
The following shows a usage example.
Example
A>cc78k4
-Fpara.pcc
A>ra78k4
-Fpara.pra
A>lk78k4
-Fpara.plk
Parameter files are created by Editor. All options and output file names that should be specified in a command
line can be described.
The following shows examples of creating parameter files by Editor.
(Contents of para.pcc)
-c4038
s1.c
-as1.asm
-e
-x
(Contents of para.pra)
-c4038
s2.asm
-e
(Contents of para.plk)
s4l.rel
s1.rel
s2.rel
-bcl4.lib
-s
-osample.lmf
User’s Manual U11572EJ3V0UM00
75
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.3 Procedure from Compiling to Linking (when Self Rewrite Mode of Flash Memory Is Used)
Do not use self rewrite mode of flash memory in this version (CC78K4 V.2.20).
3.3.1 Compiling to linking via Project Manager
The Project Manager is used on the PC-9800 Series and the IBM PC/AT and compatibles to illustrate the MAKE
technique.
Be sure to compile to link in the following order.
(1) Compiling to linking program for boot area
(a) Set the project.
Select “New” in the “Project” menu to set the project.
(b) Set each item in the Project Setup dialog box.
• Project File Name:
Specify the file name (*.prj) to be saved as the project for MAKE in boot area program.
• Title:
Specify the project title.
• Project Directory:
Specify the directory where the source and output files are input in the directory
created by the user.
• Series Name:
Specify the series name of the target device to be used.
• Device Name:
Specify the name of the flash target device to be used.
An example of the settings is shown below. The target device is assumed to be the µPD78F4943.
76
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(c) Add the source files.
Press the [Add...] button in the Source Files Setup dialog box to open the Source Files dialog box.
If the sources are displayed in (1), click the sources for MAKE (for boot area). In the state where the target
sources are displayed in File Name, press the [Add] button. Next, press the [Close] button to return to the
Source Files Setup dialog box.
Remark To create a new source, type in the source name in File Name and press the [Add] button.
User’s Manual U11572EJ3V0UM00
77
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
After confirming that all of the sources for MAKE are displayed in the Source File List, press the [OK] button
and return to the Project Manager window. A state is then entered where operations such as editing and
building (MAKE) the source are possible (the default MAKE file can be automatically created at this time).
Project Manager window
Buttons
Displays the source file list dialog box.
Starts the standard editor in the Project Manager.
Runs build (MAKE).
The Project Manager window becomes the tool box display.
78
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(d) Edit the source file.
Press the
button or the edit button for the source file list to revise the source in the standard editor. The
changes are saved by [Save] in the [File] menu.
(e) Set the compiler and linker options.
If the [Compiler Options…] in the [Option] menu are selected, the Compiler Options Setup dialog box
appears.
User’s Manual U11572EJ3V0UM00
79
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
<1> Setting compiler option
Do not specify the -ZF option in the Others category.
80
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
<2> Setting linker option
The example shown here uses the s4lb.rel (startup routine) and cl4.lib (library).
Specify the startup routine and libraries to be linked, the stack symbol automatic creation option -S, and
the output file name specification option -O, and then press the [OK] button to start build.
Remark For information about the linker options, refer to RA78K4 Assembler Package User’s
Manual Operation (U11334E).
Caution
When linking a library created by a user or a floating-point library, be sure to specify
the library attached to the compiler at the end of the library line.
The following shows the library file specification order when linking.
1. Library file of user program (specified by -B option)
2. Library file for floating point attached to C compiler (specified by -B option)
3. Library file attached to C compiler (specified by -B option)
User’s Manual U11572EJ3V0UM00
81
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(2) Compiling to linking program for flash area
(a) Set the project.
Select “New” in the “Project” menu to set the project.
(b) Set each item in the Project Setup dialog box.
• Project File Name:
Specify the file name (*.prj) to be saved as the project for MAKE in flash area program.
• Title:
Specify the project title.
• Project Directory:
Specify the directory where the source and output files are input in the directory
created by the user.
• Series Name:
Specify the series name of the target device to be used.
• Device Name:
Specify the name of the flash target device to be used.
An example of the settings is shown below. The target device is assumed to be the µPD78F4943.
82
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(c) Add the source files.
Press the [Add...] button in the Source Files Setup dialog box to open the Source Files dialog box.
If the sources are displayed in (1), click the sources for MAKE (for flash area). In the state where the target
sources are displayed in File Name, press the [Add] button. Next, press the [Close] button to return to the
Source Files Setup dialog box.
Remark To create a new source, type in the source name in File Name and press the [Add] button.
User’s Manual U11572EJ3V0UM00
83
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
After confirming that all of the sources for MAKE are displayed in the Source File List, press the [OK] button
and return to the Project Manager window. A state is then entered where operations such as editing and
building (MAKE) the source are possible (the default MAKE file can be automatically created at this time).
Project Manager window
Buttons
Displays the source file list dialog box.
Starts the standard editor in the Project Manager.
Runs build (MAKE).
The Project Manager window becomes the tool box display.
84
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(d) Edit the source file.
Press the
button or the edit button for the source file list to revise the source in the standard editor. The
changes are saved by [Save] in the [File] menu.
(e) Set the compiler and linker options.
If the [Compiler Options…] in the [Option] menu are selected, the Compiler Options Setup dialog box
appears.
User’s Manual U11572EJ3V0UM00
85
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
<1> Setting compiler option
Specify the -ZF option in the Others category.
<2> Setting linker option
The example shown here uses the s4le.rel (startup routine) and cl4e.lib (library).
Specify the startup routine and libraries to be linked, the stack symbol automatic creation option -S, and
the output file name specification option -O, and then press the [OK] button.
Remark For information about the linker options, refer to RA78K4 Assembler Package User’s
Manual Operation (U11334E).
Caution
When linking a library created by a user or a floating-point library, be sure to specify
the library attached to the compiler at the end of the library line.
In the Other options input combo box, specify the load module file for boot area in
the beginning.
86
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
The following shows the library file specification order when linking.
1. Library file of user program (specified by -B option)
2. Library file for floating point attached to C compiler (specified by -B option)
3. Library file attached to C compiler (specified by -B option)
The following shows the file specification order specified in the Other options input combo box when
linking.
1. Load module file for boot area of user program
2. Startup routine object module file for flash area attached to C compiler
User’s Manual U11572EJ3V0UM00
87
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.3.2 Compiling to linking in command line (for DOS and EWS)
(1) When parameter file is not used
The command below is used to start the C compiler, assembler, and linker in a command line. Assembling is not
needed when there is no assembler description in C source. In this case, link the object module file output from
a C compiler (∆: space).
>[path name]CC78K4[∆ option] ∆ C source name[∆ option]
>[path name]RA78K4[∆ option] ∆ C source name[∆ option]
>[path name]LK78K4[∆ option] object module name, etc.[∆ option]
The following shows examples of compiling and linking the C source for boot area and the C source for flash
area.
(a) Compiling to linking program for boot area
Examples <1> Compiling program for boot area
A> cc78k4
-cF4943
boot.c
-iA:\nectools\inc78k4
<2> Linking program for boot area
A> lk78k4
s4lb.rel
boot.rel
-bcl4.lib
-s
-oboot.lmf
(b) Compiling to linking program for flash area
Examples <3> Compiling program for flash area
A> cc78k4
-cF4943
flash.c
iA:\nectools\inc78k4
<4> Linking program for flash area and program for boot area
A> lk78k4
boot.lmf
s4le.rel
flash.rel
-bcl4e.lib
-s
-oflash.lmf
Remark When specifying multiple compiler options, delimit between compiler options by a space. It does not
matter whether a description is written in uppercase or lowercase (non case sensitive). For detailed
information, see CHAPTER 5 COMPILER OPTIONS.
88
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
Caution When linking a library created by a user or a floating-point library, be sure to specify the library
attached to the compiler at the end of the library line. Specify a program for flash area and the
load module file for boot area in the beginning, and specify the startup routine for flash area
before the user program.
The following shows the library and object module file specification orders when linking.
Library specification order
1. Library file of user program (specified by -B option)
2. Library file for floating point attached to C compiler (specified by -B option)
3. Library file attached to C compiler (specified by -B option)
Specify the library for boot area when linking the program for boot area, and the library for
flash area when linking the program for flash area.
Specification order of other files
1. Load module file for boot area of user program
2. Startup routine object module file for flash area attached to C compiler
3. Object module file for flash area of user program
User’s Manual U11572EJ3V0UM00
89
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
(2) When parameter file is used
When multiple options are input in starting a compiler, assembler, or linker, the same specification may be
repeated several times if sufficient information for startup has not been specified in the command line. In such
cases, a parameter file should be used.
Specify the parameter file specification option in the command line when using a parameter file.
Caution Parameter files cannot be specified by means of the option setting of Project Manager.
The following shows the startup method for a compiler, assembler, and linker by using a parameter file.
>[path name]CC78K4 ∆ -F parameter file name
>[path name]RA78K4 ∆ -F parameter file name
>[path name]LK78K4 ∆ -F parameter file name
The following shows a usage example.
Example
A>cc78k4
-Fpara.pcc
A>lk78k4
-Fpara.plk
Parameter files are created by Editor. All options and output file names that should be specified in a command
line can be described.
The following shows examples of creating parameter files by Editor.
(Contents of para.pcc)
-cF4943
boot.c
-iA:\nectools\inc78k4
(Contents of para.plk)
-s4lb.rel
90
boot.rel
-bcl4.lib
-s
-oboot.lmf
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.4 Input/Output Files of C Compiler
CC78K4 inputs the C source module files written in the C language. These are converted into machine language
and output as object module files.
After compiling, the assembler source module files are output so that the user can check and revise the contents
at the assembly language level. Based on the compiler options, the list files such as the preprocess list, crossreference list, and error list are output.
If there is a compiler error, the error message is output to the console and the error list file. If errors occur, various
files other than an error list file cannot be output.
CC78K4 input/output files are shown below.
Table 3-1. C Compiler Input/Output Files
I/O File
Output Files
Input Files
Type
File Name
Description
Default File Type
C source module file
• Source file written in the C language
• File created by the user
C
Include file
• File referenced by a C source module file
• File written in the C language
• File created by the user
H
Parameter file
• File created by the user when you want to specify multiple
commands that cannot be specified in the command line
when the C compiler is run
PCC
Object module file
• Binary image file containing machine language
information, relocatable information related to the location
address of the machine language, and symbol information
REL
Assembler source module file
• ASCII image file of the object code output by the compiler
ASM
Preprocess list file
• List file output by the preprocess instructions such as
#include
• ASCII image file
PPL
Cross-reference list file
• List file containing the function name and variable name
information used in the C source module file
XRF
Error list file
• List file containing the source file and compiler error
messages
ECC
CER
HER
Note
ER
Temporary file
• Intermediate file for compiling
• The file is renamed to an appropriate name when
compiling ends without error and is deleted when
compiling ends in error.
$nn
(file name fixed)
Note The following four file types are available for error list files.
• CER: Error list files with C source corresponding to *.C’ files (output for the -SE option specification)
• HER: Error list files with C source corresponding to *.H’ files (output for the -SE option specification)
• ER:
Error list files with C source corresponding to files other than the above (output for the -SE option
specification)
• ECC: Error list files without C source corresponding to all of the source files (output for the -E option
specification)
User’s Manual U11572EJ3V0UM00
91
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
Figure 3-1. C Compiler Input/Output Files
C source module files
Parameter files
Include files
Preprocess list files
Temporary files
CC78K4
Assembler source
Object module files
Error list files
Cross-reference list files
module files
Remark If there are compiling errors, a variety of files other than the error list files cannot be output. A temporary
file is renamed to an appropriate name when the compiling ends without error. If compiling ends in error,
the temporary files are deleted.
92
User’s Manual U11572EJ3V0UM00
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
3.5 Execution Start and End Messages
(1) Execution start message
When CC78K4 starts, the execution start message is displayed on the console.
78K/IV Series C Compiler Vx.xx
[xx xxx xx]
Copyright (C) NEC Corporation xxxx, xxxx
(2) Execution end message
If compiler errors were not detected in the compilation result, the compiler outputs the following message to the
console and returns control to the operating system.
Target chip : uPD784xxx
Device file : Vx.xx
Compilation complete,
0 error(s) and
0 warning(s) found.
If compiler errors were detected in the compilation result, the compiler outputs the error messages and the
number of errors to the console and returns control to the operating system.
PRIME.C(18) : W745 Expected function prototype
PRIME.C(20) : W745 Expected function prototype
PRIME.C(26) : W622 No return value
PRIME.C(37) : W622 No return value
PRIME.C(44) : W622 No return value
Target chip : uPD784xxx
Device file : Vx.xx
Compilation complete,
0 error(s) and
5 warning(s) found.
If a fatal error was detected where the compiling process cannot continue during compilation, the compiler
outputs a message to the console, stops compilation, and returns control to the operating system.
User’s Manual U11572EJ3V0UM00
93
CHAPTER 3 PROCEDURE FROM COMPILING TO LINKING
An example that outputs an error is shown below.
A>cc78k4 -c4038 -e prime.c -m
78K/IV Series C Compiler Vx.xx
[xx xxx xx]
Copyright (C) NEC Corporation xxxx
A012 Missing parameter ‘-M'
Please enter ‘ cc78k4
-- ‘ , if you want help messages.
Program aborted.
:
In this example, since a nonexistent compiler option was input, an error results and the compiler stops.
If the compiler outputs error messages and stops the compilation, find the sources of these error messages in
CHAPTER 9 ERROR MESSAGES and correct.
94
User’s Manual U11572EJ3V0UM00
CHAPTER 4 CC78K4 FUNCTIONS
4.1 Optimization Method
Optimization is performed to create efficient object module files in CC78K4. Table 4-1 Optimization Methods
lists the supported optimization methods.
User’s Manual U11572EJ3V0UM00
95
CHAPTER 4 CC78K4 FUNCTIONS
Table 4-1. Optimization Methods (1/2)
Contents
Example
<1>
Execute during constant computations
compilation.
a = 3*5; → a = 15;
<2>
True or false decision based on partial
evaluation of a logical expression
0 && (a || b) → 0
1 || (a && b) → 1
<3>
Offset calculations of pointers, arrays, etc.
Calculate the offsets during compilation.
<4>
Register management
Effectively use unused registers.
<5>
Use the special instructions of the target
CPU.
a = a + 1; → Use the inc instruction.
Use the move instruction to substitute array elements.
<6>
Use short instructions.
If there is an instruction with the same operation, use the
instruction with fewer bytes.
mov a, #0 or xor a, a (differs depending on the device)
<7>
Change long jump instructions to short jump
instructions.
The intermediate code that was output is reprocessed.
<8>
Delete common partial expressions.
→ a = b + c;
a = b + c;
d = b + c + e;
d = a + e;
<9>
Move outside an instruction loop.
for (i = 0; i < 10; i++)
{
...
a = b + c;
...
}
↓
a = b + c;
for (i = 0; i < 10; i++)
{
...
...
}
Optimizer
Code Generator
Syntax Analyzer
Phase
<10> Delete unused instructions.
a = a;
After a = b;, a is not referenced
(a is an automatic variable)
→ Delete
→ Delete
Remark <1> to <7> are performed regardless of the optimization option specifications.
96
User’s Manual U11572EJ3V0UM00
CHAPTER 4 CC78K4 FUNCTIONS
Table 4-1. Optimization Methods (2/2)
Optimizer
Phase
Contents
Example
<11>
Delete copies.
a = b;
→ c=b+d;
c = a + d;
a is not referenced any more (a is an automatic variable).
<12>
Change the calculation order in an
expression.
The result of the calculation remains in the register. The valid
calculation is executed beforehand.
<13>
Memory device allocation (temporary
variables)
Variables used locally are allocated to registers.
<14>
Peephole optimization
Replacement of special patterns
Examples a*1 → a, a + 0 → a
<15>
Decrease the strength of the calculation.
Examples a*2 → a + a, a << 1
<16>
Memory device allocation (register
variables)
Data is allocated to rapidly accessible memory.
Examples Registers, saddr (only when -QR is specified)
<17>
Jump optimization (-QJ option)
Consecutive jump instructions are combined into one instruction.
<18>
Register allocation (-QV, -QR, -QS, -QD
options)
Variables are automatically allocated to registers.
Remark The optimizations in <8> to <13>, <17>, and <18> are performed when optimization options are specified.
<14> and <15> are performed regardless of the optimization option specifications.
<16> is performed when there are register declarations in the C source program. However, the saddr area
is only allocated when the -QR option is specified.
Future support is planned for the optimizations in <8> to <13>.
For information about the optimization options, see CHAPTER 5 COMPILER OPTIONS.
User’s Manual U11572EJ3V0UM00
97
CHAPTER 4 CC78K4 FUNCTIONS
4.2 Functions on ROM
Stored on ROM means the initial values, such as the initial values of external variables, are placed in the ROM.
These values are copied to RAM when the system is executed.
CC78K4 provides startup routines with the processing of programs in ROM as samples. When stored on ROM,
using the startup routines in ROM eliminates the problem of describing ROM processes for startup.
For information about the startup routines, see 8.3 Startup Routines.
How to store a program on ROM is described below.
The startup routine is described using the example of s4l.rel (which is used when ROM processing is required and
the standard libraries are used).
4.2.1 Linking
During linking, the startup routine, object module files, and libraries are linked. The startup routine initializes the
object program.
(1) s4l.rel: Startup routine (when stored on ROM)
The copy routine for the initialization data is included, and the beginning of the initial data is indicated.
The label _@cstart (symbol) is added to the start address.
(2) cl4*.lib: Library attached to CC78K4. The following libraries are included in this library file.
<1> Runtime library
@@ is added to the symbol head of the runtime library name.
For the special library cstart,
however, _@ is added to the symbol head.
<2> Standard library
_ is added to the symbol head of the standard library name.
(3) *.lib:
Caution
Library created by a user. _ is added to the symbol head.
CC78K4 provides various kinds of startup routines and libraries. For information about startup
routines, see CHAPTER 8
STARTUP ROUTINES.
For information about libraries, see 2.4.4
Library files.
98
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
When the C compiler is started, the compiler options can be specified. The compiler options provide instructions
for compiler operation and indicate the information required beforehand in program execution.
The compiler options are not specified individually, but multiple options can be simultaneously specified. The user
selects the compiler options to match the objectives and to perform the tasks efficiently.
5.1 Specifying Compiler Options
Compiler options can be specified in the following ways.
(1) Specified in the command line when the C compiler starts.
(2) Specified in the compiler option dialog box of the Project Manager.
(3) Specified in the parameter file.
For the specification methods for the compiler options described above, see CHAPTER 3 PROCEDURE FROM
COMPILING TO LINKING.
Specify the suboption or file name after a compiler option without inserting a blank, such as a space. Spaces are
required between the compiler options.
Example (∆: blanks such as spaces)
CC78K4∆-c4026∆prime.c∆-aprime.asm∆-qx3
User’s Manual U11572EJ3V0UM00
99
CHAPTER 5 COMPILER OPTIONS
5.2 Precedence of Compiler Options
For the compiler options shown in the following table, the precedence is explained when two or more options
along the vertical axis and options along the horizontal axis are simultaneously specified.
Table 5-1. Precedence of Compiler Options
-NO
-G
-P
-NP
-D
-U
-A
-X
--
-R
×
×
-Q
×
×
-G
×
×
-K
∆
×
√
×
√
-U
-SA
-SA
×
-D
×
×
×
-LW
∆
∆
∆
∆
×
-LL
∆
∆
∆
∆
×
-LT
∆
∆
∆
∆
×
-LF
∆
∆
∆
∆
×
-LI
×
↑
Vertical axis
100
-E
User’s Manual U11572EJ3V0UM00
∆
← Horizontal axis
CHAPTER 5 COMPILER OPTIONS
[Location marked by X]
If an option in the horizontal axis is specified, the option in the vertical axis is disabled.
[Location marked by ∆]
If an option in the horizontal axis is not specified, the option in the vertical axis is disabled.
[Location marked by √]
The option specified last in an option in the horizontal axis and an option in the vertical axis has precedence.
Example 1
A>cc78k4 -c4026 -e sample.c -no -r -g
The -R and -G options are disabled.
Example 2
A>cc78k4 -c4026 -e sample.c -p -k
Since the -P option is specified, the -K option is enabled.
Example 3
A>cc78k4 -c4026 -e sample.c -utest -dtest=1
Since the -D option is specified last, the -U option is disabled, and the -D option has precedence.
As with the -O and -NO options, the option specified last has precedence even if N can be added before the
option name.
Example 4
A>cc78k4 -c4026 -e sample.c -o -no
Since the -NO option is specified last, the -O option is disabled, and the -NO option has precedence.
Options not described in Table 5-1 Precedence of Compiler Options are not particularly affected by other
options. However, if the help specification option “- -” was specified, all of the option specifications are disabled. The
help specification option cannot be specified in the Project Manager. If help is referenced in the Project Manager,
press the help button in each option dialog box of the Project Manager.
User’s Manual U11572EJ3V0UM00
101
CHAPTER 5 COMPILER OPTIONS
5.3 Descriptions of Compiler Options
This section describes each compiler option in detail.
This example illustrates starting CC78K4 in the command line. If started in the Project Manager, specify the
command, device type specification, and options left out of the C source in the compiler option setup dialog box.
Example In command line
A>cc78k4
-c4026
prime.c
-rd
Example When using Project Manager
102
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(1) Device type specification (-C)
-C
Device type specification
Description format
-C device-type
Default interpretation
None
[Function]
• The -C option specifies the target device designated for compilation.
[Application]
• Be sure to specify this option. The C compiler compiles for the specified target device and generates the object
code for it.
[Description]
• Refer to the advice about use in the supplemental product materials of the device file for the target devices that
can be specified by the -C option and the corresponding device type.
• When CC78K4 is used, device files (sold separately) are required. Use the device file by copying it to the BIN
directory or to the DEV directory.
[Caution]
• The -C option cannot be omitted. However, if the following description is in the C source, the specification can
be omitted from the command line.
#pragma
pc (device type)
• If the different devices were specified in the C source and the command line, the device in the command line
has precedence.
• It is not necessary for this option to be set by the compiler option when the Project Manager is used, because
the setting of this option is determined by the project setting.
User’s Manual U11572EJ3V0UM00
103
CHAPTER 5 COMPILER OPTIONS
-C
Device type specification
[Example Use]
• The specification is made in the command line. The target device is µPD784026.
A>cc78k4
-c4026
prime.c
• This specification is made in the C source and the compiler is started.
#pragma
pc(4026)
#define TRUE
1
#define FALSE
0
#define SIZE
200
char
mark[SIZE+1];
main() {
int i,
prime,
k,
count;
:
Therefore, the target device specification can be omitted from the command line.
A>cc78k4
104
prime.c
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-C
Device type specification
• Different devices are specified in the C source and the command line and the compiler is started.
C source
#pragma
pc(4026)
#define TRUE
1
#define FALSE
0
#define SIZE
200
char
mark[SIZE+1];
main() {
int i,
prime,
k,
count;
Command line
A>cc78k4
-c4038
prime.c
After the command line is executed, the compiler is executed as follows.
78K/IV Series C Compiler Vx.xx
[xx xxx xx]
Copyright (C) NEC Corporation xxxx, xxxx
SAMPLE\PRIME.C(1)
: W832 Duplicated chip specifier
SAMPLE\PRIME.C(18) : W745 Expected function prototype
SAMPLE\PRIME.C(20) : W745 Expected function prototype
SAMPLE\PRIME.C(26) : W622 No return value
SAMPLE\PRIME.C(37) : W622 No return value
SAMPLE\PRIME.C(44) : W622 No return value
Target chip : uPD784038
Device file : Vx.xx
Compilation complete,
0 error(s) and
6 warning(s) found.
The target device specification in the command line has precedence.
User’s Manual U11572EJ3V0UM00
105
CHAPTER 5 COMPILER OPTIONS
(2) Object module file creation specification (-O/-NO)
-O/-NO
Object module file creation specification
Description formats
-O [output-file-name]
-NO
Default interpretation
-O [input-file-name.REL]
[Function]
• The -O option indicates the output of the object module file. In addition, the output destination or output file
name is specified.
• The -NO option indicates not to output the object module file.
[Application]
• If you want to change the output destination or the output file name of the object module file, specify the -O
option.
• If only the output of the assembler source module file is the target for compilation, specify the -NO option.
Consequently, the compilation time is reduced.
[Description]
• If there is a compilation error even when the -O option is specified, the object module file is not output.
• If the drive name is omitted when the -O option is specified, the object module file is output to the current drive.
• If both the -O and -NO options are simultaneously specified, the last one specified has precedence.
[Caution]
• If the output file name and output destination are changed by this option when the Project Manager is
used, build cannot be executed normally.
[Example Use]
• Both the -NO and -O options are specified (-O has precedence).
A>cc78k4
106
-c4038
prime.c
-no
-o
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(3) Memory assignment specification (-R/-NR, -RD/-NR, -RS/-NR)
-R/-NR
Memory assignment specification
Description formats
-R [process-type] (Multiple specifications are possible)
-NR
Default interpretation
-NR
[Function]
• The -R option specifies how to assign a program to the memory.
• The -NR option disables the -R option.
[Application]
• If you want to specify how to assign a program to the memory, specify the -R option.
[Description]
• The process types that can be specified by the -R option are shown below. Process type specification cannot
be omitted. Otherwise, an abort error (A012) occurs.
Process type
A
Function
Assigns a 2 bytes or more external variable (except for the variable assigned to the saddr)
as 2-byte alignment. Makes the structure as Non-packing.
-RA is valid only when compiling with large model (specify -ML option).
B
Assigns a bit field from the most significant bit (MSB).
P
Makes the structure as Non-packing.
D[n] (n = 1, 2, 4)
Assigns an external variable/external static variable (except for the const-type variable)
automatically to the saddr area, irrespective of whether there is an sreg declaration or not.
S[n] (n = 1, 2, 4)
Assigns a static auto variable automatically to the saddr area, irrespective of whether there
is an sreg declaration or not.
Remark Multiple process types can be specified.
• When the -NR option is specified, the process types are interpreted as follows.
Process type
Function
A
Does not perform 2-byte alignment. The structure is packing.
B
Assigns a bit field from the least significant bit (LSB).
P
The structure is packing.
D
Does not automatically assign any variable to the saddr area.
S
Does not automatically assign any variable to the saddr area.
[Example Use]
A>cc78k4
-c4038
-ml
-cs15
-rds
User’s Manual U11572EJ3V0UM00
107
CHAPTER 5 COMPILER OPTIONS
-RD/-NR
Memory assignment specification
Description formats
-RD [n] (n = 1, 2, 4)
-NR
Default interpretation
-NR
[Function]
• The -RD option specifies the automatic assignment of an external variable/external static variable to the saddr
area.
• The -NR option disables the -RD option.
[Application]
• If you want to automatically assign an external variable/external static variable (except for the const-type
variable) to the saddr area irrespective of whether there is an sreg declaration or not, specify the -RD option.
[Description]
• The maximum width of variables to be assigned changes depending on the value of n.
Value of n
Variable types to be assigned
1
char, unsigned char
2
char, unsigned char, short, unsigned short, int, unsigned int, enum, pointer (to data of small
model and medium model)
4
char, unsigned char, short, unsigned short, int, unsigned int, enum, pointer (to data of small
model and medium model), long, unsigned long, pointer (to function of medium model and
large model)
Omitted
All variables (including structure and union)
• The sreg-declared variable is assigned to the saddr area irrespective of -RD option specification.
• The variable that is referenced by means of an extern declaration is processed as a variable to be assigned to
the saddr area.
• The variable assigned to the saddr area by specifying this option is handled in a similar way to an sreg variable.
108
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-RS/-NR
Memory assignment specification
Description formats
-RS [n] (n = 1, 2, 4)
-NR
Default interpretation
-NR
[Function]
• The -RS option specifies the automatic assignment of a static auto variable to the saddr area.
• The -NR option disables the -RS option.
[Application]
• If you want to automatically assign a static auto variable to the saddr area irrespective of whether there is an
sreg declaration or not, specify the -RS option.
[Description]
• The maximum width of variables to be assigned changes depending on the value of n.
Value of n
Variable types to be assigned
1
char, unsigned char
2
char, unsigned char, short, unsigned short, int, unsigned int, enum, pointer (to data of small
model and medium model)
4
char, unsigned char, short, unsigned short, int, unsigned int, enum, pointer (to data of small
model and medium model), long, unsigned long, pointer (to function of medium model and
large model)
Omitted
All variables (including structure and union)
• The sreg-declared variable is assigned to the saddr area irrespective of -RS option specification.
• The variable that is referenced by means of an extern declaration is processed as a variable to be assigned to
the saddr area.
• The variable assigned to the saddr area by specifying this option is handled in a similar way to an sregdeclared static auto variable.
User’s Manual U11572EJ3V0UM00
109
CHAPTER 5 COMPILER OPTIONS
(4) Optimization specification (-Q/-NQ)
-Q/-NQ
Optimization specification
Description formats
-Q [optimization-type] (If multiple types are specified, specify them consecutively)
-NQ
Default interpretation
-QCFHJLVW
[Function]
• The -Q option indicates calling the optimization phase to generate efficient objects.
• The -NQ option disables the -Q option.
[Application]
• If you want to improve the execution speeds of the objects and reduce the code size, specify the -Q option. If
the -Q option is specified and you want to perform multiple optimizations simultaneously, specify the
optimization types consecutively. For details, see Table 5-2 Optimization Types.
[Description]
• Table 5-2 lists the optimization types that can be specified by the -Q option.
110
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-Q/-NQ
Optimization specification
Table 5-2. Optimization Types (1/2)
Optimization Type
No specification
U
C[n]
(n = 1, 2)
Process Description
Regarded as the -QCFHJLVW specification.
Make efficient code by considering char without a modifier to be unsigned char.
By executing char calculations without integral promotion, the code becomes more efficient. Integral
promotion indicates an ANSI-C rule that is set so that a calculation for a type smaller than an integer
Note
(char, short) is converted to int .
The scope differs depending on the value of n as follows. If n is omitted, it is interpreted as n = 1.
1: Only variables are not integral-promoted
2: Neither variables nor constants are integral-promoted
R[n]
(n = 1, 2)
J
X[n]
(n = 1 to 4)
Adds a register variable to a register and assigns it to the saddr area.
The scope of assigning register variable differs depending on the value of n as follows. If n is
omitted, it is interpreted as n = 2.
1: Assigns norec argument and auto variable to the saddr area
2: Assigns norec argument, auto variable, and register variable to the saddr area
Optimize jump instructions.
Assigns the optimization options automatically according to the priority of speed/code size.
The assigned option differs depending on the value of n as follows. If n is omitted, it is interpreted
as n = 2.
1: Speed precedence. Regarded as the -QCFHJVW option specification.
2: Regarded as the -Q option specification.
3: Code size precedence. Regarded as the -QCFHJL3VW option specification.
4: Code size precedence. Regarded as the -QCFHJL4VW option specification.
(there are some debugging limitations)
F
SP and not the UUP register is used as the frame pointer (register used to access function
arguments and automatic variables on the stack). By using an empty UUP register in a register
variable, the execution speed and the code efficiency improve. If the -QF option is not specified, the
UUP register is used as the frame pointer.
H
Improve the code efficiency by calculating the array and pointer offsets without signs. If this option
is used, note that the following restrictions apply.
• An object accessed by using an array element or a pointer can only be 64 Kbytes or smaller.
• Offset calculations are not possible in the negative direction.
W
Output efficient code and design for the effective use of the registers by changing the evaluation
order in an expression (i.e., changing the evaluation order of the right subexpression and the left
subexpression in an expression with two terms).
However, if this option is not included (although within the scope of the standard, since the ANSI-C
standard omits some of the operators and does not set the evaluation order), the result of the
evaluation sometimes differs. According to the ANSI-C standard, this is not a problem in properly
written source.
V[n]
(n = 1, 2)
Automatic variables are automatically allocated to registers and the saddr area.
If specified with the R suboption simultaneously, they are allocated to registers and the saddr area.
If not specified with the R suboption, they are only allocated to registers.
If the -ZO option is not specified, automatic variables are allocated to parameters. The scope of
automatic allocation differs depending on the value of n as follows. If n is omitted, it is interpreted
as n = 2.
1: Allocated only to rp3, vp, and up
2: Allocated to all registers
User’s Manual U11572EJ3V0UM00
111
CHAPTER 5 COMPILER OPTIONS
-Q/-NQ
Optimization specification
Table 5-2. Optimization Types (2/2)
Optimization Type
Process Description
N
Generate code using block move instructions.
Y
Improve the code efficiency by compilation assuming there are no data aliases.
Note that when this option is used, if there are descriptions in the same function that mix direct
addressing of an object and indirect accessing by using pointers to that object, illegal code may
result.
(Example of illegal code)
int i, j;
int *p = &i;
void main()
{
*p = 2;
i = 1;
j = *p;
/* When -QY is specified, 2 is substituted in j. If not specified,
:
1 is substituted. */
L[n]
(n = 1 to 4)
The constant code pattern is replaced with a library.
The scope of replacing library differs depending on the value of n as follows. If n is omitted, it is
interpreted as n = 1.
1: No replacement
2: Access code to array (valid only for large model)
3: In addition to 2, four arithmetical operations and 1 instruction unit
4: In addition to 3, symbol and constant of long type and unsigned long type, or register
substitution code (debugging limitations occur because the return address from the execution
routine changes)
Note When the -QC option is specified in CC78K4, the types of constants and character constants are handled in
the following way.
0 to 127, 0x00 to 0x7F, 00 to 0177
char type
128 to 255, 0x80 to 0xFF, 0200 to 0377
unsigned char type
0U to 255U
unsigned char type
‘\0’ to ‘\377’
char type
However, when the -QU option is specified, character constants in the range from ‘\200’ to ‘\377’ are handled as
unsigned char type constants and have the values from +128 to +255.
The constants added – (minus) are handled as follows.
–0 to 128
char type
From –129
int type
The result of constant or variable calculation is overflow, cast either the constant or variable to a type capable of
representing the calculation result. By casting, changing the data type can be avoided. When the -QC1 option is
specified, constant calculation is sign-extended.
112
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-Q/-NQ
Optimization specification
(Example) When -QC2 option is specified
int
i;
/* 400 */
i = (int)20 * 20;
• Multiple optimization types can be specified.
• If the -Q option is omitted, the optimization is identical to when the -QCFHJLVW option is specified.
• If a portion of the default options will be deleted, they can be deleted by specifying the options other than the
options you want to delete (Example -QF is specified → Deletes -QCHJLVW).
• If both the object module file and the assembler source module file are not output, the -Q option other than -QU
is disabled.
• If both the -Q and -NQ options are simultaneously specified, the last one specified has precedence.
• If several -Q options are simultaneously specified, the last one specified has precedence.
[Example Use]
• Optimize so that a char without modifier is regarded as unsigned.
A>cc78k4
-c4038
prime.c
-qu
• If both the -QC and -QR options are specified as below, the -QC option is disabled, and the -QR option is
enabled.
A>cc78k4
-c4038
prime.c
-qc
-qr
• If you want to enable both the -QC and -QR options, input the following command.
A>cc78k4
-c4038
prime.c
-qcr
User’s Manual U11572EJ3V0UM00
113
CHAPTER 5 COMPILER OPTIONS
(5) Debugging information output specification (-G/-NG)
-G/-NG
Debugging information output specification
Description formats
-G [n] (n = 1, 2)
-NG
Default interpretation
-G2
[Function]
• The -G option indicates that the debugging information is added to the object module file.
• The -NG option disables the -G option.
[Application]
• If the -G option is not specified, the line numbers and symbol information needed in the object module file to be
input to the debugger are not output. However, in source level debugging, all of the modules to be linked are
compiled by specifying the -G option.
[Description]
• The operation differs depending on the value of n as follows.
Value of n
Function
Omitted
Regarded as n = 2.
1
Adds debug information (information starting with $DGS or $DGL) to the object module file
only.
No debug information is added to the assembler source module file.
This
option
makes
it
easier
to
reference
an
assembler
file.
Source debugging of object module files is available since debug information is added to
them.
2
Adds debug information to the object module file and the assembler source module file.
• If both -G and -NG are simultaneously specified, the last one specified has precedence.
• If both the object module file and the assembler source module file are not output, the -G option is disabled.
[Example Use]
• The -G option is specified.
A>cc78k4
114
-c4038
prime.c
-g
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(6) Preprocess list file creation specification (-P, -K)
-P
Preprocess list file creation specification
Description formats
-P [output-file-name]
Default interpretation
None (no file is output)
[Function]
• The -P option indicates the output of the preprocess list file. In addition, the output destination or output file
name is specified. If the -P option is omitted, no preprocess list file is output.
[Application]
• If you want to output the source file after preprocess processing is executed according to the -K option process
type, or want to change the output destination or the output file name of the preprocess list file, specify the -P
option.
[Description]
• If the output file name is omitted when the -P option is specified, the preprocess list file name becomes “inputfile-name.PPL”.
• If the drive name is omitted when the -P option is specified, the preprocess list file is output to the current drive.
[Caution]
• If you want to change the output file name and output destination with this option while using Project
Manager, it can be specified with “Other Options” of “5 Others” in the Compiler Options Setup dialog
box. If you do not change output names, etc., it is recommended to specify with “Create Preprocess
List File” in “4 Debug/Output”.
[Example Use]
• The preprocess list file sample.ppl is output.
A>cc78k4
-c4038
prime.c
-psample.ppl
User’s Manual U11572EJ3V0UM00
115
CHAPTER 5 COMPILER OPTIONS
-K
Preprocess list file creation specification
Description formats
-K [process-type] (Multiple specifications are possible)
Default interpretation
-KFLN
[Function]
• The -K option indicates the processing for the preprocess list.
[Application]
• This option is specified when comments are deleted and definition expansions are referenced when the
preprocess list file is output.
[Description]
• The process types that can be specified by the -K option are listed below.
Table 5-3. Process Types of -K Option
Process Type
Description
Omitted
Same as specifying FLN
C
Delete comments
D
#define expansion
F
Conditional compilations of #if, #ifdef, and #ifndef
I
#include expansion
L
#line processing
N
Line number and paging processing
Remark Multiple process types can be specified.
• If the -P option is not specified, the -K option is disabled.
• If several -K options are simultaneously specified, the last one specified has precedence.
116
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-K
Preprocess list file creation specification
[Example Use]
• Comments are deleted from the preprocess list prime.ppl, and line number and paging processing are
performed.
A>cc78k4
-c4038
prime.c
-p
-kcn
prime.ppl is referenced.
/*
78K/IV Series C Compiler VX.XX Preprocess List
Date: XX XXX XXXX Page:
1
Command
: -c4038 -ye:\nectools\dev -k -p prime.c
In-file
: PRIME.C
PPL-file
: PRIME.PPL
Para-file :
*/
1 : #define TRUE
1
2 : #define FALSE
0
3 : #define SIZE
200
4 :
5 : char
mark[SIZE+1];
6 :
7 : main()
8 : {
:
/*
Target chip : uPD784038
Device file : VX.XX
*/
User’s Manual U11572EJ3V0UM00
117
CHAPTER 5 COMPILER OPTIONS
(7) Preprocess specification (-D, -U, -I)
-D
Preprocess specification
Description formats
-D macro-name [=definition-name] [, macro-name [=definition-name] ]...
(Multiple specifications are possible)
Default interpretation
Only the macro definitions in a C source module file are valid.
[Function]
• The -D option indicates the same macro definition as the #define statement in the C source.
[Application]
• Specify this option when you want to replace all of the macro names for the specified constants.
[Description]
• By delimiting each definition by a comma ‘,’, multiple macro definitions are made at one time.
• Spaces are not allowed before and after ‘=’ and ‘,’.
• If the definition name is omitted, the name is defined as ‘1’.
• If the same macro name was specified in both the -D and -U options, the latter has precedence.
[Example Use]
A>cc78k4
118
-c4038
prime.c
-dTEST,TIME=10
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-U
Preprocess specification
Description formats
-U macro-name [, macro-name]... (Multiple specifications are possible)
Default interpretation
A macro definition specified with -D is valid.
[Function]
• The -U option disables macro definitions similar to the #undef statement in the C source.
[Application]
• Specify this option when the macro name defined by the -D option is disabled.
[Description]
• By delimiting each macro name by a comma ‘,’, multiple macro definitions can be disabled at one time. Spaces
are not allowed before and after a comma ‘,’.
• A macro definition that can be disabled by the -U option was defined by the -D option. A macro name defined
by #define in a C source module file or a system macro name of the compiler cannot be disabled by the -U
option.
• If the same macro name is specified by both the -D and -U options, the last one specified has precedence.
[Example Use]
• The same macro name is specified by the -D and -U options. In this example, the TEST macro is disabled.
A>cc78k4
-c4038
prime.c
-dTEST
-uTEST
User’s Manual U11572EJ3V0UM00
119
CHAPTER 5 COMPILER OPTIONS
-I
Preprocess specification
Description format
-I directory [, directory]...
(Multiple specifications are possible)
Default interpretation
• Directory specified by the environment variable INC78K
• Directory of the source files
[Function]
• The -I option indicates input from the directory where the include files specified by the #include statements in
the C source were specified.
[Application]
• Specify this option when you want to search from the directory where the include files are located.
[Description]
• By using a comma ‘,’ to delimit, multiple directories can be specified at one time.
• Spaces cannot be inserted before and after a comma ‘,’.
• If multiple directories are specified after -I, or if the -I option is specified multiple times, the files specified with
#include are searched for in the specified order. Then the search is in the same order as in the default
interpretation.
[Example Use]
• The -I option is specified.
A>cc78k4
120
-c4038
prime.c
-ib:, b:\sample
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(8) Assembler source module file creation specification (-A, -SA)
-A
Assembler source module file creation specification
Description formats
-A [output-file-name]
Default interpretation
No assembler source module file is output.
Output file
*.ASM
(*: Letters and numbers)
[Function]
• The -A option indicates the output of the assembler source module file. In addition, the output destination or
output file name is specified.
[Application]
• If you want to change the output destination or the output file name of the assembler source module file, specify
the -A option.
[Description]
• A disk file name or device file name can be specified as the file name.
• If the output file name is omitted when the -A option is specified, the assembler source module file name
becomes “input-file-name.ASM”.
• If the drive name is omitted when the -A option is specified, the assembler source module file is output to the
current drive.
• If both the -A and -SA options are simultaneously specified, the -SA option is ignored.
[Caution]
• If you want to change the output file name and output destination with this option while using Project
Manager, it can be specified with “Other Options” of “5 Others” in the Compiler Options Setup dialog
box. If you do not change output names, etc., it is recommended to specify with “Create Assembler
Source File” in “4 Debug/Output”.
[Example Use]
• The assembler source module file sample.asm is created.
A>cc78k4
-c4038
prime.c
-asample.asm
• The assembler source module file is output to the printer.
A>cc78k4
-c4038
prime.c -aprn
User’s Manual U11572EJ3V0UM00
121
CHAPTER 5 COMPILER OPTIONS
-SA
Assembler source module file creation specification
Description formats
-SA [output-file-name]
Default interpretation
No assembler source module file is output.
Output file
*.ASM
(*: Letters and numbers)
[Function]
• The -SA option adds the C source as the comment to the assembler source module file. In addition, the output
destination or output file name is specified.
[Application]
• If you want to output the assembler source module file and the C source module file together, specify the -SA
option.
[Description]
• A disk file name or device file name can be specified as the file name.
• If the output file name is omitted when the -SA option is specified, the assembler source module file name
becomes “input-file-name.ASM”.
• If the drive name is omitted when the -SA option is specified, the assembler source module file is output to the
current drive.
• If both the -SA and -A options are simultaneously specified, the -SA option is ignored.
• The C source in an include file is not added to the comments in the output assembler source module.
However, if the -LI option is specified, the C source in the include file is also added to the comments.
[Caution]
• If you want to change the output file name and output destination with this option while using Project
Manager, it can be specified with “Other Options” of “5 Others” in the Compiler Options Setup dialog
box. If you do not change output names, etc., it is recommended to specify with “Create Assembler
Source File” in “4 Debug/Output”.
122
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-SA
Assembler source module file creation specification
[Example Use]
• The -SA option is specified.
A>cc78k4
-c4038
prime.c
-sa
prime.asm is referenced.
; 78K/IV Series C Compiler VX.XX Assembler Source
;
Date:xx xxx xxxx Time:xx:xx:xx
; Command
: -c4038 -ye:\nectools\dev -sa prime.c
; In-file
: PRIME.C
; Asm-file
: PRIME.ASM
; Para-file :
$CHGSFR(15)
$PROCESSOR(4038)
$DEBUG
$NODEBUGA
$KANJICODE SJIS
$TOL_INF 03FH, 0210H, 02H, 08021H
$DGS
FIL_NAM, .file,
$DGS
AUX_FIL, PRIME.C
$DGS
MOD_NAM, PRIME,
03BH,
0FFFEH,
03FH,
067H,
01H,
00H,
0FFFEH,
00H,
077H,
00H,
00H
:
EXTRN
@@isrem
PUBLIC _mark
PUBLIC _main
User’s Manual U11572EJ3V0UM00
123
CHAPTER 5 COMPILER OPTIONS
-SA
Assembler source module file creation specification
PUBLIC
_printf
PUBLIC
_putchar
:
@@CODE
CSEG
_main:
$DGL
1,19
push
uup
push
rp3
push
vvp
push
ax
??bf_main:
; line
9 :
; line
10 :
; line
$DGL
11 :
count = 0;
0,4
subw
ax,ax
movw
[sp+0],ax
; line
12 :
; line
13 :
$DGL
int i, prime, k, count;
; count
for ( i = 0 ; i <= SIZE ; i++)
0,6
subw
rp3,rp3
cmpw
rp3,#0C8H
bgt
$?L0004
?L0003:
; 200
:
END
; Target chip : uPD784038
; Device file : Vx.xx
C source is added as comments.
124
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(9) Error list file creation specification (-E, -SE)
-E
Error list file creation specification
Description formats
-E [output-file-name]
Default interpretation
No error list file is output.
Output file
*.ECC
(*: Letters and numbers)
[Function]
• The -E option indicates the output of the error list file. In addition, the output destination or output file name is
specified.
[Application]
• If you want to change the output destination or the output file name of the error list file, specify the -E option.
[Description]
• A disk file name or device file name can be specified as the file name.
• If the output file name is omitted when the -E option is specified, the error list file name becomes “input-filename.ECC”.
• If the drive name is omitted when the -E option is specified, the error list file is output to the current drive.
• If the -W0 option is specified, warning messages are not output.
[Caution]
• If you want to change the output file name and output destination with this option while using Project
Manager, it can be specified with “Other Options” of “5 Others” in the Compiler Options Setup dialog
box. If you do not change output names, etc., it is recommended to specify with “Create Error List File”
in “4 Debug/Output”.
User’s Manual U11572EJ3V0UM00
125
CHAPTER 5 COMPILER OPTIONS
-E
Error list file creation specification
[Example Use]
• The -E option is specified.
A>cc78k4
-c4038
prime.c
-e
The error list file is referenced.
PRIME.C(
18) : W745 Expected function prototype
PRIME.C(
20) : W745 Expected function prototype
PRIME.C(
26) : W622 No return value
PRIME.C(
37) : W622 No return value
PRIME.C(
44) : W622 No return value
Target chip : uPD784038
Device file : Vx.xx
Compilation complete,
126
0 error(s) and
5 warning(s) found.
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-SE
Error list file creation specification
Description formats
-SE [output-file-name]
Default interpretation
No error list file is output.
Output files
*.CER : Error list for *.C files (*: Letters and numbers)
*.HER : Error list for *.H files
*.ER
: Error list for files other than *.C and *.H files
[Function]
• The -SE option adds the C source module file to the error list file. In addition, the output destination or output
file name is specified.
[Application]
• If you want to output the error list file and the C source module file together, specify the -SE option.
[Description]
• A disk file name or device file name can be specified as the file name.
• If the output file name is omitted when the -SE option is specified, the error list file name becomes ‘input-filename.CER’.
• If the drive name is omitted when the -SE option is specified, the error list file is output to the current drive.
• The directory and the file name cannot be specified for include files. If the file type of the include file is ‘H,’ the
error list file with the file type of ‘HER’ is output to the current drive. It the file type of the include file is ‘C,’ the
error list file with the file type of ‘CER’ is output. Otherwise, the error list file with the ‘ER’ file type is output.
• If there weren’t any errors, the C source is not added. In this case, the error list file is not created for the
include file.
• If the -W0 option is specified, warning messages are not output.
[Caution]
• If you want to change the output file name and output destination with this option while using Project
Manager, it can be specified with “Other Options” of “5 Others” in the Compiler Options Setup dialog
box. If you do not change output names, etc., it is recommended to specify with “Create Error List File”
in “4 Debug/Output”.
User’s Manual U11572EJ3V0UM00
127
CHAPTER 5 COMPILER OPTIONS
-SE
Error list file creation specification
[Example Use]
• The -SE option is specified.
A>cc78k4
-c4038
prime.c
-se
prime.cer is referenced.
/*
78K/IV Series C Compiler VX.XX Error List
Command
: -c4038
prime.c
In-file
: PRIME.C
Err-file
: PRIME.CER
Date:XX XXX XXXX Time:XX:XX:XX
-se
Para-file : -c4038 -nca -s -w2
*/
#defineTRUE
1
#defineFALSE
0
#defineSIZE
200
char
mark[SIZE+1];
main()
{
:
prime = i + i + 3;
printf("%6d",prime);
*** WARNING W745 Expected function prototype
count++;
if((count%8) == 0) putchar('\n');
*** WARNING W745 Expected function prototype
for ( k = i + prime ; k <= SIZE ; k += prime)
:
128
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(10) Cross-reference list file creation specification (-X)
-X
Cross-reference list file creation specification
Description formats
-X [output-file-name]
Default interpretation
No cross-reference list file is output.
Output file
*.XRF
(*: Letters and numbers)
[Function]
• The -X option indicates the output of the cross-reference list file. In addition, the output destination or output
file name is specified. The cross-reference list file is effective for checking the referencing frequency, definition,
and referenced point of a symbol.
[Application]
• If you want to change the output destination or the output file name of the cross-reference list file, specify the -X
option.
[Description]
• A disk file name or a device file name can be specified as the file name.
• If the output file name is omitted when the -X option is specified, the cross-reference list file name becomes
‘input-file-name.XRF’.
[Caution]
• If you want to change the output file name and output destination with this option while using Project
Manager, it can be specified with “Other Options” of “5 Others” in the Compiler Options Setup dialog
box.
If you do not change output names, etc., it is recommended to specify with “Create Cross
Reference List File [-x]” in “4 Debug/Output”.
[Example Use]
• The -X option is specified.
A> cc78k4
-c4038
prime.c
-x
User’s Manual U11572EJ3V0UM00
129
CHAPTER 5 COMPILER OPTIONS
-X
Cross-reference list file creation specification
prime.xrf is referenced.
78K/IV Series C Compiler VX.XX Cross reference List
Command
: -c4038
In-file
: PRIME.C
Date:XX XXX XXXX Page: 1
prime.c -x
Xref-file : PRIME.XRF
Para-file : -c4038 -nca -s -w2
ATTRIB
MODIFY TYPE
SYMBOL
DEFINE
REFERENCE
EXTERN
array
mark
5
14
EXTERN
func
main
7
REG1
int
i
9
15
15
15
16
17
17
16
13
22
13
13
14
21
REG1
int
prime
9
17
18
21
21
REG1
int
k
9
21
21
21
22
AUTO1
int
count
9
11
19
20
25
EXTERN
func
printf
28
18
25
EXTERN
func
putchar
39
20
REG1
pointer
s
29
36
PARAM
int
l
30
35
REG1
int
j
32
35
REG1
pointer
ss
33
36
REG1
uchar
c
40
43
uchar
d
42
43
#define
TRUE
1
14
#define
FALSE
2
22
#define
SIZE
3
5
PARAM
PARAM
REG1
Target chip : uPD784038
Device file : VX.XX
130
User’s Manual U11572EJ3V0UM00
13
15
21
CHAPTER 5 COMPILER OPTIONS
(11) List format specification (-LW, -LL, -LT, -LF, -LI)
-LW
List format specification
Description format
-LW [number-of-characters]
Default interpretation
-LW132
(For console output, this becomes 80 characters)
[Function]
• The -LW option indicates the number of characters in one line of each type of list file.
[Application]
• If you want to change the number of characters in one line of each list file, specify the -LW option.
[Description]
• The range of the number of characters that can be specified by the -LW option is as follows and does not
include terminators (CR, LF).
72 ≤ number of characters printed in one line ≤ 132
• If the number of characters is omitted, the number of characters in one line becomes 132 characters (If output
to the console, there is a maximum of 80 characters).
• If the list file specification specifies nothing, the -LW option is disabled.
[Example Use]
• The cross-reference list file when the -LW option is omitted is output to “file-name.XRF”.
A> cc78k4
-c4038
prime.c
-x
User’s Manual U11572EJ3V0UM00
131
CHAPTER 5 COMPILER OPTIONS
-LL
List format specification
Description format
-LL [number-of-lines]
Default interpretation
-LL66 (For console output, this becomes 65,535 lines)
[Function]
• The -LL option indicates the number of lines on one page of each type of list file.
[Application]
• If you want to change the number of lines in one page in each type of list file, specify the -LL option.
[Description]
•The range of the number of lines that can be specified by the -LL option is as follows.
20 ≤ number of lines printed on one page ≤ 65535
• If -LL0 is specified, there is no new page.
• If the number of lines is omitted, the number of lines on one page becomes 66 lines (If output to the console,
this becomes 65,535 lines).
• If the list file specification specifies nothing, the -LL option is disabled.
[Example Use]
• The number of lines on one page of the cross-reference list file is set to 20 lines.
A> cc78k4
132
-c4038
prime.c
-x
-ll20
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-LT
List format specification
Description format
-LT [number-of-characters]
Default interpretation
-LT8
[Function]
• The -LT option indicates the basic number of characters to output an HT (Horizontal Tabulation) code in the
source module instead of several blanks (spaces) in each list (tabulation processing).
[Application]
• If few characters are specified in one line in each list by the -LW option, few blanks will result from an HT code,
so specify the -LT option to reduce the number of characters.
[Description]
• The range of the number of characters that can be specified by the -LT option is as follows.
0 ≤ number of specifiable characters ≤ 8
• If the -LT0 is specified, the tabulation processing is not performed, and the tab codes are output.
• If the number of characters is omitted, the number of expansion characters of a tab becomes 8 characters.
• If the list file specification specifies nothing, the -LT option is disabled.
[Example Use]
• The -LT option is omitted.
A> cc78k4
-c4038
prime.c
-p
• The blanks based on the HT code is set to one.
A> cc78k4
-c4038
prime.c
-p
-lt1
User’s Manual U11572EJ3V0UM00
133
CHAPTER 5 COMPILER OPTIONS
-LF
List format specification
Description format
-LF
Default interpretation
None
[Function]
• The -LF option indicates adding the new page code at the end of each list file.
[Description]
• If the list file specification specifies nothing, the -LF option is disabled.
[Example Use]
• The -LF option is specified.
A> cc78k4
134
-c4038
prime.c
-a
-lf
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-LI
List format specification
Description format
-LI
Default interpretation
None
[Function]
• The -LI option adds the C source of the include file to the assembler source module file with C source
comments.
[Description]
• If the -SA option is not specified, this option is ignored.
[Example Use]
• The -LI option is specified.
A> cc78k4
-c4038
prime.c
-sa
-li
User’s Manual U11572EJ3V0UM00
135
CHAPTER 5 COMPILER OPTIONS
(12) Warning output specification (-W)
-W
Warning output specification
Description format
-W [level]
Default interpretation
-W1
[Function]
• The -W option indicates output of warning messages to the console.
[Application]
• This option specifies whether to output the warning messages to the console. Detailed messages can also be
output.
[Description]
• The levels of the warning message are given below.
Table 5-4. Warning Message Levels
Level
Description
0
Do not output warning messages.
1
Output normal warning messages.
2
Output detailed warning messages.
• If the -E and -SE options are specified, the warning messages are output to the error list file.
• Level 0 indicates not to output warning messages to the console and the error list file (when -E or -SE is
specified).
[Example Use]
• The warning messages when the -W option is omitted are referenced.
A> cc78k4
136
-c4038
prime.c
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(13) Execution state display specification (-V)
-V
Execution state display specification
Description format
-V
Default interpretation
Nothing is output
[Function]
• The -V option outputs the execution state of the current compilation to the console.
[Application]
• Specify this option to execute while continuing to output the execution state of the compilation to the console.
[Description]
• The phase name and function names in the process are output.
[Example Use]
• The -V option is specified.
A> cc78k4
-c4038
prime.c
-v
User’s Manual U11572EJ3V0UM00
137
CHAPTER 5 COMPILER OPTIONS
(14) Parameter file specification (-F)
-F
Parameter file specification
Description format
-F file-name
Default interpretation
The options and the input file name can be input only from the command line.
[Function]
• The -F option indicates the input of the options or input file name from the specified file.
[Application]
• To input multiple options when compiling, if you cannot specify the information needed to start the compiler in
the command line, specify the -F option.
• When specifying options repeatedly before compilation, describe the options in the parameter file, and specify
the -F option.
[Description]
• Parameter file nesting is not allowed.
• The number of characters that can be described in a parameter file is not limited.
• Spaces and tabs delimit the options or input file names.
• The options or input file names described in the parameter file are expanded at the location of the parameter
file specification in the command line.
• The precedence of the expanded options is the last one specified has precedence.
• Characters described after the ‘;’ and ‘#’ until the end of the line are interpreted as a comment.
[Caution]
• This option cannot be used when using Project Manager (an error occurs).
[Example Use]
• Contents of parameter file prime.pcc
; parameter file
prime.c
-c4038
-aprime.asm
-e
-x
prime.pcc is used in the compilation.
A> cc78k4
138
-fprime.pcc
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(15) Temporary file creation directory specification (-T)
-T
Temporary file creation directory specification
Description format
Default interpretation
-T directory
The files are created in the drive and directory specified by the environment
variable TMP. If not specified in an MS-DOS and PC DOS based system, the
files are created in the current drive and current directory. If UNIX based, they
are created in /tmp.
[Function]
• The -T option specifies the drive and directory where the temporary files are created.
[Application]
• The location for creating the temporary files can be specified.
[Description]
• Even if there are temporary files that have been created previously, if a file is not protected, it is overwritten the
next time it is created.
• A temporary file expands in memory to the required memory size. If the required memory size is no longer
available, the temporary file is created in the specified directory and the memory contents are written to the file.
Accesses to subsequent temporary files are to files not in memory.
• The temporary files are deleted when compilation ends. By pressing CTRL-C, the files are deleted when
compilation stops.
[Example Use]
• This specifies output of the temporary files to the TMP directory.
A> cc78k4
-c4038
prime.c
-ttmp
User’s Manual U11572EJ3V0UM00
139
CHAPTER 5 COMPILER OPTIONS
(16) Help specification (--/-?/-H)
--
Help specification
Description formats
--, -?, -H
Default interpretation
Nothing is displayed
[Function]
• The --, -?, and -H options display brief explanations of the options and the help messages of the default options
on the console (valid only in the command line
Note
).
Note Do not specify this option in the Project Manager. To reference help in the Project Manager, press the
help button in the Compiler Options Setup dialog box.
[Application]
• The option and its description are displayed. Refer to them when running the C compiler.
[Description]
• If the --, -?, or -H option is specified, all of the other compiler options become disabled.
• When viewing the continuation of a display of a help message, press the return key. To exit the display before
the end, press any character other than the return key, and then press the return key.
[Example Use]
• The -H option is specified.
A> cc78k4
140
-H
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
(17) Memory model specification (-MS/-MM/-ML)
-MS/-MM/-ML
Memory model specification
Description formats
-MS
-MM
-ML
Default interpretation
-ML
[Function]
• The following memory models are specified for compilation.
-MS: Small model
-MM: Medium model
-ML: Large model
[Application]
• The program segment and data segment can be changed.
[Description]
• The small model is a 64-Kbyte model for the program segment and the data segment.
• The medium model has a 1-Mbyte program segment and a 64-Kbyte data segment, and is the 1-Mbyte model.
• The large model has a 1-Mbyte program segment and a 16-Mbyte data segment, and is the 16-Mbyte model.
• All of the above data segments include the stack.
[Example Use]
• The small model is specified.
A> cc78k4
-c4038
prime.c
-ms
• The medium model is specified.
A> cc78k4
-c4038
prime.c
-mm -cs15
User’s Manual U11572EJ3V0UM00
141
CHAPTER 5 COMPILER OPTIONS
(18) Location function specification (-CS)
-CS
Location function specification
Description format
-CS [n]
Default interpretation
(n: location address)
Small model:
saddr area located at FD20H to FFFFH
Medium model:
saddr area located at FFD20H to FFFFFH
Large model:
saddr area located at FFD20H to FFFFFH
[Function]
• The -CS option specifies the location function.
• The location function changes the address of the internal data segment (internal RAM segment and SFR
segment) in the 78K/IV Series.
[Application]
• When -CS0 is specified, mapping when the LOCATION 0 instruction is executed as the internal data segment is
assumed.
• When -CS15 or -CS0FH is specified, mapping when the LOCATION 0FH instruction is executed is assumed.
• When -CSA is specified, the checking linked to the mapping of the internal data segment is the responsibility of
the linker.
[Description]
• If the location address is selected from 0, 15, or A, the locations of saddr areas can be assumed as follows.
• For the small model, a specification other than -CS0 outputs a warning and is ignored.
• For the medium model, the -CSA specification outputs a warning and is ignored.
Table 5-5. Address of Location Function Specification
Specification
0
15/0FH
A
142
Description
The saddr area is placed at addresses FD20 to FFFFH.
The saddr area is placed at addresses FFD20 to FFFFFH.
Not checked in the compiler, but checked in the linker.
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-CS
Location function specification
[Example Use]
• The saddr area is assigned to addresses FD20H to FFFFH.
A> cc78k4
-c4038
prime.c
-mm
-cs0
• The saddr area is assigned to addresses FFD20H to FFFFFH.
A> cc78k4
-c4038
prime.c
-ml
-cs15
User’s Manual U11572EJ3V0UM00
143
CHAPTER 5 COMPILER OPTIONS
(19) Function expansion specification (-Z/-NZ)
-Z/-NZ
Function expansion specification
Description format
-Z [type] (If multiple types are specified, specify them consecutively)
-NZ
Default interpretation
-NZ
[Function]
• The -Z option enables the processing for type specification.
• The -NZ option disables the -Z option.
• Types must not be omitted, otherwise, an abort error (A012) will occur.
[Application]
• The functions for processing by the following type specifications are available for the 78K Series expansion
functions.
[Description]
• The type specifications of the -Z option are as follows.
Table 5-6. Type Specifications of -Z Option (1/2)
Type Specification
Omitted
Description
Same as specifying A
O
Outputs the code for the function interface conforming to the older specification (CC78K4 V1.00).
P
The characters after “//” until the line return are interpreted as a comment.
C
Nested comments “/* */” are allowed.
S
Note
Interprets the type of kanji in comments as SJIS code.
E
Note
Interprets the type of kanji in comments as EUC code.
Note
Interprets comments as not containing kanji codes.
N
Note S, E, and N cannot be specified simultaneously.
144
User’s Manual U11572EJ3V0UM00
CHAPTER 5 COMPILER OPTIONS
-Z/-NZ
Function expansion specification
Table 5-6. Type Specifications of -Z Option (2/2)
Type Specification
Description
A
Functions not in the ANSI standard are illegal. The ANSI-compliant portion of the functions are
valid.
Specifically, the following tasks are performed.
• The following are no longer reserved words.
callt, callf, noauto, norec, sreg, bit, boolean, #asm, #endasm
• The trigraph sequence (3-character representation) becomes valid.
• The compiler-defined macro _ _STDC_ _ is 1.
•The following error is output for a char type bit field.
(W787 Bit field type is char)
• If -W2 is specified, the following warnings are output for the -QC, -ZP, and -ZC options.
(W029 ‘-QC’ option is not portable)
(W031 ‘-ZP’ option is not portable)
(W032 ‘-ZC’ option is not portable)
• If -W2 is specified, the following warning is output for each #pragma statement.
(W849 #pragma statement is not portable)
• If -W2 is specified, the following warning is output for an _ _asm statement and the assemble
output is performed.
(W850 Asm statement is not portable)
• If -W2 is specified, the following error is output for an #asm to #endasm block.
(F801 Undefined control, etc.)
R
The pascal function modifier is automatically added.
F
The object for flash is output.
[Example Use]
• The -ZC and -ZP options are specified.
A> cc78k4
-c4038
prime.c
-zpc
User’s Manual U11572EJ3V0UM00
145
CHAPTER 5 COMPILER OPTIONS
(20) Device file search path (-Y)
-Y (Path)
Description format
-Y
Default interpretation
Normal search path only
[Function]
• The -Y option first searches the path specified as the search path for reading device files. If it does not exist,
the normal paths are searched.
The normal search paths are as follows.
(1) <..\dev> (for the path where CC78K4.exe started)
(2) Path where CC78K4 started
(3) Current directory
(4) PATH environment variable
[Application]
• If the device file is not installed in the normal search path, but in a special directory, the path is specified by this
option.
[Caution]
• When using the Project Manager, a directory is determined when registering a device file at “Device
Name:” in the Project Setup dialog box. Therefore, it is not necessary to specify this option when
setting an option with this compiler.
[Example Use]
• The -Y option is specified.
A> cc78k4
146
-c4038
-ya:\tmp\dev
User’s Manual U11572EJ3V0UM00
CHAPTER 6 C COMPILER OUTPUT FILES
CC78K4 outputs the following files.
• Object module files
• Assembler source module files
• Preprocess list files
• Cross-reference list files
• Error list files
6.1 Object Module Files
An object module file is a binary image file of the result of compiling a C source program.
In addition, debugging information is included based on the debugging information output specification option (-G).
6.2 Assembler Source Module Files
An assembler source module file is an ASCII image list of the result of compiling a C source program and is a
source module file in assembly language for the C source program.
It can also include the C source program as comments based on the assembler source module file creation
specification option (-SA).
User’s Manual U11572EJ3V0UM00
147
CHAPTER 6 C COMPILER OUTPUT FILES
[Output Form]
; 78K/IV Series C Compiler V(1)x.xx Assembler Source
;
Date:(2)xxxxx Time:(3)xxxxx
; Command
: (4)-c4038 prime.c -sa -ng
; In-file
: (5)PRIME.C
; Asm-file
: (6)PRIME.ASM
; Para-file
: (7)
(8)
$PROCESSOR((9)4038)
(10)$NODEBUG
(11)
(12)
(13)
(14)
:
(15)
EXTRN
@@isrem
:
; line
(16)1
:(17)#define TRUE
1
; line
(16)2
:(17)#define FALSE
0
; line
(16)3
:(17)#define SIZE
200
:
(15)_main:
(18) $DGL
1,19
(15)
push
hl
(15)
push
ax
(15)
movw
ax, sp
(15)
movw
hl, ax
(19)??bf_main:
:
; Target chip :(20)uPD784038
; Device file :(21)Vx.xx
148
User’s Manual U11572EJ3V0UM00
CHAPTER 6 C COMPILER OUTPUT FILES
[Descriptions of Output Items] (1/2)
Item Number
Contents
No. of Digits
(1)
Version number
4 (fixed)
(2)
Date
11 (fixed)
Format
Expressed in the form of ‘x.yz’
System date
Expressed in the form of ‘DD Mmm YYYY’
(3)
Time
8 (fixed)
System time
Expressed in the form of ‘HH:MM:SS’
(4)
(5)
Command line
C source module file
name
(6)
Assembler source
module file name
(7)
(8)

Output following ‘CC78K4’ on the command line
Number of characters allowed The specified file name is output. If the file type is omitted, ‘.c’
Note
by operating system
is added.
Number of characters allowed The specified file name is output. If the file type is omitted,
Note
by operating system
‘.asm’ is added.
Parameter file contents

The contents of the parameter file are output.
SFR relocation

The SFR relocation information is output.
$CHGSFR(n) n = 0, 15
information
0: The sfr area is located at FF00H to FFFFH.
15: The sfr area is located at FFF00H to FFFFFH.
$CHGSFRA
A: Checked by the linker and not the compiler.
(9)
Device type
Max. 6 (variable)
Character string specified by the -C option
Refer to the data related to the device file.
(10)
(11)
Debugging information
Control of assembler
Max. 8 (variable)
9 (fixed)
Either $DEBUG or $NODEBUG
$NODEBUGA is output.
debugging information
(12)
Kanji type information
Max. 15 (variable)
The kanji type is output. $KANJICODE SJIS, $KANJICODE
EUC, or $KANJICODE NONE is output.
(13)
Tools information
37 (fixed)
Tool information, version number, error information, and
information about the presence or absence of options are
output (information begins with $TOL_INF).
(14)
Symbol information

Symbol information is output (information begins with $DGS).
This is output only if the debugging information output
specification option was specified. However, if -gd was
specified, nothing is output.
(15)
Assembler source

The assembler source of the compilation result is output.
body
(16)
Line number
4 (fixed)
Line number (right justified decimal number) in the C source
module file
(17)
(18)
C source

Input C source image
Line number

Line number information (information begins with $DGL)
information
This is output only if the debugging information output
specification option was specified. However, if -gd was
specified, nothing is output.
Note However, the maximum number of characters in the primary name of the file name is 198.
User’s Manual U11572EJ3V0UM00
149
CHAPTER 6 C COMPILER OUTPUT FILES
[Descriptions of Output Items] (2/2)
Item Number
Contents
No. of Digits
(19)
Symbol information
creation label
Max. 34 (variable)
This is label information of the function (information
begins with ??).
This is output only if the debugging information output
specification option was specified.
(20)
Target product
name for compiling
Max. 15 (variable)
The target device name specified by the command line
option (-C) or in the source file is displayed.
(21)
Device file version
6 (fixed)
The version number of the input device file is displayed.
150
Format
User’s Manual U11572EJ3V0UM00
CHAPTER 6 C COMPILER OUTPUT FILES
6.3 Error List File
An error list file collects the warnings and error messages generated during compilation.
By specifying the compiler option, the C source program can be added to the error list. An error list file containing
the C source program can be used as the C source module file by revising the C source program and deleting
comments, such as the list header.
6.3.1 Error list file with C source
[Output Form]
/*
78K/IV Series C Compiler V(1)x.xx Error List
Command
: (4) -c4038 prime.c -se
C-file
: (5)PRIME.C
Err-file
: (6)PRIME.CER
Para-file
: (7)
Date:(2)xxxxx Time:(3)xxxxx
*/
(8)#define
TRUE
1
(8)#define
FALSE
0
(8)#define
SIZE
200
(8)char
mark[SIZE+1];
(8)main()
(8){
(8)
(8)
int
i, prime, k, count;
cont = 0;
*** ERROR (9)F711 (10)Undeclared 'cont' ; function 'main'
(8)
for ( i = 0 ; i <= SIZE ; i++)
(8)
mark[i] = TRUE;
(8)
for ( i = 0 ; i <= SIZE ; i++) {
(8)
if (mark[i]) {
prime = i + i + 3;
printf("%6d",prime);
*** WARNING(9)W745 (10)Expected function prototype
:
/*
(11)Target chip : uPD784038
(12)Device file : Vx.xx
Compilation complete,
(13)1 error(s) and
(14)5 warning(s) found.
*/
User’s Manual U11572EJ3V0UM00
151
CHAPTER 6 C COMPILER OUTPUT FILES
[Descriptions of Output Items]
Item Number
Contents
No. of Digits
(1)
Version number
4 (fixed)
(2)
Date
11 (fixed)
Format
Expressed in the form of ‘x.yz’
System date
Expressed in the form of ‘DD Mmm YYYY’
(3)
Time
8 (fixed)
System time
Expressed in the form of ‘HH:MM:SS’
(4)
(5)
Command line
C source module file
name
(6)
Error list file name

Output following ‘CC78K4’ on the command line
Number of characters allowed The specified file name is output. If the file type is omitted, ‘.c’
Note
by operating system
is added.
Number of characters allowed The specified file name is output. If the file type is omitted,
Note
by operating system
‘.cer’ is added.
(7)
Parameter file contents

The contents of the parameter file are output.
(8)
C source

Input C source image
(9)
Error message number
4 (fixed)
The error number is output in the form of ‘#nnn’.
If an error, # becomes F. If a warning, # becomes W. nnn is
the error number.
(10)
Error message

See CHAPTER 9 ERROR MESSAGES. A message longer
than 80 columns is output without a line return.
(11)
Target product name
Max. 15 (variable)
for compiling
The target device name specified by the command line option
(-C) or in the source file is displayed.
(12)
Device file version
6 (fixed)
The version number of the input device file is displayed.
(13)
Number of errors
4 (fixed)
Right justified decimal number
(14)
Number of warnings
4 (fixed)
Right justified decimal number
Note However, the maximum number of characters in the primary name of the file name is 198.
152
User’s Manual U11572EJ3V0UM00
CHAPTER 6 C COMPILER OUTPUT FILES
6.3.2 Error list file with error messages only
[Output Form]
(1)PRIME.C((2) 18) : (3)W745 (4)Expected function prototype
(1)PRIME.C((2) 20) : (3)W745 (4)Expected function prototype
(1)PRIME.C((2) 26) : (3)W622 (4)No return value
(1)PRIME.C((2) 37) : (3)W622 (4)No return value
(1)PRIME.C((2) 44) : (3)W622 (4)No return value
Target chip :(7)uPD784038
Device file :(8)Vx.xx
Compilation complete,
(5)0 error(s) and
(6)5 warning(s) found.
[Descriptions of Output Items]
Item Number
(1)
Contents
C source module file
name
No. of Digits
Format
Number of characters allowed The specified file name is output. If the file type is omitted, ‘.c’
Note
by operating system
(2)
Line number
5 (fixed)
(3)
Error message number
4 (fixed)
is added.
Right justified decimal number
The error number is output in the form of ‘#nnn’.
If an error, # becomes F. If a warning, # becomes W. nnn is
the error number.

(4)
Error message
(5)
Number of errors
4 (fixed)
Right justified decimal number
(6)
Number of warnings
4 (fixed)
Right justified decimal number
Target product name
Max. 15 (variable)
(7)
for compiling
(8)
Device file version
See CHAPTER 9 ERROR MESSAGES.
The target device name specified by the command line option
or in the source file is displayed.
6 (fixed)
The version number of the input device file is displayed.
Note However, the maximum number of characters in the primary name of the file name is 198.
User’s Manual U11572EJ3V0UM00
153
CHAPTER 6 C COMPILER OUTPUT FILES
6.4 Preprocess List File
The preprocess list file is an ASCII image file of the result of only preprocessing the C source program.
If ‘N’ is not specified as the process type when the -K option is specified, this file can be used as the C source
module file. If -KD is specified, the list with #define expansions is output.
[Output Form]
When PAGEWIDTH = 80
/*
78K/IV Series C Compiler V(1)x.xx Preprocess List
Command
: (4) -c4038
prime.c -p -lw80
In-file
: (5)PRIME.C
PPL-file
: (6)PRIME.XRF
Para-file
: (7)
*/
(8)1 : (9)#define TRUE
1
(8)2 : (9)#define FALSE
0
(8)3 : (9)#define SIZE
200
(8)4 : (9)
(8)5 : (9)char
mark[SIZE+1];
(8)6 : (9)
/*
(10)Target chip : uPD784038
(11)Device file : Vx.xx
*/
154
User’s Manual U11572EJ3V0UM00
Date:(2)xxxxx Page:(3)xxx
CHAPTER 6 C COMPILER OUTPUT FILES
[Descriptions of Output Items]
Item Number
Contents
No. of Digits
(1)
Version number
4 (fixed)
(2)
Date
11 (fixed)
Format
Expressed in the form of ‘x.yz’
System date
Expressed in the form of ‘DD Mmm YYYY’
(3)
Number of pages
(4)
Command line
(5)
C source module file
name
(6)
Preprocess list file
name
(7)
Parameter file contents
(8)
Line number
(9)
C source
(10)
Target product name
4 (fixed)

Device file version
Output following ‘CC78K4’ on the command line
Number of characters allowed The specified file name is output. If the file type is omitted, ‘.c’
Note
by operating system
is added.
Number of characters allowed The specified file name is output. If the file type is omitted,
Note
by operating system

5 (fixed)

‘.ppl’ is added.
The contents of the parameter file are output.
Right justified decimal number
Input C source
Max. 15 (variable)
The target device name specified by the command line
option or in the source file is displayed.
6 (fixed)
The version number of the input device file is displayed.
for compiling
(11)
Right justified decimal number
Note However, the maximum number of characters in the primary name of the file name is 198.
User’s Manual U11572EJ3V0UM00
155
CHAPTER 6 C COMPILER OUTPUT FILES
6.5 Cross-Reference List File
The cross-reference list file is a list of the identifiers of the declarations, definitions, referenced function names,
and variable names in a C source program. Information such as the attributes and the line numbers are also
included. These are output in the order of appearance.
[Output Form]
When PAGEWIDTH = 80
78K/IV Series C Compiler V(1)x.xx Cross reference List Date:(2)xxxxx Page:(3)xxx
Command
: (4) -c4038
In-file
: (5)PRIME.C
Xref-file
: (6)PRIME.XRF
Para-file
: (7)
Inc-file
: [n] (8)
ATTRIB MODIFY TYPE
prime.c -x -lw80
SYMBOL
DEFINE
REFERENCE
(9)EXTERN (10)
(11)array (12)mark
(13)5
(14)14
(14)16
(14)22
(9)EXTERN (10)
(11)func
(12)main
(13)7
(9)AUTO1
(11)int
(12)l
(13)9
(14)13
(14)13
(14)13
(14)14
(14)15
(14)15
(14)15
(14)16
(10)
(14)17
(14)17
(14)21
(9)AUTO1
(10)
(11)int
(12)prime
(13)9
(14)17
(14)18
(14)21
(14)21
(9)AUTO1
(10)
(11)int
(12)k
(13)9
(14)21
(14)21
(14)21
(14)22
(9)AUTO1
(10)
(11)int
(12)count
(13)9
(14)11
(14)19
(14)20
(14)25
:
/* (15)Target chip : uPD784038
(16) Device file : Vx.xx
156
*/
User’s Manual U11572EJ3V0UM00
CHAPTER 6 C COMPILER OUTPUT FILES
[Descriptions of Output Items]
Item Number
Contents
(1)
Version number
(2)
Date
No. of Digits
Format
4
Expressed in the form of ‘x.yz’
11 (fixed)
System date
Expressed in the form of ‘DD Mmm YYYY’
(3)
Number of pages
(4)
Command line
(5)
C source module file
name
(6)
4 (fixed)
Right justified decimal number

Output following ‘CC78K4’ on the command line
Number of characters allowed The specified file name is output. If the file type is omitted, ‘.c’
Note
by operating system
is added.
Cross-reference list file Number of characters allowed The specified file name is output. If the file type is omitted,
name
(7)
Parameter file contents
(8)
Include file
Note
by operating system

‘.xrf’ is added.
The contents of the parameter file are output.
Number of characters allowed The file name specified in the C source is output. n indicates
Note
by operating system
the include file number using numbers beginning from 1.
If there are no include files, this line is not output.
(9)
Symbol attribute
6 (fixed)
Indicates the symbol attribute.
An external variable is EXTERN. A static variable is EXSTC
externally and INSTC internally. An auto variable is AUTOnn.
A register variable is REGnn (nn represents the scope by a
number beginning from 1). A typedef declaration is EXTYP
externally and INTYP internally. A label is LABEL. The tag of
a structure or union is TAG. A member is MEMBER. A
parameter of a function is PARAM.
(10)
Symbol modifier
6 (fixed)
attribute
Indicates the symbol modifier attribute. Left justified. The
attributes are CONST (const variable), VLT (volatile variable),
CALLT (callt function), CALLF (callf function), NOAUTO
(noauto function), NOREC (norec function), SREG (sreg · bit
variable), RWSFR (sfr variable), ROSFR (read-only sfr
variable), WOSFR (write-only sfr variable), VECT (interrupt
function), SREG1 (sreg1 · boolean1 variable), OSVECT
(RTOS interrupt handler), and TASK (RTOS task function).
(11)
Symbol type
7 (fixed)
Indicates the symbol type.
This becomes char, int, short, long, or field. An unsigned type
has u added to the beginning of each of these types. The
other types are void, float, double, ldouble (longdouble), func,
array, pointer, struct, union, enum, bit, inter, and #define.
(12)
Symbol name
15 (fixed)
If there are more than 15 characters, the symbol name is
output unchanged, and items (13) and (14) are output in the
next line starting at column 39.
(13)
Symbol definition line
7 (fixed)
Indicates the line number where the symbol was defined.
7 (fixed)
Indicates the line number where the symbol is referenced.
number
(14)
Symbol reference line
number
(15)
Target product name
Max. 15 (variable)
for compiling
(16)
Device file version
The target device name specified by the command line option
or in the source file is displayed.
6 (fixed)
The version number of the input device file is displayed.
Note However, the maximum number of characters in the primary name of the file name is 198.
User’s Manual U11572EJ3V0UM00
157
[MEMO]
158
User’s Manual U11572EJ3V0UM00
CHAPTER 7 USING C COMPILER
7.1 Efficient Operation (EXIT Status Function)
When the compilation ends, CC78K4 returns the top error level generated during compilation to the operating
system as the EXIT status.
The EXIT status is shown below.
• Ends normally:
0
• WARNING:
0
• FATAL ERROR:
1
• ABORT:
2
If the Project Manager is not used and CC78K4 is started in the command line, efficient operation can be further
improved by using the status in a batch file.
[Example Use]
cc78k4 -c4026 %1
IF ERRORLEVEL 1 GOTO ERR
cc78k4 -c4026 %2
IF ERRORLEVEL 1 GOTO ERR
GOTO EXIT
:ERR
echo Some error found.
:EXIT
[Description]
• When the C source passed to %1 was compiled, a FATAL ERROR was generated. Essentially, the process
continues after an error message was output. But using the 1 returned in the EXIT status, execution can be
stopped without processing the next C source in %2.
User’s Manual U11572EJ3V0UM00
159
CHAPTER 7 USING C COMPILER
7.2 Setting Up Development Environment (Environment Variables)
CC78K4 supports the following environment variables.
• PATH:
Search path for executable forms
• INC78K:
Search path for include files
• TMP:
Search path for temporary files
• LANG78K:
Type of kanji code (can be specified by -ZE, -ZS, or -ZN option)
(euc: EUC code, sjis: shift JIS code, none: no 2-byte codes)
• LIB78K4:
Search path for libraries
[Example Use] (for MS-DOS)
;AUTOEXEC.BAT
PATH A:\NECTOOLS\BIN;A:\BAT;A:\CC78K4;A:\TOOL;
VERIFY ON
BREAK ON
SET INC78K=A:\NECTOOLS\INC78K4
SET LIB78K4=A:\NECTOOLS\LIB78K4\LIB
SET TMP=A:\TMP
SET LANG78K=SJIS
[Description]
• Based on the path specification, the executable form of a file is searched for successively in
A:\NECTOOLS\BIN, A:\BAT, A:\CC78K4, and A:\TOOL.
• Include files are searched for in A:\NECTOOLS\INC78K4.
• Library files are searched for in A:\NECTOOLS\LIB78K4\LIB when linking.
• Temporary files are created in A:\TMP.
• The kanji code is set to the shift JIS code.
7.3 Interrupting Compilation
If compiling was started from the command line, the compilation can be interrupted by the command key input
(CTRL-C). If ‘break on’ was specified, control returns to the operating system unrelated to the timing of the key input.
And for ‘break off,’ control returns to the operating system only when the screen is displayed. Then all of the open
temporary files and output files are deleted.
If you want to stop a build (MAKE) in the Project Manager, select “Stop build” in the “Run” menu in the Project
Manager window. When building in the Project Manager, command key input is not accepted.
160
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
When a C language program is executed, a program is required to activate ROM processing for inclusion in the
system and the user program (main function). This program is called the startup routine.
To execute a program written by a user, a startup routine must be created for that program. CC78K4 provides the
object files of the startup routines which include the processing required before program execution and the source
files (assembly source) of the startup routines that the user can adapt to the system. By linking the object file of the
startup routine to the user program, an executable program can be created even if the user does not describe the
execution preprocess.
This chapter describes the contents, uses, and improvements of the startup routines.
8.1 File Organization
The files related to a startup routine are stored in the SRC\CC78K4 directory of the compiler package.
If installed by dosinst.bat and in UNIX version, the contents of the SRC\CC78K4 directory are installed in the
LIB78K4 directory.
User’s Manual U11572EJ3V0UM00
161
CHAPTER 8 STARTUP ROUTINES
\
BIN
INC78K4
LIB78K4
SMP78K4
SRC\CC78K4
→ Directories that contain files
BAT
related to startup routines
SRC
INC
LIB
The contents of the directories under SRC\CC78K4 are shown next. When installed in the UNIX version and
dosinst.bat, the contents of SRC\CC78K4 directory are installed in LIB78K4.
The LIB directory contains the object files of the startup routines and the assembled library sources. An object
file can be linked to a program for any target device in the 78K/IV Series. If no particular revisions are needed, link
the unmodified object files which are already available. If mkstup.bat (mkstup.sh) offered by CC78K4 is executed,
this object file can be overwritten.
For the file contents, see 2.4.4 Library files.
162
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
8.1.1 BAT directory contents
A batch file in this directory cannot be used in the Project Manager.
Use these batch files only when the source, such as for a startup routine, must be modified.
Table 8-1. BAT Directory Contents
Batch File Name
Description
MKSTUP.BAT
Assemble batch file for startup routine
REPERRST.BAT
Batch file for updating error processing routine when the stack overflows
REPROM.BAT
Batch file for updating ROM.ASM
REPGETC.BAT
Batch file for updating GETCHAR.ASM
REPPUTC.BAT
Batch file for updating PUTCHAR.ASM
REPPUTCS.BAT
Batch file for updating _PUTCHAR.ASM
REPSELO.BAT
Batch file for updating SETJMP.ASM and LONGJMP.ASM
Note 2
(the compiler reserved area is saved)
REPSELON.BAT
Batch file for updating SETJMP.ASM and LONGJMP.ASM
Note 2
(the compiler reserved area is not saved)
Note 1
Notes 1. Since ROM routines are in the library, the library is also updated by this batch file.
2. setjmp and longjmp which save the compiler reserved area (saddr area secured for KREGXX, etc.), and
setjmp and longjmp which do not save the compiler reserved area (only the registers are saved) are
created.
User’s Manual U11572EJ3V0UM00
163
CHAPTER 8 STARTUP ROUTINES
8.1.2 SRC directory contents
The SRC directory contains the assembler sources of the startup routines, ROM routines, error processing
routines, and standard library functions (a portion). If the source must be modified to conform to the system, the
object files for linking can be created by modifying this assembler source and using a batch file in the BAT directory
to assemble.
Table 8-2. SRC Directory Contents
Startup Routine Source File Name
CSTART.ASM
Note
CSTARTN.ASM
Note
Description
Source file for startup routine (when standard library is used)
Source file for startup routine (when standard library is not used)
ROM.ASM
Source file for routines on ROM
ERRSTK.ASM
Sample source program for error processing routine
_PUTCHAR.ASM
_putchar function
PUTCHAR.ASM
putchar function
GETCHAR.ASM
getchar function
LONGJMP.ASM
longjmp function
SETJMP.ASM
setjmp function
VECTXX.ASM
Vector source for each interrupt (XX: vector address)
Note A file name with N added is a startup routine that does not have standard library processing. Use only if the
standard library will not be used. CSTARTB*.ASM is a startup routine for boot area and CSTARTE*.ASM is a
startup routine for flash area.
Table 8-3. INC Directory Contents
Include File Name
*.INC, etc.
164
Description
Include files for startup routines and ROM routines
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
8.2 Batch File Description
8.2.1 Batch files for creating startup routines
The MKSTUP.BAT (mkstup.sh in UNIX) in the BAT directory is used to create the object file of a startup routine.
The assembler in the RA78K4 Assembler Package is required in MKSTUP.BAT (mkstup.sh). Therefore, if PATH
is not specified, specify it and run.
How to use this file is described next.
[How To Use]
Execute the following command line in the BAT directory containing MKSTUP.BAT (mkstup.sh).
mkstup
device-type
Note
Note Refer to the document related to device files.
[Example Use]
The startup routine to be used is created when the target product is µPD784038Y.
mkstup
4038Y
User’s Manual U11572EJ3V0UM00
165
CHAPTER 8 STARTUP ROUTINES
The MKSTUP.BAT (mkstup.sh) batch file is stored in the form that overwrites the object file of the startup routine
in the LIB directory with the same structure as the BAT directory as shown below.
The startup routine that is required to link the object file is output to each directory.
The names of the object files created in LIB are shown below.
LIB
s4.rel
s4b.rel
s4c.rel
s4cb.rel
s4ce.rel
s4cl.rel
s4clb.rel
s4cle.rel
s4clp.rel
s4clpb.rel
s4clpe.rel
s4cp.rel
s4cpb.rel
s4cpe.rel
s4e.rel
s4l.rel
s4lb.rel
s4le.rel
s4lp.rel
s4lpb.rel
s4lpe.rel
s4m.rel
s4mb.rel
s4mc.rel
s4mcb.rel
s4mce.rel
s4mcl.rel
s4mclb.rel
s4mcle.rel
s4me.rel
s4ml.rel
s4mlb.rel
s4mle.rel
s4p.rel
s4pb.rel
s4pe.rel
s4s.rel
s4sb.rel
s4se.rel
s4sl.rel
s4slb.rel
s4sle.rel
166
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
8.3 Startup Routines
8.3.1 Overview of startup routines
A startup routine makes the preparations needed to execute the C source program written by the user. By linking
to a user program, a load module file that achieves the objective can be created.
(1) Function
Memory initialization, ROM processing for inclusion in the system, and the starting and ending processes for the
C source program are performed.
ROM processing: The initial values of the external variables, static variables, and sreg variables defined in the
C source program are located in ROM. However, the variable values cannot be rewritten
when placed in ROM. Therefore, the initial values located in ROM must be copied to RAM.
This process is called a ROM processing. When a program is written to ROM, it can be run
by a microcontroller.
User’s Manual U11572EJ3V0UM00
167
CHAPTER 8 STARTUP ROUTINES
(2) Configuration
Table 8-4 lists the programs related to the startup routines and their configurations.
Table 8-4. Startup Routine Overview
For system inclusion
Preprocess
Note 1
Initial settings
(hdwinit function
Note 2
call)
ROM processing
Start main function
Postprocess
Definitions of labels used in
ROM processing
Notes 1. If the standard library is used, the processing related to the library is performed first. Files that do not
have an ‘n’ appended at the end of the name in the startup routine source file are processed in relation
to the standard library. Files with the appended ‘n’ are not processed.
2. The hdwinit function is a function created when needed by the user as the function to initialize a
peripheral device (sfr).
By creating the hdwinit function, the timing of the initial settings can be
speeded up (The initial settings can be made in the main function). If the user does not create the
hdwinit function, the process returns without doing anything.
CSTART.ASM and CSTARTN.ASM have nearly identical contents.
Table 8-5 shows the differences in the above files.
168
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
Table 8-5. Differences Between Startup Routine Sources
Type of Startup Routine
Uses Library Processing
CSTART.ASM
Yes
CSTARTN.ASM
No
(3) Uses of startup routines
Table 8-6 lists the names of the object files for the source files offered by CC78K4.
Table 8-6. Correspondence Between Source Files and Object Files
File Type
Source File
Startup routine
CSTART*.ASM
ROM file
ROM.ASM
Note 1
Object File
Note 2
S4*.REL
Included in library
Notes 1. *: If the standard library is not used, ‘N’ is added. If used, the character is not added.
‘B’ is startup routine for boot area and ‘E’ is startup routine for flash area.
2. *: If a fixed area in the standard library is used, ‘L’ is added.
ROM.ASM defines the label indicating the final address of the data copied by ROM processing.
The object of the ROM.ASM is included in the library.
User’s Manual U11572EJ3V0UM00
169
CHAPTER 8 STARTUP ROUTINES
8.3.2 Description of sample program (cstart.asm)
This section uses cstart.asm and rom.asm as examples to describe the contents of the startup routines. A startup
routine consists of the preprocessing, initial settings, ROM processing, starting the main function, and
postprocessing.
Remark
cstart and cstarte are called in the format added _@ to its head.
(1) Preprocessing
Preprocessing in cstart.asm are described in <1> to <6> (see below).
[cstart.asm preprocessing]
NAME
@cstart
<1> Including include files
$INCLUDE (mod.inc)
<2> Library switch
; attention):
change to EQU value 1 -> 0
if necessary
;
BRKSW
EQU
1
;brk,sbrk,calloc,free,malloc,realooc function use
EXITSW
EQU
1
;exit,atexit function use
RANDSW
EQU
1
;rand,srand
function use
DIVSW
EQU
1
;div
function use
LDIVSW
EQU
1
;ldiv
function use
1
;strtok
function use
STRTOKSW EQU
PUBLIC
<3> Symbol definitions
_@cstart,_@cend
$_IF(BRKSW)
PUBLIC
_errno,_@BRKADR,_@MEMTOP,_@MEMBTM
$ENDIF
$_IF(EXITSW)
PUBLIC
_@FNCTBL,_@FNCENT
$ENDIF
:
<4> External reference declaration of symbol for stack resolution
EXTRN
_main,_@STBEG,_hdwinit
$_IF(EXITSW)
EXTRN
_exit
$ENDIF
$_IF(MEDIUM)
170
<5> External reference declaration of label for ROM processing
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
$_IF(LOC_0)
EXTRN
_?R_INIT,_?R_INIS,_?DATA,_?DATS
EXTRN
_?R_INS1,_?DATS1
$ELSE
:
$_IF(SMALL)
@@DATA
<6> Securing area for standard library
DSEG
:
$_IF(EXITSW)
$_IF(SMALL)
_@FNCTBL:
DS
2*32
DS
3*32
DS
2
$ELSE
_@FNCTBL:
$ENDIF
_@FNCENT:
$ENDIF
:
<1> Including include files
MOD.INC → Memory model (-MS, -MM, -ML), location (-CS0, -CS15), alignment information (-RA, -RP)
<2> Library switch
If standard libraries in comments are not used, by changing the EQU definition to 0, the space secured for the
processing of unused libraries and for use by the library can be conserved. The default is set to use everything
(In a startup routine without library processing, this processing is not performed).
<3> Symbol definitions
The start and end labels of the startup routine and the symbols used when using the standard library are
defined.
<4> External reference declaration of symbol for stack resolution
• The public symbol (_@STBEG) for stack resolution is an external reference declaration. _@STBEG has the
value of the last address in the stack area + 1.
• _@STBEG is automatically generated by specifying the symbol generation option (-S) for stack resolution in
the linker. Therefore, always specify the -S option when linking. In this case, specify the name of the area
used in the stack. If the name of the area is omitted, the RAM area is used, but the stack area can be located
anywhere by creating a link directive file. When memory mapping, refer to the user’s manual of the target
device.
• An example of a link directive file is shown below. The link directive file is a text file created by the user in an
ordinary editor (For details about the description method, refer to RA78K4 Assembler Package User’s
Manual Operation (U11334E)).
User’s Manual U11572EJ3V0UM00
171
CHAPTER 8 STARTUP ROUTINES
[Example of link directive file (LK78K4.DR)]
(a)
(b)
memory STACK : ( xxxxh, xxxh )
(a): First address (b): Size of the area being specified
The linking procedure is as follows.
1. Create the link directive file.
2. Specify the file name with the -d linker option and the area name specified for the stack in the link directive
by the -s linker option.
(Example LK78K4 s4l.rel xxxx.rel ... -bcl4.lib -sSTACK -dLK78K4.DR)
<5> External reference declaration of label for ROM processing
The label for ROM processing is defined in the postprocessing section.
<6> Securing area for standard library
The area used when using the standard library is secured.
172
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
(2) Initial settings
The initial settings in cstart.asm are described in <7> to <13>.
[Initial settings in cstart.asm]
@@VECT00 CSEG
DW
@@BASE
CSEG
AT
0000H
<7> Reset vector setting
_@cstart
BASE
_@cstart:
$_IF(LOC_0)
LOCATION
0H
LOCATION
0FH
<8> Location setting
$ELSE
$ENDIF
MOVG
SP,#_@STBEG
<9> SP (stack pointer) setting
$_IF(LOC_0)
$_IF(SMALL OR MEDIUM)
SEL
RB7
MOV
A,#00H
MOV
V,A
MOV
U,A
MOV
T,A
<10> Initialization of general-purpose registers
$_IF(SMALL)
MOV
W,A
SEL
RB6
MOV
A,#00H
MOV
V,A
MOV
U,A
MOV
T,A
$ENDIF
$_IF(SMALL)
MOV
W,A
$ENDIF
:
$ELSE
$_IF(LARGE)
SEL
RB0
<11> Register bank setting
User’s Manual U11572EJ3V0UM00
173
CHAPTER 8 STARTUP ROUTINES
$ENDIF
$_IF(MEDIUM)
SEL
RB7
MOV
A,#0FH
MOV
V,A
MOV
U,A
MOV
T,A
SEL
RB6
MOV
A,#0FH
MOV
V,A
MOV
U,A
MOV
T,A
SEL
RB5
:
SEL
RB0
MOV
A,#0FH
MOV
V,A
MOV
U,A
MOV
T,A
<11> Register bank setting
$ENDIF
$ENDIF
$_IF(SMALL)
CALL
!_hdwinit
<12> Hardware initialization function call
CALL
!!_hdwinit
<12> Hardware initialization function call
$ELSE
$ENDIF
<13> Initial value settings for standard library
$_IF(BRKSW OR EXITSW OR RANDSW)
SUBW
AX,AX
$ENDIF
$_IF(SMALL)
$_IF(BRKSW)
MOVW
!_errno,AX
;errno <- 0
!_@FNCENT,AX
;FNCENT <- 0
$ENDIF
$_IF(EXITSW)
MOVW
$ENDIF
$_IF(RANDSW)
174
MOVW
!_@SEED+2,AX
MOVW
!_@SEED,#1
;SEED <- 1
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
$ENDIF
=
<7> Reset vector setting
The segment of the reset vector table is defined as follows. The first address of the startup routine is set.
@@VECT00
CSEG
AT
DW
_@cstart
0000H
<8> Location setting
Location 0H or 0FH is set to match the setting of the -CS compiling option.
<9> SP (stack pointer) setting
_@STBEG is set in the stack pointer.
_@STBEG is automatically generated by specifying the symbol generation option (-S) for stack resolution in the
linker.
<10> Initialization of general-purpose registers
The general-purpose registers of register banks 0 to 7 are initialized as follows.
The V, U, T, and W registers when the small model is specified, and the V, U, and T registers when the medium
model is specified must be initialized only once after being reset. These registers save the initial values during
program execution (If these registers are rewritten by the user during execution, the operation is not
guaranteed).
The W register when the medium model is specified, and all of the above registers when the large model is
specified do not have to be initialized since they are always changed during program execution.
Small model (-MS):
Set 0 in V, U, T, and W.
Medium model (-MM) and location 0H (-CS0):
Set 0 in V, U, and T.
Medium model (-MM) and location 0FH (-CS15): Set 0FH in V, U, and T.
<11> Register bank setting
Register bank RB0 is set as the work register.
<12> Hardware initialization function call
The hdwinit function is created when needed by the user as the function for initializing a peripheral device
(SFR). By creating this function, initial settings can be made to match the user’s objectives.
If the user does not create the hdwinit function, the process returns without doing anything.
<13> Initial value settings for standard library
The initialization required for using the standard library is performed.
User’s Manual U11572EJ3V0UM00
175
CHAPTER 8 STARTUP ROUTINES
(3) ROM processing
The ROM processing in cstart.asm is described.
[ROM processing]
<14> ROM processing
;ROM DATA COPY
$_IF(SMALL)
MOVW
DE,#_@INIT
MOVW
HL,#_@R_INIT
$ENDIF
$_IF(MEDIUM)
MOVW
DE,#_@INIT
MOVG
WHL,#_@R_INIT
$ENDIF
$_IF(LARGE)
MOVG
TDE,#_@INIT
MOVG
WHL,#_@R_INIT
$ENDIF
LINIT1:
$_IF(SMALL)
CMPW
HL,#_?R_INIT
SUBG
WHL,#_?R_INIT
BE
$LINIT2
$ELSE
$ENDIF
$_IF(MEDIUM OR LARGE)
ADDG
WHL,#_?R_INIT
$ENDIF
:
$_IF(LARGE)
ADDG
WHL,TDE
MOV
[DE+],A
BR
$LDATS11
$ENDIF
LDATS12:
;
176
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
In ROM processing, the initial values of the external variables and the sreg and sreg1 variables stored in ROM
are copied to RAM. The variables to be processed have the six types (a) to (f) shown in the following example.
(Example)
char
(a) External variable with initial value
c = 1;
int
Note
(b) External variable without initial value
i;
_ _sreg
int
si = 0;
(c) sreg variable with initial value
_ _sreg
char
sc;
(d) sreg variable without initial value
_ _sreg1 int
si1 = 0;
(e) sreg1 variable with initial value
_ _sreg1 char
sc1;
(f) sreg1 variable without initial value
Note
Note
void main (void)
{
:
}
Note The external variables and sreg and sreg1 variables without initial value are not copied, and zeros are
written directly to RAM.
• Figure 8-1 shows the ROM processing for (a) External variable with initial value.
The initial value of the variable in (a) is placed in @@R_INIT segment in the ROM by the compiler. The ROM
processing copies this value to the @@INIT segment in RAM (The same processes are performed for the
variables in (c) and (e)).
• The first and last labels in the @@R_INIT segment are defined by _@R_INIT and _?R_INIT. The first and last
labels in the @@INIT segment are defined by _@INIT and _?INIT.
• The variables in (b), (d), and (f) are not copied, but zeros are directly placed in the segment determined by the
RAM (See Table 8-8 RAM Area for Initial Values (Copy Destination)). Tables 8-7 and 8-8 show the
segment names of the ROM and RAM areas where the variables in (a) to (f) are placed, and the first and last
labels of the initial values in each segment.
User’s Manual U11572EJ3V0UM00
177
CHAPTER 8 STARTUP ROUTINES
Figure 8-1. ROM Processing
@@R_INIT (segment name)
@@INIT
_@R_INIT:
_@INIT:
(first label)
→
Area storing initial
Copy
value of variable
in (a)
_?R_INIT:
_?INIT:
(last label)
Table 8-7. ROM Area for Initial Values
Variable Type
Segment
First Label
Last Label
External variable with initial value in (a)
@@R_INIT
_@R_INIT
_?R_INIT
sreg variable with initial value in (c)
@@R_INIS
_@R_INIS
_?R_INIS
sreg1 variable with initial value in (e)
@@R_INS1
_@R_INS1
_?R_INS1
Table 8-8. RAM Area for Initial Values (Copy Destination)
Variable Type
178
Segment
First Label
Last Label
External variable with initial value in (a)
@@INIT
_@INIT
_?INIT
External variable without initial value in (b)
@@DATA
_@DATA
_?DATA
sreg variable with initial value in (c)
@@INIS
_@INIS
_?INIS
sreg variable without initial value in (d)
@@DATS
_@DATS
_?DATS
sreg1 variable with initial value in (e)
@@INIS1
_@INIS1
_?INIS1
sreg1 variable without initial value in (f)
@@DATS1
_@DATS1
_?DATS1
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
(4) Starting main function and postprocessing
Starting the main function and postprocessing in cstart.asm are described in <15> to <17>.
[Starting main function and postprocessing]
$_IF(SMALL)
CALL
!_main
;main();
<15> main function call
CALL
!!_main
;main();
<15> main function call
$ELSE
$ENDIF
$_IF(EXITSW)
SUBW
AX,AX
$_IF(SMALL)
CALL
!_exit
;exit(0);
<16> exit function call
CALL
!!_exit
;exit(0);
<16> exit function call
BR
$$
$ELSE
$ENDIF
$ENDIF
;
_@cend:
;
$_IF(SMALL)
@@RSINIT CSEG
BASE
<17> Definitions of segments and
labels used in ROM processing
$ENDIF
$_IF(MEDIUM)
@@R_INIT CSEG
$ENDIF
$_IF(LARGE)
$_IF(TWO_ALN)
@@R_INIT CSEG
UNITP
$ELSE
@@R_INIT CSEG
$ENDIF
$ENDIF
_@R_INIT:
$_IF(SMALL)
@@RSINIS CSEG
BASE
$ELSE
User’s Manual U11572EJ3V0UM00
179
CHAPTER 8 STARTUP ROUTINES
@@R_INIS CSEG
$ENDIF
_@R_INIS:
:
$_IF(LARGE)
@@CODE
CSEG
@@CALF
CSEG
FIXED
$_IF(TWO_ALN)
@@CNST
CSEG
UNITP
$ELSE
@@CNST
CSEG
$ENDIF
$ENDIF
@@CALT
CSEG
CALLT0
@@BITS
BSEG
SADDR2
@@BITS1
BSEG
SADDR
;
END
<15> main function call
The main function is called.
<16> exit function call
The exit function is called.
<17> Definitions of segments and labels used in ROM processing
The segments and labels used in each variable in (a) to (f) (See 8.3.2 (3)
processing are defined. A label indicates the first address in each segment.
180
User’s Manual U11572EJ3V0UM00
ROM processing) in ROM
CHAPTER 8 STARTUP ROUTINES
The ROM file rom.asm is described.
$INCLUDE (mod.inc)
;
$_IF(MEDIUM)
$_IF(COMMON)
NAME
@rom
$ELSE
:
$_IF(MEDIUM)
$_IF(COMMON)
PUBLIC
_?R_INIT,_?R_INIS
PUBLIC
_?INIS,_?DATS
PUBLIC
_?R_INS1,_?INIS1,_?DATS1
$ELSE
:
;
$_IF(SMALL)
@@RSINIT CSEG
BASE
<1> Definition of labels used in ROM processing
_?R_INIT:
@@RSINIS CSEG
BASE
_?R_INIS:
@@INIT
DSEG
_?INIT:
@@DATA
DSEG
_?DATA:
@@INIS
DSEG
SADDR2
DSEG
SADDR2
_?INIS:
@@DATS
_?DATS:
@@RSINS1 CSEG
BASE
_?R_INS1:
@@INIS1
DSEG
SADDR
DSEG
SADDR
_?INIS1:
@@DATS1
_?DATS1:
:
$_IF(LARGE)
User’s Manual U11572EJ3V0UM00
181
CHAPTER 8 STARTUP ROUTINES
$_IF(TWO_ALN)
@@R_INIT CSEG
UNITP
$ELSE
@@R_INIT CSEG
$ENDIF
_?R_INIT:
@@R_INIS CSEG
_?R_INIS:
:
$ENDIF
;
END
<1> Definition of labels used in ROM processing
The labels used for each variable in (a) to (f) (See 8.3.2 (3) ROM processing) in ROM processing are defined.
These labels indicate the last address of the segment storing the initial value of each variable.
182
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
8.3.3 Revising startup routines
The startup routines provided by CC78K4 can be revised to match the target system actually being used. The
essential points about revising these files are explained in this section.
(1) When revising startup routine
The essential points about revising a startup routine source file are described. After revising, use the batch file
MKSTUP.BAT (mkstup.sh for the workstation version) in the BAT directory to assemble the revised source file
(cstart*.asm) (*: letters and numbers).
• Symbols used in standard library functions
If the library functions listed in Table 8-9 are not used, the symbols corresponding to each function in the
startup routine (cstart.asm or cstartr.asm) can be deleted. However, since the exit function is used in the
startup routine, _@FNCTBL and _@FNCENT cannot be deleted (If the exit function is deleted, these symbols
can be deleted). The symbols in the unused library functions can be deleted by changing the library switch (For
information about the library switch, see <2> Library switch in 8.3.2 (1) Preprocessing).
Table 8-9. Symbols Used in Library Functions
Library Function Name
Symbols Used
brk
sbrk
malloc
calloc
realloc
free
_errno
_@MEMTOP
_@MEMBTM
_@BRKADR
exit
atexit
_@FNCTBL
_@FNCENT
rand
srand
_@SEED
div
_@DIVR
ldiv
_@LDIVR
strtok
_@TOKPTR
User’s Manual U11572EJ3V0UM00
183
CHAPTER 8 STARTUP ROUTINES
• Area used in memory functions
If the size of the area used by a memory function is defined by the user, this is explained in the following
example.
Example)
If you want to reserve 72 bytes for use by memory functions, make the following
changes to the initial settings of the startup routine.
_@MEMTOP: DS
72
_@MEMBTM:
_@MEMTOP →
72 bytes reserved
as area for
memory functions
_@MEMBTM →
If the specified size is too big, the RAM area is not entered and errors occur when linking.
In this case, decrease the size specified as shown below, or avoid by correcting the link directive file. If the link
directive file is changed, see (2) Link directive file.
Example) To decrease the specified size
_@MEMTOP:
184
DS
72
→ Change to 40
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
(2) Link directive file
How to create a link directive file is explained. Specify a file created using the -D option when linking to match
the actual target system. Heed the following cautions when creating the file (For the detailed description method
for a link directive, see RA78K4 Assembler Package User’s Manual Operation (U11334E)).
• CC78K4 sometimes uses a portion of the short direct address area (saddr2 area) in the following compilerspecific objectives. Specifically, this is any 32-byte area in (F)FD20H to (F)FDFFH.
(a) Argument or automatic variable of a norec function (16 bytes)
(b) register variable when the -qr2 option was specified (16 bytes)
(c) Standard library task (part of the area in (b))
Specifically, _@KREG00 is referenced when longjmp or setjmp is used.
• If the user does not use the standard library, the (c) area is not used.
An example of a link directive file is described below. If memory is defined, do not overlap another area. When
creating, refer to the memory map of the target device to be used.
(Example using µPD784038)
First address, Size
memory STACK:
( 0FEE00h, 20h )
memory RAM:
( 0FEE20h, 11E0h )
memory EXTRAM: ( 0F0000h, 00100h )
merge @@DATA: = EXTRAM → The location of the segment is specified.
If you want to change the location of the segment, add a merge statement. If the function to change the compiler
output section name was used, the segment can be independently located (Refer to CHAPTER 11 in CC78K4
User’s Manual Language (U11571E)).
If the result of changing the location of a segment does not provide enough memory for the location, change the
corresponding memory statement.
Remark If the small model (-MS) or medium model (-MM) and -CS0 are specified, set the data area in 0H to
0FFFFH. If the medium model (-MM) and -CS15 are specified, set the data area in 0F0000H to
0FFFFFH.
User’s Manual U11572EJ3V0UM00
185
CHAPTER 8 STARTUP ROUTINES
8.4 ROM Processing in Startup Module for Flash Area
The startup modules for flash differ with the ordinary startup modules in the following points.
Table 8-10. ROM Area Section for Initialization Data
Memory Model
Variable Type
First Label
Last Label
@ER_INIT CSEG
E@R_INIT
E?R_INIT
@ER_INIS CSEG
E@R_INIS
E?R_INIS
@ER_INS1 CSEG
E@R_INS1
E?R_INS1
External variable with initial value in (a)
@ER_INIT CSEG UNITP
E@R_INIT
E?R_INIT
sreg variable with initial value in (c)
@ER_INIS CSEG
E@R_INIS
E?R_INIS
sreg1 variable with initial value in (e)
@ER_INS1 CSEG
E@R_INS1
E?R_INS1
External variable with initial value in (a)
@ERSINIT CSEG BASE
E@R_INIT
E?R_INIT
sreg variable with initial value in (c)
@ERSINIS CSEG BASE
E@R_INIS
E?R_INIS
sreg1 variable with initial value in (e)
@ERSINS1 CSEG BASE
E@R_INS1
E?R_INS1
First Label
Last Label
E@INIT
E?INIT
External variable without initial value in (b) @EDATA DSEG
E@DATA
E?DATA
sreg variable with initial value in (c)
@EINIS DSEG SADDR2
E@INIS
E?INIS
sreg variable without initial value in (d)
@EDATS DSEG SADDR2
E@DATS
E?DATS
sreg1 variable with initial value in (e)
@EINIS1 DSEG SADDR
E@INIS1
E?INIS1
sreg1 variable without initial value in (f)
@EDATS1 DSEG SADDR
E@DATS1
E?DATS1
External variable with initial value in (a)
@EINIT DSEG UNITP
E@INIT
E?INIT
External variable without initial value in (b) @EDATA DSEG UNITP
E@DATA
E?DATA
sreg variable with initial value in (c)
@EINIS DSEG SADDR2
E@INIS
E?INIS
sreg variable without initial value in (d)
@EDATS DSEG SADDR2
E@DATS
E?DATS
sreg1 variable with initial value in (e)
@EINIS1 DSEG SADDR
E@INIS1
E?INIS1
sreg1 variable without initial value in (f)
@EDATS1 DSEG SADDR
E@DATS1
E?DATS1
External variable with initial value in (a)
@EINITM DSEG PAGE64K
E@INIT
E?INIT_F
External variable without initial value in (b) @EDATAM DSEG PAGE64K
E@DATA
E?DATA_F
sreg variable with initial value in (c)
@EINIS DSEG SADDR2
E@INIS
E?INIS
sreg variable without initial value in (d)
@EDATS DSEG SADDR2
E@DATS
E?DATS
sreg1 variable with initial value in (e)
@EINIS1 DSEG SADDR
E@INIS1
E?INIS1
sreg1 variable without initial value in (f)
@EDATS1 DSEG SADDR
E@DATS1
E?DATS1
Large model (without External variable with initial value in (a)
2-byte alignment),
sreg variable with initial value in (c)
medium model
sreg1 variable with initial value in (e)
Large model (with 2byte alignment)
Small model
Segment
Table 8-11. RAM Area Section for Copy Destination
Memory Model
Large model (without
2-byte alignment),
medium model
(location 0), small
model
Large model (with 2byte alignment)
Medium model
(location 15)
186
Variable Type
External variable with initial value in (a)
Segment
@EINIT DSEG
User’s Manual U11572EJ3V0UM00
CHAPTER 8 STARTUP ROUTINES
• In the startup module, the following labels are added at the head of each segment in ROM area and RAM area.
E@R_INIT, E@R_INIS, E@R_INS1, E@INIT, E@DATA, E@INIS, E@DATS, E@INIS1, E@DATS1
• In the terminal module, the following labels are added at the terminal of each segment in ROM area and RAM
area.
E?R_INIT, E?R_INIS, E?R_INS1, E?INIT (E?INIT_F in medium model location 15), E?DATA (E?DATA_F in
medium model location 15), E?INIS, E?DATS, E?INIS1, E?DATS1
• The startup module copies the contents from the first label address of each segment in ROM area to the terminal
label address –1, to the area from the first label address of each segment in RAM area.
• Zeros are embedded from E@DATA to E?DATA (E?DATA_F in medium model location 15), from E@DATS to
E?DATS, and from E@DATS1 to E?DATS1.
User’s Manual U11572EJ3V0UM00
187
[MEMO]
188
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
9.1 Error Message Format
The error message format is as follows.
Source-file-name (line-number) : Error-message
Examples
PRIME.C(8) : F712 Declaration syntax
PRIME.C(8) : F301 Syntax error
PRIME.C(8) : F701 External definition syntax
PRIME.C(19) : W745 Expected function prototype
However, the following output format is used only for the internal errors F101, F103, and F104.
[xxx.c <yyy> zzz] F101 Internal error
[xxx.c <yyy> zzz] F103 Intermediate file error
[xxx.c <yyy> zzz] F104 Illegal use of register
xxx.c: source file name, yyy: line number, zzz: message
9.2 Types of Error Messages
The following ten types of error messages are output by the compiler.
(1) Error message for a command line
(2) Error message for an internal error or memory
(3) Error message for a character
(4) Error message for a configuration element
(5) Error message for conversion
(6) Error message for an expression
(7) Error message for a statement
(8) Error message for a declaration or function definition
(9) Error message for a preprocessing directive
(10) Error message for fatal file I/O and running on an illegal operating system
User’s Manual U11572EJ3V0UM00
189
CHAPTER 9 ERROR MESSAGES
9.3 List of Error Messages
You must understand the format of an error number before using the list of error messages. The error number
indicates the type of error message and the compiler processing for the error.
The error number format is as follows.
A/F/Wnnn
A: ABORT
After the error message is output, the compile processing ends immediately. The object module file
and the assembler source module file are not output.
F: FATAL
After the error message is output, the error portion is ignored and processing continues. The object
module file and the assembler source module file are not output.
W: WARNING
After the warning message is output, processing continues. The file specified by the option is output.
nnn (3-digit number)
Caution
From 001
Error message for a command line
From 101
Error message for an internal error or memory
From 201
Error message for a character
From 301
Error message for a configuration element
From 401
Error message for conversion
From 501
Error message for an expression
From 601
Error message for a statement
From 701
Error message for a declaration or a function definition
From 801
Error message for a preprocessing directive
From 901
Error message for fatal file I/O or running on an illegal operating system
If the file name contains a syntax error, the file name is added to the message.
An error
message is added, changed, and deleted according to the language specification of the C
compiler being developed.
190
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(1) Error message for command line <from 001> (1/3)
A001
A002
A003
A004
A005
A006
A007
A008
A009
A010
A011
A012
A013
A014
Message
Missing input file
Cause
The input source file name was not specified.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
Message
Too many input files
Cause
Multiple input source file names are specified.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
Message
Unrecognized string
Cause
An item other than an option was specified on the interactive command line.
Message
Illegal file name file name
Cause
Either the format, characters, or number of characters in the specified file name are incorrect.
Message
Illegal file specification
Cause
An illegal file name was specified.
Message
File not found
Cause
The specified input file does not exist.
Message
Input file specification overlapped file name
Cause
Duplicate input file names were specified.
Message
File specification conflicted file name
Cause
Duplicate I/O file names were specified.
Message
Unable to make file file name
Cause
Since the specified output file already exists as a read-only file, it cannot be created.
Message
Directory not found
Cause
A drive or directory not existed is included in the output file name.
Message
Illegal path
Cause
An illegal path name was specified in the option setting the path name in the parameter.
Message
Missing parameter ‘option’
Cause
A required parameter is not specified.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
Message
Parameter not needed ‘option’
Cause
An unnecessary option parameter was specified.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
Message
Out of range ‘option’
Cause
The specified value of the option parameter is out of range.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
User’s Manual U11572EJ3V0UM00
191
CHAPTER 9 ERROR MESSAGES
(1) Error message for command line <from 001> (2/3)
A015
A016
A017
A018
A019
A020
A021
W022
W023
A024
W027
W028
W029
W031
192
Message
Parameter is too long
Cause
The number of characters in the option parameter exceeded the limit.
Message
Illegal parameter ‘option’
Cause
There is a syntax error in the option parameter.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
Message
Too many parameters
Cause
The total number of option parameters exceeds the limit.
Message
Option is not recognized ‘option’
Cause
An incorrect option was specified.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
Message
Parameter file nested
Cause
The -F option was specified in the parameter file.
Remedy
Since a parameter file cannot be specified in a parameter file, correct them so that there is no
nesting.
Message
Parameter file read error
Cause
The parameter file read failed.
Message
Memory allocation failed
Cause
Memory allocation failed.
Message
Same category option specified - ignored ‘option’
Cause
Conflicting options had duplicate specifications.
Compiler
The option specified later is enabled and processing continues.
Message
Incompatible chip name
Cause
The device type in the command line and the device type in the source differ.
Compiler
The device type in the command line has precedence.
Message
Illegal chip specifier on command line
Cause
The device type in the command line is incorrect.
Message
‘-MS’ or ‘-MM’ option specified - ignored ‘-CSA’
Cause
Since the small model (-MS) or medium model (-MM) was specified in the memory model
specification option, the location function specification option -CSA is ignored.
Message
‘-MS’ option specified - ignored ‘-CS15’
Cause
Since the small model (-MS) was specified in the memory model specification option, the location
function specification option -CS15 is ignored.
Message
‘-QC’ option is not portable
Cause
The -QC option does not conform to the ANSI standard (For details about -QC, see CHAPTER 5
COMPILER OPTIONS).
Message
‘-ZP’ option is not portable
Cause
The -ZP option does not conform to the ANSI standard (For details about -ZP, see CHAPTER 5
COMPILER OPTIONS).
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(1) Error message for command line <from 001> (3/3)
W032
A033
W034
W035
W042
W043
W046
Message
'-ZC' option is not portable
Cause
The -ZC option does not conform to the ANSI standard (For details about -ZC, see CHAPTER 5
COMPILER OPTIONS).
Message
Same category option specified ‘option’
Cause
Conflicting options had duplicate specifications.
Remedy
“Please enter ‘cc78k4--’ if you want help message” is output.
Use the --, -?, or -H option to reference the help file and correct the input.
Message
'-MS' or '-MM' option specified - ignored '-RA'
Cause
Since the small model (-MS) or medium model (-MM) was specified in the memory model
specification option, the external variable alignment option (-RA) is ignored.
Message
'-MM' option specified - ignored '-ZO'
Cause
Since the medium model (-MM) was specified in the memory model specification option, the older
function interface option (-ZO) is ignored.
Message
‘-QH’ option is not portable
Cause
The -QH option does not conform to the ANSI standard (For details about -QH, see CHAPTER 5
COMPILER OPTIONS).
Message
‘-ZO’ option specified - ignored ‘-ZR’
Cause
Since the old specification function interface specification option (-ZO) is specified, the pascal
interface specification option (-ZR) is ignored.
Message
‘-ZF’ option specified - regarded as ‘QL1’
Cause
Since the flash area object creation option (-ZF) is specified, after -QL2 in the library replace option
(-QL) of constant code pattern is regarded as -QL1.
(2) Error message for internal errors and memory <from 101> (1/2)
F101
F102
Message
Internal error
Cause
An internal error occurred.
Depending on the type of the EMS or XMS driver (depending on the supplier or the version), the
compiler will not run correctly and internal errors may occur. In this case, perform the following
process and stop using EMS or XMS in the compiler.
Use the latest version of the EMS or XMS driver, or use the driver included in the standard for each
operating system.
Remedy
Add the following environment variable settings with AUTOEXEC.BAT to stop using XMS or EMS.
If either one does not work properly, add both (This will slow down the compiling speed).
SET XMS78K=OFF
SET EMS78K=OFF
Message
Too many errors
Cause
The total number of fatal errors exceeded 30.
Compiler
Processing continues, but subsequent error messages are not output. The previous errors may
have caused many errors. First, remove these previous errors.
User’s Manual U11572EJ3V0UM00
193
CHAPTER 9 ERROR MESSAGES
(2) Error message for internal errors and memory <from 101> (2/2)
F103
F104
F105
A106
F108
F109
F110
Message
Intermediate file error
Cause
The intermediate file contains errors.
Remedy
Contact support.
Message
Illegal use of register
Cause
The register is incorrectly used.
Message
Register overflow : simplify expression
Cause
The expression is too complex and no more usable registers remain.
Remedy
Simplify the complex expression causing the error.
Message
Stack overflow ‘overflow cause’
Cause
The stack overflowed. The cause of the overflow is the stack or heap.
Remedy
Contact support.
Message
Compiler limit : too much automatic data in function
Cause
The area allocated for the automatic variables of the function exceeded the limit of 64 Kbytes.
Remedy
Decrease the variables so that 64 Kbytes are not exceeded.
Message
Compiler limit : too much parameter of function
Cause
The area allocated for the parameters of the function exceeded the limit of 64 Kbytes.
Remedy
Decrease the parameters so that 64 Kbytes are not exceeded.
Message
Compiler limit : too much code defined in file
Cause
• For the small model
The area allocated for the code in the file exceeded the limit of 64 Kbytes.
• For the medium or large model
The area allocated for the code in the file exceeded the limit of 1,024 Kbytes.
F111
Message
Compiler limit : too much global data defined in file
Cause
• For the small or medium model
The area allocated for the global variables in the file exceeded the limit of 64 Kbytes.
• For the large model
The area allocated for the global variables in the file exceeded the limit of 16 Mbytes.
F112
F113
194
Message
Too much internal node on temporary file
Cause
The intermediate file processing reached the limit.
Remedy
This may be output in CC78K4 V1.00 and V2.00. To avoid this, try the following methods (This is
not output in V2.10 and later versions).
• If the output assembler file containing the source is the cause:
Remove the -SA option.
• If the number of initial values exceeds 5,000 or the initial values are set by complicated
computations:
Decrease the number of initial values. Or directly initialize with constants that do not depend on
computations.
• If the source is too large: Divide up the source, or try to use the UNIX version.
Message
Compiler limit : too many local labels
Cause
Number of internal labels in one function exceeds the process limit.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(3) Error message for characters <from 201>
F201
F202
W203
Message
Unknown character ‘hexadecimal number’
Cause
Characters having the specified internal code cannot be recognized.
Message
Unexpected EOF
Cause
The file ended while the function was operating.
Message
Trigraph encountered
Cause
A trigraph sequence (3-character representation) appeared.
Remedy
If the -ZA option was specified, since trigraph sequences are valid, this warning is not output.
(4) Error message for configuration elements <from 301> (1/2)
F301
F303
W304
F305
F306
F307
F308
W309
W310
F311
F312
F313
Message
Syntax error
Cause
A syntax error occurred.
Remedy
Make sure there are no description errors in the source.
Message
Expected identifier
Cause
An identifier is required.
Message
Identifier truncate to ‘identifier’
Cause
The specified identifier is too long.
Remedy
Shorten the length of the identifier.
Message
Compiler limit : too many identifiers with block scope
Cause
There are too many symbols having block scope in one block.
Message
Illegal index , indirection not allowed
Cause
An index is used in an expression that does not take a pointer value.
Message
Call of non-function ‘variable name’
Cause
The variable name is used as a function name.
Message
Improper use of a typedef name
Cause
The typedef name is improperly used.
Message
Unused ‘variable name’
Cause
The specified variable is declared in the source, but is never used.
Message
‘variable name’ is assigned a value which is never used
Cause
The specified variable is used in an assignment statement, but is never used otherwise.
Message
Number syntax
Cause
The constant expression is illegal.
Message
Illegal octal digit
Cause
This is illegal as an octal digit.
Message
Illegal hexadecimal digit
Cause
This is illegal as a hexadecimal digit.
User’s Manual U11572EJ3V0UM00
195
CHAPTER 9 ERROR MESSAGES
(4) Error message for configuration elements <from 301> (2/2)
F314
F315
F316
F317
F318
F319
W320
F321
F322
F323
F324
F325
F326
F327
W328
F329
F336
W337
196
Message
Too big constant
Cause
The constant is too large and cannot be represented.
Message
Too small constant
Cause
The constant is too small and cannot be represented.
Message
Too many character constants
Cause
The character constant exceeds two characters.
Message
Empty character constant
Cause
The character constant ‘ ’ is empty.
Message
No terminated string literal
Cause
There is no double quote ‘“’ at the end of the string.
Message
Changing string literal
Cause
A character string literal is rewritten.
Message
No null terminator in string literal
Cause
The null character is not added to the character string literal.
Message
Compiler limit : too many characters in string literal
Cause
The number of characters in the character string literal exceeded 509.
Message
Ellipsis requires three periods
Cause
The compiler detected “..”, but “...” is required.
Message
Missing ‘delimiter’
Cause
The delimiter is incorrect.
Message
Too many }'s
Cause
The ‘{’ and ‘}’ are incorrectly paired.
Message
No terminated comment
Cause
The comment is not terminated by “*/”.
Message
Illegal binary digit
Cause
This is illegal as a binary digit.
Message
Hex constants must have at least one hex digit
Cause
At least one hexadecimal digit is required in a hexadecimal constant representation.
Message
Unrecognized character escape sequence ‘character’
Cause
The escape sequence cannot be correctly recognized.
Message
Compiler limit : too many comment nesting
Cause
The number of nesting levels of comments exceeded the limit of 255.
Message
‘-ZO’ option specified - _ _flash keyword is not allowed
Cause
Since the old specification function interface specification option (-ZO) is specified, _ _flash keyword
cannot be used.
Message
‘-ZO’ option specified - ignored ‘_ _pascal’ in this file
Cause
Since the old specification function interface specification option (-ZO) is specified, _ _pascal
keyword is ignored in this file.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(5) Error message for conversion <from 401>
W401
F402
F403
F404
F405
F406
F407
F408
F409
W410
W411
W412
W413
F414
Message
Conversion may lose significant digits
Cause
A long was converted into int.
Message
Incompatible type conversion
Cause
An illegal type conversion took place in the assignment statement.
Message
Illegal indirection
Cause
The * operator is used in an integer type expression.
Message
Incompatible structure type conversion
Cause
The types on both sides of an assignment statement to a structure or structure pair differ.
Message
Illegal lvalue
Cause
This is an illegal lvalue.
Message
Cannot modify a const object ‘variable name’
Cause
A variable with the const attribute is rewritten.
Message
Cannot write for read / only sfr ‘SFR name’
Cause
Tried to write to a read-only sfr.
Message
Cannot read for write/only sfr ‘SFR name’
Cause
Tried to read a write-only sfr.
Message
Illegal SFR access ‘sfr name’
Cause
Illegal data was read from or written to an sfr.
Message
Illegal pointer conversion
Cause
A pointer and an object other than a pointer are converted.
Message
Illegal pointer combination
Cause
Different types are mixed in the same pointer combination.
Message
Illegal pointer combination in conditional expression
Cause
Different types in a pointer combination are used in a conditional expression.
Message
Illegal structure pointer combination
Cause
Pointers to structures with different types are mixed.
Message
Expected pointer
Cause
A pointer is required.
User’s Manual U11572EJ3V0UM00
197
CHAPTER 9 ERROR MESSAGES
(6) Error message for expressions <from 501> (1/3)
F501
F502
W503
W504
F507
W508
W509
W510
W511
F512
F513
F514
F515
F516
198
Message
Expression syntax
Cause
The expression contained a syntax error.
Message
Compiler limit : too many parentheses
Cause
The nesting of parentheses in the expression exceeded 32.
Message
Possible use of ‘variable name’ before definition
Cause
The variable is used before a value is assigned to it.
Message
Possibly incorrect assignment
Cause
The main operators in conditional expressions, such as if, while, and do statements, are assignment
operators.
Message
Expected integral index
Cause
Only an integer type expression is allowed in the index of an array.
Message
Too many actual arguments
Cause
The number of arguments specified in a function call is more than the number of parameters
specified in the list of argument types or the function definition.
Message
Too few actual arguments
Cause
The number of arguments specified in a function call is fewer than the number of parameters
specified in the list of argument types or the function definition.
Message
Pointer mismatch in function ‘function name’
Cause
The given arguments have different pointer types than the arguments specified in the list of
argument types or the function definition.
Message
Different argument types in function ‘function name’
Cause
The argument types given in the function call do not match the list of argument types or the function
definition.
Message
Cannot call function in norec function
Cause
A function is called in the norec function. A function cannot be called in a norec function.
Message
Illegal structure / union member ‘member name’
Cause
A member that is referenced in the structure and not defined is indicated.
Message
Expected structure / union pointer
Cause
The expression before the ‘→’ operator is not a pointer to a structure or a union, but is the name of a
structure or a union.
Remedy
Make the expression before the ‘→’ operator a pointer to a structure or a union.
Message
Expected structure / union name
Cause
The expression before the ‘.’ operator is not the name of a structure or a union, but is a pointer to a
structure or a union.
Remedy
Make the expression before the ‘.’ operator a structure or a union variable.
Message
Zero sized structure ‘structure name’
Cause
The size of the structure is zero.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(6) Error message for expressions <from 501> (2/3)
F517
F518
F519
F520
F521
W522
F523
F524
F525
F526
F527
W528
F529
F530
F531
F532
F533
Message
Illegal structure operation
Cause
An operator that cannot be used in a structure is used.
Message
Illegal structure / union comparison
Cause
Two structures or unions cannot be compared.
Message
Illegal bit field operation
Cause
There is an illegal description for a bit field.
Message
Illegal use of pointer
Cause
The only operators that can be used on pointers are addition, subtraction, assignment, relational,
indirection (*), and member reference (->).
Message
Illegal use of floating
Cause
An operator that cannot be used on floating-point variables is used.
Message
Ambiguous operators need parentheses
Cause
Two shift, relational, and bit logical operators appear continuously without parentheses.
Message
Illegal bit, boolean type operation
Cause
An illegal operation is performed on bit or boolean type variables.
Message
‘&’ on constant
Cause
A constant address is not obtained.
Message
‘&’ requires lvalue
Cause
The ‘&’ operator can only be used in an expression assigned to the lvalue.
Message
‘&’ on register variable
Cause
The address of a register variable is not obtained.
Message
‘&’ on bit, boolean ignored
Cause
The address of a bit field, or bit or boolean type variable is not obtained.
Message
‘&’ is not allowed array / function, ignored
Cause
The & operator does not have to be applied to an array name or function name.
Message
Sizeof returns zero
Cause
The value of the sizeof expression becomes zero.
Message
Illegal sizeof operand
Cause
The operand of the sizeof expression must be an identifier or a type name.
Message
Disallowed conversion
Cause
Illegal casting occurred.
Remedy
Check for illegal casting.
This error occurs when a constant is cast to a pointer, or when an address is outside the range of
the memory model.
Message
Pointer on left, needs integral right : ‘operator’
Cause
Since the left operand is a pointer, the right operand must be an integral value.
Message
Invalid left-or-right operand : ‘operator’
Cause
The left or right operand is illegal for the operator.
User’s Manual U11572EJ3V0UM00
199
CHAPTER 9 ERROR MESSAGES
(6) Error message for expressions <from 501> (3/3)
F534
F535
F536
F537
F538
F539
W540
F541
W543
F544
F546
Message
Divide check
Cause
The divisor of the / operation or % operation is zero.
Message
Invalid pointer addition
Cause
Two pointers are not added.
Message
Must be integral value addition
Cause
Only integral values can be added to a pointer.
Message
Illegal pointer subtraction
Cause
The subtraction between pointers must be for pointers having the same type.
Message
Illegal conditional operator
Cause
The conditional operator is not correctly described.
Message
Expected constant expression
Cause
A constant expression is required.
Message
Constant out of range in comparison
Cause
The constant partial expression is compared to a value outside of the range permitted by the type of
the other partial expression.
Message
Function argument has void type
Cause
The argument of the function has the void type.
Message
Undeclared parameter in noauto or norec function prototype
Cause
The parameter declarations are not in the prototype declarations of the noauto or norec function.
Message
Illegal type for parameter in noauto or norec function prototype
Cause
Parameters with illegal types are declared in the prototype declarations of the noauto or norec
function.
Message
Too few actual argument for inline function ‘function name’
Cause
The number of arguments specified in the function call of a function expanded inline is less than the
number of parameters provided in the specifications.
(7) Error message for statements <from 601> (1/2)
F602
F603
F604
F605
F606
200
Message
Compiler limit : too many characters in logical source line
Cause
The number of characters in a logical source line exceeded 509.
Message
Compiler limit : too many labels
Cause
The number of labels exceeded 33.
Message
Case not in switch
Cause
The case statement is not described in the correct position.
Message
Duplicate case ‘label name’
Cause
The same case label is described two or more times in a switch statement.
Message
Non constant case expression
Cause
Something other than an integral constant is specified in a case statement.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(7) Error message for statements <from 601> (2/2)
F607
F608
F609
F610
F611
W613
W615
F617
F620
F621
W622
F623
Message
Compiler limit : too many case labels
Cause
The number of case labels in the switch statement exceeded 257.
Message
Default not in switch
Cause
The default statement is not described in the correct position.
Message
More than one ‘default’
Cause
The default statement is described multiple times in the switch statement.
Message
Compiler limit : block nest level too depth
Cause
The block nesting exceeded 45.
Message
Inappropriate ‘else’
Cause
There is no correspondence between if and else.
Message
Loop entered at top of switch
Cause
A while, do, or for is specified immediately after the switch statement.
Message
Statement not reached
Cause
The statement is never reached.
Message
Do statement must have ‘while’
Cause
A while is required at the end of a do.
Message
Break / continue error
Cause
The positions of the break and continue statements are incorrect.
Message
Void function ‘function name’ cannot return value
Cause
A function declared as void returns a value.
Message
No return value
Cause
A function that should return a value does not return a value.
Remedy
If a value must be returned, add a return statement. If a value does not have to be returned, give the
function the void type.
Message
No effective code and data, cannot create output file
Cause
Since the code and data are not valid, the output file cannot be created.
User’s Manual U11572EJ3V0UM00
201
CHAPTER 9 ERROR MESSAGES
(8) Error message for declarations and function definitions <from 701> (1/5)
F701
F702
F703
F704
F705
F706
F707
W708
F710
F711
F712
F713
W714
F715
F716
202
Message
External definition syntax
Cause
The function is not correctly defined.
Message
Too many callt functions
Cause
There are too many declarations of the callt function. A maximum of 32 callt functions can be
declared.
Remedy
Decrease the number of callt function declarations.
Message
Function has illegal storage class
Cause
The function is specified with an illegal storage class.
Message
Function returns illegal type
Cause
The return value of the function is an illegal type.
Message
Too many parameters in noauto or norec function
Cause
A noauto or norec function has too many parameters.
Remedy
Decrease the number of parameters.
Message
Parameter list error
Cause
The function parameter list contains errors.
Message
Not parameter ‘character string’
Cause
Something other than a parameter is declared in a function definition.
Message
Already declared symbol ‘variable name’
Cause
The same variable has already been declared.
Message
Illegal storage class
Cause
The auto and register declarations are outside the function.
Message
Undeclared ‘variable name’; function ‘function name’
Cause
An undeclared variable is used.
Message
Declaration syntax
Cause
The declaration statement does not match the syntax.
Message
Redefined ‘variable name’
Cause
Two or more of the same variables are defined.
Remedy
Set the variable definition once.
Message
Too many register variables
Cause
There are too many declarations of register variables.
Remedy
Decrease the number of register variables. For the number that can be used, see CHAPTER 11 in
the Language (U11571E) manual.
Message
Too many sreg variables
Cause
There are too many declarations of sreg variables.
Message
Not allowed automatic data in noauto function
Cause
Automatic variables cannot be used in the noauto function.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(8) Error message for declarations and function definitions <from 701> (2/5)
F717
F718
F719
F720
W721
F723
F724
W725
F726
F727
F728
F729
F730
F731
F732
Message
Too many automatic data in noauto or norec function
Cause
There are too many automatic variables in a noauto or norec function.
Remedy
Decrease the number of automatic variables in a noauto or norec function. For the number that
can be used, see CHAPTER 11 in the Language (U11571E) manual.
Message
Too many bit, boolean type variables
Cause
There are too many bit and boolean type variables.
Remedy
Decrease the number of bit, boolean, and _ _boolean type variables. For the number that can be
used, see CHAPTER 11 in the Language (U11571E) manual.
Message
Illegal use of type
Cause
An illegal type name is used.
Message
Illegal void type for ‘identifier’
Cause
The identifier is declared by void.
Message
Illegal type for register declaration
Cause
A register declaration is specified with an illegal type.
Compiler
The register declaration is ignored and processing continues.
Message
Illegal type for parameter in noauto or norec function
Cause
The type of a parameter in a noauto or norec function is too big.
Message
Structure redefinition
Cause
The same structure is redefined.
Message
Illegal zero sized structure member
Cause
The area taken as a structure member is not secured.
Remedy
When an array is used in the member of a structure and the index is given by a constant
computation, sometimes there is overflow by the -QC2 action and the area is not secured. In this
case, specify -QCI/-QC. -QC is included in the default options.
Message
Function cannot be structure / union member
Cause
A function cannot be a member of a structure or a union.
Message
Unknown size structure / union ‘name’
Cause
Structures or unions have undefined sizes.
Message
Compiler limit : too many structure / union members
Cause
The members in a structure or union exceeded 127.
Message
Compiler limit : structure / union nesting
Cause
The nesting of structures or unions exceeded 15.
Message
Bit field outside of structure
Cause
A bit field is declared outside of the structure.
Message
Illegal bit field type
Cause
A type other than an integral type is specified in a bit field type.
Message
Too long bit field size
Cause
The number of bit specifications in a bit field declaration exceeds the number of bits in that type.
User’s Manual U11572EJ3V0UM00
203
CHAPTER 9 ERROR MESSAGES
(8) Error message for declarations and function definitions <from 701> (3/5)
F733
F734
F735
F736
F737
F738
F739
F740
F741
F742
F743
W744
W745
F747
W748
W749
F750
F751
204
Message
Negative bit field size
Cause
The number of bit specifications in a bit field declaration is negative.
Message
Illegal enumeration
Cause
The enumeration type declaration does not match the syntax.
Message
Illegal enumeration constant
Cause
The enumeration constant is illegal.
Message
Compiler limit : too many enumeration constants
Cause
The number of enumeration constants exceeded 255.
Message
Undeclared structure / union / enum tag
Cause
A tag is not declared.
Message
Compiler limit : too many pointer modifying
Cause
The number of indirection operators (*) exceeded 12 in a pointer definition.
Message
Expected constant
Cause
A variable is used in the index in an array declaration.
Message
Negative subscript
Cause
The specification of the size of an array is negative.
Message
Unknown size array ‘array name’
Cause
The size of an array is undefined.
Remedy
Specify the size of the array.
Message
Compiler limit : too many array modifying
Cause
The array declaration exceeds 12 dimensions.
Message
Array element type cannot be function
Cause
An array of functions is not allowed.
Message
Zero sized array ‘array name’
Cause
The number of elements of the defined array is zero.
Message
Expected function prototype
Cause
The function prototype is not declared.
Message
Function prototype mismatch
Cause
The function prototype declaration contains errors.
Message
A function is declared as a parameter
Cause
A function is declared as an argument.
Message
Unused parameter ‘parameter name’
Cause
The parameter is not used.
Message
Initializer syntax
Cause
The initialization does not match the syntax.
Message
Illegal initialization
Cause
The constant of an initial value setting does not match the type of the variable.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(8) Error message for declarations and function definitions <from 701> (4/5)
W752
F753
F755
F756
F757
F758
F759
W760
W761
W763
W764
F765
F766
F767
F768
F770
F771
Message
Undeclared initializer name ‘name’
Cause
The initializer name is not declared.
Message
Cannot initialize static with automatic
Cause
The static variable cannot be initialized using an automatic variable.
Message
Cannot initialize structure / union in function ‘function name’
Cause
A structure or union in a function cannot be initialized.
Message
Too many initializers ‘array name’
Cause
There are more initial values than elements in the declared array.
Message
Too many structure initializers
Cause
There are more initial values than members in the declared structure.
Message
Cannot initialize a function ‘function name’
Cause
The function cannot be initialized.
Message
Compiler limit : initializers too deeply nested
Cause
The depth of the nesting of initialized elements exceeded the limit.
Message
Double and long double are treated as IEEE 754 single format
Cause
double and long double are handled as IEEE 754 single-precision formats.
Message
Cannot declare sreg with const or function
Cause
sreg cannot be declared with a const declaration or function.
Compiler
An sreg declaration is ignored.
Message
Cannot declare const with bit, boolean
Cause
bit and boolean type variables cannot have const declarations.
Compiler
A const declaration is ignored.
Message
‘variable name’ initialized and declared extern-ignored extern
Cause
An externally referenced variable without a body was initialized.
Compiler
The extern declaration is ignored.
Message
Undefined static function ‘function name’
Cause
There was a reference to a function whose body is not in the same file and was declared static.
Message
Illegal type for automatic data in noauto or norec function
Cause
The type of the automatic variable in a noauto or norec function is large.
Message
Too many _ _sreg1 variables
Cause
There are too many _ _sreg1 variable declarations.
Message
Too many _ _boolean1 type variables
Cause
There are too many _ _boolean1 type variable declarations.
Message
Parameters are not allowed for interrupt function
Cause
An interrupt function cannot have arguments.
Message
Interrupt function must be void type
Cause
An interrupt function must have the void type.
User’s Manual U11572EJ3V0UM00
205
CHAPTER 9 ERROR MESSAGES
(8) Error message for declarations and function definitions <from 701> (5/5)
F772
F773
F774
F775
F776
F777
F778
W779
F780
W787
F788
F789
F790
F791
W792
W793
206
Message
callt / callf / noauto / norec/_ _pascal are not allowed for interrupt function
Cause
An interrupt function cannot be declared callt, callf, noauto, norec, or _ _pascal.
Message
Cannot call interrupt function
Cause
An interrupt function cannot be called.
Message
Interrupt function can't use with the other kind interrupts
Cause
An interrupt function cannot be used in other types of interrupts.
Message
Cannot call rtos_task function
Cause
An RTOS task function cannot be called.
Message
Cannot call ret_int/ret_wup except in rtos_interrupt_handler
Cause
A ret_int or ret_wup system call cannot be called except in an RTOS_INTERRUPT handler.
Message
Not call ret_int/ret_wup in rtos_interrupt_handler
Cause
A ret_int or ret_wup system call is not called in an RTOS_INTERRUPT handler.
Message
Cannot call ext_tsk in interrupt function
Cause
An ext_tsk system call cannot be called in an interrupt function or interrupt handler.
Message
Not call ext_tsk in rtos_task
Cause
An ext_tsk system call is not called in an RTOS task.
Message
Zero width for bit field ‘member name’
Cause
The member name is specified when the number of bit specifications in a bit field declaration has
zero members.
Message
Bit field type is char
Cause
A char type is specified in a bit field type.
Message
Cannot allocate a _ _flash function ‘function name’
Cause
The _ _flash function cannot be allocated.
Message
‘-ZF’ option did not specify - cannot allocate an EXT_FUNC function ‘function name’
Cause
The flash area object creation option (-ZF) is not specified. The function specified with #pragma
EXT_FUNC cannot be allocated.
Message
Callt/callf/_ _interrupt are not allowed for EXT_FUNC function ‘function name’
Cause
callt/callf/_ _interrupt declarations cannot be specified in the function specified with #pragma
EXT_FUNC.
Message
‘-ZF’ option specified - cannot allocate a callt/callf function ‘function name’
Cause
The flash area object creation option (-ZF) is specified. callt/callf function cannot be allocated.
Message
Undeclared parameter in _ _pascal function definition or prototype
Cause
Parameters are not declared in _ _pascal function definition or prototype declaration. void must be
described if there is no parameter.
Message
Variable parameters are not allowed for _ _pascal function - ignored _ _pascal
Cause
Variable parameters cannot be specified for _ _pascal function. _ _pascal keyword is ignored.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(9) Error message for preprocessing directives <from 801> (1/5)
F801
F802
F803
W804
F805
F806
F807
F810
F811
F812
F813
F814
W816
W817
F818
W819
F821
Message
Undefined control
Cause
A symbol starting with # cannot be recognized as a keyword.
Message
Illegal preprocess directive
Cause
The preprocess directive is illegal.
Message
Unexpected non-whitespace before preprocess directive
Cause
A character other than a whitespace character precedes the preprocess directive.
Message
Unexpected characters following ‘preprocess directive’ directive - newline expected
Cause
Extra characters follow the preprocess directive.
Message
Misplaced else or elif
Cause
The #if, #ifdef, and #ifndef do not correspond to #else and #elif.
Message
Misplaced endif
Cause
The #if, #ifdef, and #ifndef do not correspond to #endif.
Message
Compiler limit : too many conditional inclusion nesting
Cause
The nesting of conditional compiling exceeded 255.
Message
Cannot find include file ‘file name’
Cause
The include file was not found.
Message
Too long file name ‘file name’
Cause
The file name is too long.
Message
Include directive syntax
Cause
The file name in the definition of the #include statement is not correctly enclosed by “ ” or < >.
Message
Compiler limit : too many include nesting
Cause
The nesting of the include files exceeded 8.
Message
Illegal macro name
Cause
The macro name is illegal.
Message
Redefined macro name ‘macro name’
Cause
The macro name is redefined.
Message
Redefined system macro name ‘macro name’
Cause
The system macro name is redefined.
Message
Redeclared parameter in macro ‘macro name’
Cause
The same identifier appears in the parameter list in the macro definition.
Message
Mismatch number of parameter ‘macro name’
Cause
The number of parameters when referencing differs from the number of parameters defined by
#define.
Message
Illegal macro parameter ‘macro name’
Cause
The description enclosed by parentheses ( ) in the function format macro is illegal.
User’s Manual U11572EJ3V0UM00
207
CHAPTER 9 ERROR MESSAGES
(9) Error message for preprocessing directives <from 801> (2/5)
F822
F823
W824
W825
F826
F827
F828
W829
Message
Missing ) ‘macro name’
Cause
The right parenthesis ‘)’ was not found in the same line as the #define definition in the function
format macro.
Message
Too long macro expansion ‘macro name’
Cause
The actual argument during macro expansion is too long.
Message
Identifier truncate to ‘macro name’
Cause
The macro name is too long.
Compiler
It is shortened to the displayed ‘macro name’.
Message
Macro recursion ‘macro name’
Cause
The #define definition becomes recursive.
Message
Compiler limit : too many macro defines
Cause
The number of macro definitions exceeded 10,000.
Message
Compiler limit : too many macro parameters
Cause
One macro definition had over 31 calling parameters.
Message
Not allowed #undef for system macro name
Cause
The system macro name is specified by #undef.
Message
Unrecognized pragma ‘character string’
Cause
This character string is not supported.
Remedy
Check that the keywords are correct.
This warning occurs if an incorrect segment was specified in the #pragma section. Since the
segment name differs with the model, be careful.
Example When the small model is specified, specify #pragma section @@CODE code →
Convert to W829 @@CODES → Terminate normally
F830
F831
W832
F833
F834
W835
W836
208
Message
No chip specifier : #pragma pc ( )
Cause
There is no device specifier.
Message
Illegal chip specifier : ‘#pragma pc (device type)’
Cause
The device specifier is illegal.
Message
Duplicated chip specifier
Cause
The device specifier is duplicated.
Message
Expected #asm
Cause
There is no #asm.
Message
Expected #endasm
Cause
There is no #endasm.
Message
Too many characters in assembler source line
Cause
A line in the assembler source is too long.
Message
Expected assembler source
Cause
There is no assembler source between #asm and #endasm.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(9) Error message for preprocessing directives <from 801> (3/5)
W837
F838
F839
W840
F842
F843
F845
W846
F847
F848
W849
W850
W851
W852
Message
Output assembler source file, not object file
Cause
Assembler source is output instead of the object file.
Message
Duplicated pragma VECT or INTERRUPT or RTOS_INTERRUPT ‘character string’
Cause
The #pragma VECT ‘character string’, or INTERRUPT ‘character string’, or RTOS_INTERRUPT
‘character string’ is duplicated.
Message
Unrecognized pragma VECT or INTERRUPT or RTOS_INTERRUPT ‘character string’
Cause
There is an unrecognized #pragma VECT ‘character string’, or INTERRUPT ‘character string’, or
RTOS_INTERRUPT ‘character string’.
Message
Undefined interrupt function ‘function name’- ignored BANK or SP_SWITCH specified
Cause
The save destination is specified for an undefined interrupt function.
Compiler
Register bank specifications and stack switching specifications are ignored.
Message
Unrecognized pragma SECTION ‘character string’
Cause
There is an unrecognized #pragma SECTION ‘character string’.
Message
Unspecified start address of ‘section name’
Cause
The correct starting address is not specified after AT in the #pragma section.
Message
Cannot allocate ‘section name’ out of ‘address range’
Cause
The specified section cannot be placed at the specified starting address.
Message
Rechanged section name ‘section name’
Cause
The same section name is duplicated and its specification is changed.
Compiler
The section name specified last is valid and processing continues.
Message
Different BANK or SP_SWITCH specified on same interrupt function ‘function name’
Cause
A different register bank or stack switching is specified for an interrupt function with the same
name.
Message
Cannot allocate segment to saddr area with –CSA ‘section name’
Cause
When -CSA is specified, the section has an address specification and cannot be placed in the
saddr area.
Remedy
If a section has an address specification and is placed in the saddr area, specify either the -CS0 or
-CS15 option.
Message
#pragma statement is not portable
Cause
The #pragma statement does not conform to ANSI.
Message
Asm statement is not portable
Cause
The ASM statement does not conform to ANSI.
Message
Data aligned in ‘area name’
Cause
The segment area or structure tag is data aligned. The area name is a segment name or a
structure tag.
Message
Module name truncate to ‘module name’
Cause
The specified module name is too long.
Compiler
It is shortened to the displayed ‘module name’.
User’s Manual U11572EJ3V0UM00
209
CHAPTER 9 ERROR MESSAGES
(9) Error message for preprocessing directives <from 801> (4/5)
F853
F854
F855
W856
W857
F858
F859
F860
F861
F862
F863
F864
F865
F866
F867
210
Message
Unrecognized pragma NAME ‘module name’
Cause
Unrecognizable characters are in the ‘module name’.
Message
Undefined rtos_task ‘character string’
Cause
The body of the RTOS task is not defined.
Message
Cannot assign rtos_interrupt_handler to non-maskable and software interrupt
Cause
A non-maskable interrupt and a software interrupt cannot be specified in an RTOS_INTERRUPT
handler.
Message
Rechanged module name ‘module name’
Cause
Duplicate module names are specified.
Message
Section name truncate to ‘section name’
Cause
The specified section name is too long.
Compiler
It is shortened to the displayed ‘section name’. Make the section name 8 or fewer characters.
Message
Unrecognized pragma ‘pragma character string’ ‘illegal character string’
Cause
There is unrecognized #pragma ‘pragma character string’ ‘illegal character string’.
Message
Cannot allocate EXT_TABLE out of 0x80-0xff80
Cause
The first address of the flash area branch table must be 0x80 to 0xff80.
Message
Redefined #pragma EXT_TABLE
Cause
#pragma EXT_TABLE is redefined.
Message
No EXT_TABLE specifier
Cause
There is no first address specification of the flash area branch table.
Message
Illegal EXT_FUNC id specifier : out of 0x0-0xff
Cause
The function ID value in the flash area specified with #pragma EXT_FUNC must be 0x0 to 0xff.
Message
Redefined #pragma EXT_FUNC name ‘function name’
Cause
The function name specified with #pragma EXT_FUNC is redefined.
Message
Redefined #pragma EXT_FUNC id ‘ID value’
Cause
The ID value specified with #pragma EXT_FUNC is redefined.
Message
Out of range – cannot allocate an EXT_FUNC function ‘function name’
Cause
The address of the flash area branch table exceeded the range. The function specified with
#pragma EXT_FUNC cannot be allocated.
Message
#pragma section found after C body. cannot include file contain #pragma section and not C body
Cause
There is #pragma section syntax after C body description. Subsequent files that contain #pragma
section syntax and no C body (including external reference declarations of variables and functions)
cannot be included.
Message
#pragma section found after C body. cannot specify #include after #pragma section not C body in
this file
Cause
There is #pragma section syntax after C body description. Hereafter, #include syntax cannot be
described.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(9) Error message for preprocessing directives <from 801> (5/5)
F868
W869
W870
W871
F899
Message
#include found after C body. cannot rechange section
Cause
There is #include syntax after C body description. Hereafter, #pragma section syntax cannot be
described.
Message
‘section name’ section cannot change after C body
Cause
Specified section cannot be changed after C body description.
Message
Data aligned before ‘variable name’ in ‘section name’
Cause
Data alignment is done before ‘variable name’ is allocated in ‘section name’.
Message
Data aligned after ‘variable name’ in ‘section name’
Cause
Data alignment is done after ‘variable name’ is allocated in ‘section name’.
Message
Character string specified by #error is output
Cause
An #error character string was specified.
User’s Manual U11572EJ3V0UM00
211
CHAPTER 9 ERROR MESSAGES
(10) Error message for fatal file I/O and running on illegal operating system <from 901> (1/2)
A901
A902
A903
A904
A905
A906
A907
A908
A909
A910
A911
A912
A913
A914
212
Message
File I/O error
Cause
A physical I/O error was generated during file input/output.
Remedy
If an intermediate file is the cause, increase the conventional memory, or use EMS or XMS
memory.
Message
Cannot open ‘file name’
Cause
The file cannot be opened.
Message
Cannot open overlay file ‘file name’
Cause
The overlay file cannot be opened.
Message
Cannot open temp
Cause
The input temporary file cannot be opened.
Message
Cannot create ‘file name’
Cause
A file create error was generated.
Message
Cannot create temp
Cause
A create error was generated in an output temporary file.
Message
No available data block
Cause
A temporary file cannot be created because the drive file does not have sufficient capacity.
Message
No available directory space
Cause
A temporary file cannot be created because of insufficient directory area on the drive.
Message
R/O : read / only disk
Cause
A temporary file cannot be created because the drive is read only.
Message
R/O file : read / only , file opened read / only mode
Cause
A write error was generated by a temporary file for the following reasons.
1. A file with the same name as a temporary file already exists on the drive and it has the readonly attribute.
2. The output temporary file is opened with the read-only attribute because of internal conflicts.
Message
Reading unwritten data, no available directory space
Cause
An I/O error was generated for the following reasons.
1. EOF was passed and input proceeded.
2. The temporary file cannot be created because of insufficient directory area on the drive.
Message
Write error on temp
Cause
A write error was generated to the output temporary file.
Remedy
A complex source expression (such as too deep nesting) may be the cause. Contact support.
Message
Requires MS-DOS V2.11 or greater
Cause
The operating system is not MS-DOS (V2.11 or later).
Message
Insufficient memory in hostmachine
Cause
The compiler cannot start because of insufficient memory.
Remedy
Increase the free area in the conventional memory.
User’s Manual U11572EJ3V0UM00
CHAPTER 9 ERROR MESSAGES
(10) Error message for fatal file I/O and running on illegal operating system <from 901> (2/2)
W915
F922
A923
Message
Asm statement found. skip to jump optimize this function ‘function name’
Cause
An ASM statement was detected. This function does not have jump optimization.
Message
Heap overflow : please retry compile without -QJ
Cause
A memory overflow was generated in jump optimization. Recompile without specifying -QJ.
Message
Illegal device file format
Cause
A device file in an old format was referenced.
9.4 List of Error Messages in Project Manager
This section describes the error messages related to starting CC78K4 which are output when CC78K4 is used in
the Project Manager. The messages are displayed in the form of a Windows message box.
Refer to the user’s manual for the Project Manager for the other messages. For information about the error
messages for CC78K4, see 9.3 List of Error Messages.
Icon
!
STOP
STOP
Cause/Action
Description
Message
“Cannot find CC78K4E.EXE shown in environment variable PATH.”
Cause
The executable form of CC78K4E.EXE is not in a directory indicated by the PATH
environment variable.
User action
Place CC78K4 related files, such as CC78K4E.EXE, in a directory indicated by the
PATH environment variable.
Button
Press “OK” to close the message.
Message
“Not enough memory.”
Cause
Insufficient memory
User action
After exiting other applications, try again.
Button
Press “OK” to close the message.
Message
“Cannot lock the memory.”
Cause
There is insufficient memory or the Windows systems may be corrupted.
User action
After exiting other applications or restarting Windows, try again.
Button
Press “OK” to close the message.
User’s Manual U11572EJ3V0UM00
213
[MEMO]
214
User’s Manual U11572EJ3V0UM00
APPENDIX A SAMPLE PROGRAMS
A.1 C Source Module File
#define TRUE
1
#define FALSE
0
#define SIZE
200
char
mark[SIZE+1];
main()
{
int i, prime, k, count;
count = 0;
for ( i = 0 ; i <= SIZE ; i++)
mark[i] = TRUE;
for ( i = 0 ; i <= SIZE ; i++) {
if (mark[i]) {
prime = i + i + 3;
printf("%6d",prime);
count++;
if((count%8) == 0) putchar('\n');
for ( k = i + prime ; k <= SIZE ; k += prime)
mark[k] = FALSE;
}
}
printf("\n%d primes found.",count);
}
printf(s,i)
char *s;
int i;
User’s Manual U11572EJ3V0UM00
215
APPENDIX A SAMPLE PROGRAMS
{
int j;
char *ss;
j = i;
ss = s;
}
putchar(c)
char c;
{
char d;
d = c;
}
A.2 Execution Example
A>cc78K4 -c4026 prime.c -a -p -x -e -ng
78K/IV Series C Compiler Vx.xx
[xx xxx xx]
Copyright (C) NEC Corporation xxxx
SAMPLE\PRIME.C(18) : W745 Expected function prototype
SAMPLE\PRIME.C(20) : W745 Expected function prototype
SAMPLE\PRIME.C(26) : W622 No return value
SAMPLE\PRIME.C(37) : W622 No return value
SAMPLE\PRIME.C(44) : W622 No return value
Target chip : uPD784026
Device file : Vx.xx
Compilation complete,
216
0 error(s) and
5 warning(s) found.
User’s Manual U11572EJ3V0UM00
APPENDIX A SAMPLE PROGRAMS
A.3 Output List
(1) Assembler source module file
; 78K/IV Series C Compiler Vx.xx Assembler Source
;
Date:xx xxx xxxx Time:xx:xx:xx
; Command
:
-c4026 prime.c -a -p -x -e -ng
; In-file
: PRIME.C
; Asm-file
: PRIME.ASM
; Para-file :
$CHGSFR(15)
$PROCESSOR(4026)
$NODEBUG
$NODEBUGA
$KANJICODE SJIS
$TOL_INF 03FH, 0210H, 02H, 08021H
EXTRN
@@isrem
PUBLIC
_mark
PUBLIC
_main
PUBLIC
_printf
PUBLIC
_putchar
@@CNST
CSEG
L0011:
DB
'%6d'
DB
00H
DB
0AH
DB
'%d primes found.'
DB
00H
L0017:
User’s Manual U11572EJ3V0UM00
217
APPENDIX A SAMPLE PROGRAMS
@@DATA
DSEG
_mark:
DS
(201)
; line
5
; line
8
@@CODE
CSEG
_main:
push
uup
push
rp3
push
vvp
push
ax
; line
11
subw
ax,ax
movw
[sp+0],ax
; line
; count
13
subw
rp3,rp3
cmpw
rp3,#0C8H
bgt
$L0004
L0003:
; line
; 200
14
movw
hl,rp3
mov
a,h
cvtbw
mov
w,a
addg
whl,#_mark
mov
a,#01H
mov
[hl],a
incw
rp3
br
$L0003
; 1
L0004:
; line
15
subw
rp3,rp3
cmpw
rp3,#0C8H ; 200
bgt
$L0007
L0006:
; line
218
16
User’s Manual U11572EJ3V0UM00
APPENDIX A SAMPLE PROGRAMS
movw
hl,rp3
mov
a,h
cvtbw
mov
w,a
addg
whl,#_mark
mov
a,[hl]
cmp
a,#00H
be
$L0015
; line
; 0
17
movw
ax,rp3
addw
ax,ax
addw
ax,#03H ; 3
movw
up,ax
; line
18
push
up
movg
whl,#L0011
call
$!_printf
pop
ax
; line
19
movw
ax,[sp+0]
incw
ax
movw
[sp+0],ax
; line
; count
; count
20
movw
bc,ax
movw
ax,#08H ; 8
call
!!@@isrem
or
a,x
bne
$L0012
mov
x,#0AH
call
$!_putchar
; 10
L0012:
; line
21
movw
ax,rp3
addw
ax,up
movw
vp,ax
cmpw
vp,#0C8H; 200
L0014:
User’s Manual U11572EJ3V0UM00
219
APPENDIX A SAMPLE PROGRAMS
bgt
; line
$L0015
22
movw
hl,vp
mov
a,h
cvtbw
mov
w,a
addg
whl,#_mark
mov
a,#00H
mov
[hl],a
addw
vp,up
br
$L0014
; 0
L0015:
; line
24
incw
rp3
br
$L0006
L0007:
; line
25
ax,[sp+0]
push
ax
movg
whl,#L0017
call
$!_printf
pop
ax
; line
movw
; count
26
pop
ax
pop
vvp
pop
rp3
pop
uup
ret
; line
31
_printf:
; line
push
uup
push
rp3
push
vvp
movg
uup,whl
35
movw
220
ax,[sp+11]
; i
User’s Manual U11572EJ3V0UM00
APPENDIX A SAMPLE PROGRAMS
movw
; line
rp3,ax
36
movg
; line
vvp,uup
37
pop
vvp
pop
rp3
pop
uup
ret
; line
41
_putchar:
; line
push
rp3
mov
r6,x
43
mov
; line
r7,r6
44
pop
rp3
ret
END
; Target chip : uPD784026
; Device file : Vx.xx
User’s Manual U11572EJ3V0UM00
221
APPENDIX A SAMPLE PROGRAMS
(2) Preprocess list file
/*
78K/IV Series C Compiler Vx.xx Preprocess List
Command
Date:xx xxx xxxx Page:
: -c4026 prime.c -a -p -x -e -ng
In-file
: PRIME.C
PPL-file
: PRIME.PPL
Para-file :
*/
1 : #define TRUE
1
2 : #define FALSE
0
3 : #define SIZE
200
4 :
5 : char
mark[SIZE+1];
6 :
7 : main()
8 : {
9 :
int i, prime, k, count;
10 :
11 :
count = 0;
12 :
13 :
for ( i = 0 ; i <= SIZE ; i++)
14 :
mark[i] = TRUE;
15 :
for ( i = 0 ; i <= SIZE ; i++) {
16 :
if (mark[i]) {
17 :
prime = i + i + 3;
18 :
printf("%6d",prime);
19 :
count++;
20 :
if((count%8) == 0) putchar('\n');
21 :
for ( k = i + prime ; k <= SIZE ; k += prime)
22 :
mark[k] = FALSE;
23 :
}
24 :
}
25 :
printf("\n%d primes found.",count);
26 : }
27 :
222
User’s Manual U11572EJ3V0UM00
1
APPENDIX A SAMPLE PROGRAMS
28 : printf(s,i)
29 : char *s;
30 : int i;
31 : {
32 :
int j;
33 :
char *ss;
34 :
35 :
j = i;
36 :
ss = s;
37 : }
38 :
39 : putchar(c)
40 : char c;
41 : {
42 :
char d;
43 :
d = c;
44 : }
/*
Target chip : uPD784026
Device file : Vx.xx
*/
User’s Manual U11572EJ3V0UM00
223
APPENDIX A SAMPLE PROGRAMS
(3) Cross-reference list file
78K/IV Series C Compiler Vx.xx Cross reference List
Command
: -c4026 prime.c -a -p -x -e -ng
In-file
: PRIME.C
Date:xx xxx xxxx Page:
Xref-file : PRIME.XRF
Para-file :
ATTRIB MODIFY TYPE
SYMBOL
DEFINE
EXTERN
array
mark
5
EXTERN
func
main
7
int
i
REG1
15
15
9
16
17
REFERENCE
14
16
22
13
13
13
14
17
21
REG1
int
prime
9
17
18
21
21
REG1
int
k
9
21
21
21
22
AUTO1
int
count
9
11
19
20
25
EXTERN
func
printf
28
18
25
EXTERN
func
putchar
39
20
REG1
pointer s
29
36
PARAM
int
i
30
35
REG1
int
j
32
35
REG1
pointer ss
33
36
REG1
char
40
43
15
21
PARAM
c
PARAM
REG1
42
43
#define TRUE
char
d
1
14
#define FALSE
2
22
#define SIZE
3
5
13
Target chip : uPD784026
Device file : Vx.xx
224
User’s Manual U11572EJ3V0UM00
15
1
APPENDIX A SAMPLE PROGRAMS
(4) Error list file
PRIME.C(
18) : W745 Expected function prototype
PRIME.C(
20) : W745 Expected function prototype
PRIME.C(
26) : W622 No return value
PRIME.C(
37) : W622 No return value
PRIME.C(
44) : W622 No return value
Target chip : uPD784026
Device file : Vx.xx
Compilation complete,
0 error(s) and
5 warning(s) found.
User’s Manual U11572EJ3V0UM00
225
[MEMO]
226
User’s Manual U11572EJ3V0UM00
APPENDIX B LIST OF USE-RELATED CAUTIONS
Number
1
Applicable Versions
All versions from V1.00
Cautions
[Cautions related to include files]
Functions cannot be defined (except declarations) and expanded in the C source in
include files.
If there are definitions in include files, there are negative effects, such as not
displaying the correct definition during source debugging.
2
All versions from V1.00
[Cautions when using assembler source output]
If there are descriptions in assembly language such as ASM statements in C source
programs, the steps for creating the load module file are, in order, compiling,
assembling, and linking.
Note the following cautions if the assembler source is output once without the output
of the direct object code by the compiler, such as when using ASM statements,
assembled, and used. If these cautions are not heeded, assembling errors result and
the debugging information output by the assembler will be incorrect.
When direct object code is output by the compiler, there are no problems.
(a) When symbols must be defined in #asm blocks (part enclosed by #asm and
#endasm) and _ _asm statements, use symbols with eight or fewer characters
beginning with the character string ?L@ (for example, ?L@01, ?L@sym).
However, do not make this symbol an external definition (PUBLIC declaration).
In addition, segment cannot be defined in #asm blocks and _ _asm statements.
(b) A function name with more than 24 characters cannot be used.
(c) Describe the definitions of normal functions, callf functions, and callt
functions and interrupt functions by combining into these three groups.
3
All versions from V1.00
[Cautions about source file names]
In CC78K4, the part excluding the extension of the source file name (primary name)
is used by default as the module name. Therefore, the possible source file names
are somewhat restricted. However, if the #pragma name of the module name
modification function was used, the restrictions are eliminated.
(a) A file name consists of the primary name of 8 or fewer characters and an
extension of 3 or fewer characters. Use the format where a period (.) is the
delimiter between the primary name and the extension.
(b) The characters that can be used in the primary name and the extension are the
English alphabet and numeric, and the underline character (_) of the ASCII
characters. Make the first character in the primary name a letter.
(c) Files with the same name for the first 8 characters in the primary name produce
an error when linking (only in the UNIX version).
User’s Manual U11572EJ3V0UM00
227
APPENDIX B LIST OF USE-RELATED CAUTIONS
Number
4
Applicable Versions
All versions from V1.00
Cautions
[Cautions with -QC compiler option]
If the -QC option is specified in CC78K4, the ranges of the types of the constants and
character constants that can be represented are handled as follows.
–128 to 127
char type
128 to 255
unsigned char type
0U to 255U
unsigned char type
From 256
int type
To –129
int type
‘\0’ to ‘\377’
char type
If the -QC option is specified, the calculation results of a pair of char type constants
and a pair of unsigned char type constants are handled as char types and unsigned
char types, respectively. The calculation result of a char type constant and an
unsigned char type constant is handled as unsigned char type.
If the calculation result overflows, cast to a type that can represent either constant or
specify the -QC1 or -QC (default) option simultaneously. By casting, changing the
data type can be avoided.
(Example) When -QC option is specified
int i;
i = 20*20
/* Negative value */
i = (int)20*20
/* 400 */
Remark However, if the -QU option is specified, all char type data are handled as
unsigned char type. Character constants in the range from ‘\200’ to ‘\377’
are handled as unsigned char type and have values from +128 to +255.
5
All versions from V1.00
[Cautions when using network]
When the directory where the temporary files are created is placed in a file system
shared on a network, file contention arises based on the type of network software
being used and incorrect operation results. This contention is avoided by setting the
options and the environment variables.
6
V2.20
[Usable assembler package]
CC78K4 V2.20 should be used with V1.30 and later versions of the assembler
package.
228
User’s Manual U11572EJ3V0UM00
APPENDIX B LIST OF USE-RELATED CAUTIONS
Number
7
Applicable Versions
All versions from V1.00
Cautions
[Creating link directive file]
When an area outside of the ROM or RAM area of the target device is used when
linking the objects created by the compiler, or when you want to place the code or
data at any specified address, create a link directive file and specify the -D option
when linking.
For information about creating link directive files, see RA78K4 Assembler Package
User’s Manual Operation (U11334E).
(Example Use) When you want to place external variables without initial value
(except sreg variables) in some C source file in external memory
1. Change the section name for external variables without initial value at the
beginning of the C source.
#pragma
section
@@DATA
EXTDATA
:
Caution Initialization of the changed segment and storing on ROM should be
performed by changing the startup routine.
2. Create the link directive file.
<78k4.dr>
memory EXTRAM : ( 0F0000h , 00200h )
merge
EXTDATA
:= EXTRAM
Heed the following points when creating a link directive file.
1. The compiler sometimes uses a portion of the short direct addressing area (saddr2
area) with the following compiler-specific objectives. Specifically, any 32-byte area
in (F)FD20H to (F)FDFFH is automatically secured and used.
(a) norec function arguments and automatic variables
(b) register variable when the -QR option was specified
(c) work area of the setjmp and longjmp functions = Area in (b)
(These functions save and return area (b))
When the -QR optimization option was not specified (default), the compiler does not
use areas (a) and (b). If the user does not use the setjmp and longjmp functions, the
area (c) is not used.
User’s Manual U11572EJ3V0UM00
229
APPENDIX B LIST OF USE-RELATED CAUTIONS
Number
7
Applicable Versions
All versions from V1.00
Cautions
2. If the -S automatic generation option for stack symbols is used when linking, the
stack area is secured by the memory directive of the link directive file. Explicitly
specifying the name of the secured stack area is recommended. If the area name
is omitted, it is used as the stack area in the RAM (except for the SFR area).
Example When added to the link directive file 78k4.dr
memory EXTRAM : ( 0F0000h , 00200h )
memory STK : (0FF700H, 100H)
merge EXTDATA := EXTRAM
(Command line)
> lk78k4 s4l.rel
prime.rel
-bcl4.lib
-SSTK
-D78k4.dr
3. The following error is output when linking in the defined memory area.
*** ERROR F206 Segment 'xxx' can't allocate to memory - ignored.
[Causes]
Because of insufficient space in the defined memory area, the indicated segment
cannot be located.
[Action]
The action is roughly divided into the following three steps.
1. Examine the size of a segment that cannot be located (see the .map file).
2. Based on the size of the segment examined in step 1, increase the size of
the area where the segment is located in the directive file.
3. Specify the directive file specification option (-D) and link.
However, based on the type of the segment marked by an error in step 1, the
method used to examine the segment size differs in the following way.
(1) When the segment is automatically generated during compilation
Examine the size of the segment by the map file that was linked and
created.
(2) When the segment was created by the user
Examine the size of a segment that was not located by the assemble list
file (.prn).
230
User’s Manual U11572EJ3V0UM00
APPENDIX B LIST OF USE-RELATED CAUTIONS
Number
8
Applicable Versions
All versions from V1.00
Cautions
[Cautions when using small model]
Note the following when using the small model (-MS).
In the small model, set 0H in the W, V, U, and T registers of WHL, VVP, UUP, and
TDE during startup. Then the code is generated to save all of the values (The values
of the W, V, U, and T registers are set by the startup routine provided by CC78K4).
Therefore, when the user describes and links the assembler source without using a
startup routine provided by CC78K4, the user first sets zeros in the W, V, U, and T
registers. Be careful not to corrupt the W, V, U, and T registers in the assembler
source.
9
All versions from V2.00
[Cautions when using medium model]
Note the following when using the medium model (-MM).
(a) The medium model can place 1 MB of code and 64 Kbytes of data. However, the
data is placed in 64 K in either 000000H to 00FFFFH or 0F0000H to 0FFFFFH by
the LOCATION value. If the code segments @@CNSTS (LOCATION 0) and
@@CNSTM (LOCATION 0F) are used, always place in the 64 K identical to the
area where the data is located.
(b) In the medium model, 0H is set if LOCATION 0 and 0FH is set if LOCATION 15 in
the V, U, and T registers of VVP, UUP, and TDE during startup. Then the code is
generated to save all of the values (The values of the V, U, and T registers are
set by the startup routine provided by CC78K4). Therefore, when the user
describes and links the assembler source without using a startup routine provided
by CC78K4, the user first sets the appropriate values in the V, U, and T registers.
Be careful not to corrupt the V, U, and T registers in the assembler source.
(c) When the address of data is referenced or when the low-order 2 bytes of the data
address are located at the 0000H position, it is judged to be equivalent to
comparing to the NULL pointer (The reason is the medium model only uses the
low-order 2 bytes of a data address).
10
All versions from V2.00
[Cautions when -ZO is not specified]
If -ZO is not specified, the operation of the va_start macro defined in stdarg.h is not
guaranteed (The reason is the offset of the first argument from this function differs).
Specifically, when a stdarg.h macro is used, the macro does not function normally in
<1> below. If there are at least two arguments as in <2>, the macro functions
correctly.
<1> void func(int p1, ...) ;
<2> void func(int p1, int p2, ...) ;
User’s Manual U11572EJ3V0UM00
231
APPENDIX B LIST OF USE-RELATED CAUTIONS
Number
11
Applicable Versions
All versions from V1.00
Cautions
[Cautions when using saddr1 or saddr2 area]
A variable with the same name as a variable declared with extern sreg (using saddr2
area) in one file is not declared with _ _sreg1 (using saddr1 area) in another file. Do
not do the reverse.
A variable with the same name as a variable declared with extern bit, boolean, or _
_boolean (using saddr2 area) in one file is not declared with _ _boolean1 (using
saddr1 area) in another file. Do not do the reverse.
If the above declarations are made, the operation is not guaranteed.
12
All versions from V1.00
[Cautions when referencing SFR (Special Function Register) constant address]
If the 16-bit SFR was referenced by a constant address reference, use the SFR name
to reference since illegal code is generated to access in 8-bit units.
13
All versions from V1.00
[Startup routines and libraries]
Use the provided startup routines and libraries with the same versions as the files in
the executable form (CC78K4.EXE or CC78K4).
14
All versions from V2.00
[-ZO option]
When the source was developed using CC78K4 V1.00 or when used with the
assembler, changes must be made unless the -ZO option is specified.
However, if the -ZO option is specified, the code efficiency drops and the functions in
CC78K4 V2.00 and later versions are not available.
15
All versions from V2.10
[Cautions when starting Project Manager]
When performing the processes from compiling to linking in Windows from the Project
Manager, specify the startup routine, libraries, and linker options in the linker option
setting dialog box in the Project Manager. Always specify “-O load-module-file-name”
in the linker options.
If the load module file name is not specified, the linker outputs the load module file
with the file name specified first when linking. However, since the default load
module file name is “source-file-name.LMF specified in the source file setting dialog
box”, if the load module file name output when linking differs, an object conversion
error occurs.
Remark
232
Specify the compiler options in the compiler option setting dialog box.
User’s Manual U11572EJ3V0UM00
APPENDIX B LIST OF USE-RELATED CAUTIONS
Number
16
Applicable Versions
All versions from V2.20
Cautions
[Cautions when source debugging with ID78K4]
When calling a pascal function, the Next command operates as the same as the Step
command. Return to the calling side of the function with the Return command, etc.
When the compile option -ZR is specified, all functions become pascal functions.
Therefore, the above phenomenon occurs in all functions.
When debugging the load module file that includes object module file specifying the
compile option -QL4, set the runtime library source provided by the compiler to the
current. During debug of this load module file, when specifying the Next or Step
command, the runtime library window will appear, and the current PC may move to
the runtime library side. In this case, set the break point in the next line of C source,
and return to the calling function side with the Go command.
17
All versions from V2.20
[Cautions when source debugging with SM78K4]
Do not execute the Next command when calling a pascal function. Otherwise, a
runaway will occur. When the compile option -ZR is specified, all functions become
pascal functions. Therefore, be sure not to execute the Next command when the -ZR
is specified.
When debugging the load module file that includes object module file specifying the
compile option -QL4, set the runtime library source provided by the compiler to the
current.
When debugging this load module file, do not execute the Next command because a
runaway may occur. When specifying the Step command, the runtime library window
will appear, and the current PC may move to the runtime library side. In this case, set
the break point in the next line of C source, and return to the calling function side with
the Go command.
User’s Manual U11572EJ3V0UM00
233
[MEMO]
234
User’s Manual U11572EJ3V0UM00
APPENDIX C LIST OF RESTRICTIONS
This chapter describes in detail the restrictions on CC78K4 and how to avoid them.
Number
Overview of Restrictions
1
If the type of the function is not specified in the prototype declaration, errors (F301, F701) result.
2
If there is a spelling mistake in the keyword at the beginning of the line outside a function, sometimes the display
position of the error line is offset, and an inappropriate error is output.
3
The initialization of an external variable declared extern within a block does not become an error. In addition, the
debugging information in the assembler source is incorrect.
4
Binding a variable with the same name to a variable declared extern in the block is sometimes illegal.
5
If there are comments before or in a preprocess directive, errors such as F803 or F814 result.
6
If a type defined by typedef (typedef name) is used in a function prototype declaration or a declaration using a const or
volatile type modifier, the typedef expansion is illegal, and an error results.
7
Sometimes a multidimensional array with an undefined size does not operate properly.
8
If the tag (for a structure, union, or enum) is used before defining it in a function prototype declaration, warning (W510)
or error (F737) results.
9
An array, structure, or union cannot be initialized by using the addresses of auto variables or arguments, or the return
values of functions in a function.
10
If the address of an extern callt function is referenced by initializing the function table and the callt function is called by
the same module, the assembler list is illegal and an assembler error results.
11
When a function returns a structure, an interrupt is generated in a process returning a return value. If there is a call to
the same function in the interrupt process, the return value is illegal after the interrupt process ends.
12
In a function returning the address of a function with arguments, those arguments cannot be referenced. There is no
error when referenced, but illegal code is output.
13
If the total size of auto variables in one function exceeds 65,535 bytes in the large model, the output code and the
debugging information will be incorrect.
User’s Manual U11572EJ3V0UM00
235
APPENDIX C LIST OF RESTRICTIONS
C.1 Details about Restrictions and Prevention Methods
• Restriction 1
[Description]
If the type of the function is not specified in the prototype declaration, errors (F301, F701) result.
[Reproduced example]
/* F301: Syntax error */
f(void);
/* F701: External definition syntax */
[Prevention method]
Add the int type for the function. For example, make the following change.
int
f(void);
All versions from V1.00 to V2.20
[Generation]
• Restriction 2
[Description]
If there is a spelling mistake in the keyword at the beginning of the line outside a function, sometimes the display
position of the error line is offset, and an inappropriate error is output.
[Reproduced example]
extrn int
/* extern is correct. */
i;
/* The error is actually output here. */
/*****************/
/*
Comment
*/
/******************/
void
[Prevention method]
[Generation]
236
/* F712,... errors are output. */
f(void);
None
All versions from V1.00 to V2.20
User’s Manual U11572EJ3V0UM00
APPENDIX C LIST OF RESTRICTIONS
• Restriction 3
[Description]
The initialization of an external variable declared extern within a block does not become an error. In addition, the
debugging information in the assembler source is incorrect.
According to the strict specifications, the description should produce an error, but the object defined as an
external variable with initial value is interpreted and the code is output. The debugging information in the object
output by the compiler is correct, but the debugging information in the assembler source is incorrect.
[Reproduced example]
int
i;
void
f(void) {
extern int
i = 2;
}
[Prevention method]
[Generation]
None
All versions from V1.00 to V2.20
• Restriction 4
[Description]
Binding a variable with the same name to a variable declared extern in the block is illegal in the following cases.
(1) When a variable declared with extern in a block and a variable declared with static after outside the block have
the same name
(Since no error occurs and there is no binding, illegal code is output when this variable is referenced)
(2) When a variable declared with extern in a block and a variable not declared with static after outside the block
have the same name
(There is no binding, and illegal code is output)
(3) When a variable declared with extern in a block and a variable not declared with extern before outside the block
have the same name, and an automatic variable declared in a block containing the block with the variable
declared with extern has the same name
(The variable outside the block and the variable declared with extern in the block are not bound, and illegal code
is output)
(4) A variable declared with extern in a block and a variable declared with extern in another block have the same
name
(There is no binding, and illegal code is output)
[Reproduced example 1]
void
f(void) {
extern int
i = 1;
i;
/* Illegal code output */
}
static int
i;
User’s Manual U11572EJ3V0UM00
237
APPENDIX C LIST OF RESTRICTIONS
[Reproduced example 2]
void
f(void) {
extern int
i;
/* Illegal code output */
i = 1;
}
int
i;
[Reproduced example 3]
int i = 1;
void
f(void) {
int
i;
{
extern int
i;
/* Illegal code output */
i = 1;
}
}
[Reproduced example 4]
void
f1(void) {
extern int
i;
i = 2;
}
void
f2(void){
extern int
i;
i = 3;
}
[Prevention method]
[Generation]
None
All versions from V1.00 to V2.20
• Restriction 5
[Description]
If there are comments before or in a preprocess directive, errors such as F803 or F814 result.
[Reproduced examples]
/* */ #pragma sfr
/* */ #define ONE
#define /* */ TWO
#ifdef /* */ ANSI_C
/* F803 */
1
/* F803 */
2
/* F814 */
/* F814 */
/* */ #endif
238
User’s Manual U11572EJ3V0UM00
APPENDIX C LIST OF RESTRICTIONS
[Prevention method]
In this case, do not specify the comments or describe them in other places. For example, make the following
descriptions.
#pragma sfr
#define ONE
1
#define TWO
2
/*
*/
/*
*/
/*
*/
#ifdef ANSI_C
/*
*/
#endif
/*
*/
All versions from V1.00 to V2.20
[Generation]
• Restriction 6
[Description]
If a type defined by typedef (typedef name) is used in a function prototype declaration or a declaration using a
const or volatile type modifier, the typedef expansion is illegal, and an error results.
[Reproduced example 1]
typedef int
FTYPE
int
FTYPE();
func;
func(void);
/* F713 Redefined 'func' */
[Reproduced example 2]
typedef int
VTYPE[2];
typedef int
*VPTYPE[3];
const VTYPE
*a;
const int
(*a)[2];
volatile VPTYPE
b[2];
volatile int *volatile
[Prevention method]
[Generation]
/* F713 Redefined 'a' */
b[2][3]; /* F713 Redefined 'b' */
None
All versions from V1.00 to V2.20
• Restriction 7
[Description]
Sometimes a multidimensional array with an undefined size does not operate properly. Omitting the number of
elements in an array is acceptable only for the first element.
[Reproduced example 1]
char
c[][3]={{1},2,3,4,5};
/* Illegal code */
User’s Manual U11572EJ3V0UM00
239
APPENDIX C LIST OF RESTRICTIONS
[Reproduced example 2]
char
c[][2][3]={"ab","cd","ef"};
/* Error (F756) is output. */
[Prevention method]
Define the size of the multidimensional array.
[Generation]
All versions from V1.00 to V2.20
• Restriction 8
[Description]
If the tag (for a structure, union, or enum) is used before defining it in a function prototype declaration, warning
(W510) or error (F737) results.
(1) If a tag is used in an argument declaration and a pointer type to a structure or union is specified, when a function
is called, warning (W510) results.
(2) If this tag is used in a return value type declaration or an argument declaration, and a structure, union, or enum
type is specified, error (F737) results.
[Reproduced example 1]
void
func(int, struct st *);
struct st {
char
memb1;
char
memb2;
} st[] = {
{ 1, 'a' }, { 2, 'b' }
};
void
caller(void){
func(sizeof(st)/sizeof(st[0]), st);
/* W510 Pointer mismatch */
}
[Reproduced example 2]
void
func1(int, struct st);
struct st
/* F737 Undeclared structure/union/enum tag */
/* F737 Undeclared structure/union/enum tag */
func2(int);
struct st {
char
memb1;
char
memb2;
};
[Prevention method]
Describe the definition of the tag of the structure, union, or enum beforehand.
[Generation]
240
All versions from V1.00 to V2.20
User’s Manual U11572EJ3V0UM00
APPENDIX C LIST OF RESTRICTIONS
• Restriction 9
[Description]
An array, structure, or union cannot be initialized by using the addresses of auto variables or arguments, or the
return values of functions in a function.
[Reproduced example]
void f(void);
void f(void) {
char * p, *p1, *p2 ;
char *ca[3] = {p, p1, p2} ;
/* F750 error */
}
[Prevention method]
In assignment statements, describe ca[0] = p;ca[1] = p1;ca[2] = p2;.
[Generation]
All versions from V1.00 to V2.20
• Restriction 10
[Description]
If the address of an extern callt function is referenced by initializing the function table and the callt function is
called by the same module, the assembler list is illegal and an assembler error results.
[Reproduced example]
callt extern void funca(void);
callt extern void funcb(void);
callt extern void funcc(void);
static void( * const func[] )()={
funca, funcb, funca
};
callf void func2(void){
funcc();
funcb();
funca();
}
[Prevention method]
Separate the function table and the function calling module.
[Generation]
All versions from V1.00 to V2.20
User’s Manual U11572EJ3V0UM00
241
APPENDIX C LIST OF RESTRICTIONS
• Restriction 11
[Description]
When a function returns a structure, an interrupt is generated in a process returning a return value. If there is a
call to the same function in the interrupt process, the return value is illegal after the interrupt process ends.
[Reproduced example]
struct str {
char c ;
int l ;
long l ;
} st ;
struct str func()
{
:
/* Interrupt generated */
}
void main()
{
st = func();
/* Interrupt generated */
}
If func was called before the interrupt in the above process, st may be corrupted.
[Prevention method]
[Generation]
242
None
All versions from V1.00 to V2.20
User’s Manual U11572EJ3V0UM00
APPENDIX C LIST OF RESTRICTIONS
• Restriction 12
[Description]
In a function returning the address of a function with arguments, those arguments cannot be referenced. There is
no error when referenced, but illegal code is output.
[Reproduced example]
char *c;
int
*i;
void (*f1(int *))(char *);
void (*f2(void))(char *);
void (*f3(int *))(void);
void main() {
/* Correct description */
(*f1(i))(c);
*** WARNING W510 Pointer mismatch in function 'f1'
(*f1(i))(i);
/* Incorrect description */
(*f2())(c);
/* Correct description */
*** WARNING W508 Too many actual arguments
(*f2())();
/* Incorrect description */
(*f3(i))();
/* Correct description */
*** WARNING W509 Too few actual arguments
/* Incorrect description */
(*f3(i))(i);
}
W508, W509, or W510 is output for a correct description. Nothing is output for a description that should produce a
warning. However, the output code is normal.
void (*f4())(int p) {
/* Incorrect description */
p++;
}
An error is not output for a description that should cause an error. Illegal code is generated.
[Prevention method]
[Generation]
None
All versions from V1.00 to V2.20
User’s Manual U11572EJ3V0UM00
243
APPENDIX C LIST OF RESTRICTIONS
• Restriction 13
[Description]
If the total size of auto variables in one function exceeds 65,535 bytes in the large model, the output code and the
debugging information will be incorrect.
[Reproduced example] (When -ML is specified)
void func(long a, int b) {
int i;
char tab1[35000] ;
char tab2[35000] ;
i = b ;
}
[Prevention method]
Set the total size of auto variables in one function to 65,535 bytes or less.
[Generation]
244
All versions from V1.00 to V2.20
User’s Manual U11572EJ3V0UM00
APPENDIX D INDEX
Error level ...............................................................159
[A]
Error list file ..............................................91, 151, 225
ABORT .......................................................... 159, 190
ERRSTK.ASM ........................................................164
ANSI-C..................................................................... 19
EXIT status.............................................................159
*.ASM....................................................................... 50
_errno .....................................................................183
Assembler................................................................ 25
-E option .................................................................125
Assembler source .................................................. 227
Assembler source module file.................. 91, 147, 217
[F]
AUTOEXEC.BAT ............................................... 39, 44
FATAL ....................................................................190
-A option ................................................................ 121
FATAL ERROR ......................................................159
_@FNCENT ...........................................................183
[B]
_@FNCTBL............................................................183
Build......................................................................... 31
_@BRKADR .......................................................... 183
[C]
-F option .................................................................138
[G]
GETCHAR.ASM .............................................163, 164
CC78K4.EXE ........................................................... 50
CC78K4.MSG .......................................................... 50
CC78K4P.DLL ......................................................... 55
-G option...........................................................29, 114
[H]
CER ......................................................................... 91
Hardware initialization function ..............................175
cl4.lib ....................................................................... 81
hdwinit function ..............................................168, 175
cl4e.lib ..................................................................... 86
HER..........................................................................91
Constant address reference .................................. 232
*.H ............................................................................50
Cross-reference list file ............................ 91, 156, 224
*.HLP ........................................................................50
CSTART.ASM........................................ 164, 168, 169
--/-?/-H option .........................................................140
cstart.asm .............................................................. 170
CSTARTN.ASM ..................................... 164, 168, 169
[I]
CSTART*.ASM ................................................ 50, 169
INC78K.....................................................49, 120, 160
C compiler........................................................ 24, 159
Include file ........................................................91, 227
C source module file .................................. 23, 91, 215
*.INC.................................................................50, 164
-C option ................................................................ 103
-I option ..................................................................120
-CS option.............................................................. 142
[K]
[D]
-K option .................................................................116
Debugger ................................................................. 29
[L]
$DGL ..................................................................... 114
$DGS ..................................................................... 114
LANG78K .........................................................49, 160
_@DIVR................................................................. 183
Large model ...................................................141, 142
*.DLL........................................................................ 50
LIB78K4............................................................49, 160
dosinst.bat ....................... 34, 35, 44, 45, 50, 161, 162
Librarian ...................................................................28
-D option ................................................................ 118
Library ..............................................................51, 232
Library file.................................................................51
[E]
Library function.......................................................183
ECC ......................................................................... 91
Library naming rule...................................................52
Environment variable ............................................... 49
Library switch .................................................171, 183
ER............................................................................ 91
Link directive file.....................................172, 185, 229
User’s Manual U11572EJ3V0UM00
245
APPENDIX D INDEX
Linker ....................................................................... 26
Location ................................................................. 175
Location function.................................................... 142
LONGJMP.ASM ............................................. 163, 164
_@LDIVR............................................................... 183
[Q]
-Q option................................................................ 110
-QC option ..................................................... 112, 228
-QU option ..................................................... 112, 228
-LF option............................................................... 134
[R]
-LI option ................................................................ 135
REPERRST.BAT ............................................. 50, 163
-LL option ............................................................... 132
REPGETC.BAT ..................................................... 163
-LT option............................................................... 133
REPPUTC.BAT...................................................... 163
-LW option.............................................................. 131
REPPUTCS.BAT ................................................... 163
[M]
REPROM.BAT ................................................. 50, 163
Medium model ....................................... 141, 142, 231
Memory model ....................................................... 141
MKSTUP.BAT .......................................... 50, 163, 165
mkstup.sh....................................................... 162, 165
_@MEMBTM.................................................. 183, 184
_@MEMTOP.................................................. 183, 184
-ML option .............................................................. 141
-MM option ............................................. 141, 175, 185
-MS option.............................................. 141, 175, 185
REPSELO.BAT...................................................... 163
REPSELON.BAT ................................................... 163
Reset vector .......................................................... 175
ROM.ASM........................................ 50, 163, 164, 169
rom.asm................................................................. 181
ROM processing............................ 167, 176, 178, 186
ROM routine .......................................................... 163
Runtime library .................................................. 51, 98
-R option ................................................................ 107
-RD option ............................................................. 108
[N]
-RS option.............................................................. 109
-NG option.............................................................. 114
[S]
-NO option.............................................................. 106
-NQ option.............................................................. 110
-NR option.............................................. 107, 108, 109
-NZ option .............................................................. 144
saddr1.................................................................... 232
saddr2.................................................................... 232
SETJMP.ASM................................................ 163, 164
setupxx.exe ....................................................... 34, 35
Small model........................................... 141, 142, 231
[O]
Object converter....................................................... 27
Object module file ............................................ 91, 147
On-line help file ........................................................ 50
Optimization ............................................................. 95
Option setting dialog box ......................................... 57
-O option ................................................................ 106
Source debugging ................................................. 233
Source file name.................................................... 227
Stack pointer.......................................................... 175
Standard library ................................................. 51, 98
Startup module ...................................................... 186
Startup routine ........................... 51, 98, 161, 167, 232
Startup routine naming rule ..................................... 52
[P]
Stored on ROM........................................................ 98
Parameter file..................................................... 75, 91
System simulator ..................................................... 30
PATH ............................................................... 49, 160
s4l.rel ....................................................................... 98
Preprocess list file.................................... 91, 154, 222
s4lb.rel ..................................................................... 81
prjtman.exe .............................................................. 34
s4le.rel ..................................................................... 86
Project Manager......................................... 31, 55, 232
S4*.REL................................................................. 169
PUTCHAR.ASM ............................................. 163, 164
_@SEED ............................................................... 183
#pragma pc ............................................................ 103
_@STBEG..................................................... 171, 175
_PUTCHAR.ASM ........................................... 163, 164
-SA option.............................................................. 122
-P option................................................................. 115
-SE option.............................................................. 127
246
User’s Manual U11572EJ3V0UM00
APPENDIX D INDEX
[T]
tar command................................................ 35, 46, 47
Temporary file.......................................................... 91
TMP ................................................................. 49, 160
_@TOKPTR........................................................... 183
-T option................................................................. 139
[U]
-U option ................................................................ 119
[V]
VECTXX.ASM........................................................ 164
-V option ................................................................ 137
[W]
WARNING ..................................................... 159, 190
windpmi.386....................................................... 48, 50
-W option ............................................................... 136
[X]
-X option ................................................................ 129
[Y]
-Y option ................................................................ 146
[Z]
-Z option................................................................. 144
-ZO option...................................................... 231, 232
User’s Manual U11572EJ3V0UM00
247
[MEMO]
248
User’s Manual U11572EJ3V0UM00
Facsimile Message
From:
Name
Company
Tel.
Although NEC has taken all possible steps
to ensure that the documentation supplied
to our customers is complete, bug free
and up-to-date, we readily accept that
errors may occur. Despite all the care and
precautions we've taken, you may
encounter problems in the documentation.
Please complete this form whenever
you'd like to report errors or suggest
improvements to us.
FAX
Address
Thank you for your kind support.
North America
Hong Kong, Philippines, Oceania
NEC Electronics Inc.
NEC Electronics Hong Kong Ltd.
Corporate Communications Dept. Fax: +852-2886-9022/9044
Fax: 1-800-729-9288
1-408-588-6130
Korea
Europe
NEC Electronics Hong Kong Ltd.
NEC Electronics (Europe) GmbH
Seoul Branch
Technical Documentation Dept.
Fax: 02-528-4411
Fax: +49-211-6503-274
South America
NEC do Brasil S.A.
Fax: +55-11-6462-6829
Asian Nations except Philippines
NEC Electronics Singapore Pte. Ltd.
Fax: +65-250-3583
Japan
NEC Semiconductor Technical Hotline
Fax: 044-435-9608
Taiwan
NEC Electronics Taiwan Ltd.
Fax: 02-2719-5951
I would like to report the following error/make the following suggestion:
Document title:
Document number:
Page number:
If possible, please fax the referenced page or drawing.
Document Rating
Excellent
Good
Acceptable
Poor
Clarity
Technical Accuracy
Organization
CS 00.6