Shared Program Code
C-5
Program Examples
C.2 Shared Program Code
Example C–1. Generic Command File (c203.cmd)
/* Title: c203.cmd */
/* Generic command file for linking TMS320C2xx assembler files */
/* input files: *.obj files */
/* output files: *.out file */
/* Map files: *.map file (optional) */
/* TMS320C2xx architecture declaration for linker use */
MEMORY
{
PAGE 0: /* PM – Program memory */
EX1_PM :ORIGIN=0H , LENGTH=0FEFFH /* External program RAM */
B0_PM :ORIGIN=0FF00H, LENGTH=0100H /* BLOCK MAP IN CNF=1 */
PAGE 1: /* DM – Data memory */
REGS :ORIGIN=0H , LENGTH=60H /* MEM–MAPPED REGS */
BLK_B2 :ORIGIN=60H , LENGTH=20H /* BLOCK B2 */
BLK_B0 :ORIGIN=200H , LENGTH=100H /* BLOCK B0 */
BLK_B1 :ORIGIN=300H , LENGTH=100H /* BLOCK B1 */
EX1_DM :ORIGIN=0800H, LENGTH=7800H /* EXTERNAL DATA RAM */
GM_DM :ORIGIN=8000H, LENGTH=8000H /* External DATA RAM AS GLOBAL*/
PAGE 2: /* I/O SPACE */
IO_IN :ORIGIN=0FF00H, LENGTH=0FFH /* I/O MAPPED PERIPHERAL */
IO_EX :ORIGIN=0000H, LENGTH=0FF00H /* EXT. I/O MAPPED PERIPHERAL */
}
SECTIONS
/* Linker directive to specify section placement in the memory map */
{
vectors :{} > EX1_PM PAGE 0 /* Vectors at 0x0000 */
.text :{} > EX1_PM PAGE 0 /* .text placed after vectors */
.bss :{}> EX1_DM PAGE 1 /* .bss in 0x800 in DM */
new :{}> BLK_B2 PAGE 1 /* new in 0x0060 in DM */
.data :{} > 0x0370 PAGE 1 /* .data at 0x0370 in DM */
}