NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
CA850 U18512EJ1V0UM00 U18512EJ1V0UM U18513E U18514E U18515E U18416E ID850 - Datasheet Archive
Old Company Name in Catalogs and Other Documents On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology
To our customers, Old Company Name in Catalogs and Other Documents On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology Corporation, and Renesas Electronics Corporation took over all the business of both companies. Therefore, although the old company name remains in this document, it is a valid Renesas Electronics document. We appreciate your understanding. Renesas Electronics website: http://www.renesas.com April 1st, 2010 Renesas Electronics Corporation Issued by: Renesas Electronics Corporation (http://www.renesas.com) Send any inquiries to http://www.renesas.com/inquiry. Notice 1. 2. 3. 4. 5. 6. 7. All information included in this document is current as of the date this document is issued. Such information, however, is subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website. Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information. When exporting the products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations. You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein. Renesas Electronics products are classified according to the following three quality grades: "Standard", "High Quality", and "Specific". The recommended applications for each Renesas Electronics product depends on the product's quality grade, as indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular application. You may not use any Renesas Electronics product for any application categorized as "Specific" without the prior written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as "Specific" or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics. The quality grade of each Renesas Electronics product is "Standard" unless otherwise expressly specified in a Renesas Electronics data sheets or data books, etc. "Standard": 8. 9. 10. 11. 12. Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots. "High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anticrime systems; safety equipment; and medical equipment not specifically designed for life support. "Specific": Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas Electronics. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products, or if you have any other inquiries. (Note 1) "Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majorityowned subsidiaries. (Note 2) "Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics. User's Manual CA850 CA850 Ver. 3.20 C Compiler Package Operation Target Device V850 Series Document No. U18512EJ1V0UM00 U18512EJ1V0UM00 (1st edition) Date Published May 2007 CP(K) © NEC Electronics Corporation 2007 Printed in Japan [MEMO] 2 User's Manual U18512EJ1V0UM U18512EJ1V0UM Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries. User's Manual U18512EJ1V0UM U18512EJ1V0UM 3 · The information in this document is current as of May, 2007. The information is subject to change without notice. For actual design-in, refer to the latest publications of NEC Electronics data sheets or data books, etc., for the most up-to-date specifications of NEC Electronics products. Not all products and/or types are available in every country. Please check with an NEC Electronics sales representative for availability and additional information. · No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may appear in this document. · NEC Electronics 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 Electronics products listed in this document or any other liability arising from the use of such products. No license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others. · Descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. The incorporation of these circuits, software and information in the design of a customer's equipment shall be done under the full responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. · While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To minimize risks of damage to property or injury (including death) to persons arising from defects in NEC Electronics products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment and anti-failure features. · NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and "Specific". The "Specific" quality grade applies only to NEC Electronics products developed based on a customerdesignated "quality assurance program" for a specific application. The recommended applications of an NEC Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of each NEC Electronics product before using it in a particular application. "Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots. "Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support). "Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. The quality grade of NEC Electronics products is "Standard" unless otherwise expressly specified in NEC Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to determine NEC Electronics' willingness to support a given application. (Note) (1) "NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its majority-owned subsidiaries. (2) "NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as defined above). M8E 02. 11-1 4 User's Manual U18512EJ1V0UM U18512EJ1V0UM [MEMO] User's Manual U18512EJ1V0UM U18512EJ1V0UM 5 INTRODUCTION Target Devices The CA850 CA850 is a C compiler package used to create object codes for NEC Electronics's V850 Series of RISC microcontrollers. This manual explains the features and functions of the CA850 CA850 C Compiler Package. Readers This manual is intended for user engineers who wish to develop application systems using the V850 Series C Compiler Package. Purpose This manual explains how to operate each command, such as the C compiler and assembler included in each package on WindowsTM. PM+ (Windows version only) is provided with this C compiler package. However, for how to operate PM+ as an integrated development environment, refer to the PM+ user's manual. For the Windows operations, refer to the function guides provided with the Windows OS. Organization This manual is organized into the following sections. · Overview of the CA850 CA850 · Using the CA850 CA850 from the command line · Using the CA850 CA850 from Project Manager · Command functions, options, and output messages Commands Included in This Package C compiler (ca850) Assembler (as850) Linker (ld850) ROMization processor (romp850) Hexadecimal converter (hx850) Archiver (ar850) Section file generator (sf850) Dump command (dump850) Disassembler (dis850) Cross reference tool (cxref) Memory layout visualization tool (rammap) Stack estimation tool (stk850) How to Read This Manual · The name of each program in the C compiler package is referred to as follows in this manual. C compiler package CA850 CA850 Assembler as850 C compiler ca850 6 User's Manual U18512EJ1V0UM U18512EJ1V0UM Related Documents Read this manual together with the following documents. 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 CA850 CA850 Ver. 3.20 C Compiler Package Document No. Operation This manual C Language U18513E U18513E Assembly Language U18514E U18514E Link Directives U18515E U18515E U18416E U18416E PM+ Ver. 6.30 Project Manager ID850 ID850 Ver. 3.00 Integrated Debugger Operation U17358E U17358E ID850NW ID850NW Ver. 3.10 Integrated Debugger Operation U17369E U17369E ID850QB ID850QB Ver. 3.20 Integrated Debugger Operation U17964E U17964E SM+ System Simulator Operation U17246E U17246E User Open Interface U18212E U18212E SM850 SM850 Ver. 2.50 System Simulator Operation U16218E U16218E SM850 SM850 Ver. 2.00 or Later System Simulator External Part User Open Interface Specifications U14873E U14873E RX850 RX850 Ver. 3.20 or Later Real-Time OS Basics U13430E U13430E Installation U17419E U17419E Technical U13431E U13431E Task Debugger U18165E U18165E Internal Structure U18164E U18164E Task Debugger U17422E U17422E Functionalities U16643E U16643E Internal Structure U16644E U16644E Task Debugger RX850V4 RX850V4 Ver. 4.22 Real-Time OS U17420E U17420E Basics RX850 RX850 Pro Ver. 3.21 Real-Time OS U16811E U16811E AZ850 AZ850 Ver. 3.30 System Performance Analyzer U17423E U17423E AZ850V4 AZ850V4 Ver. 4.10 System Performance Analyzer U17093E U17093E TW850 TW850 Ver. 2.00 Performance Analysis Tuning Tool U17241E U17241E User's Manual U18512EJ1V0UM U18512EJ1V0UM 7 [MEMO] 8 User's Manual U18512EJ1V0UM U18512EJ1V0UM CONTENTS CHAPTER 1 OVERVIEW . 20 1.1 Features of Compiler Package . 20 1.2 Operating Environments . 22 CHAPTER 2 INSTALLATION . 23 2.1 Installation . 23 2.2 Folder Organization . 24 2.2.1 Folder organization of stack usage tracer . 25 2.3 Uninstallation . 26 CHAPTER 3 C COMPILER . 27 3.1 Flow of Operation . 27 3.2 Input/Output Files . 29 3.3 Executable Object . 30 3.4 Operation Method . 32 3.4.1 Command input method . 32 3.4.2 Method using PM+ . 32 3.5 Types and Features of Options . 33 3.5.1 Version/help display/operation status . 34 3.5.2 Output file specification . 35 3.5.3 Controlling source debugger . 37 3.5.4 Control of compile driver . 38 3.5.5 Optimization . 44 3.5.6 Generation code control . 49 3.5.7 Library specification . 59 3.5.8 Warning message control . 60 3.5.9 Other . 62 3.5.10 Option to each module . 64 3.6 Settings Made via PM+ . 68 3.6.1 [Compiler Common Options] dialog box . 69 [File] . 70 [Startup] . 72 [Link Directive] . 73 [ROM] . 74 [Flash] . 75 [Device] . 76 [ROM] (library) . 78 [Flash] (library) . 79 3.6.2 [Compiler Options] dialog box . 80 [General] . 81 [Input File] . 84 [Preprocessor] . 86 [C Language] . 88 [Optimization and Debug Information] . 90 [Detail of Optimization] . 92 [External Register] . 96 [Output File] . 98 [Output Code] . 100 [Message] . 105 [Assembler] . 107 [Others] . 109 [Difference] . 111 User's Manual U18512EJ1V0UM U18512EJ1V0UM 9 3.6.3 [Edit Option] dialog box . 113 3.7 Cautions . 115 3.7.1 Specifying multiple options . 115 3.7.2 Command file . 116 3.7.3 Efficient use of optimization . 117 3.7.4 Effects of optimization on debugging . 122 CHAPTER 4 ASSEMBLER . 124 4.1 Flow of Operation . 124 4.2 Input/Output Files . 125 4.3 Operation Method . 126 4.3.1 Command input method . 126 4.3.2 Method using PM+ . 126 4.4 Types and Features of Options . 127 4.4.1 File . 128 4.4.2 Option . 129 4.4.3 Device . 131 4.4.4 Other . 133 4.5 Settings Made via PM+ . 135 4.5.1 [Assembler Options] dialog box . 136 [Option] . 137 [Difference] . 141 4.6 Assemble List . 143 4.6.1 Output method . 143 4.6.2 Output example . 144 4.7 Cautions . 146 4.7.1 Magic number . 146 4.7.2 Options for avoiding CPU faults . 148 CHAPTER 5 LINKER . 153 5.1 Flow of Operation . 153 5.1.1 Link procedure . 155 5.2 Operation Method . 157 5.2.1 Command input method . 157 5.2.2 Method using PM+ . 157 5.3 Types and Features of Options . 158 5.3.1 Input file . 159 5.3.2 Output file . 160 5.3.3 Library . 161 5.3.4 Flash ROM . 162 5.3.5 Device . 164 5.3.6 Option . 165 5.3.7 Other . 168 5.4 Settings Made via PM+ . 170 5.4.1 [Linker Options] dialog box . 170 [File] . 171 [Library] . 172 [Option] . 174 [Others] . 177 5.5 Link Map . 178 5.5.1 When starting the ld850 from the command line . 178 5.5.2 When starting from PM+ . 178 5.5.3 Link map output example . 178 5.6 Flash Memory/External ROM Relink Function . 181 5.6.1 Relink function . 181 5.6.2 Image of relink function . 182 10 User's Manual U18512EJ1V0UM U18512EJ1V0UM 5.6.3 Realizing relink function . 185 5.7 Supplementary Information . 194 5.7.1 Using -A option . 194 5.7.2 Archive files . 197 5.7.3 Reserved symbols . 198 5.7.4 May not be allocated to the expected sections . 199 5.7.5 V850 core and V850Ex core . 199 5.7.6 V850 core and V850E2 V850E2 core . 199 5.7.7 Mathematics library . 199 5.7.8 main function . 199 5.7.9 Prologue/epilogue runtime library . 200 5.7.10 Linking for ROMization . 201 5.7.11 Programmable peripheral I/O register . 202 5.7.12 Option byte . 203 CHAPTER 6 ROMIZATION PROCESSOR . 204 6.1 Flow of Operation . 204 6.2 Input/Output Files . 207 6.3 rompsec Section . 208 6.3.1 Types of sections to be packed . 208 6.3.2 Size of rompsec section . 209 6.3.3 rompsec section and link directive . 210 6.4 Creating Object for ROMization . 212 6.4.1 Creating procedure (default) . 212 6.4.2 Creating procedure (customize) . 215 6.5 Copy Functions . 218 6.5.1 Copy routine . 218 _rcopy . 219 _rcopy1 . 220 _rcopy2 . 221 _rcopy4 . 222 6.5.2 Example . 223 6.6 Operation Method . 225 6.6.1 Command input method . 225 6.6.2 Method using PM+ . 225 6.7 Types and Features of Options . 226 6.7.1 File . 227 6.7.2 Options . 228 6.7.3 Other . 230 6.8 Settings Made via PM+ . 231 6.8.1 [ROM Processor Options] dialog box . 231 [File] . 232 [Section] . 233 [Option] . 235 [Others] . 237 CHAPTER 7 HEXADECIMAL CONVERTER . 238 7.1 Flow of Operation . 238 7.2 Input/Output Files . 239 7.3 Operation Method . 240 7.3.1 Command input method . 240 7.3.2 Method using PM+ . 240 7.4 Types and Features of Options . 241 7.4.1 File . 242 7.4.2 Format . 243 7.4.3 Other . 246 User's Manual U18512EJ1V0UM U18512EJ1V0UM 11 7.5 Settings Made via PM+ . 247 7.5.1 [Hexa Converter Options] dialog box . 247 [File] . 248 [Option] . 249 [Others] . 252 7.6 Output File Formats . 253 7.6.1 Intel expanded . 253 7.6.2 Motorola S type . 257 7.6.3 Expanded Tek . 259 CHAPTER 8 ARCHIVER . 263 8.1 Archiver . 263 8.2 Operation Method . 264 8.2.1 Command input method . 264 8.2.2 Method using PM+ . 264 8.3 Types and Features of Keys and Options . 265 8.3.1 Types and features of keys . 266 8.3.2 Types and features of options . 268 8.4 Settings Made via PM+ . 269 8.4.1 [Archiver Options] dialog box . 269 [Option] . 270 CHAPTER 9 SECTION FILE GENERATOR . 272 9.1 Section Files . 272 9.2 Section File Format . 275 9.3 Operation Method . 280 9.3.1 Command input method . 280 9.3.2 Method using PM+ . 280 9.3.3 Use from command line . 281 9.3.4 Use via PM+ . 282 9.4 Types and Features of Options . 283 9.4.1 Options . 284 9.5 Settings Made via PM+ . 287 9.5.1 [Section File Generator Options] dialog box . 287 [File] . 288 [Option] . 289 [Others] . 292 CHAPTER 10 DUMP COMMAND . 293 10.1 Dump Command . 293 10.2 Operation Method . 294 10.2.1 Command input method . 294 10.2.2 Method using PM+ . 294 10.3 Types and Features of Options . 295 10.4 Settings Made via PM+ . 297 10.4.1 [Object Analysis Tool] dialog box . 297 [Dump] . 298 10.4.2 [Output Index] dialog box . 302 10.4.3 [Archive File Options] dialog box . 303 10.5 Dump List . 304 10.5.1 Dump list display contents . 304 10.5.2 Element values and meanings . 310 CHAPTER 11 DISASSEMBLER . 313 11.1 Disassembler . 313 12 User's Manual U18512EJ1V0UM U18512EJ1V0UM 11.2 Operation Method . 314 11.2.1 Command input method . 314 11.2.2 Method using PM+ . 314 11.3 Types and Features of Options . 315 11.4 Settings Made via PM+ . 317 11.4.1 [Object Analysis Tool] dialog box . 317 [Disassembler] . 318 11.5 Cautions . 321 11.6 Output Format . 322 CHAPTER 12 CROSS REFERENCE TOOL . 323 12.1 Cross Reference Tool . 323 12.2 Input/Output . 324 12.2.1 Input file . 324 12.2.2 Output information . 325 12.3 Operation Method . 326 12.3.1 Command input method . 326 12.3.2 Method using PM+ . 326 12.4 Types and Features of Options . 327 12.4.1 Common options . 328 12.4.2 Cross reference . 331 12.4.3 Tag information . 332 12.4.4 Call tree . 333 12.4.5 Function metrics . 334 12.4.6 Call database . 335 12.5 Settings Made via PM+ . 336 12.5.1 [Static performance analyzer] dialog box . 336 [Cross reference] . 337 12.5.2 [Cross reference Option] dialog box . 340 [Common option] . 341 [Cross reference list] . 344 [Tag information] . 345 [Call graph] . 346 [Function measure] . 349 [Call database] . 351 12.6 Output Files . 353 12.6.1 Cross reference . 353 12.6.2 Tag information . 355 12.6.3 Call tree . 357 12.6.4 Function metrics . 360 12.6.5 Call database . 363 CHAPTER 13 MEMORY LAYOUT VISUALIZATION TOOL . 366 13.1 Memory Layout Visualization Tool . 366 13.2 Input/Output . 367 13.2.1 Input file . 367 13.2.2 Output information . 367 13.3 Operation Method . 368 13.3.1 Command input method . 368 13.3.2 Method using PM+ . 368 13.4 Types and Features of Options . 369 13.5 Settings Made via PM+ . 372 13.5.1 [Static performance analyzer] dialog box . 372 [RAM map] . 373 13.5.2 [RAM map option] dialog box . 375 [Common option] . 376 User's Manual U18512EJ1V0UM U18512EJ1V0UM 13 13.5.3 [Object Analysis Tool] dialog box . 378 [RAM map] . 379 13.6 Output Files . 381 13.6.1 Memory map table . 381 CHAPTER 14 STACK USAGE TRACER . 383 14.1 Flow of Operation . 383 14.2 Input/Output Files . 384 14.2.1 Input files . 384 14.2.2 Output file . 384 14.3 Operation Method . 385 14.4 Window Reference . 386 Main window . 388 [Adjust Stack Size] dialog box . 392 [Stack Size Unknown / Adjusted Function Lists] dialog box . 394 [About stk850] dialog box . 396 14.5 Cautions . 397 14.5.1 Quantitative limit of the stk850 . 397 14.6 Output File Formats . 399 14.6.1 Output result files . 399 14.6.2 Stack size specification file . 402 14.6.3 stk system file . 405 APPENDIX A FORMAT OF OBJECT FILE . 406 A.1 Structure of Object File . 406 A.2 ELF Header . 407 A.3 Program Header Table . 408 A.4 Section Header Table . 409 A.4.1 Section types . 410 A.4.2 Constituent elements (link/info) dependent on section type . 410 A.5 Sections . 411 A.5.1 Symbol table . 411 A.5.2 String table . 412 A.5.3 Reserved sections . 413 APPENDIX B MESSAGE . 415 B.1 Output Message . 415 B.1.1 Message format . 415 B.1.2 Compiler . 416 B.1.3 Assembler . 442 B.1.4 Linker . 450 B.1.5 ROMization process . 468 B.1.6 Hexadecimal converter . 471 B.1.7 Archiver . 477 B.1.8 Section file generator . 479 B.1.9 Dump command . 480 B.1.10 Disassembler . 481 B.1.11 Cross reference tool . 482 B.1.12 Memory layout visualization tool . 484 B.2 Messages from PM+ . 486 B.2.1 Format of message . 486 B.2.2 Messages common to compiler . 486 B.2.3 Compiler . 487 B.2.4 Assembler . 488 B.2.5 Linker . 488 B.2.6 ROMization processor . 489 14 User's Manual U18512EJ1V0UM U18512EJ1V0UM B.2.7 Hexadecimal converter . 489 B.2.8 Archiver . 490 B.2.9 Section file generator . 490 B.2.10 Cross reference tool and memory layout visualization tool . 491 B.3 Messages from stk850 . 493 B.3.1 Message formats . 493 B.3.2 Messages . 493 APPENDIX C INDEX . 498 User's Manual U18512EJ1V0UM U18512EJ1V0UM 15 LIST OF FIGURES Figure No. Title Page 1-1 2-1 2-2 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8 3-9 3 - 10 3 - 11 3 - 12 3 - 13 3 - 14 3 - 15 3 - 16 3 - 17 3 - 18 3 - 19 3 - 20 3 - 21 3 - 22 3 - 23 3 - 24 3 - 25 3 - 26 3 - 27 4-1 4-2 4-3 4-4 4-5 4-6 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 5 - 20 16 Package Configuration . 21 Folder Organization . 24 Folder Organization of Stack Usage Tracer . 25 Operation Flow of ca850 . 28 [Compiler Common Options] Dialog Box ([File] Tab) . 70 Checking Creation of Folder . 71 [Compiler Common Options] Dialog Box ([Startup] Tab) . 72 [Compiler Common Options] Dialog Box ([Link Directive] Tab) . 73 [Compiler Common Options] Dialog Box ([ROM] Tab) . 74 [Compiler Common Options] Dialog Box ([Flash] Tab) . 75 [Compiler Common Options] Dialog Box ([Device] Tab) . 76 [Compiler Common Options] Dialog Box ([ROM] Tab (library) . 78 [Compiler Common Options] Dialog Box ([Flash] Tab (library) . 79 [Compiler Options] Dialog Box ([General] Tab) . 81 [Compiler Options] Dialog Box ([Input File] Tab) . 84 [Compiler Options] Dialog Box ([Preprocessor] Tab) . 86 [Compiler Options] Dialog Box ([C Language] Tab) . 88 [Compiler Options] Dialog Box ([Optimization and Debug Information] Tab) . 90 [Compiler Options] Dialog Box ([Detail of Optimization] Tab) . 92 Output Example (Function Name func) . 93 [Compiler Options] Dialog Box ([External Register] Tab) . 96 [Compiler Options] Dialog Box ([Output File] Tab) . 98 [Compiler Options] Dialog Box ([Output Code] Tab) . 100 [Compiler Options] Dialog Box ([Message] Tab) . 105 [Compiler Options] Dialog Box ([Assembler] Tab) . 107 [Compiler Options] Dialog Box ([Others] Tab) . 109 [Compiler Options] Dialog Box ([Difference] Tab) . 111 [Edit Option] Dialog Box . 113 [Add Option] Dialog Box . 113 Optimization Processing and Parameters . 117 Operation Flow of as850 . 124 [Assembler Options] Dialog Box ([Option] Tab) . 137 [Assembler Options] Dialog Box ([Difference] Tab) . 141 Example of Output Assemble List . 144 Image of Creating Common Object with as850 . 146 Example of as850 CPU Core Compatibility (V850Ex Core and V850 Core) . 147 Operation Flow of ld850 . 153 ld850 Operation Image (Example) . 154 Batch Processing . 154 Modular Processing . 154 Creation of Output Section . 155 Allocation to Memory Space . 155 [Linker Options] Dialog Box . 170 [Linker Options] Dialog Box ([File] Tab) . 171 [Linker Options] Dialog Box ([Library] Tab) . 172 [Library List] Dialog Box . 173 [Linker Options] Dialog Box ([Option] Tab) . 174 [Linker Options] Dialog Box ([Others] Tab) . 177 Link Map Output Example . 179 In Fixed ROM . 182 In Flash Memory . 182 From Fixed ROM to Flash Memory . 183 From Flash Memory to Fixed ROM . 184 Compiler Common Options for Flash Memory . 191 Compiler Common Options for Fixed ROM . 191 Memory Allocation Image of gp Offset Reference Section . 194 User's Manual U18512EJ1V0UM U18512EJ1V0UM 5 - 21 5 - 22 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 7-1 7-2 7-3 7-4 7-5 7-6 7-7 8-1 8-2 9-1 9-2 9-3 9-4 9-5 9-6 10 - 1 10 - 2 10 - 3 10 - 4 11 - 1 11 - 2 12 - 1 12 - 2 12 - 3 12 - 4 12 - 5 12 - 6 12 - 7 12 - 8 12 - 9 12 - 10 12 - 11 12 - 12 12 - 13 12 - 14 12 - 15 12 - 16 13 - 1 13 - 2 13 - 3 13 - 4 13 - 5 13 - 6 14 - 1 14 - 2 14 - 3 14 - 4 Example of Output Information on Executable Object File . 195 Example of Output Information on Relocatable Object File . 196 Creation of Object for ROMization . 204 Image of Processing Immediately After _rcopy Function Call . 205 Link Directive Taking ROMization Processing into Consideration . 210 Link Directive Taking ROMization Processing into Consideration (Size Considered) . 211 Example of Using Copy Function _rcopy 1 . 212 ROMization Image 1 . 214 Example of rompack.s . 215 Example of Using Copy Function _rcopy 2 . 215 Link Directive Specification Example . 216 ROMization Image 2 . 217 [ROM Processor Options] Dialog Box ([File] Tab) . 232 [ROM Processor Options] Dialog Box ([Section] Tab) . 233 [ROM Processor Options] Dialog Box ([Option] Tab) . 235 [ROM Processor Options] Dialog Box ([Others] Tab) . 237 Operation Flow in hx850 . 238 [Hexa Converter Options] Dialog Box ([File] Tab) . 248 [Hexa Converter Options] Dialog Box ([Option] Tab) . 249 [Hexa Converter Options] Dialog Box ([Others] Tab) . 252 File Configuration in Intel Expanded Hex Format . 253 File Configuration of Motorola S Type Hex Format . 257 File Configuration of Expanded Tek Hex Format . 259 The ar850's Operation Flow . 263 [Archiver Options] Dialog Box ([Option] Tab) . 270 Image of Compilation Using Section File Specifications . 273 Example of Section File Output by sf850 . 275 Example of Section File Output by sf850 Using -O Option . 276 [Section File Generator Options] Dialog Box ([File] Tab) . 288 [Section File Generator Options] Dialog Box ([Option] Tab) . 289 [Section File Generator Options] Dialog Box ([Others] Tab) . 292 Operation Flow of dump850 . 293 [Object Analysis Tool] Dialog Box ([Dump] Tab) . 298 [Output Index] Dialog Box . 302 [Archive File Options] Dialog Box . 303 Operation Flow of dis850 Command . 313 [Object Analysis Tool] Dialog Box ([Disassembler] Tab) . 318 Flow of Operation in cxref . 323 [Static performance analyzer] Dialog Box (Cross reference) . 337 [Cross reference option] Dialog Box ([Common option] Tab) . 341 [Cross reference option] Dialog Box ([Cross reference list] Tab) . 344 [Cross reference option] Dialog Box ([Tag information] Tab) . 345 [Cross reference option] Dialog Box ([Call graph] Tab) . 346 [Cross reference option] Dialog Box ([Function measure] Tab) . 349 [Cross reference option] Dialog Box ([Call database] Tab) . 351 Cross Reference Output Example (cxref) . 353 Tag Information Output Example (cxref) . 355 Call Tree Text-Format Output Example (cxref) . 357 Call Tree CSV-Format Output Example (cxref) . 358 Function Metrics Text-Format Output Example (cxref) . 360 Function Metrics CSV-Format Output Example (cxref) . 361 Call Database Text-Format Output Example (cxref) . 363 Call Database CSV-Format Output Example (cxref) . 364 Flow of Operation in rammap . 366 [Static performance analyzer] Dialog Box ([RAM map] Tab) . 373 [RAM map option] Dialog Box ([Common option] Tab) . 376 [Object Analysis Tool] Dialog Box ([RAM map] Tab) . 379 Memory Map Table Text-Format Output Example (rammap) . 381 Memory Map Table CSV-Format Output Example (rammap) . 382 Estimation Flow in stk850 . 383 Main Window of st850 . 388 [Adjust Stack Size] Dialog Box . 392 [Stack Size Unknown / Adjusted Function Lists] Dialog Box . 394 User's Manual U18512EJ1V0UM U18512EJ1V0UM 17 14 - 5 A-1 B-1 18 [About stk850] Dialog Box . 396 Object File Structures . 406 Example of Message Dialog Box . 486 User's Manual U18512EJ1V0UM U18512EJ1V0UM LIST OF TABLES Table No. Title Page 3-1 3-2 3-3 3-4 3-5 3-6 3-7 3-8 4-1 4-2 4-3 4-4 4-5 5-1 5-2 6-1 6-2 6-3 7-1 7-2 7-3 8-1 9-1 9-2 9-3 9-4 10 - 1 11 - 1 12 - 1 12 - 2 13 - 1 13 - 2 13 - 3 14 - 1 14 - 2 14 - 3 14 - 4 14 - 5 14 - 6 14 - 7 14 - 8 14 - 9 14 - 10 14 - 11 A-1 A-2 A-3 A-4 A-5 A-6 A-7 A-8 B-1 B-2 Register Mode . 49 Correspondence Between CPU Core and -Xv850patch Option for This Bug . 63 [Compiler Common Options] Dialog Box . 69 [Compiler Common Options] Dialog Box (library) . 69 [Compiler Options] Dialog Box . 80 [Compiler Options] Dialog Box (Individual Source) . 80 Message Numbers of Messages That Can Be Specified . 106 Optimization Processing and Items . 117 [Assembler Options] Dialog Box . 136 [Assembler Options] Dialog Box (Individual Source) . 136 Section Attributes and Their Meanings . 145 Correspondence Between CPU Core and -p Option . 149 Correspondence Between Created Objects and -p Options . 152 Reserved Section . 198 Special Symbols in Ordinary Object File . 198 Reserved Sections Packed by romp850 . 208 Copy Routines . 218 [ROM Processor Options] Dialog Box . 231 HEX Format Block/Record . 243 [Hexa Converter Options] Dialog Box . 247 HEX Format Block/Record . 251 [Archiver Options] Dialog Box . 269 Variable Types and Displays . 275 Variable Displays and Their Meanings . 276 Types of Sections Specifiable by ca850 . 277 [Section File Generator Options] Dialog Box . 287 [Object Analysis Tool] Dialog Box (dump850) . 297 [Object Analysis Tool] Dialog Box (dis850) . 317 [Static performance analyzer] Dialog Box (cxref) . 336 [Cross reference Option] Dialog Box . 340 [Static performance analyzer] Dialog Box (rammap) . 372 [RAM map option] Dialog Box . 375 [Object Analysis Tool] Dialog Box (rammap) . 378 Windows and Dialog Boxes of stk850 . 386 Function Icons for stk850 . 390 Project File Related Upper Limit Values . 397 Intermediate Assembly Language File Related Upper Limit Values . 397 Stack Size Specification File Related Upper Limit Values . 397 Output File Related Upper Limit Values . 398 Stack Size Related Limit . 398 Upper Limit Values in Message Display Area . 398 Description for Each Parameter . 399 Output Format and Content of Adjustment Information . 400 Description for Each Parameter . 402 Constituent Elements of ELF Header and Their Meanings . 407 Constituent Elements of Program Header Table Entries and Their Meanings . 408 Constituent Elements of Section Header Table Entries and Their Meanings . 409 Section Types and Their Meanings . 410 Meanings of Link and Info . 410 Constituent Elements of Symbol Table Entries and Their Meanings . 411 Relationship Between Indexes and Character Strings in String Table . 412 Reserved Sections . 413 Formats of Messages Output by stk850 . 493 [Do you want to stop reading?] Dialog Box . 494 User's Manual U18512EJ1V0UM U18512EJ1V0UM 19 CHAPTER 1 OVERVIEW CHAPTER 1 OVERVIEW 1.1 Features of Compiler Package The C compiler package for the V850 microcontrollers contains the following programs. 1. C COMPILER (ca850) 2. ASSEMBLER (as850) 3. LINKER (ld850) 4. ROMIZATION PROCESSOR (romp850) 5. HEXADECIMAL CONVERTER (hx850) 6. ARCHIVER (ar850) 7. SECTION FILE GENERATOR (sf850) 8. DUMP COMMAND (dump850) 9. DISASSEMBLER (dis850) 10. CROSS REFERENCE TOOL (cxref) 11. MEMORY LAYOUT VISUALIZATION TOOL (rammap) 12. STACK USAGE TRACER (stk850) 13. LINK DIRECTIVE GENERATOR (LDG) These programs can be activated in either of the following ways. (1) Activating from integrated development environment "PM+" "PM+" is included in the C compiler package. For details of PM+, refer to PM+ User's Manual. (2) Activating from command line Activate the C compiler package by inputting a command in response to the command prompt. To generate a load module file by using a batch file or make file, describe the module in the command input format. Utilities 8 to 11 above can also be activated by inputting a command. For details on command input methods, refer to the section "Operation Method" for the respective tool. 20 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 1 OVERVIEW The package configuration is as shown below when PM+ is used. Figure 1 - 1 Package Configuration CA850 CA850 package command C compiler Assembler Linker ROMization processor Hexadecimal converter Archiver Section file generator Cross-reference tool Memory layout visualization tool Dump command Dissassembler Command prompt Stack usage tracer Link directive generator PM+ Specify the options of the C compiler, assembler, linker, and so on that are included in the "CA850 CA850 package commands" above on the relevant windows from PM+. PM+ automatically activates these commands and creates a load module file. To use the CA850 CA850, a device file that has device information is necessary. Obtain the device file corresponding to the device to be used. User's Manual U18512EJ1V0UM U18512EJ1V0UM 21 CHAPTER 1 OVERVIEW 1.2 Operating Environments The Windows version C compiler package operates under the following environments. (1) Host machine - CPU: Pentium IITM 400MHz or higher - Memory: 128 M bytes or more - OS: Windows® 2000, Windows XP Professional, Windows XP Home Edition Caution (2) Regardless of which OS is used, higher and the latest Service Pack must be installed. Related development tools - Integrated debugger ID850 ID850 (Ver.3.10 or later), ID850NW ID850NW (Ver.3.10 or later), or ID850QB ID850QB (Ver.3.10 or later) - System simulator SM850 SM850 (Ver.3.00 or later), or SM+ for V850 (Ver.2.00 or later) - Performance analysis tuning tool TW850 TW850 (Ver.2.10 or later) - Real-time OS RX850 RX850 (Ver.3.20 or later), RX850 RX850 Pro (Ver.3.20 or later) - Task debugger RD850 RD850 (Ver.3.20 or later), RD850 RD850 Pro (Ver.3.20 or later) - System performance analyzer AZ850 AZ850 (Ver.3.30 or later) - Device file installer DFINST (Ver.3.10 or later) Caution To use the CA850 CA850, a device file which includes the device information is required. Download the device file of target device to be used from the following web site: http://www.necel.com/micro/ods/eng/index.html 22 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 2 INSTALLATION CHAPTER 2 INSTALLATION This chapter describes the installation and uninstallation of the CA850 CA850. 2.1 Installation To use the CA850 CA850, both the CA850 CA850 itself and the related device files must be installed. To use PM+, PM+ must also be installed. Install the CA850 CA850 as follows. The supply medium is one CD-ROM. (1) Start Windows. (2) Insert the CD-ROM into the CD-ROM drive. The setup program starts up automatically. If the setup program does not start, start Windows Explorer, and double-click "Install.exe" in the CD-ROM drive. (3) Select the tool to be installed (CA850 CA850, PM+, STK850 STK850, LDG, etc.), and specify the folder in which the tool is to be installed. Then, click the [Install] button (4) Note Execute installation in compliance with the messages displayed on the screen. Install the device file in compliance with the device file installer (DFINST) that has been installed. User's Manual U18512EJ1V0UM U18512EJ1V0UM 23 CHAPTER 2 INSTALLATION 2.2 Folder Organization Figure 2 - 1 shows the organization of the file folder that is read from the supply medium when the CA850 CA850 is installed. Below is the CA850 CA850's standard folder (default). C:\Program Files\NEC Electronics Tools\CA850 CA850\Vx.xx In the CA850 CA850 package, the lib850 folder shown in Figure 2 - 1 is called the standard folder for the library, and the inc850 folder is called the standard folder for include files. Below is the standard folder for the device files (default). C:\Program Files\NEC Electronics Tools\DEV Figure 2 - 1 Folder Organization bin Command group inc850 Include file group lib Module group internally called by C compiler r22 r26 Install Folder smp850 Library (for 26-register mode) startup module r32 Library (for 32-register mode) startup module r32msk lib850 Library (for 22-register mode) startup module Library (for 32-register mode with mask register support) startup module ca850 Link directive sample hlp doc 24 Online help Online manual User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 2 INSTALLATION 2.2.1 Folder organization of stack usage tracer Figure 2 - 2 shows the organization of the file folder that is read from the supply medium when the stack usage tracer is installed. Below is the standard folder for the stack usage tracer (default). C:\Program Files\NEC Electronics Tools\STK850 STK850\Vx.xx Figure 2 - 2 Folder Organization of Stack Usage Tracer bin Command group Install Folder dat850 Stack size specification file for standard library functions User's Manual U18512EJ1V0UM U18512EJ1V0UM 25 CHAPTER 2 INSTALLATION 2.3 Uninstallation This section describes the method for uninstallation of the CA850 CA850. (1) Start Windows. (2) Start "Add or Remove Programs" ("Add/Remove Programs" in Windows other than Windows XP) on the Control Panel of Windows (3) Select the following items. - NEC EL CA850 CA850 Vx.xx - NEC EL CA850 CA850 Vx.xx Documents Remark Other tools (PM+, STK850 STK850, LDG, etc.) and documents can be uninstalled in a similar way. 26 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER CHAPTER 3 C COMPILER This chapter provides an overview and explains the operation and output messages of the C compiler (ca850). 3.1 Flow of Operation The ca850 creates relocatable object files and object files executable on the target system from C language source programs described in C language source files. The ca850 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 ca850 performs processing in the following sequenceNote (refer to 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 language 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 "File merging option (-Om)" is specified, two or more intermediate-language OPTIC programs are merged into one. If "Level 2 Advanced option (Exec. Speed)" 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 (as850) converts the assembly-language source program into machine language instructions and creates a relocatable object file. (7) The linker (ld850) links the relocatable object file, and creates an executable object file. The machine-dependent optimization module are called only when the optimization option is specified (refer to Figure 3 - 1). It is assumed that the modules of (1) front end (cafe) through (5) machinedependent optimization module (impr) are started from the ca850. Consequently, operation is not guaranteed if any of these modules is started alone. User's Manual U18512EJ1V0UM U18512EJ1V0UM 27 CHAPTER 3 C COMPILER Figure 3 - 1 Operation Flow of ca850 .c Code generation module Front end .s .ic -Od/-Og/Default(-Ob) specified -O/-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 .ic Input file processing completed YES .a Linker .out 28 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER 3.2 Input/Output Files The ca850 can specify the following files as input files or output files. file.c called the .c file file.ic OPTIC file called the .ic file file.s assembly language source file called the .s file file.o object file called the .o file file.a - C language source file archive file called the .a file The .s file is passed to the as850 (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 and .o files, are all passed as is to the ld850 Caution The input file names supported by Windows can be specified, but "@" cannot be used at the head of a file name because it is regarded as a command option. If the Kanji code of the file is EUC, a file name, folder name, or folder name in Japanese cannot be used. User's Manual U18512EJ1V0UM U18512EJ1V0UM 29 CHAPTER 3 C COMPILER 3.3 Executable Object The ca850 can read a C language source file and create an executable object file at the same time since it starts both the as850 and the ld850. In addition, processing can be stopped before the as850 and the ld850 are started by specifying the (-S) command line option and or by specifying single source compilation via PM+. Either of these methods can be used to output a compiler code or to create a relocatable object file (refer to "3.4 Operation Method" for details of these methods). Examples of starting commands from command line are shown below (refer to "3.5 Types and Features of Options" for details of the command line options). (1) When executing everything from the ca850 > ca850 -cpu 3201 file.c obj.o This specifies "-cpu 3201" (V850ES/SA2 V850ES/SA2) as the device and reads file.c and obj.o to create an executable object file a.out. At this time, crtE.o is linked as the startup module and the standard libraries libc.a and libm.a are referenced. > ca850 -cpu 3201 -R org_crt.o file.c obj.o This reads file.c and obj.o to create an executable object file a.out. At this time, org_crt.o is linked as the startup module and the standard libraries libc.a and libm.a are referenced. (2) When starting from the ca850 to the as850, and starting the ld850 alone > ca850 -cpu 3201 -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 3201 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. 30 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (3) When starting the ca850, the as850, and the ld850 by themselves > ca850 -cpu 3201 -c file.c This reads file.c to create the relocatable object file file.o. > as850 -cpu 3201 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. At this time, libc.a is referenced. User's Manual U18512EJ1V0UM U18512EJ1V0UM 31 CHAPTER 3 C COMPILER 3.4 Operation Method This section explains how to operate the ca850. 3.4.1 Command input method Enter the following from the command prompt. ca850 [option] . file name [file name or option] . [ ] : Can be omitted . : Pattern in proceeding [ ] can be repeated. 3.4.2 Method using PM+ The [Compiler Options] dialog box that is used to set compiler options for the C language source files can be displayed via either of the following methods once a project has been established under PM+. - Set for all C language source files of the target project (1) - Select [Tool] - [Compiler Options.]. Set for a specific C language source file (1) (2) 32 Select the name of the source file to be set a option in the [Project] window on the PM+. Select [Individual Compiler Options.] item that is displayed by clicking the right mouse button. User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER 3.5 Types and Features of Options The following table lists the ca850 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 ld850 option and is passed to the ld850 without modification. Some options listed below are not included in the PM+'s option dialog box. When one of these options must be specified, activate the ca850 from the command line. [Symbols used in option list] [V850E2 V850E2] Option dedicated to V850E2 V850E2 core [V850E V850E] Option dedicated to V850Ex core [PM+] Option exists as specification item under the PM+. [78K-compatible] Option compatible with 78K microcontrollers C compiler CC78Kx User's Manual U18512EJ1V0UM U18512EJ1V0UM 33 CHAPTER 3 C COMPILER 3.5.1 Version/help display/operation status Version/help display/operation status options are shown below. -V This option outputs ca850's version information to standard error output. It does not execute compilation. -help This option outputs an option description to standard error output. -v [PM+] This option outputs the execution status of the ca850 to the standard error output in detail. 34 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER 3.5.2 Output file specification This section describes the options that specify an output file. -Fic[=outfile] This option specifies where an OPTIC file generated during compilation is to be saved. (a) If the file name is specified as outfile Saves the outfile to the current folder under the specified file name. The extension of outfile is restricted to ".ic" (b) If the folder is specified as outfile Saves the outfile under a file name with extension .c replaced by .ic to the specified folder. (c) If =outfile is omitted Saves the outfile under a file name with extension .c replaced by .ic to the current folder. (d) If two or more files are output Creates a folder specified for outfile, and saves the OPTIC file under a file name with extension .c replaced by .ic. -Fo[=outfile] This option specifies where an object file generated in the middle of compiling is to be saved. (a) If the file name is specified as outfile Saves the outfile to the current folder under the specified file name. (b) If the folder is specified as outfile Saves the outfile under a file name with extension .c or .s replaced by .o to the specified folder. (c) If =outfile is omitted Saves the outfile under a file name with extension .c or .s replaced by .o to the current folder. (d) If two or more files are output Creates a folder specified as outfile, and saves the object file under a file name with extension .c or .s replaced by .o. -Fs[=outfile] [PM+] This option specifies where an assembly language file generated in the middle of compiling is to be saved. (a) If the file name is specified as outfile Saves the outfile to the current folder under the specified file name. (b) If the folder is specified as outfile Saves the outfile under a file name with extension .c replaced by .s to the specified folder. (c) If =outfile is omitted Saves the outfile under a file name with extension .c replaced by .s to the current folder. (d) If two or more files are output (this cannot be specified with PM+) Creates a folder specified as outfile, and saves the object file under a file name with extension .c replaced by .s. User's Manual U18512EJ1V0UM U18512EJ1V0UM 35 CHAPTER 3 C COMPILER -Fv[=outfile] [PM+] This option specifies whether an assemble list generated in the middle of compiling is to be saved. (a) If the file name is specified as outfile Saves the outfile to the current folder under the specified file name. (b) If the folder is specified as outfile Saves the outfile under a file name with extension .c or .s replaced by .v to the specified folder. (c) If =outfile is omitted Saves the object file under a file name with extension .c or .s replaced by .v to the current folder. (d) If two or more files are output (this cannot be specified with PM+) Creates a folder specified as outfile, and saves the outfile under a file name with extension .c or .s replaced by .v. If this option and the -a option are not specified, an assemble list will not be generated. -o outfile This option specifies an output file as outfile. It is valid even if compiling is stopped midway by specifying the compiler control option -S, -c, or -m. (a) If this option is specified with the -S option An assembler file (.s) is specified. (b) If this option is specified with the -c option A relocatable object file (.o) is specified. (c) If this option is specified with the -m option A front-end output file (.ic) is specified. (d) Other than above An executable object file (.out) is specified. (e) The default assumption is a.out. An error occurs. -temp=dir [PM+] This option specifies the work folder for creating temporary files that are used internally. If this option is omitted, temporary files are generated in a folder specified by environmental variable TEMP or a root folder in the current drive. If the capacity of the hard disk runs short and a temporary file cannot be generated, an error occurs. This error can be avoided by using this option. 36 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER 3.5.3 Controlling source debugger The following options are used to control the source debugger. -Xno_word_bitop [PM+] This option prohibits replacing the ld.w/ld.h and st.w/st.h instructions with 1-bit manipulation instructions (set1, clr1, tst1, and not1). If a read/write event of a variable is set during debugging, an event may not be generated if these instructions are replaced by 1-bit manipulation instructions. If this option is specified in such a case, the ld.w/ld.h and st.w/st.h instructions are not replaced by 1-bit manipulation instructions, making debugging easy. -g [PM+] This option outputs symbol information for the source debugger. When the as850 is started via the ca850, specification of this option is regarded as the same as specifying the as850's "-g" option. As a result, assembly language source debugging is performed by the debugger. User's Manual U18512EJ1V0UM U18512EJ1V0UM 37 CHAPTER 3 C COMPILER 3.5.4 Control of compile driver Control of compile driver options are shown below. (1) Options related to device specification -X256M -X256M [V850E V850E] [PM+] This option treats the memory space as 256 M bytes. If this option is not specified, address resolution is performed, assuming that the memory space is 64 M bytes. Set this option in accordance with the chipset to be used. The physical address space of the V850Ex core has 256 M bytes in many cases. When creating an application that uses a space between 64 M bytes and 256 M bytes, specify this option. -Xbpc=num [PM+] This option sets the higher address of the programmable peripheral I/O register. In num, specify only the part of address from which the highest bit of the BPC register is removed. If the target device has programmable peripheral I/O register functions (such as V850E/IA1 V850E/IA1), the value must be determined when compiling (assembling) the application to set the variable address portion (= value set in BPC register). Thus, specifying this option compiles (assembles) using the specified value. When specifying this option, be sure to specify a value. A binary, octal, decimal, or hexadecimal number can be used for the value. If an invalid value is specified, or if a value outside the range that can be set in the BPC register is specified, a warning message is output and this option is ignored. Example -Xbpc=0x1234 In the above case, if the target device is the V850E/IA1 V850E/IA1, the start address of the programmable peripheral I/ O register area is treated as this value shifted 14 bits to the left, or 0x48d0000. One value is set for an entire application. If you specify "-Xbpc" or "-bpc" when setting options by file, make the values the same between files. However, this option need not be specified for files that do not use the programmable peripheral I/O register. If this option is specified for a target device that does not have programmable peripheral I/O register functions or when assembling as a common for V850 core/V850Ex core/V850E2 core, a warning message is output and this option is ignored. This option is for determining the address of the programmable peripheral I/O register when compiling (assembling) and does not actually cause a value to be reflected in the BPC register. For operation, it is necessary to set a value in the BPC register separately using a startup module or the like. A sample appears (commented out) in the startup module included in the package. 38 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER Example For the V850E/IA1 V850E/IA1, specify the following descriptions in the startup module to make the variable portion of the start address of the programmable peripheral I/O register "0x1234" and set the flag 0x8000 that enables the use of this function. mov0x9234, r10 - - 0x1234 | 0x8000 = 0x9234 st.hr10, BPC The as850 outputs a .bpc section in the special reserved sections when the programmable peripheral I/O register is referenced, regardless of whether this option is specified or omitted. This section is used for checking when linking. The .bpc section is a special reserved section for information and is never loaded into memory. Therefore, it need not be specified in a link directive like a normal section. -cn This option embeds the magic number of common to V850 core into the object to be generated. For further description of magic numbers, refer to "4.7.1 Magic number". -cnv850e [V850E V850E] This option embeds the magic number of common to V850Ex core into the object to be generated. -cnv850e2 [V850E2 V850E2] This option embeds the magic number of common to V850E2 V850E2 core into the object to be generated. -cpu devicename This option specifies the target deviceNote. When using PM+, this is equivalent to specifying the device on the [Project Information] of the [Project Settings] wizard. If this option is omitted and nothing has been specified by the -cn option, -cnv850e option, -cnv850e2 option or #pragma directive, compilation is stopped. Note This has the same function as "#pragma cpu devicename". There are two methods: specification by the -cpu option or specification by the #pragma directive. If both are specified but have different contents, the specification by the -cpu option has priority. -devpath=dir This option searches a device file from the folder dir. Only the standard folders are searched if this option is omitted. When using PM+, the device file's installation folder is automatically set, so there is no need to be aware of this option. User's Manual U18512EJ1V0UM U18512EJ1V0UM 39 CHAPTER 3 C COMPILER (2) Compiler control specification options -S This option outputs the generated assembly language source program without executing any modules under the as850. The output file uses .s as the extension instead of .c. If this option is omitted, modules following the as850 are also executed. However, modules under the as850 are also executed if this option has been specified via PM+. To avoid executing those modules, compile source files one at a time. -a This option outputs an assemble list to a file whose extension .c is changed to .v (refer to "4.6 Assemble List"). When the -Og, -O, -Os, or -Ot option is specified, a part of the assemble list may be incorrectly output due to instruction rearrangement for optimization by the as850. By using this option (-Fv option) with PM+, a file name on the assemble list can be specified. -c This option outputs the object file without starting the ld850. The file name extension is .o instead of .c or .s. The ld850 is started if this option is omitted. When PM+ is used, this option is automatically specified for all compilation. -m This option simply executes the front end, generates an .ic file, then terminates processing. If this option is omitted, modules after the front end are also executed. (3) ROMization control option -Xr [PM+] This option is necessary when creating an object for ROMization, and starts up the ROMization processor after link processing. The created object file (default name: romp.out) is the file with the ROMization information. The compiler processing is as follows. (a) The label of the first argument for _rcopy specifies the first address (aligned according to the four-byte alignment condition) that exceeds the end of the .text section in the object. (b) Consequently, this specifies the area securing code for the rompsec section (default name: rompcrt.o) and the libr.a file to be linked by the linker (ld850). Refer to "6.4 Creating Object for ROMization" for details of ROMization object creation methods. 40 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (4) Preprocessor processing setting options -C [PM+] The -C option includes source program comments in a C language source program's preprocessing output. This option is valid only when either the -E option or the -P option has been specified. -Dname[=def] [PM+] When this option is specified, it is assumed that #define name def is entered before the C language source program. If the =def specification is omitted, the def value is regarded as 1. Up to 256 of this options can be specified. -E This option executes preprocessing only for a C language source program and outputs the results to standard output. The results include the line numbers and file name of the source program. -Idir [PM+] This option searches the folder dir and the standard folder, in that order, for the header file of a C language source program. Up to 100 of this option can be specified. If this option is omitted, only the standard folder is searched. The standard folder is the install folder \inc850 folder. If #include "header file name" is described, the folder where the source file is stored is searched first. -P This option executes preprocessing only for a C language source program and outputs the results to a file whose name is the C language source file name plus .i as the extension instead of .c. The source program's line numbers and file name are not output. -Uname [PM+] When this option is specified, it is assumed that #undef name is coded before the C language source program. Up to 256 of this options can be specified. -Wa,-Dname[=num] [PM+] When this option is specified, it is assumed that .set name, num is entered before the assemble source. If the =num specification is omitted, the num value is regarded as 1. -Wa,-I,dir [PM+] This option searches the folder dir and the standard folder, in that order, for the header file of an assembly language file. If this option is omitted, only the standard folder is searched. User's Manual U18512EJ1V0UM U18512EJ1V0UM 41 CHAPTER 3 C COMPILER -Xcxxcom [PM+] In addition to ordinary comments, this interprets all characters that appear after "//" and before the end of the line as comments (C+ comment style). -Xd This option outputs a warning message in response to initialization of a pointer type external variable which uses a variable address that is not an automatic variable or which uses a function address. -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. A default value of 2047 is used if this option is omitted. 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. -t [PM+] This option replaces a trigraph sequence. This option specifies a three-character (trigraph) string to be replaced by a single character defined by the ANSI standard. For details, refer to the documents related to the ANSI standard. (5) Options to save memory during compilation -Wp,-D [PM+] This option reduces memory in pre-optimizer phase during compiling. Specify this option if compiling is not completed correctly because the memory of the machine runs short. The compilation speed drops when this option is specified. -Wi,-D [PM+] This option reduces the memory capacity used in the machine dependent optimization phase during compiling. Specify this option if compiling is not completed correctly. The compilation speed drops when this option is specified. 42 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (6) Error output specification options +err_file=file This option adds and saves error messages to the file file. With PM+, specifying a file name as "Error File" on the [File] in the [Compiler Common Options] dialog box is equivalent to specifying this option. -err_file=file This option overwrites and saves error messages to the file file. -err_limit=num [PM+] This option specifies the maximum number of error message to be output, num. Specify 15 to 50 in decimal numbers as num. If this option is omitted, 15 is assumed. (7) Expansion function specification option -cc78k [78K-compatible] [PM+] This option enables the expansion functions compatible with the 78K microcontrollers C compiler CC78Kx. User's Manual U18512EJ1V0UM U18512EJ1V0UM 43 CHAPTER 3 C COMPILER 3.5.5 Optimization "Optimization" is processing used to increase the execution speed of an application or to decrease the ROM capacity to be used. How optimization is performed differs depending on the level of optimization. If a high level of optimization is selected, the compilation speed may slow down and the probability of allocating C language source lines to be deleted or changed and variables to registers increases. In the latter case, phenomena such as being unable to set breakpoints with the debugger may occur, and the debugging efficiency may be affected. For details of optimization, refer to "3.7.3 Efficient use of optimization". (1) Optimization options -Od [PM+] Optimize for Debugging option This option generates codes emphasizing logic debugging, without putting stress on the ROM capacity and execution speed. Its function is equivalent to the default optimization of CA850 CA850 Ver. 2.41 or earlier. -Ob [PM+] Default Optimization option This option generates codes emphasizing logic debugging. It executes optimization within a range where logic debugging is not affected -Og [PM+] Standard Optimization option This option executes appropriate optimization. It executes optimization that allows debugging of the C language source in most cases. Because external variables are assigned to registers, both the execution speed and code size are improved from those of the default option. -O [PM+] Level 1 Advanced Optimization option This option executes optimization emphasizing the ROM capacity. -Os [PM+] Level 2 Advanced (Object Size) option This option executes the maximum optimization placing the utmost emphasis on the ROM capacity. -Ot [PM+] Level 2 Advanced (Exec. Speed) option This option executes the maximum optimization placing the utmost emphasis on the execution speed rather than on the ROM capacity. 44 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (2) Target code optimization options -Wi,-O4 [PM+] This option strictly analyzes the data flow and executes the most advanced optimization. Specify this option, in addition to the optimization option -O, -Os, or -Ot, to execute more advanced optimization. Specifically, this option executes optimization as follows. - Optimization of registers extending over a branch instruction - Optimization of absolute value operations - Optimization of a cmp instruction extending over a branch instruction - Optimization of a return instruction extending over a branch instruction Depending on the source, the result may be the same as that of -Os or -Ot. The compiling time is longer than that of -Os or -Ot. -Wi,-P [PM+] This option prevents optimization that allows branch destination labels to be aligned. This option can reduce the size of the execution code. It is useful when the Level 2 Advanced option (Exec. Speed) -Ot is specified. (3) File merging option -Om When two or more files are specified at the same time, this option merges the files. The compiling speed will drop, but the optimization application range of such as optimization between functions can be expanded by specifying this option together with the optimization option -O, -Os or -Ot. However, source debugging will become difficult. (4) Inline expansion optimization control options -Wp,-Gnum [PM+] This option limits the stack size of a function in an intermediate language subject to inline expansion to size num, and does not execute inline expansion of a function larger than num. For num, refer to the description of the -Wp,-l[=file] option below. If this option is not specified, it is assumed that -Wp,-G32 is specified. -Wp,-Nnum [PM+] Restricts the intermediate language size for a function subject to inline expansion by the num value specification so that inline expansion is not performed for any value larger than the num value. Refer to the -Wp,-l[=file] option's description below with regard to the range of num values. -Wp,-N128 -N128 is assumed as the specification if this option is omitted and Level 2 Advanced option (Exec. Speed) is specified, otherwise -Wp,-N24 is assumed as the specification. User's Manual U18512EJ1V0UM U18512EJ1V0UM 45 CHAPTER 3 C COMPILER -Wp,-S [PM+] This option unconditionally executes inline expansion of a static function that is referenced only once. -Wp,-l[=file] [PM+] This option outputs function information to standard output or additional output to the file. It serves as a guide to the value to be specified by the -Wp,-Gnum and -Wp,-Nnum options above. For example, a function called is expanded inline if the function requires stack size equal to or less than the value specified by -Wp,-Nnum. If the function has code size equal to or less than the value specified by -Wp,-Nnum, it is expanded inline. Note that the stack size output by this option is the size in intermediate language output by the pre-optimizer and is different from the stack size actually used by the function. -Wp,-inline [PM+] This option executes inline expansion of only a function for which #pragma inline is specified. When -Ot is specified, the compiler automatically identifies the function and executes inline expansion. Specify this option to expand only the function specified by the user. -Wp,-no_inline [PM+] This option suppresses inline expansion of all functions, including the function for which #pragma inline is specified. It is useful for suppressing all inline expansion functions when -Ot is specified. -Wp,-r[funcname] This option deletes unnecessary functions from the functions called from an entry function, funcname, after expansion. Specify funcname by prefixing '_' to a function described in C. If funcname is not specified, it is assumed that "_main" is specified. The function that is called only by an assembler statement is deleted as an unnecessary function because the calling is not recognized. Interrupt functions and real-time OS tasks are not included as functions subject to deletion. For the relationship between inline expansion and option, refer to CA850 CA850 for C Language User's Manual. 46 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (5) Loop expansion optimization control options -Wo,-Ol[num] [PM+] This option expands a loop num times using for and while. This option can be specified only for "Level 2 Advanced option (Exec. Speed)". The loop is converted into execution of a loop that is executed N times (N is a constant) and execution of a loop that includes a code expanded num times. If the code size after expansion is too great or if the number of times of execution of the loop is too few, the number of times of expansion may decrease, or the loop may not be expanded at all. In addition, a loop having a complicated structure, such as having inner loops, may not be expanded. If 0 or 1 is specified as num, expansion is suppressedNote. If num is not specified, it is assumed that 4 is specified. Specify num in decimal numbers. Example To expand a loop that is executed 10 times four times i = 0; while(i < 10) { /* Processing */ +i; } Note i = 0; /* Processing */ i =1; /* Processing */ i = 2; while(i < 10) { /* Processing +i; /* Processing +i; /* Processing +i; /* Processing +i; } */ */ */ */ This option is useful when loop expansion does not need to be performed with "Level 2 Advanced option (Exec. Speed)" specified. -Wo,-Xlo [PM+] This option expands a loop by fixing the number of times of expanding the loop to the value specified by -Wo,-Olnum. User's Manual U18512EJ1V0UM U18512EJ1V0UM 47 CHAPTER 3 C COMPILER (6) strcpy, strcmp expansion option -Xi [PM+] This option sets a four-byte alignment condition for arrays (including character strings) and structures and expands strcpy() or strcmp() function calls to inline. This speeds up the object's execution but it also increases the code size. This option executes conversion only when the second argument of strcpy() or strcmp() is a character string. In addition, the program requires four-byte alignment of the first argument (the ca850 aligns the second argument since it is a character string). This option must not be specified together with the -Xpack option. (7) External variable sort options -Wo,-Op[=file] [PM+] This option rearranges external variables allocated to a section other than const/sconst sequentially, starting from the largest alignment size. If the intermediate file file is specified, the definition and temporary definition of variables in the source file allocated to a section other than const/sconst having external linkage are moved to file. After being moved, the definition and temporary definition of the source file are treated in the same manner as declaration. An error does not occur even if file does not exist at the beginning. (8) Branch instruction control option -Wo,-XFo [PM+] This option arranges and outputs branch instructions, giving priority to the code size. However, it makes source debugging difficult. This option is valid when the -Og, -O, -Os, or -Ot option is specified. If this option is omitted, a code giving priority to debug information is output for a branch instruction. 48 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER 3.5.6 Generation code control Generation code control options are shown below. (1) Register use control options -rnum=sym [PM+] By using the -rnum option, an external variable can be allocated to a register. Specify a register other than the mask register that is vacated by specifying the -reg option. Specify an external variable using a symbol name, excluding "_". The following external variables must not be specified. - volatile variable - Variable using address operator "&" - Structure - Array - Internally coupled variable (static) - Peripheral I/O register The definition (temporary definition) and declaration of the specified external variable are deleted. To use the default value of an external variable (if initialization is not executed at the beginning of program execution), assign a default value to a register using the startup file. -regn [PM+] This option limits the number of registers used by the ca850 as n registers (n = register mode). The specifiable range of values for n are: Table 3 - 1 Register Mode Register Mode (n) Working Registers Registers for Register Variables 22 r10 - r14 r25 - r29 26 r10 - r16 r23 - r29 32 r10 - r19 r20 - r29 This option cannot be set independently for each source file, and is always used for all files. Since the settings by this option are also recognized by the linker, a library of the appropriate mode is referenced. 32 (32-register mode) is specified if this option is omitted. By specifying this option, the register mode of the software register bank function can be changed. User's Manual U18512EJ1V0UM U18512EJ1V0UM 49 CHAPTER 3 C COMPILER -Xmask_reg [PM+] This option specifies use of the mask register function. When this function is used, the ca850 outputs codes, assuming that an 8-bit mask value, 0xff, is set to r20 and a 16-bit mask value, 0xffff, is set to r21. Mask values must be set to the mask registers (r20 and r21) by a user program such as the startup routine. With the V850 microcontrollers, byte data and halfword data are sign-extended to word length, depending on the value of the most significant bit, when they are loaded from memory to registers. Consequently, the mask code of the higher bits may be generated when an operation on unsigned char or unsigned short type data is performed. When the result of an operation is stored in a register variable, a mask code is generated for unsigned byte data and unsigned halfword data to clear the higher bits. In both the cases, generation of the mask code can be avoided if word data is used. If word data cannot be used and a mask code is generated, the code size can be reduced by using the mask register function. To decide whether the mask register function is to be used or not, the following points must be thoroughly considered. - Is it a program that outputs many mask codes? - Two register variable registers are used as mask registers: Does this have any effect? If an object that uses a mask register and an object that does not use a mask register exist together when this option is specified, the ld850 outputs an error. In the 32 register mode, -mask_reg is passed to the ld850. As a result, the standard library is searched by the linker first in the mask register folder (lib850/r32mak) and then the standard folder. For the mask register function, refer to CA850 CA850 for C Language User's Manual. (2) Prologue/epilogue runtime option -Xpro_epi_runtime[=on|=off] [PM+] This option specifies whether or not to perform prologue/epilogue processing based on runtime library function calls. If this option is on, prologue/epilogue processing of the function is performed based on run-time library function calls. If neither [=on] or [=off] is specified, specification of [=on] is assumed. This option is set to on if an optimization option other than the "Level 2 Advanced option (Exec. Speed) [-Ot]" is specified as the optimization type of the "Optimization and Debug Information" option, or by default, and is set to off if [=off] is specified or the -Ot option is specified. 50 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (3) Variable placement control options -Gnum [PM+] Data that is less than num bytes is allocated to the .sdata section or the .sbss section. If this option is omitted, all data is allocated to the .sdata section or the .sbss section. However, any data that is specified for an .sdata or .sbss section in a #pragma section directive or a section file (refer to "9.1 Section Files") is allocated to the .sdata or .sbss section regardless of the data size. Specify a decimal number as the num value. The range of values that can be specified as num is output by the ld850's "-A" option. For details of the #pragma section directive, refer to CA850 CA850 for C Language User's Manual . -Xsconst[=num] [PM+] This option allocates const attribute data and character string literal to the .sconst section. If num has been specified, data whose size is num bytes or less is allocated to the .sconst section and if num has been omitted, allocation is performed regardless of the data size. Specify a decimal number as the num value. If a different option is specified for each file, a code of a different method of placing and referencing variables may be generated and an error or warning may be output during linking (a different option cannot be specified for each file with PM+). -Xcre_sec_data[=outfile] [PM+] This option outputs a variable frequency data file used by the section file generator. (a) If the file name is specified as outfile Saves the outfile to the current folder under the specified file name. (b) If the folder is specified as outfile Saves outfile to a specified folder, with extension .c replaced by .sec. (c) If =outfile is omitted Saves the file to the current folder, with extension .c replaced by .sec. (d) If two or more files are output Creates a folder specified as outfile, and saves the files with extension .c replaced by .sec. When several C language source files exist, and a frequency data file is to be created with a file name specified for each file, PM+ opens the option dialog box for each C language source file from the source file list and then specifies a file name when the frequency data file is created. When using command line input, it specifies this option with =outfile for each C language source file. The C language source files are specified one at a time (with -c specified). The variable frequency data file outputs information how often the ld850 or st instruction accesses variables in the C language source file. Nothing is performed on the assembly language source file. When this option and the -Xcre_sec_data_only option are simultaneously specified, the Xcre_sec_data_only option takes priority. User's Manual U18512EJ1V0UM U18512EJ1V0UM 51 CHAPTER 3 C COMPILER -Xcre_sec_data_only[=outfile] This option outputs the variable frequency data file used by the section file generator. However, unlike the -Xcre_sec_data, this option outputs only the variable frequency data file and does not perform object generation. This is used when outputting only the frequency data file. (a) If the file name is specified as outfile Saves the outfile to the current folder under the specified file name. (b) If the folder is specified as outfile Saves the outfile under a file name with extension .c replaced by .sec to the specified folder. (c) If =outfile is omitted Saves the outfile under a file name with extension .c replaced by .sec to the current folder. (d) If two or more files are output Creates a folder specified as outfile, and saves the object file under a file name with extension .c replaced by .sec. When several C language source files exist, and a frequency data file is to be created with a file name specified for each file, PM+ opens the option dialog box for each C language source file from the source file list and then specifies a file name when the frequency data file is created. When using command line input, it specifies this option with =outfile for each C language source file. The C language source files are specified one at a time (with -c specified). The variable frequency data file outputs information how often the ld850 or st instruction accesses variables in the C language source file. Nothing is performed on the assembly language source file. -Xsec_file=file [PM+] This option specifies the name of the section file (refer to "9.1 Section Files") that is used to specify section allocation of data when the C language compiler is activated.Be sure to specify this file name. This option can be specified several times and several section files can be input. 52 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (4) Signed/unsigned control option -Xbitfield=string [PM+] 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. -Xenum_type=string [PM+] This option specifies which integer type the enumeration type matches. The following can be specified as string. char Treated as char uchar Treated as unsigned char short Treated as short ushort Treated as unsigned short If this option is omitted, the enumeration type is treated as signed int. User's Manual U18512EJ1V0UM U18512EJ1V0UM 53 CHAPTER 3 C COMPILER (5) Switch-case statement output code control options -Xcase=string [PM+] This option specifies a mode in which the code of a switch statement is to be output. As string, the following can be specified. ifelse Outputs the code in the same format as the if-else statement along a string of case statements. If the case statements are written in the order of frequency or if only a few labels are used, select this option. Because the case statements are compared starting from the top, unnecessary comparison can be reduced and the execution speed can be increased if the case statement that most often matches is written first. binary Outputs the code in the binary search format. Searches for a matching case statement by using a binary search algorithm. If this option is selected when many labels are used, any case statement can be found at almost the same speed. table Outputs the code in a table jump format. A table indexed based on the value of a case statement is referenced and a case label is selected depending on the value of the switch statement. Execution branches to any case statement at almost the same speed. If case values are not used in succession, an unnecessary area is created. If this option is omitted, the compiler automatically selects the optimum format. -Xword_switch [PM+] This option creates one four-byte branch table per case label in a switch statement. Specify this option to prevent compile errors that would otherwise occur when the switch statement is long. Two-byte branch tables are generated if this option is omitted. 54 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (6) Structure packing control options -Xbyte [PM+] This option specifies indirect address access to a structure in byte units. Use this option if a limit is exceeded when the structure packing function is used. -Xpack=num [PM+] By using this option, the specified alignment can be used without aligning structure members in accordance with the type of each member. The data size can be reduced but the code size increases. 1, 2, 4, or 8 can be specified as num. The default value is 8Note. If this option is specified if structure packing is specified by the #pragma directive in the C language source, the value specified by this option is applied to all structures until the first #pragma directive appears. After that, the value of the #pragma directive is applied. Even after the #pragma directive has appeared, however, the value specified by the option is applied if the default value is specified. This option must not be specified with Xi option. Note the following when using this option. (a) If -Xpack option is specified when structure packing is specified by the #pragma directive in the C language source, the value specified by the option is applied to all structures until the first #pragma pack directive appears. After that, the value of the #pragma directive is applied. Even after the #pragma directive has appeared, however, the value specified by the option is applied if the default value is specified. This option has following restrictions, when using the V850 core/V850Ex core/V850E2 core that is set to disable misalign access. These restrictions are the same as for #pragma pack. (a) The address of a structure member cannot be obtained correctly. (b) Accessing a bit field also accesses a data field because the type of the member is read. If the width of the bit field is less than the type of the member, the outside of the object is accessed because the type of the member is read. Usually, no problem with execution occurs, but an illegal access may be made if I/O is mapped. For details of structure packing, refer to CA850 CA850 for C Language User's Manual. Note With this version, the operation when the value of num is "4" is the same as that when it is "8". User's Manual U18512EJ1V0UM U18512EJ1V0UM 55 CHAPTER 3 C COMPILER (7) Far jump output control options -Xfar_jump=file -Xfar_jump file [PM+] The jmp directive is used to branch (jump) to the function specified in file. The ld850 outputs an error if the function is in a range that cannot be branched to by the jarl or jr directive, in which case this option is used to recompile. The file name space cannot be left blank. A extension is necessary for a file name. The extension ".fjp" is recommended. This option must not be specified to call a function at the flash side from the boot side by using the Flash/ external ROM re-link function. For details, refer to "5.6 Flash Memory/External ROM Relink Function". -Xj [PM+] This option uses the jmp instruction to perform a branch for an ordinary interrupt function defined in C language. If the number of functions is in the range that cannot be branched by the jr directive and the ld850 outputs an error, this option can be used to recompile. The jr instruction is used if this option is omitted. This option must not be specified to call a function at the flash side from the boot side by using the Flash/ external ROM re-link function. For details, refer to "5.6 Flash Memory/External ROM Relink Function" . (8) Comment output option -Xc [PM+] This option outputs C language source programs as comments to the assembly language source file to be output. However, the output comments are for reference only and may not correspond exactly to the code. For instance, comments concerning global variables, local variables, function declarations, etc., may be output to incorrect positions. If the code is deleted on the optimization, only the extracted comment may remain. To use this option, -S, -a, -Fs, or -Fv must be specified. 56 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER (9) ANSI standard options -Xe [PM+] This option specifies that runtime library _ _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. The runtime library of the CA850 CA850 is prepared as the standard library of CA850 CA850 so that the instructions not provided to the architecture of the V850 microcontrollers satisfy the ANSI standard. For the runtime library, refer to CA850 CA850 for C Language User's Manual . -Xdefvar [PM+] This option handles tentative definition as definition. -ansi [PM+] This option makes ca850 processing comply with the ANSI standard and outputs an error or warning for a specification that violates the standard. Extended description other than in _asm format is recognized. Specifying this option defines the macro name _ _STDC_ . If this option is omitted, compatibility with the conventional C language specifications is conferred and processing continues after warning message is output. Processing when compiling in strict adherence to the language specification is as follows. (1) Trigraph sequences Replaces trigraphs. They are not replaced if this option is not specified. (2) Bit fields It is an error if a type other than an int type is specified in a bit field. If this option is not specified, a warning may be output and the specification is permitted. (3) Scope of variables If an automatic variable of the same name as a function argument is declared, it is a duplicate definition error. If this option is not specified, a warning may be output and the automatic variable is made valid. (4) Pointer assignment (a) It is an error if a pointer type numeric value is assigned to a general integer type variable. If this option is not specified, a warning may be output and the pointer is assigned by casting. (b) It is an error to assign pointers that point to different types. If this option is not specified, a warning may be output and the assignment is permitted. (5) Type conversion It is an error to convert a non-left side value array to a pointer. If this option is not specified, a warning may be output and the conversion is permitted. (6) Comparison operators Comparison of a pointer to an arithmetic type variable is an error. If this option is not specified, a warning may be output and the comparison is permitted. User's Manual U18512EJ1V0UM U18512EJ1V0UM 57 CHAPTER 3 C COMPILER (7) Conditional operators It is an error if the second and third expressions are not both general integer types, the same structure, the same common, or pointer types to the same type of target. If this option is not specified, a warning may be output and the operator is assigned by casting. (8) #line-number This is an error. If this option is not specified, #line-number is treated the same way as "#line line- number". (9) "#" character within a line This is an error. If this option is not specified, a warning may be output and the "#" character is permitted. (10) _asm A warning may be output and -asm is treated as a function call. However, _asm is valid. If this option is not specified, -asm is treated as an assembler insert. (11) _STDC_ _ A macro with a value of 1 is defined. If this option is not specified, the macro name is not defined as a macro. (12) B ina r y c on stan t Unusable. If this option is not specified, a string that consists of "0b" or "0B" followed by one or more "0" or "1" is handled as a binary constant. 58 User's Manual U18512EJ1V0UM U18512EJ1V0UM CHAPTER 3 C COMPILER 3.5.7 Library specification Library specification options are shown below. -Ldir This option searches libraries starting in the folder dir, then in the standard folder. Only the standard folder is searched if this option is omitted. The standard folder is the install folder \lib850 folder and install folder \lib850\r32 folder. If the register mode is specified, however, r22 or r26 folder is searched instead of r32 folder. Refer to the description of the -L option of the ld850. -R file When startup goes as far as the ld850, the startup module to be used is indicated to the ld850 as file. For details of the startup module, refer to CA850 CA850 for C Language User's Manual . If this option is omitted, crtN.o in the standard folder is used as the startup module. The standard folder is the install folder \lib850\r32 (r26 or r22). -lstring This option specifies the archive file that is referenced by the ld850. Nothing is referenced if this option is omitted. When activating the ld850 from the ca850, however, the ca850 automatically passes the link specification of the standard library (-lc) and mathematical library (-lm) to the ld850. For how to specify an archive file, refer to the description of the ld850 library specification option (-l). User's Manual U18512EJ1V0UM U18512EJ1V0UM 59 CHAPTER 3 C COMPILER 3.5.8 Warning message control Warning message control options are shown below. -wnum [PM+] This option specifies the level of warning messages. The following numbers can be specified as num. 0 Suppresses message 1 Outputs ordinary warning message 2 Outputs detailed warning message The -w0 specification is assumed if num is omitted. The -w1 specification is assumed if this option is omitted. -wstring+ -wstringThis option specifies outputting or suppressing a warning message for each parameter regardless of the level. A warning message is output when "+" has been specified or is suppressed when "-" has been specified. The following character strings can be specified as string. bitfield_align When bit field members have exceeded the boundary set by the alignment condition and have been allocated starting from the next boundary bitfield_type When a type that cannot be specified in the ANSI specification is specified for the bit field callnodecl When calling an undeclared function nopic When using a variable address that is not an automatic variable or a function address to initialize a pointer type external variable pragma When a non-executable #pragma description appears sharp When a sharp symbol (#) appears in a source line An error occurs if neither "+" nor "-" has been specified. The specification is according to the -wnum level if this option is omitted. -won=num[,num]. -won=nu