
OSMIC Version 4.0 CSoftware C Cross Compiler User’sARY Guide forN PowerPC PRELIMI Copyright © COSMIC Software 1995, 2008 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................................................... 9 Listings...................................................................................... 10 Optimizations............................................................................ 10 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 ...................................... 21 Linking Your Application......................................................... 23 Generating Automatic Data Initialization................................. 24 Specifying Command Line Options ......................................... 27 Chapter 3 Programming Environments PRELIMINARYIntroduction............................................................................... 30 Modifying the Runtime Startup ................................................ 31 Description of Runtime Startup Code ................................ 31 Initializing data in RAM........................................................... 34 The const and volatile Type Qualifiers..................................... 36 (i) Performing Input/Output in C................................................... 38 Redefining Sections.................................................................. 39 Referencing Absolute Addresses.............................................. 41 Inserting Inline Assembly Instructions..................................... 43 Inlining with pragmas......................................................... 43 Inlining with _asm.............................................................. 44 Writing Interrupt Handlers ....................................................... 46 Placing Addresses in Interrupt Vectors .................................... 47 Interfacing C to Assembly Language ....................................... 48 Register Usage.......................................................................... 50 Heap Management Control with the C Compiler..................... 51 Modifying The Heap Location........................................... 53 Data Representation.................................................................. 56 ChapterY 4 Using The Compiler Invoking the Compiler...........................................R................... 60 Compiler Command Line Options ..................................... 61 File Naming Conventions......................................................... 65 Generating Listings...................................................................A 66 Generating an Error File ........................................................... 66 Return Status............................................................................. 66 Examples .................................................................................. 66 C Library Support.....................................................................IN 67 How C Library Functions are Packaged............................. 67 Inserting Assembler Code Directly .................................... 67 Linking LibrariesM with Your Program................................ 67 Integer Library Functions................................................... 67 Common IInput/Output Functions....................................... 68 Functions Implemented as Macros..................................... 68 FunctionsL Implemented as Builtins .................................... 68 Including Header Files ....................................................... 69 EDescriptions of C Library Functions ........................................ 70 Generate inline assembly code........................................... 71 Abort program execution.................................................... 72 R Find absolute value............................................................. 73 Arccosine............................................................................ 74 P Arcsine................................................................................ 75 Arctangent .......................................................................... 76 Arctangent of y/x................................................................ 77 Convert buffer to double .................................................... 78 Convert buffer to integer .................................................... 79 (ii) Convert buffer to long ........................................................ 80 Allocate and clear space on the heap.................................. 81 Round to next higher integer .............................................. 82 Verify the recorded checksum............................................ 83 Verify the recorded checksum............................................ 84 Verify the recorded checksum............................................ 85 Verify the recorded checksum............................................ 86 Cosine................................................................................. 87 Hyperbolic cosine............................................................... 88 Divide with quotient and remainder................................... 89 Exit program execution ...................................................... 90 Exponential......................................................................... 91 Find double absolute value................................................. 92 Round to next lower integer ............................................... 93 Find double modulus .......................................................... 94 Free space on the heap........................................................ 95 Extract fraction from exponent part ................................... 96 Get character from input stream ......................................... 97 Get a text line from input stream........................................ 98 Test for alphabetic or numeric character............................ 99 Test for alphabetic character ............................................ 100 Test for control character.................................................. 101 Test for digit ..................................................................... 102 Test for graphic character................................................. 103 Test for lower-case character............................................ 104 Test for printing character ................................................ 105 Test for punctuation character.......................................... 106 Integer square root............................................................ 107 Test for whitespace character ........................................... 108 Test for upper-case character............................................ 109 Test for hexadecimal digit ................................................ 110 Find long absolute value................................................... 111 Scale double exponent...................................................... 112 Long divide with quotient and remainder ........................ 113 Natural logarithm.............................................................. 114 Common logarithm........................................................... 115 Restore calling environment............................................. 116 PRELIMINARYLong integer square root................................................... 117 Allocate space on the heap ............................................... 118 Test for maximum ............................................................ 119 Scan buffer for character .................................................. 120 Compare two buffers for lexical order ............................. 121 Copy one buffer to another............................................... 122 (iii) Copy one buffer to another..............................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages386 Page
-
File Size-