C Cross Compiler User's Guide for RENESAS RX
Total Page:16
File Type:pdf, Size:1020Kb
OSMIC Version 4.0 CSoftware C Cross Compiler User’s Guide for RENESAS RX Copyright © COSMIC Software 1995, 2014 All Trademarks are the property of their respective owners Table of Contents Preface Organization of this Manual ....................................................... 1 Chapter 1 Introduction Introduction................................................................................. 4 Document Conventions............................................................... 4 Typewriter font..................................................................... 4 Italics .................................................................................... 5 [ Brackets ] ........................................................................... 5 Conventions.......................................................................... 6 Command Line ..................................................................... 6 Flags ..................................................................................... 6 Compiler Architecture ................................................................ 8 Predefined Symbol...................................................................... 9 Linking........................................................................................ 9 Programming Support Utilities................................................. 10 Listings...................................................................................... 10 Optimizations............................................................................ 11 Chapter 2 Tutorial Introduction Acia.c, Example file.................................................................. 14 Default Compiler Operation............................................... 16 Compiling and Linking............................................................. 17 Step 1: Compiling............................................................... 17 Step 2: Assembler............................................................... 18 Step 3: Linking ................................................................... 19 Step 4: Generating S-Records file ...................................... 22 Linking Your Application......................................................... 23 Generating Automatic Data Initialization................................. 24 Specifying Command Line Options ......................................... 27 Chapter 3 Programming Environments Introduction............................................................................... 30 Memory Models........................................................................ 31 Bit Variables ............................................................................. 33 Modifying the Runtime Startup ................................................ 34 Description of Runtime Startup Code ................................ 34 Initializing data in RAM........................................................... 36 (i) The const and volatile Type Qualifiers..................................... 38 Performing Input/Output in C................................................... 40 Redefining Sections.................................................................. 41 Referencing Absolute Addresses.............................................. 42 Inserting Inline Assembly Instructions..................................... 44 Inlining with pragmas......................................................... 44 Inlining with _asm.............................................................. 45 Writing Interrupt Handlers ....................................................... 47 Placing Addresses in Interrupt Vectors .................................... 48 Interfacing C to Assembly Language ....................................... 49 Register Usage.......................................................................... 51 Heap Management Control with the C Compiler..................... 52 Modifying The Heap Location........................................... 54 Data Representation.................................................................. 57 Chapter 4 Using The Compiler Invoking the Compiler.............................................................. 60 Compiler Command Line Options ..................................... 61 File Naming Conventions......................................................... 66 Generating Listings................................................................... 67 Generating an Error File ........................................................... 67 Return Status............................................................................. 67 Examples .................................................................................. 67 C Library Support..................................................................... 68 How C Library Functions are Packaged............................. 68 Inserting Assembler Code Directly .................................... 68 Linking Libraries with Your Program................................ 68 Integer Library Functions................................................... 68 Common Input/Output Functions....................................... 69 Functions Implemented as Macros..................................... 69 Functions Implemented as Builtins .................................... 70 Including Header Files ....................................................... 70 Descriptions of C Library Functions ........................................ 71 Generate inline assembly code........................................... 72 Abort program execution.................................................... 73 Find absolute value............................................................. 74 Arccosine............................................................................ 75 Arcsine................................................................................ 76 Arctangent .......................................................................... 77 Arctangent of y/x................................................................ 78 Convert buffer to double .................................................... 79 (ii) Convert buffer to integer .................................................... 80 Convert buffer to long ........................................................ 81 Convert buffer to long long ................................................ 82 Allocate and clear space on the heap.................................. 83 Round to next higher integer .............................................. 84 Verify the recorded checksum............................................ 85 Verify the recorded checksum............................................ 86 Verify the recorded checksum............................................ 87 Verify the recorded checksum............................................ 88 Cosine................................................................................. 89 Hyperbolic cosine............................................................... 90 Divide with quotient and remainder................................... 91 Exit program execution ...................................................... 92 Exponential......................................................................... 93 Find double absolute value................................................. 94 Copy a moveable code segment in RAM........................... 95 Round to next lower integer ............................................... 96 Find double modulus .......................................................... 97 Free space on the heap........................................................ 98 Extract fraction from exponent part ................................... 99 Get character from input stream ....................................... 100 Get a text line from input stream...................................... 101 Test for alphabetic or numeric character.......................... 102 Test for alphabetic character ............................................ 103 Test for control character.................................................. 104 Test for digit ..................................................................... 105 Test for graphic character................................................. 106 Test for lower-case character............................................ 107 Test for printing character ................................................ 108 Test for punctuation character.......................................... 109 Integer square root............................................................ 110 Test for whitespace character ........................................... 111 Test for upper-case character............................................ 112 Test for hexadecimal digit ................................................ 113 Find long absolute value................................................... 114 Scale double exponent...................................................... 115 Long divide with quotient and remainder ........................ 116 Find long long absolute value........................................... 117 Long long divide with quotient and remainder ................ 118 Long long integer square root........................................... 119 Natural logarithm.............................................................. 120 Common logarithm........................................................... 121 (iii) Restore calling environment............................................. 122