Example 1. Linker Command File and Link Map for Scenario 1

/****************************************************************************/ /* Scenario 1 Link Command */ /* */ /* Usage: lnkpru <obj files...> -o <out file> -m <map file> lnk32.cmd */ /* clpru <src files...> -z -o <out file> -m <map file> lnk32.cmd */ /* */ /* Description: This file is a sample command file that can be used */ /* for linking programs built with the TMS470 C */ /* compiler. Use it as a guideline; you may want to change */ /* the allocation scheme according to the size of your */ /* program and the memory layout of your target system. */ /* */ /* Notes: (1) You must specify the directory in which rts32.lib is */ /* located. Either add a "-i<directory>" line to this */ /* file, or use the system environment variable C_DIR to */ /* specify a search path for libraries. */ /* */ /* (2) If the runtime-support library you are using is not */ /* named rts32.lib, be sure to use the correct name here. */ /****************************************************************************/ -m example1.map /* SPECIFY THE SYSTEM MEMORY MAP */ MEMORY { I_MEM : org = 0x00000000 len = 0x00000020 /* INTERRUPTS */ D_MEM : org = 0x00000020 len = 0x00010000 /* DATA MEMORY (RAM) */ P_MEM : org = 0x00010020 len = 0x00100000 /* PROGRAM MEMORY (ROM) */ } /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */ SECTIONS { secA: load = P_MEM secB: load = 0x1000 }

You must create a hex conversion command file to generate a hex output with the correct addresses and format for the EPROM programmer.

In the memory system outlined in Figure B-1, only the application data is stored on the EPROM; the data resides in secB of the object file created by the linker. By default, the hex conversion utility converts all initialized sections that appear in the object file. To prevent the conversion of the application code in secA, a SECTIONS directive must be defined in the hex conversion command file to list explicitly the section(s) to be converted. In this case, secB must be listed explicitly as the section to be converted.

The EPROM programmer in this scenario has the following system requirements:

Since memwidth and romwidth have the same value, only one output file is generated (the number of output files is determined by the ratio of memwidth to romwidth). The output file is named with the -o option.

The hex conversion command file for Scenario 1 is shown in Example 2. This command file uses the following options to select the requirements of the system:

Option Description
-i Create Intel format
-image Generate a memory image
-map example1.mxp Generate example1.mxp as the map file of the conversion
-o example1.hex Name example1.hex as the output file
-memwidth 8 Set EPROM system memory width to 8
-romwidth 8 Set physical ROM width to 8