Floating Point C Compiler: Tips and Tricks Part I



Similar documents
Binary Search Algorithm on the TMS320C5x

SN54165, SN54LS165A, SN74165, SN74LS165A PARALLEL-LOAD 8-BIT SHIFT REGISTERS

Fast Logarithms on a Floating-Point Device

Monitoring TMS320C240 Peripheral Registers in the Debugger Software

SDLS068A DECEMBER 1972 REVISED OCTOBER Copyright 2001, Texas Instruments Incorporated

Using C to Access Data Stored in Program Space Memory on the TMS320C24x DSP

Using C to Access Data Stored in Program Memory on the TMS320C54x DSP

Signal Conditioning Wheatstone Resistive Bridge Sensors

Theory of Operation. Figure 1 illustrates a fan motor circuit used in an automobile application. The TPIC kω AREF.

EDI s x32 MCM-L SRAM Family: Integrated Memory Solution for TMS320C3x DSPs

EDI s x32 MCM-L SRAM Family: Integrated Memory Solution for TMS320C4x DSPs

RETRIEVING DATA FROM THE DDC112

CUSTOM GOOGLE SEARCH PRO. User Guide. User Guide Page 1

SN28838 PAL-COLOR SUBCARRIER GENERATOR

Motor Speed Measurement Considerations When Using TMS320C24x DSPs

Analysis of Filter Coefficient Precision on LMS Algorithm Performance for G.165/G.168 Echo Cancellation

TSL250, TSL251, TLS252 LIGHT-TO-VOLTAGE OPTICAL SENSORS

TSL INTEGRATED OPTO SENSOR

Audio Tone Control Using The TLC074 Operational Amplifier

How To Make A Two Series Cell Battery Pack Supervisor Module

Controlling TAS5026 Volume After Error Recovery

SN54F157A, SN74F157A QUADRUPLE 2-LINE TO 1-LINE DATA SELECTORS/MULTIPLEXERS

bq2114 NiCd or NiMH Gas Gauge Module with Charge-Control Output Features General Description Pin Descriptions

Supply voltage Supervisor TL77xx Series. Author: Eilhard Haseloff

High-Speed Gigabit Data Transmission Across Various Cable Media at Various Lengths and Data Rate

Wireless Subwoofer TI Design Tests

Managing Code Development Using CCS Project Manager

A Low-Cost, Single Coupling Capacitor Configuration for Stereo Headphone Amplifiers

SN54HC157, SN74HC157 QUADRUPLE 2-LINE TO 1-LINE DATA SELECTORS/MULTIPLEXERS

Multi-Transformer LED TV Power User Guide. Anderson Hsiao

TMS320C3x/C4x Assembly Language Tools User s Guide

SEO Meta Templates. Magento Extension. User Guide. SEO Meta Templates

Next-Generation BTL/Futurebus Transceivers Allow Single-Sided SMT Manufacturing

Smart Battery Module with LEDs and Pack Supervisor

APPLICATION BULLETIN

IMPORT/EXPORT CUSTOMER REVIEWS. User Guide. User Guide Page 1

1. Installation Instructions

Implementing an In-Service, Non- Intrusive Measurement Device in Telecommunication Networks Using the TMS320C31

How To Close The Loop On A Fully Differential Op Amp

Texas Instruments. FB PS LLC Test Report HVPS SYSTEM AND APPLICATION TEAM REVA

Designing Gain and Offset in Thirty Seconds

Guidelines for Software Development Efficiency on the TMS320C6000 VelociTI Architecture

How To Fix An Lmx9838 Bluetooth Serial Port Module With Bluetooth (Bluetooth 2) From A Bluetooth Bluetooth 4.2 Device With A Bluembee 2.2 Module

Filter Design in Thirty Seconds

SN54HC191, SN74HC191 4-BIT SYNCHRONOUS UP/DOWN BINARY COUNTERS

DUAL MONITOR DRIVER AND VBIOS UPDATE

AN3354 Application note

Standard Linear & Logic Semiconductor Marking Guidelines

Current-Transformer Phase-Shift Compensation and Calibration

August 2001 PMP Low Power SLVU051

QUADRO POWER GUIDELINES

WHAT DESIGNERS SHOULD KNOW ABOUT DATA CONVERTER DRIFT

