Texas Instruments TMS470R1x manual Getting Started With the C Compiler, Cl470 ±o ±mt funtion

Page 55

Getting Started With the C Compiler

5.2 Getting Started With the C Compiler

The TMS470R1x C compiler consists of many phases, including parsing, opti- mization, and code generation. The simplest way to compile is to use the shell program, which is included with the compiler. This section provides a quick walkthrough so that you can get started without reading the entire TMS470R1x Optimizing C Compiler User's Guide.

1) Create a sample file called function.c that contains the following code:

/**************************************/

/*

function.c

*/

/*

(Sample file for walkthrough)

*/

/**************************************/ int main(int i)

{

return(i < 0 ? ±i : i );

}

2)To invoke the shell program to compile and assemble function.c, enter: cl470 ±o function

By default, the TMS470R1x shell program compiles and assembles 32-bit instructions. To compile 16-bit instructions, use the ±mt option:

cl470 ±o ±mt funtion

The shell program prints the following information as it compiles the pro- gram:

[function]

 

 

TMS470 ANSI C Compiler

Version 1.20

Copyright (c) 1995±1997

Texas Instruments Incorporated

ºfunction.cº

==> main

 

TMS470 ANSI C Optimizer

Version 1.20

Copyright (c) 1995±1997

Texas Instruments Incorporated

ºfunction.cº

==> main

 

TMS470 ANSI C Codegen

Version 1.20

Copyright (c) 1995±1997

Texas Instruments Incorporated

ºfunction.cº:

==> main

 

TMS470 COFF Assembler

Version 1.20

Copyright (c) 1995±1997

Texas Instruments Incorporated

PASS 1

 

 

PASS 2

 

 

No Errors, No Warnings

By default, the shell deletes the assembly language file from the current directory after the file is assembled. If you want to inspect the assembly language output, use the ±k option to retain the assembly language file:

cl470 ±o ±k function

Getting Started With the Code Generation Tools

5-7

Image 55
Contents Getting Started Guide SPNU117B TMS470R1x Code Generation Tools Getting Started Guide Important Notice Notational Conventions About This ManualSet PATH=c\tooldir%PATH% Related Documentation From Texas InstrumentsSET CDIR=pathname1 pathname2 Trademarks North America, South America, Central America If You Need AssistanceContents Setting Up the Code Generation Tools With SunOS Defines terms and acronyms used in this book Page Setting Up the Code Generation Tools With DOS or Windows Software checklist Hardware checklistSystem Requirements Install Installing the Code Generation ToolsInstalling the tools on DOS systems Installing the tools on Windows 3.1x systemsAdir Cdir Coption TMP Setting Up the Code Generation EnvironmentSet ADIR=pathname1 pathname2 \tooldirTMS470R1x Assembly Language Tools Users Guide Setting default shell options CoptionSet COPTION=±qs ±z Specifying a temporary file directory TMP Resetting defined environment variablesVerifying that the environment variables are set Performance Considerations Where to Go From HereChapter TMS470R1x Code Generation Tools \setup.exe These variables are set up in the registry under \tooldir Set COPTION=option1 option2 Set ADIR= Set variablename=Where to Go From Here Setting Up the Code Generation Tools With SunOS Disk space Mount ±rF hsfs /dev/sr0 /cdrom exit Cd /cdrom/cdrom0/sunos Boot ±rMounting the CD-ROM Mount ±rt hsfs /dev/sr0 /cdrom exit Cd /cdrom/sunosCd eject Copying the filesUnmounting the CD-ROM Umount /cdrom eject /dev/sr0 exitSetting Up the Code Generation Environment ADIR=ºpathname1 pathname2 . . .º export Adir Yourpathname /tooldirSet path=/yourpathname /tooldir $path Setenv Adir ºpathname1 pathname2 . . .ºCDIR=ªpathname1 pathname2 . . .º export Cdir Setenv Cdir ªpathname1 pathname2 . . .ºSetenv Coption º±qs ±zº Source ~/.cshrc Reinitializing your shellSetenv TMP º/tempº TMP=º/tempº export TMPTo verify that the environment variables are set, enter Setting Up the Code Generation Tools on an HP Workstation An HP 9000 Series 700 PA-RISC computer Cd /cdrom/hp Mount ±rt cdfs /dev/dsk/yourcdromdevice /cdrom exitUmount /cdrom exit Setting up the software tools using a C shellSetting up the software tools using a Korn shell PATH=tooldir$PATHSetting Up the Code Generation Environment Setenv Adir ºpathname1 pathname2 … º Identifying alternate directories for the assembler AdirADIR=ºpathname1 pathname2 … º export Adir Setenv Cdir ªpathname1 pathname2 . . .º Identifying alternate directories for the compiler CdirSpecifying a temporary file directory TMP Unsetenv variable name Where to Go From Here Getting Started With Code Generation Tools Example 5±2. file2.asm Getting Started With the Assembler and LinkerGetting Started With the Code Generation Tools Example 5±4. Output Map File, lnker2.map Example 5±5. Sample Linker Command File, linker2.cmd Entry Point Symbol Memory Configuration Cl470 ±o ±mt funtion Getting Started With the C CompilerCl470 ±o ±k function Cl470 ±s function ±z lnk32.cmd ±o function.out Release Notes Media Contents ±2. Media Contents for PCs General enhancements Release EnhancementsAssembler enhancements Compiler enhancements Page Troubleshooting DOS Systems Troubleshooting in the Protected-Mode Environment PMINFO32.EXE program Error MessagesTable A±1. Pminfo Fields Action Recopy the file from the source media Kernel Error MessagesAction Make more memory available and try again Action Contact technical support Action Reinstall and run the tools on a 386 or later PCAction Rerun the program and/or restart your computer ExecutionTings Cause this errorMemory is available to non-Windows programs. Under OS/2 Increase the Dpmimemorylimit in the DOS box setAction Free some memory for the DOS/4G application DOS/4G Error MessagesAction Make sure that the filename was spelled correctly DOS/4G Error Messages Glossary Glossary Glossary B-3 Page Index Index MS-DOS Pminfo Setup.exe For DOS systems For Windows 3.1x systems Windows 95/NT systems Index-6 Important Notice