V3.6R1 Dsp56xxx Toolchain C Compiler
Total Page:16
File Type:pdf, Size:1020Kb
MA039–002–00–00 Doc. ver.: 1.24 DSP56xxx v3.6 C CROSS–COMPILER USER’S GUIDE A publication of Altium BV Documentation Department Copyright 2008 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 Table of Contents CONTENTS CONTENTS Table of Contents V SOFTWARE INSTALLATION 1-1 1.1 Introduction . 1-3 1.2 Installation for Windows . 1-3 1.2.1 Setting the Environment . 1-3 1.3 Installation for Linux . 1-5 1.3.1 RPM Installation . 1-5 1.3.2 Debian Installation . 1-6 1.3.3 Tar.gz Installation . 1-7 1.3.4 Setting the Environment . 1-7 1.4 Installation for UNIX Hosts . 1-8 1.4.1 Setting the Environment . 1-9 1.5 Licensing TASKING Products . 1-10 1.5.1 Obtaining License Information . 1-10 1.5.2 Installing Node-Locked Licenses . 1-11 1.5.3 Installing Floating Licenses . 1-12 1.5.4 Starting the License Daemon . 1-14 1.5.5 Setting Up the License Daemon to Run Automatically . 1-15 1.5.6 Modifying the License File Location . 1-16 1.5.7 How to Determine the Hostid . 1-17 1.5.8 How to Determine the Hostname . 1-18 OVERVIEW 2-1 2.1 Introduction to DSP56xxx Family C Cross-Compiler . 2-3 2.2 General Implementation . 2-5 2.2.1 Compiler Phases . 2-5 2.2.2 Frontend Optimizations . 2-6 2.2.3 Backend Optimizations . 2-8 2.2.4 Specific Optimizations . 2-9 2.2.4.1 Replacing NOPs . 2-10 2.2.4.2 Instruction Parallelization (parallel moves) . 2-10 2.2.4.3 Hardware DO and REP Loops . 2-10 2.2.4.4 Bitfields . 2-14 2.2.4.5 MAC Instruction Generation . 2-14 2.2.4.6 Absolute Addressing Mode Usage . 2-14 •••••••• VI Table of Contents 2.3 Compiler Structure . 2-15 2.4 Environment Variables . 2-19 2.5 Sample Session . 2-21 2.5.1 Using EDE . 2-21 2.5.2 Using the Control Program . 2-29 2.5.3 Using the Makefile . 2-31 LANGUAGE IMPLEMENTATION 3-1 3.1 Introduction . 3-3 3.2 Accessing Memory . 3-4 3.2.1 Storage Specifiers . 3-5 3.2.2 Memory Models . 3-8 3.2.2.1 16 and 24-bit Models for DSP563xx . 3-9 3.2.2.2 DSP566xx Memory Model . 3-9 3.2.2.3 Static Model for DSP5600x . 3-9 3.2.2.4 Mixed Model for DSP5600x . 3-11 3.2.2.5 DSP5600x Static and Mixed Model Limitations . 3-11 3.2.2.6 Reentrant Model . 3-12 3.2.2.7 _MODEL, _DSP, _DEFMEM and _STKMEM . 3-13 3.2.3 The _at() Attribute . 3-14 3.3 Data Types . 3-15 3.3.1 The Fractional Data Type . 3-17 3.3.2 The Complex Data Type . 3-18 3.3.3 Unsigned Characters . 3-19 3.3.4 ANSI C Type Conversions . 3-19 3.3.5 Memory Mapped Registers . 3-21 3.4 Automatic Variables . 3-23 3.5 Register Variables . 3-24 3.6 Initialized Variables . 3-25 3.7 Type Qualifier volatile . 3-25 3.8 Strings . 3-26 3.9 Pointers . 3-27 3.10 Integer Division and Modulo . 3-27 3.11 Inline C Functions . 3-29 CONTENTS Table of Contents VII 3.12 Inline Assembly . 3-31 3.12.1 Using the _asm Intrinsic Function . 3-31 3.12.2 Using the __asm Intrinsic Function . 3-32 3.12.3 Using Inline Assembly Pragmas . 3-40 3.12.4 Linking with Separate Assembly Routines . 3-41 3.13 Intrinsic Functions . 3-42 3.14 Interrupts . 3-68 3.15 Circular Buffers . 3-70 3.16 DSP563xx Cache Support . 3-72 3.16.1 Cache Alignment . 3-72 3.16.2 Cache Regions . 3-73 3.16.3 Cache Intrinsic Functions . 3-73 3.16.4 Examples . 3-74 3.17 Patriot Bank Switching Support . 3-75 3.18 Packed Strings . 3-77 3.18.1 Library Functions . 3-77 3.18.2 Pragmas . 3-78 3.18.3 Examples . 3-78 3.19 Structure Tags . 3-80 3.20 Typedef . 3-80 3.21 Switch Statement . 3-81 3.22 Portable C Code . 3-82 3.23 Efficient Use of the DSP56xxx Tool Set . 3-83 3.23.1 Char and Short Types . 3-83 3.23.2 Unsigned . 3-83 3.23.3 Hardware Loops . 3-83 3.23.4 Speed vs. Size . 3-86 3.23.5 Assembly Interfacing . 3-86 3.23.6 Selecting the Most Efficient Model . 3-87 3.23.7 Memory Mapped I/O from C . 3-87 3.23.8 Parallel Moves . 3-88 3.23.9 Shifting Fractional Data . 3-88 3.23.10 Dynamic Scaling . 3-89 3.23.11 Reviewing the Optimized Code . 3-89 3.23.12 Integer and Fractional Types . 3-90 •••••••• VIII Table of Contents 3.23.13 Interrupt Routines . 3-93 COMPILER USE 4-1 4.1 Control Program . 4-3 4.2 Compilers . 4-6 4.2.1 Detailed Description of the Compiler Options . 4-10 4.3 Include Files . 4-83 4.4 Pragmas . 4-86 4.5 Alias Checking . ..