Teaching DSP through the Practical Case Study of an FSK Modem

Important Notice. All company and brand products and service names are trademarks or registered trademarks of their respective holders.

SINGLE-SUPPLY OPERATION OF OPERATIONAL AMPLIFIERS

SEO Suite Pro. User Guide

VisualDSP Emulation Tools Installation Guide for Windows 95/98/NT/2000

AN10866 LPC1700 secondary USB bootloader

IMPORT / EXPORT PRODUCTS

TMS320C67x FastRTS Library Programmer s Reference

Simplifying System Design Using the CS4350 PLL DAC

Using Code Coverage and Multi-event Profiler in Code Composer Studio v2.3 for Robustness and Efficiency Analyses

Using the RDTSC Instruction for Performance Monitoring

Signal Conditioning Piezoelectric Sensors

SN54ALS191A, SN74ALS191A SYNCHRONOUS 4-BIT UP/DOWN BINARY COUNTERS

AN AES encryption and decryption software on LPC microcontrollers. Document information

IMPORT/EXPORT COUPON/SHOPPING CART RULES. User Guide. User Guide Page 1

Intel SSD 520 Series Specification Update

Using the RS232 serial evaluation boards on a USB port

NVIDIA GRID 2.0 ENTERPRISE SOFTWARE

AN3265 Application note

THE RIGHT-HALF-PLANE ZERO --A SIMPLIFIED EXPLANATION

AN Boot mode jumper settings for LPC1800 and LPC4300. Document information

Intel Retail Client Manager Audience Analytics

UM0985 User manual. Developing your STM32VLDISCOVERY application using the IAR Embedded Workbench software. Introduction

AN LPC1700 timer triggered memory to GPIO data transfer. Document information. LPC1700, GPIO, DMA, Timer0, Sleep Mode

Data sheet acquired from Harris Semiconductor SCHS067B Revised July 2003

Intel Media SDK Library Distribution and Dispatching Process

White Paper. ACPI Based Platform Communication Channel (PCC) Mechanism. InSarathy Jayakumar Intel Corporation

Application Report SLVA051

WAN_0240. I 2 S USB Audio Streaming INTRODUCTION IDENTIFYING THE FIRMWARE HARDWARE CONFIGURATION SOFTWARE CONFIGURATION

AN48. Application Note DESIGNNOTESFORA2-POLEFILTERWITH DIFFERENTIAL INPUT. by Steven Green. 1. Introduction AIN- AIN+ C2

Resetting USB drive using Windows Diskpart command

Wide Bandwidth, Fast Settling Difet OPERATIONAL AMPLIFIER

PAC52XX Clock Control Firmware Design

AN3998 Application note

Understanding the Terms and Definitions of LDO Voltage Regulators

iscsi Quick-Connect Guide for Red Hat Linux

Application Report. 1 Introduction. 2 Resolution of an A-D Converter. 2.1 Signal-to-Noise Ratio (SNR) Harman Grewal... ABSTRACT

Code Composer Studio s Command Window

Adapting the PowerPC 403 ROM Monitor Software for a 512Kb Flash Device

Design Note DN304. Cebal CCxxxx Development Tools USB Driver Installation Guide By Åsmund B. Bø. Keywords. 1 Introduction

AN11008 Flash based non-volatile storage

Intel Storage System SSR212CC Enclosure Management Software Installation Guide For Red Hat* Enterprise Linux

LANDesk Management Suite 8, v8.1 Creating Custom Vulnerabilities

PCIe XMC x8 Lane Adapter

Data sheet acquired from Harris Semiconductor SCHS087D Revised October 2003

Application Report. 1 Description of the Problem. Jeff Falin... PMP Portable Power Applications ABSTRACT

AVR106: C Functions for Reading and Writing to Flash Memory. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Transcription:

TMS320 DSP DESIGNER S NOTEBOOK Floating Point C Compiler: Tips and Tricks Part I APPLICATION BRIEF: SPRA229 Karen Baldwin Digital Signal Processing Products Semiconductor Group Texas Instruments June 1993

