NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
CA830 CA850 U13998EJ1V0UM00 V850E V850E/MS1 V830/V850 V850ETM U13997E U13996E - Datasheet Archive
CA830, CA850 C Compiler Package Operation Target Devices V830 FamilyTM V850 FamilyTM Supported Compilers CA830 Ver. 2.20 or later
User's Manual CA830 CA830, CA850 CA850 C Compiler Package Operation Target Devices V830 FamilyTM V850 FamilyTM Supported Compilers CA830 CA830 Ver. 2.20 or later CA850 CA850 Ver. 2.20 or later Document No. U13998EJ1V0UM00 U13998EJ1V0UM00 (1st edition) Date Published October 1999 N CP(K) © 1998 1999 Printed in Japan [MEMO] 2 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 V800 Series, V810 Family, V830 Family, V850 Family, V852, V853, V850E V850E, and V850E/MS1 V850E/MS1 are trademarks of NEC Corporation. Windows, WindowsNT, and MS-DOS are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company, Limited. SPARCstation is a trademark of SPARC International, Inc. Solaris and SunOS are trademarks of Sun Microsystems, Inc. TRON is an abbreviation for The Realtime Operating system Nucleus. ITRON is an abbreviation for Industrial TRON. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 3 The export of these products from Japan is regulated by the Japanese government. The export of some or all of these products may be prohibited without governmental license. To export or re-export some or all of these products from a country other than Japan may also be prohibited without a license from that country. Please call an NEC sales representative. · The information in this document is subject to change without notice. Before using this document, please confirm that this is the latest version. · No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Corporation. NEC Corporation assumes no responsibility for any errors which may appear in this document. · NEC Corporation does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from use of a device described herein or any other liability arising from use of such device. No license, either express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Corporation or of 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 the customer's equipment shall be done under the full responsibility of the customer. NEC Corporation assumes no responsibility for any losses incurred by the customer or third parties arising from the use of these circuits, software, and information. M7A 98. 8 4 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 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 (France) S.A. 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. Spain Office Madrid, Spain Tel: 91-504-2787 Fax: 91-504-2860 United Square, Singapore 1130 Tel: 65-253-8311 Fax: 65-250-3583 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 Hong Kong Ltd. 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 Rodovia Presidente Dutra, Km 214 07210-902-Guarulhos-SP Brasil Tel: 55-11-6465-6810 Fax: 55-11-6465-6829 J99.1 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 5 [MEMO] 6 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 INTRODUCTION Target Devices The V800 SeriesTM is a C Compiler Package to create object codes for NEC's RISC microprocessors V800 Series, and is provided for each family. The V830 FamilyTM has inherited the basic instruction set of the V810 FamilyTM. Accordingly, software resources that have been created for the V810 Family can be used as it is. Readers This manual is intended for developers of application systems that use the V830/V850 V830/V850 Family C Compiler Package under WindowsTM or UNIXTM. Purpose This manual explains how to operate each command, such as C compilers and assemblers included in each package, on Windows or Unix. A Project Manager (for Windows version only) is provided included in this C compiler package. However, for how to operate it as an integrated development, refer to the Project Manager User's Manual. For the Windows operation, refer to the function guides provided with the Windows OS. Organization This manual is organized by following sections. · Overview of the CA · Using the CA from the command line · Using the CA from the Project Manager · Command functions, options, and output messages Commands included in this package C compiler (ca) Assembler (as) Link editor (ld) Archiver (ar) Hexa-converter (hx) Dump command (dump) Disassembler (dis) ROMization processor (romp) Section file generator (sf) V850 How to Read · This manual explains two families of C compiler Packages (CA830 CA830 and CA850 CA850). For specific This Manual functions to each family, a targeted family is specified as an indication of a title name or symbols such as V830 or V850 . When no specification is indicated, both families are targeted. Unless otherwise specified, when the command name for a particular family is described, the description pertains to both families. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 7 · In descriptions applying to both families, the package name and directory name are abbreviated as "CA" and "lib*". These package names and directory names should be understood as follows, depending on the target device. Package name CA: CA830 CA830 or CA850 CA850 : Directory name lib*: lib830 or lib850 · Within the V850 Family, specific functions to the V850ETM V850ETM are indicated by a title name or the symbol " V850E V850E ". · In this manual, directory path dividers or command line prompts are based on the Windows OS. Therefore, the backward slash (\) is used as the directory path divider, which corresponds to the forward slash (/) under UNIX. Related Documents Refer to the documents listed below as documents related to this manual. The related documents indicated in this publication may include preliminary versions. However, preliminary versions are not marked as such. Documents related to development tools (user's manuals) Document name CA830 CA830, CA850 CA850 (C Compiler Package) Document No. Operation This manual C language U13997E U13997E Project Manager U13996E U13996E CA830 CA830 (C compiler package) Assembly language U14370E U14370E CA850 CA850 (C compiler package) Assembly language U13828E U13828E ID850 ID850 (Ver. 2.00 or later) (integrated debugger) Operation version, Windows based U14217E U14217E SM850 SM850 (Ver. 2.00 or later) (system simulator) Operation version, Windows based U13759E U13759E V800 Series Development Tools (32-bit support) Application Note Tutorial Guide, Windows based U14218E U14218E RX830 RX830 (Real-time OS) Fundamental U11730E U11730E Installation U11731E U11731E Fundamental U13152E U13152E Installation U13151E U13151E Basics U13430E U13430E Installation U13410E U13410E Fundamental U13773E U13773E Installation U13774E U13774E ITRON1 µITRON Ver.3.0 RX850 RX850 (Real-time OS) RX850 RX850 Pro (Real-time OS) RD830 RD830 (Task Debugger) RD850 RD850 (Ver. 3.0) (Task Debugger) U13737E U13737E RD850 RD850 Pro (Ver. 3.0) (Task Debugger) U13916E U13916E AZ850 AZ850 (System Performance Analyzer) 8 U13946E U13946E U11181E U11181E User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CONTENTS CHAPTER 1 GENERAL . 21 1.1 Features of the CA. 21 1.2 Operating Environments . 23 CHAPTER 2 INSTALLATION . 25 2.1 Installation. 25 2.1.1 2.1.2 2.2 2.3 Installation of Windows version . 25 Install UNIX version . 32 Directory Organization. 35 Uninstall . 36 2.3.1 Uninstall Windows version . 36 2.3.2 Uninstall UNIX version. 38 CHAPTER 3 C COMPILER (ca830/ca850). 39 3.1 General . 39 3.1.1 I/O files . 41 3.1.3 3.2 Flow of operation . 39 3.1.2 Processing up to creation of executable object . 41 Operation Method. 43 3.2.1 3.3 Command line input method. 43 3.2.2 Project Manager method . 43 Types and Features of Options. 44 3.3.1 3.4 Settings Made Via Project Manager. 56 3.4.1 3.5 Option list . 44 Tabs for displaying option setting dialog boxes . 56 Cautions . 75 3.5.1 3.5.2 Command files . 75 3.5.3 Efficient use of optimization . 76 3.5.4 Effects of optimization on debugging. 79 3.5.5 3.6 Cautions on specifying multiple options. 75 Output of bdld directive V830 . 81 Compiler's Output Messages . 85 3.6.1 Message format. 85 3.6.2 Messages. 86 CHAPTER 4 ASSEMBLER (as830/as850). 109 4.1 Overview. 109 4.1.1 4.1.2 4.2 Flow of operation . 109 I/O files . 109 Operation Method. 110 4.2.1 4.3 Command input format from command line . 110 4.2.2 Method using Project Manager. 110 Types and Features of Options. 111 4.3.1 Option list . 111 4.3.2 Magic number. 114 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 9 4.3.3 Options for avoiding CPU faults V850 . 116 4.4 Settings Made via Project Manager . 118 4.5 4.6 Assembly List . 124 Assembler's Output Messages . 127 4.4.1 Tabs for displaying option setting dialog boxes. 118 4.6.1 Message format . 127 4.6.2 Messages . 127 CHAPTER 5 LINKER (ld830/ld850). 135 5.1 Overview . 135 5.1.1 5.2 Flow of operation . 135 5.1.2 Link procedure . 137 Operation Method . 139 5.2.1 5.2.2 5.3 Command input format from command line. 139 Method using Project Manager . 139 Types and Features of Options. 139 5.3.1 5.4 Option list. 139 5.3.2 Use of -A option. 145 Settings Made via Project Manager . 150 5.4.1 5.5 5.6 Tabs for displaying option setting dialog boxes. 150 Link Map . 159 Cautions . 162 5.6.1 Reserved symbols. 162 5.6.3 File name in link directive. 163 5.6.4 Link between V850 family object file and V850E V850E object file . 163 5.6.5 Linking mathematical libraries. 163 5.6.6 main function. 164 5.6.7 Flash/external ROM relink function . 164 5.6.8 Prologue/epilogue runtime library. 180 5.6.9 5.7 Use of archive files. 162 5.6.2 Linking for ROMization . 181 Linker Output Messages . 182 5.7.1 Message format . 182 5.7.2 Messages . 183 CHAPTER 6 LINK DIRECTIVE . 197 6.1 Overview . 197 6.1.1 6.2 Link directive . 197 6.1.2 Items specified in a link directive . 197 Sections and Segments . 198 6.2.1 6.2.2 Segments . 199 6.2.3 Relation between segments and sections . 200 6.2.4 Types of sections . 201 6.2.5 6.3 Sections . 198 Section types and attributes . 207 Symbols. 208 6.3.1 6.3.2 10 Text pointer (tp) . 208 Global pointer (gp) . 209 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 6.3.3 Rules for determining gp symbol values. 210 6.3.5 6.4 Offset specification for gp symbol values. 210 6.3.4 Element pointer (ep) . 212 Link Directive Format. 213 6.4.1 6.5 Characters used in a link directive file. 214 6.4.2 Link directive file name . 214 Segment Directive Format . 215 6.5.1 6.5.2 Segment name . 216 6.5.3 Segment type . 216 6.5.4 Segment attributes. 216 6.5.5 Address. 217 6.5.6 Maximum memory size. 217 6.5.7 Hole size . 217 6.5.8 Fill value. 218 6.5.9 Alignment condition . 218 6.5.10 6.6 Specification items . 215 Example of segment directive specification . 218 Mapping Directive Format . 219 6.6.1 Output section name . 220 6.6.3 Section type. 220 6.6.4 Section attributes. 221 6.6.5 Address. 221 6.6.6 Hole size . 221 6.6.7 Alignment condition . 222 6.6.8 Input section name/object file name . 222 6.6.9 6.7 Specification items . 219 6.6.2 Mapping directive specification example . 224 Symbol Directive Format . 225 6.7.1 Specification items . 225 6.7.2 Symbol name. 227 6.7.3 Symbol type. 227 6.7.4 Base symbol name . 227 6.7.5 Address. 228 6.7.6 Alignment condition . 228 6.7.7 Segment name . 229 6.7.8 Symbol directive specification example . 229 6.8 Directive Coding Examples . 230 6.9 Default Link Directive. 237 6.10 Reference Examples of Link Directives . 238 CHAPTER 7 ROMIZATION PROCESSOR (romp830/romp850) . 243 7.1 Overview. 243 7.1.1 Flow of operation . 243 7.1.2 I/O files . 245 7.1.3 Types of sections to be packed. 246 7.1.4 Size of rompsec section . 247 7.1.5 Steps in (default) creation of ROMization object . 248 7.1.6 Steps in (custom) creation of ROMization object . 252 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 11 7.1.7 7.2 Copy function (_rcopy) . 257 Operation Method . 259 7.2.1 7.3 Command input format from command line. 259 7.2.2 Method using Project Manager . 259 Types and Features of Options. 260 7.3.1 7.4 Settings Using Project Manager. 262 7.4.1 7.5 Option list. 260 Tabs for displaying option setting dialog boxes. 262 ROMization Processor's Output Messages . 266 7.5.1 Message format . 266 7.5.2 Messages . 266 CHAPTER 8 HEXADECIMAL CONVERTER (hx830/hx850) . 269 8.1 Overview . 269 8.1.1 8.2 Flow of operation . 269 8.1.2 I/O files . 269 Operation Method . 270 8.2.1 8.2.2 8.3 8.4 Command line input method. 270 Method using Project Manager . 270 Types and Features of Options. 271 Settings Made via Project Manager . 273 8.4.1 8.5 Tabs for displaying option setting dialog boxes. 273 Hexadecimal File Formats . 278 8.5.1 8.5.2 Motorola S type hex format . 281 8.5.3 8.6 Intel expanded hexadecimal format . 278 Expanded Tek hex format. 283 Hexadecimal Converter's Output Messages. 286 8.6.1 Message format . 286 8.6.2 Messages . 286 CHAPTER 9 ARCHIVER (ar830/ar850). 291 9.1 Overview . 291 9.1.1 9.1.2 9.2 Flow of operation . 291 I/O files . 291 Operation Method . 292 9.2.1 9.3 Command line input method. 292 9.2.2 Method using Project Manager . 292 Types and Functions of Keys and Options. 293 9.3.1 9.3.2 9.4 Types and functions of keys . 293 Types and functions of options . 294 Archiver's Output Messages . 295 9.4.1 Message format . 295 9.4.2 Messages . 295 CHAPTER 10 DUMP COMMAND (dump830/dump850). 297 10.1 Overview . 297 10.1.1 Flow of operation . 297 10.2 Operation Method . 298 12 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 10.3 Types and Features of Options. 299 10.3.1 Option list . 299 10.4 Dump List Display Format . 300 10.4.1 Archive header . 300 10.4.2 Archive symbol table . 300 10.4.3 Archive string table. 300 10.4.4 ELF header . 300 10.4.5 Program header table . 301 10.4.6 Section header table . 301 10.4.7 String table . 301 10.4.8 Symbol table. 301 10.4.9 Relocation information . 302 10.4.10 Register mode information . 302 10.4.11 Global pointer table . 302 10.4.12 Line number information. 302 10.4.13 Debug information . 303 10.4.14 PROGBITS data . 303 10.4.15 Element values and meanings. 303 10.5 dump Command's Output Messages . 305 10.5.1 Message format. 305 10.5.2 Messages. 305 CHAPTER 11 DISASSEMBLER (dis830/dis850) . 307 11.1 Overview. 307 11.1.1 11.2 11.3 11.4 11.5 11.6 Flow of operation . 307 Operation Method. 307 Types and Features of Options. 308 Caution Points . 309 Disassembler Output Examples . 309 Disassembler's Output Messages . 310 11.6.1 Message format. 310 11.6.2 Messages. 310 CHAPTER 12 SECTION FILE GENERATOR (sf850) . 311 12.1 Overview. 311 12.2 Section Files . 311 12.3 Use of Section File . 314 12.3.1 Activation from command line. 314 12.3.2 Activation via Project Manager. 315 12.4 Section File Generator . 317 12.4.1 Operation method . 317 12.4.2 Types and features of options . 317 12.4.3 Section file generator's output messages . 319 12.5 Section Files . 320 APPENDIX A FORMAT OF OBJECT FILE . 325 A.1 Structure of Object File. 325 A.2 ELF Header. 326 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 13 A.3 Program Header Table . 327 A.4 Section Header Table . 328 A.4.1 Section types . 329 A.4.2 Constituent elements (link/info) dependent on section type . 329 A.5 Sections. 330 A.5.1 Symbol table . 331 A.5.2 String table. 332 A.5.3 Reserved sections. 333 APPENDIX B INDEX . 335 14 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 LIST OF FIGURES (1/3) Figure No. Title Page 1-1 Composition of CA Package . 22 2-1 Directory Organization . 35 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8 3-9 3-10 3-11 3-12 Operation Flow of ca. 40 Input Option Settings Dialog Box . 57 Preprocessor Option Settings Dialog Box . 58 Language Option Settings Dialog Box . 60 Optimization 1 Option Settings Dialog Box. 61 Optimization Level 2 Option Settings Dialog Box . 63 Output 1 Option Settings Dialog Box . 65 Output 2 Option Settings Dialog Box . 67 Output 3 Option Settings Dialog Box . 69 Message Option Settings Dialog Box . 71 Dialog Box for Other Option Settings (C Compiler) . 73 Optimization Processing and Parameters . 76 4-1 4-2 4-3 4-4 4-5 4-6 as Operation Flow. 109 Image of Creating Common Object with as . 114 Dialog Box for Option 1 Settings (Assembler) . 119 Dialog Box for Option 2 Settings (Assembler) . 120 Dialog Box for Other Option Settings (Assembler) . 123 Example of Output Assembly List. 125 5-1 5-2 5-3 5-4 5-5 5-6 5-7 5-8 5-9 5-10 5-11 5-12 5-13 5-14 5-15 5-16 5-17 5-18 5-19 Batch Processing and Modular Processing . 135 ld's Operation Flow . 136 ld Operation Image (Example) . 136 Creation of Output Section. 137 Allocation to Memory Space . 137 Image of Memory Location of gp Offset Reference Section . 146 File Option Settings Dialog Box (Linker). 151 Library Option Settings Dialog Box . 152 Flash Option Settings Dialog Box . 154 Option Settings Dialog Box (Linker). 155 Other Option Settings Dialog Box (Linker). 158 Link Map Output Example. 160 File Creation Flow . 166 Image of Function Calls from Boot Area to Flash Area. 168 Image of Interrupt Function Call when Interrupt Vector Is in Flash Area . 169 Image of Interrupt Function Call when Interrupt Vector Is in Boot Area. 170 Example of Correct Allocation of Branch Table . 174 Example of Branch Table Overlap with Segment Having Address Specification . 175 Example of Branch Table Overlap with Segment without Address Specification . 176 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 15 LIST OF FIGURES (2/3) Figure No. Title Page 6-1 6-2 6-3 6-4 6-5 6-6 6-7 6-8 6-9 6-10 6-11 Segment Directives and Mapping Directives. 197 Symbol Directive. 198 Relation between Segments and Sections. 200 Example of Memory Allocation Image of CA830 CA830 Sections . 203 Example of Memory Allocation Image to Various Sections by CA850 CA850 (with Internal ROM) . 206 Example of tp Setting . 208 Example of gp Setting . 209 Example of gp Setting when Specifying Offset from tp . 210 Rules for Determining Global Pointer Values . 211 Example of ep Setting . 212 Outline of Link Directive Format . 213 7-1 7-2 7-3 7-4 7-5 7-6 7-7 7-8 7-9 7-10 7-11 7-12 7-13 7-14 Creation of Object for ROMization. 243 Image of Processing Immediately after _rcopy Function Call . 244 Use Example of Copy Function _rcopy(). 248 Link Directive Specification Example . 248 ROMization Image 1 (for V830 Family) . 250 ROMization Image 1 (for V850 Family) . 251 Example of rompack.s . 252 Use Example of Copy Function _rcopy(). 253 Link Directive Specification Example . 253 ROMization Image 2 (for V830 Family) . 255 ROMization Image 2 (for V850 Family) . 256 File Option Settings Dialog Box (ROMization Processor) . 263 Option Settings Dialog Box (ROMization Processor) . 264 Other Option Settings Dialog Box (ROMization Processor) . 265 8-1 8-2 8-3 8-4 8-5 8-6 8-7 8-8 Operation Flow in hx. 269 File Option Settings Dialog Box (Hex Converter) . 274 Format Option Settings Dialog Box . 275 Option Settings Dialog Box (Hex Converter) . 276 Other Option Settings Dialog Box (Hex Converter) . 277 File Configuration in Intel Expanded Hex Format. 278 File Configuration of Motorola S Type Hex Format . 281 File Configuration of Expanded Tek Hex Format . 283 9-1 The Ar's Operation Flow . 291 10-1 Operation Flow of dump Command. 297 11-1 Operation Flow of dis Command . 307 12-1 12-2 Image of Compilation Using Section File Specifications . 312 Creation of Frequency Information File . 315 16 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 LIST OF FIGURES (3/3) Figure No. Title Page 12-3 12-4 12-5 Creation of Section Data File . 316 Example of Section File Output by sf850. 320 Example of Section File Output by sf850 Using -O Option . 321 A-1 A-2 Object File Structures . 325 Relation between Indexes and Character Strings in String Table . 332 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 17 LIST OF TABLES (1/2) Table No. Title Page 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8 Input Options . 44 Preprocessor Options . 45 Language Options . 46 Optimization Options . 47 Output Options. 50 Message Options. 53 Other Options . 54 C Compiler Option Setting Dialog Box . 56 4-1 4-2 4-3 4-4 4-5 4-6 Option 1 (Assembler). 111 Option 2 (Assembler). 112 Other Options (Assembler) . 113 Correspondence between Created Objects and -p Options . 117 Assembler Option Setting Dialog Box . 118 Section Attributes and Their Meanings. 126 5-1 5-2 5-3 5-4 5-5 5-6 5-7 File Options (Linker) . 140 Library Options . 140 Flash Options . 141 Options (Linker) . 142 Other Options (Linker) . 143 Linker Option Setting Dialog Box. 150 Special Symbols in Ordinary Object File . 163 6-1 6-2 6-3 6-4 6-5 6-6 6-7 6-8 6-9 6-10 6-11 6-12 6-13 6-14 6-15 6-16 6-17 6-18 6-19 6-20 CA830 CA830's Allocation Section Types. 202 CA850 CA850's Allocation Section Types. 204 Allocation Method for .tidata Section . 205 Section Types. 207 Section Attributes . 207 Types of Sections . 207 Items Specified via Segment Directive . 215 Default Values for Omitted Segment Directive Specification Items. 215 Reserved Section Names with Fixed Segment Names. 216 Segment Attributes and Their Meanings . 216 Segment Example . 218 Items Specified via Mapping Directive. 219 Default Values/Conventions for Values Can be Omitted in Mapping Directive Specification Items. 219 Input Section Names with Fixed Output Section Names. 220 Section Types. 220 Section Attributes and Their Meanings. 221 Section Types and Default Values for Alignment Condition . 222 Output Based on Combination of Input Section and Object File Specifications . 222 Specific Examples of Combined Input Section/Object File Specifications . 223 Mapping Directive Specification Example . 224 18 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 LIST OF TABLES (2/2) Table No. Title Page 6-21 6-22 6-23 6-24 6-25 6-26 6-27 6-28 Specifiable Items when Creating tp Symbol . 225 Default Values for tp Symbols . 225 Specifiable Items when Creating gp Symbol . 226 Default Values for gp Symbols . 226 Specifiable Items when Creating ep Symbol . 227 Address Specification for tp Symbol and gp Symbol . 228 Segment Names Targeted for Reference by tp Symbol and gp Symbol . 229 Symbol Directive Specification Example . 229 7-1 7-2 7-3 7-4 7-5 Reserved Sections Packed by Romp . 246 File Options (ROMization Processor) . 260 Options (ROMization Processor) . 261 Other Options (ROMization Processor) . 261 ROMization Processor Option Setting Dialog Box. 262 8-1 8-2 8-3 8-4 File Options (Hexadecimal Converter). 271 Format Options (Hexadecimal Converter) . 271 Other Options (Hex Converter) . 272 Hex Converter Option Setting Dialog Box. 273 9-1 9-2 ar's Key List . 293 ar's Options . 294 10-1 dump Options. 299 11-1 dis Options . 308 12-1 12-2 12-3 12-4 12-5 sf's Options . 317 Variable Types and Displays . 320 Variable Types and Displays . 321 Types of Sections Specifiable by CA830 CA830. 322 Types of Sections Specifiable by CA850 CA850. 322 A-1 A-2 A-3 A-4 A-5 A-6 A-7 Constituent Elements of ELF Header and Their Meanings. 326 Constituent Elements of Program Header Entries and Their Meanings . 327 Constituent Elements of Section Header Entries and Their Meanings. 328 Section Types and Their Meanings . 329 Meanings of link and info . 329 Constituent Elements of Symbol Table Entries and Their Meanings. 331 Reserved Sections. 333 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 19 [MEMO] 20 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 1 GENERAL 1.1 Features of the CA The CA (C compiler package) provides the following features. · ANSI-compliant language specification The C language used in this manual complies with the ANSI standard. They are also compatible with the conventional C language specification (K & R specification). · Advanced optimization The C compiler/assembler provide multi-level optimization. · Features for embedded control A utility is provided to facilitate ROMization of the application system. · Improved description The expanded language specification provides improved descriptions of C-language programming. In addition, the following operation-related features are provided in the Windows-based C compiler package. · Activation from the Project Manager The CA can be activated from an integrated environment (Project Manager) that provides an excellent user interface. The Project Manager, a control software package that efficiently activates various tools operating under Windows, is included in the CA package. · Activation from the command line The Windows-based CA version can be activated from the MS-DOS prompt and the UNIX-based CA version can be activated directly from the command line. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 21 CHAPTER 1 GENERAL Figure 1-1. Composition of CA Package Project Manager MS-DOS prompt Option specification Tool-related DLLs Command line activation CA package command C compiler Assembler Link editor ROMization processor Hexa-converter Archiver Disassembler Dump command Section file generator V850 The Project Manager runs under Windows and provides graphical application development environments. Consequently, the Project Manager can be used to specify options for the C compiler, assembler, link editor, and ROMization processor, so that the corresponding commands are automatically activated to enable creation of an application load module. The CA830 CA830 and CA850 CA850 C compiler packages also provide command line-based application development environments. As a result, not only the C compiler, assembler, link editor, and ROMization processor but also the archiver, hex converter, and other utilities or tools can be started either from the MS-DOS prompt when Windowsbased or directly from the command line when UNIX-based. 22 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 1 GENERAL 1.2 Operating Environments The UNIX-based C compiler package operates under the following environments. (1) Host machine SPARCstationTM (2) Operating system SunOSTM 4.1.4 or later, or SolarisTM 2.5.1 or later (3) Hard disk storage requirement About 12 megabytes of hard disk storage space is required. The Windows-based C compiler package operates under the following environments. (1) Machine Must be able to operate under Windows 95, Windows 98, or Windows NTTM 4.0 or later (2) Operating system Windows 95, Windows 98, or Windows NT 4.0 (3) Hard disk storage requirement About 14 megabytes of hard disk storage space is required. (4) Memory About 32 megabytes of memory is required (40 or more megabytes are recommended) A device file is required for each target device used when processing CA commands (refer to Table 3-7 Other Options). Such device files are sold separately. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 23 [MEMO] 24 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 2 INSTALLATION This chapter describes the installation and uninstallation of the CA850 CA850 and the Project Manager. To use the CA850 CA850, both the CA850 CA850 itself and the related device files must be installed. Install the device files according to the instructions provided by the device file installer (DFINST). Remark Refer to the CA830 CA830, CA850 CA850 C COMPILER PACKAGE USER'S MANUAL, PROJECT MANAGER (U13996E U13996E) for description of the device file installer (DFINST). 2.1 Installation 2.1.1 Installation of Windows version This section describes the installation method for the Windows-based CA850 CA850 and Project Manager. Once you have installed CA850 CA850 and/or the Project Manager, be sure to uninstall the installed version of the CA850 CA850 and/or the Project Manager before re-installing this software. Prepare the following floppy disks when installing the CA850 CA850. · CA850 CA850 system disks (DISK1 to DISK9) These system disks should be copied to other floppy disks for backup so that the backup disks can be used to prevent installation-related problems. The following example shows how to install the CA850 CA850 and/or Project Manager. The settings used in this example are: · Installation directory: d:\nectools32 · Floppy disk drive: drive A · Windows installation directory: c:\WINDOWS The installation steps are listed below. 1. Start Windows. 2. Insert the system disk (DISK1) into the floppy drive (in this example, drive A). 3. Start Windows Explorer and select drive A, then double click on "Setup.exe". User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 25 CHAPTER 2 INSTALLATION 4. After setup has been initialized, start the setup program. Click the Next > button. 5. During the installation process, you will be prompted to accept the software license agreement by clicking the Yes button. To cancel installation, click the No button. 6. Select the components to be installed and also select the drive and directory to be used for installation. Remove the check mark from any checked components that you do not want to install. If you are having difficulty specifying the drive and directory to be used for installation, click the Browse button and then select the desired drive and directory. Once you have completed setting up installation components, click the Next > button. To cancel installation, click the Cancel button. If a previously installed version of CA850 CA850 and/or Project Manager has not been uninstalled, a dialog box will prompt you as to whether or not you want to uninstall the previous version(s). To re-install, first execute the uninstall procedure, then install again. 26 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 2 INSTALLATION 7. Specify the folder to be used to register CA850/Project Manager icons. Click the Next > button after specifying the group name. To cancel installation, click the Cancel button. The default group name is "NEC Tools32". User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 27 CHAPTER 2 INSTALLATION 8. Final check before installing Check the settings made from steps 4. to 7. To accept all of these settings as they are, click the Next > button. To change any of these settings, click the < Back button to go back to the target step. If problems occurs, click the Cancel button to cancel installation. 28 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 2 INSTALLATION 9. File copying Various files are now automatically copied to the directory specified at step 6. During this process, a message box appears, prompting you to change setup disks. Click the OK button after inserting each new setup disk. 10. Revision of AUTOEXEC.BAT file A dialog box appears, prompting you to revise the AUTOEXEC.BAT file's PATH specification to include the installation drive and directory for CA850/Project Manager. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 29 CHAPTER 2 INSTALLATION Select one of the three options ("Let Setup modify the AUTOEXEC.BAT file", "Save the required changes to AUTOEXEC.NEW file", or "Do not make any changes"), then click the Next > button. 11. Close file installation The "Setup Complete" dialog box appears once the files have been installed. Click the Finish button. This is the last step in the CA850/Project Manager installation process. 30 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 2 INSTALLATION 12. After the setup disks have been copied, the icons for CA850 CA850 and the Project Manager are registered in the "NEC Tools32" group. 13. This completes the CA850/Project Manager installation process. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 31 CHAPTER 2 INSTALLATION 2.1.2 Install UNIX version Two types of supply media are provided: cartridge magnetic tape (CGMT) and floppy disks (FD). Files are stored on these media as .tar files which are handled using UNIX's tar command. The ways in which files are read are described below for each type of supply media Note . (1) If supply medium is CGMT If the supply medium is CGMT, there is only one CGMT. 1. 2. Log in to the host machine. Go to the installation directory. In this example, the installation directory is /usr/nectools32. % cd /usr/nectools32 Make sure that the installation directory has the "write-enabled" attribute. 3. Insert the CGMT into the host machine's CGMT drive. 4. Execute the tar command to read the files on the CGMT. Note % tar xvof /dev/rst8 Note This is a special file name which indicates a CGMT drive under the UNIX operating system. The type of special file differs depending on the storage density of the medium being used. Refer to the host machine's manual or contact the host machine's system administrator. 5. Set the command search path for the bin directory. In this example, the environmental variable path is set from the .cshrc file. set path = (. /usr/nectools32/bin) 32 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 2 INSTALLATION (2) If supply medium is an FD: If the supply medium is an FD, the number of disks depends on the family Note . Note Three disks are required for the CA830 CA830 and four disks for the CA850 CA850. 1. Log in to the host machine. 2. Go to the installation directory. In this example, the installation directory is /usr/nectools32. % cd /usr/nectools32 Make sure that the installation directory has the "write-enabled" attribute. 3. Insert the first FD into the host machine's FD drive. 4. Execute the tar command to read the files on the FD. Note % tar xvof /dev/rfd0c % cd *install Note This is a special file name which indicates an FD drive under the UNIX operating system. From this point on, install according to the instructions for the ca*install command. 5. Set the command search path for the bin directory. In this example, the environmental variable path is set from the .cshrc file. set path = (. /usr/nectools32/bin) User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 33 CHAPTER 2 INSTALLATION (3) Check operation Perform the following procedure to check whether or not installation was executed successfully and the compiler is operating normally. Before continuing with this check of operations, install the device file for the target device specified by the -cpu option. In this example, "-cpu 3002 (V852TM V852TM) was specified. If you executed the setup command without specifying the -cpu option, CA830 CA830 assumes that "-cpu 5100" (V830TM V830TM) was specified and CA850 CA850 assumes that "-cpu 3002" was specified. 1. Go to the operation verification directory under the installation directory. % cd /usr/nectools32/smp*/ca* 2. Execute the setup command. % ./setup cpu 3002 A series of search status messages appear and, if the operation is completed normally, the following message is output. Installation was successful. If an error occurs while checking operation, an error message is output instead of the above message. In such cases, check the error message and take the appropriate action. [Reference files] Directive files Note are provided as sample files in the ca* directory (v830def.dir/v850def.dir/v850def2.dir). Refer to these files when coding link directives. When the setup command is activated, it uses these sample files as link directives. Note Refer to CHAPTER 6 LINK DIRECTIVE. 34 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 2 INSTALLATION 2.2 Directory Organization The organization of the file directory that is read from the supply media when the CA is installed is shown in Figure Note 2-1 below . Note In the CA package, the lib* directory shown in Figure 2-1 is called the standard directory for the library and the inc* directory is called the standard directory for include files. The standard library for the device file is the dev directory in the same level. Figure 2-1. Directory Organization bin Command group inc* Include file group lib Module group internally called by C compiler [Calling specification (new functions)] r22 Library (for 22-register mode) startup module r26 Library (for 26-register mode) startup module r32 Library (for 32-register mode) startup module Install directory lib* r32msk Library (for 32-register mode with mask register support) startup module [Calling specification (old functions)] V850 r22old r26old Library (for 26-register mode) startup module r32old smp* Library (for 22-register mode) startup module Library (for 32-register mode) startup module ca* Operation check file Link directive sample hlp On-line manualNote dev Device file doc Release notes (.txt file) Note .hlp files are included only in the Windows based C compiler package. In the CA830 CA830 package, there is no calling function for old function calls. Accordingly, the supply media for the CA830 CA830 package does not include a library/startup module for old function calling specifications. Even in the CA850 CA850, old function calling is not supplied when the V850E V850E is used for the target device. There is no calling function for old function calls. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 35 CHAPTER 2 INSTALLATION 2.3 Uninstall 2.3.1 Uninstall Windows version This section describes the method for uninstalling. In this example, "c:\WINDOWS" is used as the Windows installation directory. 1. Start Windows. 2. Click the "Add/Remove Programs" icon in the Control Panel. 3. To uninstall the CA850 CA850, select "NEC V850 Family C Compiler V2.xx" from the list of programs shown under the "Install/Uninstall" tab. To uninstall the Project Manager, select "NEC Project Manager V3.xx". Next, click the Add/Remove. button. 36 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 2 INSTALLATION 4. A confirmation message appears next. Click Yes to continue with the uninstall operation. 5. The selected program now gets deleted. Afterward, when an "Uninstall completed. Some elements could not be removed. You should manually remove items related to the application." message appears, click the OK button. The message shown below appears when CA850 CA850 has been uninstalled. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 37 CHAPTER 2 INSTALLATION 2.3.2 Uninstall UNIX version Given /usr/nectools32 as the installation directory, execute the following command from the command line to delete executable files. % rm r /usr/nectools32 38 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 3 C COMPILER (ca830/ca850) 3.1 General This chapter provides an overview and explains the operation and output messages of the C compiler (ca) included in this compiler package. 3.1.1 Flow of operation The ca creates relocatable object files and object files executable on the target system from C source programs described in C source files. The ca acts as the driver of the modules included in the package and performs operations such as macro expansion, comment processing, merging of intermediate-language files, optimization, creation/conversion from assembly-language source programs to machine language instructions, and linking of object files. The ca performs processing in the following sequence Note (see Figure 3-1). Note As is shown in Figure 3-1, the processing flow varies slightly depending on the specified optimization level. (1) The front end (cafe) performs macro expansion and comment processing of a C source program and then converts the program into an intermediate-language OPTIC program. (2) The pre-optimizer (popt) rearranges the functions in the intermediate-language OPTIC program. If this command is activated from the command line, and if size-priority or execution speed-priority optimization is specified, two or more intermediate-language OPTIC programs are merged into one. If execution time-priority optimization is specified, inline expansion is performed for the functions in the intermediate-language OPTIC program. (3) The global optimization module (opt) optimizes the intermediate-language OPTIC program. (4) The code generation module (cgen) converts the intermediate-language OPTIC program into an assemblylanguage source program. (5) The machine-dependent optimization module (impr) optimizes the assembly-language source program. (6) The assembler (as) converts the assembly-language source program into machine language instructions and creates a relocatable object file. (7) The link editor (ld) links the relocatable object file, and creates an executable object file. The global optimization module and the machine-dependent optimization module are called only when the optimization option is specified (see Figure 3-1). It is assumed that the modules of (1) front end (cafe) through (5) machine-dependent optimization module (impr) are started from the ca. Consequently, operation is not guaranteed if any of these modules is started alone. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 39 CHAPTER 3 C COMPILER (ca830/ca850) Figure 3-1. Operation Flow of ca .c Code generation module Front end .s -Os/Ot not specified .ic -Os/-Ot specified -Om not specified -Om specified NO Machine-dependent optimization module Input file processing completed YES .s Pre-optimizer Assembler .ic .o -Om specified -Om not specified Global optimization module NO Input file processing completed .ic YES .a Link editor .out 40 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 3 C COMPILER (ca830/ca850) 3.1.2 I/O files The ca can specify the following files as input files or output files. file.c . C source file (called a .c file) file.ic . OPTIC file (called an .ic file) file.s . assembler source file (called an .s file) file.o . object file (called an .o file) file.a . archive file (called an .a file) · The .s file is passed to the as (assembler) without modification (a source program directly coded in assembly language does not go through the machine-dependent optimization module). · All the files other than .c, .ic., and .s files, such as a. files and .o files, are all passed as is to the ld. Caution The input file names supported by Windows can be specified, but "@" cannot be used at the head of a file name with the CA because it is regarded as a command option. 3.1.3 Processing up to creation of executable object As was explained in section 3.1.1, the ca can read a C source file and create an executable object file at the same time since it starts both the as and the ld. In addition, processing can be stopped before the as and the ld are started by specifying the (-S) command line option and or by specifying single source compilation via the Project Manager. Either of these methods can be used to output a compiler code or to create a relocatable object file before linking. (refer to 3.2 Operation Method for details of these methods.) Examples of starting commands from command line are shown below (refer to 3.3 Types and Features of Options for details of the command line options.) (1) When executing everything from the ca Note > ca850 cpu 3002 file.c obj.o This reads file.c and obj.o to create the executable object file a.out. At this time, crtN.o is linked as the startup module and the standard library libc.a is referenced. > ca850 cpu 3002 R org_crt.o file.c obj.o This reads file.c and obj.o to create the executable object file a.out. At this time, org_crt.o is linked as the startup module and the standard library libc.a is referenced. Note Refer to the CA830 CA830, CA850 CA850 C COMPILER PACKAGE C LANGUAGE USER'S MANUAL (U13997E U13997E) for further description of the startup modules used in these examples. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 41 CHAPTER 3 C COMPILER (ca830/ca850) (2) When starting from the ca to the as, and starting the ld alone > ca850 cpu 3002 c file.c asm.s This reads file.c and asm.s to create the relocatable object files file.o and asm.o. > ld850 cpu 3002 org_crt.o file.o asm.o obj.o lc This links org_crt.o, file.o, asm.o, and obj.o to create the executable object file a.out. At this time, libc.a is referenced. (3) When starting the ca, the as, and the ld by themselves > ca850 cpu 3002 c file.c This reads file.c to create the relocatable object file file.o. > as850 cpu 3002 asm.s This reads asm.s to create the relocatable object file asm.o. > ld850 org_crt.o file.o asm.o lc This links org_crt.o, file.o, and asm.o to create the executable object file a.out. referenced. 42 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 At this time, libc.a is CHAPTER 3 C COMPILER (ca830/ca850) 3.2 Operation Method This section explains how to operate the ca. 3.2.1 Command line input method Enter the following from the MS-DOS prompt (Windows) or directly from the command line (UNIX). ca830 [ option] . file name [ file name or option] . ca850 [ option] . file name [ file name or option] . [ ] : Can be omitted . : Pattern in [ ] immediately before can be repeated. 3.2.2 Project Manager method After setting the project via the Project Manager, use either of the following methods to open the dialog box for setting source files displayed in the project window. · Select "Set Compiler Options" via the Option menu. · Click the target source file name from among the source files listed in the project window, then select "Set Compiler Options". Use the former method to set a C source file for the entire target project and use the latter method to specifically set a C source file Note . If the latter method is used, all option settings for that file are ignored. Note When specific options have been set, an asterisk (*) is added to "Source File Name". User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 43 CHAPTER 3 C COMPILER (ca830/ca850) 3.3 Types and Features of Options 3.3.1 Option list The following table lists the ca options. When starting from the command line, if an option that is not listed in the following table is given, that option is regarded as an ld option and is passed to the ld without modification. However, "-WI" must be specified to pass the options marked -WI (in the ld option list shown in section 5.3.1) from the ca to the ld without modification. The options listed below are options which are not included in the Project Manager's option dialog box. When one of these options must be specified, enter them as "Other options" under the option dialog box's "Other" tab. [Symbols used in option list] V830 : Option is used only for V830 Family V850 : Option is used only for V850 Family -Wa : Option requires "-Wa" specification for CA830/CA850 CA830/CA850 when CA830/CA850 CA830/CA850 to as830/as850 are started from the command line. -WI : Option requires "-WI" specification for CA830/CA850 CA830/CA850 when CA830/CA850 CA830/CA850 to ld830/ld850 are started from the command line. PM : Option exists as specification item under the Project Manager (1) Input options These specifications set options related to ca input. Table 3-1. Input Options Coding format Function Note 1 -Xfar_jump file PM The jmp directive is used to branch (jump) to the function specified in file . The ld outputs an error if the function is in a range that cannot be branched to by the jarl ( V850 / V850E V850E ), jal ( V830 ), or jr directive, in which case this option is used to recompile. -Xk=code PM This option specifies the character code to be used for Japanese comments or character strings Note 2 in input files . An error message is output if a code other than the specified code exists. The following can be specified as code. EUC Code is not guaranteed Shift JIS The "|" indicates that either the left or right option symbol must be specified. e | euc n | none s | sjis If this option is omitted, Shift JIS is assumed. -Xsec_file=file PM This option specifies the name of the section file (refer to 12.5 Section File) that is used to specify section allocation of data when the C compiler is activated. Be sure to specify this file name. This option can be specified several times and several section files can be input. Notes 1. For further description of calling far jump, refer to 5.5 C Language Program in the C Language (U13997E U13997E). 2. Also, refer to the C Language (U13997E U13997E) for description of character strings and comments in the language specification. 44 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 3 C COMPILER (ca830/ca850) (2) Preprocessor options These specifications set options related to preprocessing at compile time. Table 3-2. Preprocessor Options Coding format -Dname [=def] -Wa -Wl PM Function When this option is specified, it is assumed that #define name def is entered before the C source program. If the =def specification is omitted, the def value is regarded as 1. This option specifies searching first in the directory dir and then in the standard directory -Idir -Wa PM Note 1 Note 2 when searching for the header file . If this option is omitted, only the standard directory is searched. -Uname PM When this option is specified, it is assumed that #undef name is coded before the C source program. In addition to ordinary comments, this interprets all characters that appear after "//" and before -Xcxxcom PM the end of the line as comments (C+ comment style). -Xmnum PM This option specifies an upper limit for the number of macro identifiers. A decimal value up to 32767 can be specified as num. This option increases the size of the buffer used by the preprocessor. However, this option cannot be used to set a specific value for buffer size in terms of the number of characters the buffer can contain. A default value of 2047 is used if this option is omitted. -t -Wl PM This option replaces a trigraph sequence Note 3 . Notes 1. The installation directory is the \inc* directory. 2. When the file name is enclosed in double quotation marks ("), the directory where the source file exists is searched first. For details of file searching to retrieve header files, refer to the C Language (U13997E U13997E). 3. This is a three-character (trigraph) sequence that is replaced by single characters as stipulated in the ANSI standard. Refer to documents related to the ANSI standard (under "Related Documents"). User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 45 CHAPTER 3 C COMPILER (ca830/ca850) (3) Language options These specifications set options related to switches provided in the C language. Table 3-3. Language Options Coding format -Xbitfield=string PM Function This option specifies whether specifications in int type bit fields that do not indicate the type specifier (signed or unsigned) are regarded as signed or unsigned specifications. The following can be specified as string. s Handled as signed signed Handled as signed u Handled as unsigned unsigned Handled as unsigned A warning message is output when the specification is handled as unsigned. The specification is handled as signed if this option is omitted. -Xchar=string PM This option specifies whether char type specifications that do not indicate the type specifier (signed or unsigned) are regarded as signed or unsigned specifications. The following can be specified as string. s Handled as signed signed Handled as signed u Handled as unsigned unsigned Handled as unsigned The specification is handled as signed if this option is omitted. -Xe V850 -ansi PM This option specifies that runtime library PM Note 1 _ _ _mul/_ _ _mulu or _ _ _div/_ _ _divu will be used instead of the mulh and divh directives for integers corresponding to data that is 16 bits or less. This option slows the processing speed but strictly complies with the multiplication and division processing under the ANSI standard. The mulh and divh directives are used if this option is omitted. This option outputs an error message or warning message corresponding to the returned symbol so that processing by the ca strictly complies with the ANSI standard. Note 2 All extensions other than the _asm extension are recognized . Specifying this option defines the macro name _STDC_. Note 3 Strict ANSI compliance cannot be guaranteed if this option is omitted . Notes 1. The CA850 CA850's runtime library is used as a standard library so that THE CA can meet the ANSI standard for directives that are not included in the V850 Family architecture. For details of the runtime library, refer to the C Language (U13997E U13997E). 2. Refer to the C Language (U13997E U13997E) for details of how processing of the supplied extension symbol and the defined macro name differs according to whether or not this option has been specified. 3. To maintain compatibility with previous C language specifications, a warning message is output and processing continues. 46 User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 CHAPTER 3 C COMPILER (ca830/ca850) (4) Optimization options These specifications set options related to the optimization levels and parameters. Table 3-4. Optimization Options (1/3) Coding format -O [c] -Wa PM Function This option specifies the optimization level. Note The following numbers and characters that can be specified as c . s Optimizes based on object size t Optimizes based on execution speed l Forcibly optimizes code scheduling and redundant directive elimination (valid when this m option has been specified along with -Os or -Ot) Note that this may slow down the compilation speed. Merges intermediate language files If this specification is omitted, optimization is performed within the basic block. -Wc, arg1[, arg2]. PM Passes arguments (arg1, arg2, etc.) to module c. The following can be specified for module c. p Pre-optimizer -D: -Gnum: -Nnum: Enables reduction of memory usage at compile time. Restricts the stack size for the target function for inline expansion by num size specification in intermediate language so that inline expansion is not performed for any value larger than the num value. See the "-I" option's description below with regard to the range of num values. G32 is assumed as the specification if this option is omitted. Restricts the intermediate language size for the target function for inline expansion by the num value specification so that inline expansion is not performed for any value larger than the num value. See the "-I" option's description below with regard to the range of num values. N128 is assumed as the specification if this option is omitted and -S: optimization based on execution speed has been specified, otherwise N24 is assumed as the specification. Unconditionally performs inline expansion for static functions that have -I: been referenced only once. Displays function-related information. The displayed information includes a range of values to be specified for the -G and -N options described above. For example, in the case of stack size, inline expansion is performed if the called function's value is not greater than the value specified for -N. -r [funcname]: Given the "funcname" function as the entry function, this deletes the functions called by this function that are no longer needed after expansion. Enter a "_" at the start of the function name specified in funcname. If funcname is omitted, "_main" is assumed as the specification. Caution Functions that are called only by assembly-language programs are not recognized as called functions and are instead deleted as unnecessary functions. Note Refer to 3.5.3 Efficient use of optimization for further description of optimization. User's Manual U13998EJ1V0UM00 U13998EJ1V0UM00 47 CHAPTER 3 C COMPILER (ca830/ca850) Table 3-4. Optimization Options (2/3) Coding format Function o Global optimization Note 1 -0l [num]: in for, Loops are unrolled the number of times specified by num while, etc.Note 2. When a loop for which N number of executions has been specified (N is a constant) is executed, the code is converted so that the loop includes code that has been unrolled num times. However, if the unrolled code size is large or the number of loop executions is small, the number of unrolling times may be too small, so that unrolling is not performed. Note 3 Unrolling is suppressed if the specified num value is 0 or 1 . If num is not specified, a value of 4 is assumed. Example: When execution times = 10 and unrolling times = 4. i = 0; while(i < 10){ (Processing) +i; } i = 0; (Processing) i = 1; (Processing) i = 2; while(i < 10){ (Processing) +i; (Processing) +i; (Processing) +i; (Processing) +i; } -Xlo: Loop unrolling is performed using the previous version's conditions Note 4 . i Machine-dependent optimization -D: The amount of memory used at compile time can be reduced. Note that this may slow down the compilation speed. If too much memory is