MA299-024-00-00 Doc. ver.: 1.4 M16C v3.0 C Compiler, Assembler, Linker User's Guide A publication of Altium BV Documentation Department Copyright 2002-2004 Altium BV All rights reserved. Reproduction in whole or part is prohibited without the written consent of the copyright owner. TASKING is a brand name of Altium Limited. The following trademarks are acknowledged: FLEXlm is a registered trademark of Globetrotter Software, Inc. Intel is a trademark of Intel Corporation. Motorola is a registered trademark of Motorola, Inc. MS-DOS and Windows are registered trademarks of Microsoft Corporation. SUN is a trademark of Sun Microsystems, Inc. UNIX is a registered trademark of X/Open Company, Ltd. All other trademarks are property of their respective owners. Data subject to alteration without notice. http://www.tasking.com http://www.altium.com The information in this document has been carefully reviewed and is believed to be accurate and reliable. However, Altium assumes no liabilities for inaccuracies in this document. Furthermore, the delivery of this information does not convey to the recipient any license to use or copy the software or documentation, except as provided in an executed license agreement covering the software and documentation. Altium reserves the right to change specifications embodied in this document without prior notice. CONTENTS TABLE OF CONTENTS IV User's Guide CONTENTS CONTENTS Table of Contents V SOFTWARE INSTALLATION AND CONFIGURATION 1-1 1.1 Introduction . 1-3 1.2 Software Installation . 1-3 1.2.1 Installation for Windows . 1-3 1.2.2 Installation for Linux . 1-4 1.2.3 Installation for UNIX Hosts . 1-6 1.3 Software Configuration . 1-7 1.3.1 Configuring the Embedded Development Environment 1-7 1.3.2 Configuring the Command Line Environment . 1-9 1.4 Licensing TASKING Products . 1-12 1.4.1 Obtaining License Information . 1-12 1.4.2 Installing Node-Locked Licenses . 1-13 1.4.3 Installing Floating Licenses . 1-14 1.4.4 Starting the License Daemon . 1-16 1.4.5 Setting Up the License Daemon to Run Automatically . 1-17 1.4.6 Modifying the License File Location . 1-18 1.4.7 How to Determine the Hostid . 1-19 1.4.8 How to Determine the Hostname . 1-20 GETTING STARTED 2-1 2.1 Introduction . 2-3 2.2 Working With Projects in EDE . 2-7 2.3 Start EDE . 2-8 2.4 Using the Sample Projects . 2-9 2.5 Create a New Project Space with a Project . 2-10 2.6 Set Options for the Tools in the Toolchain . 2-14 2.7 Build your Application . 2-17 2.8 How to Build Your Application on the Command Line 2-18 2.9 Debug getstart.elf . 2-19 C LANGUAGE 3-1 3.1 Introduction . 3-3 3.2 Programming Strategies . 3-4 •••••••• VI User's Guide 3.2.1 Memory Spaces . 3-4 3.2.2 Bit Programming . 3-6 3.2.3 Floating-Point . 3-7 3.2.4 General Optimization Tips . 3-8 3.3 Data Types . 3-10 3.4 Memory Qualifiers . 3-12 3.4.1 Memory Type Qualifiers . 3-13 3.4.2 Accessing Peripherals from C: __sfr . 3-15 3.4.3 Declare a Data Object at an Absolute Address: __at() . 3-18 3.5 Memory Models . 3-19 3.6 Using Assembly in the C Source: __asm() . 3-20 3.7 Controlling the Compiler: Pragmas . 3-27 3.8 Predefined Macros . 3-28 3.9 Initialized Variables . 3-30 3.10 Strings . 3-30 3.11 Switch Statement . 3-31 3.12 Functions . 3-32 3.12.1 Parameter Passing . 3-32 3.12.2 Function Return Types . 3-33 3.12.3 Inlining Functions: inline . 3-34 3.12.4 Intrinsic Functions . 3-36 3.12.5 Calling Assembly Functions: __asmfunc . 3-37 3.12.6 Interrupt Functions . 3-38 3.12.6.1 Defining an Interrupt Service Routine: __interrupt() . 3-39 3.12.6.2 Register Bank Switching: __bankswitch . 3-40 3.12.6.3 Interrupt Frame: __frame() . 3-41 3.13 Section Naming . 3-42 3.14 Libraries . 3-44 3.14.1 Overview of Libraries . 3-44 3.14.2 Printf and Scanf Formatting Routines . 3-45 3.14.3 Rebuilding Libraries . 3-46 3.15 Converting C Modules to ISO C99 . 3-47 CONTENTS Table of Contents VII ASSEMBLY LANGUAGE 4-1 4.1 Introduction . 4-3 4.2 Assembly Syntax . 4-3 4.3 Assembler Significant Characters . 4-4 4.4 Operands of an Assembly Instruction . 4-5 4.5 Symbol Names . 4-6 4.6 Assembly Expressions . 4-7 4.6.1 Numeric Constants . 4-8 4.6.2 Strings . 4-8 4.6.3 Expression Operators . 4-9 4.7 Built-in Assembly Functions . 4-11 4.8 Assembler Directives and Controls . 4-13 4.8.1 Overview of Assembler Directives . 4-14 4.8.2 Overview of Assembler Controls . 4-16 4.9 Working with Sections . 4-17 4.10 Macro Operations . 4-19 4.10.1 Defining a Macro . 4-19 4.10.2 Calling a Macro . 4-21 4.10.3 Using Operators for Macro Arguments . 4-22 4.10.4 Using the DUP, DUPA, DUPC, DUPF Directives as Macros . 4-26 4.10.5 Conditional Assembly: IF, ELIF and ELSE Directives . 4-26 USING THE COMPILER 5-1 5.1 Introduction . 5-3 5.2 Compilation Process . 5-4 5.3 Compiler Optimizations . 5-5 5.3.1 Optimize for Size or Speed . 5-9 5.4 Calling the Compiler . 5-10 5.5 How the Compiler Searches Include Files . 5-15 5.6 Compiling for Debugging . 5-15 5.7 C Code Checking: MISRA C . 5-16 5.8 C Compiler Error Messages . 5-18 •••••••• VIII User's Guide USING THE ASSEMBLER 6-1 6.1 Introduction . 6-3 6.2 Assembly Process . 6-3 6.3 Assembler Optimizations . 6-4 6.4 Calling the Assembler . 6-5 6.5 How the Assembler Searches Include Files . 6-8 6.6 Generating a List File . 6-8 6.7 Assembler Error Messages . 6-9 USING THE LINKER 7-1 7.1 Introduction . 7-3 7.2 Linking Process . 7-4 7.2.1 Phase 1: Linking . 7-6 7.2.2 Phase 2: Locating . 7-7 7.2.3 Linker Optimizations . 7-9 7.3 Calling the Linker . 7-11 7.4 Linking with Libraries . 7-14 7.4.1 Specifying Libraries to the Linker . 7-15 7.4.2 How the Linker Searches Libraries . 7-16 7.4.3 How the Linker Extracts Objects from Libraries . 7-17 7.5 Incremental Linking . 7-18 7.6 Controlling the Linker with a Script . 7-19 7.6.1 Purpose of the Linker Script Language . 7-19 7.6.2 EDE and LSL . 7-20 7.6.3 Structure of a Linker Script File . 7-21 7.6.4 The Architecture Definition . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages297 Page
-
File Size-