IMPORTANT NOTICE Texas Instruments (TI) reserves the right to make changes to its products or to discontinue any semiconductor product or service without notice, and advises its customers to obtain the latest version of relevant information to verify, before placing orders, that the information being relied on is current. TI warrants performance of its semiconductor products and related software to the specifications applicable at the time of sale in accordance with TI s standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements. Certain application using semiconductor products may involve potential risks of death, personal injury, or severe property or environmental damage ( Critical Applications ). TI SEMICONDUCTOR PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED, OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT APPLICATIONS, DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS. Inclusion of TI products in such applications is understood to be fully at the risk of the customer. Use of TI products in such applications requires the written approval of an appropriate TI officer. Questions concerning potential risk applications should be directed to TI through a local SC sales office. In order to minimize risks associated with the customer s applications, adequate design and operating safeguards should be provided by the customer to minimize inherent or procedural hazards. TI assumes no liability for applications assistance, customer product design, software performance, or infringement of patents or services described herein. Nor does TI warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such semiconductor products or services might be or are used. Copyright 1997, Texas Instruments Incorporated

TRADEMARKS TI is a trademark of Texas Instruments Incorporated. Other brands and names are the property of their respective owners.

CONTACT INFORMATION US TMS320 HOTLINE (281) 274-2320 US TMS320 FAX (281) 274-2324 US TMS320 BBS (281) 274-2323 US TMS320 email dsph@ti.com

Contents Abstract... 7 Design Problem... 8 Solution... 8 Examples Example 1. Indirect Function Call... 8 Example 2. Naming Load and Run Addresses... 8 Example 3. A Homemade Loader in C... 9 Example 4. Macro Definition Solution To Defining Named Sections... 9

Floating Point C Compiler: Tips and Tricks Part I Abstract There are some tricks for making the most out of the C Compiler. This document discusses the three ideas listed below, and includes a short code example for each. Solving the C40 Discontinuity Issue with Indirect Calls Making use of Relocatable C code Making a C Function Part of a Different Section Floating Point C Compiler: Tips and Tricks Part I 7

Design Problem Solution Example 1. Indirect Function Call What are some of the tricks of the masters for making the most out of the C Compiler? 1. Solving the C40 Discontinuity Issue with Indirect Calls The C40 has only relative jumps. Therefore PC discontinuities using direct-mode addressing are limited to a 24-bit range. This, coupled with the C40 memory map, makes it impossible to directly call a routine in on-chip memory because the compiler uses the direct form of CALL for calls to named functions. (The BR instruction is never used: all branches except returns must be within a single function, so the short conditional form is used.) You can use indirect calls to call functions anywhere in the address space. You do this by declaring a pointer to a function and then calling via the pointer. int f(); /* function that resides in internal mem */ int (*ptr_to_f)() = f; /* pointer to function f */ main() { (*ptr_to_f)(); /* call function f indirectly */ } 2. Making use of Relocatable C code You can specify different load addresses and run addresses for a section in the linker command file. But you have to write your own loader to move the section to the run address. If using assembly language you can use the.label statement to get the load address. Here is an example: Example 2. Naming Load and Run Addresses.global sec_start ; run address.global sec_end.global l_sec_start ; load address.global l_sec_end sec_start:.label l_sec_start ; l_sec_start will ;contain the load address (sec_start = run ; address program code goes here sec_end:.label l_sec_end ; same explanation 8 SPRA229

Example 3. A Homemade Loader in C Your loader makes use of these labels to write from l_sec_start to sec_start and so on. The loader is a loop that copies the code from one location to the other. The C version is shown in listing 3. /* also asm( with.global... */ asm( sec_start.label l_sec_start") /* same as */ /* assembly version */ /* program code goes here */ void func(a,b,c) <local variable declaration> } asm( sec_end.label l_sec_end ) 3. Making a C Function Part of a Different Section The C compiler does not directly specify a section name for the executable assembly code that it generates. It relies on the assembler defaulting the section name to.text. However, it is possible to relocate the executable code from a function into a userdefined section from within the C source. This is accomplished by placing an asm statement that declares the new section before the actual function definition. Example 4 below uses a macro definition to provide a general solution to defining named sections. Example 4. Macro Definition Solution To Defining Named Sections #define sect(a) asm(.sect #a) sect( pp ); /* Creates.sect pp in */ /* asm code */ void func() { } The section name will remain pp until changed. If other functions follow this function in the file and their code is not to be included within this section then reset the section name before the next function definition. Floating Point C Compiler: Tips and Tricks Part I 9