Creating a Linker Command File
2 - 16 C2000 Microcontroller Workshop - Programming Development Environment
MEMORY
{
M0SARAM: origin = 0x000000 , length = 0x0400
M1SARAM: origin = 0x000400 , length = 0x0400
}
Remember that the MCU has two memory maps: Program, and Data. Therefore, the MEMORY
description must describe each of these separately. The loader uses the following syntax to
delineate each of these:
Linker Page TI Definition
Page 0 Program
Page 1 Data
Linker Command File
SECTIONS
{
.text:> FLASH PAGE = 0
.ebss:> M0SARAM PAGE = 1
.cinit:> FLASH PAGE = 0
.stack:> M1SARAM PAGE = 1
}
MEMORY
{
PAGE 0: /* Program Memory */
FLASH: origin = 0x3E8000, length = 0x10000
PAGE 1: /* Data Memory */
M0SARAM: origin = 0x000000, length = 0x400
M1SARAM: origin = 0x000400, length = 0x400
}
A linker command file consists of two sections, a memory section and a sections section. In the
memory section, page 0 defines the program memory space, and page 1 defines the data memory
space. Each memory block is given a unique name, along with its origin and length. In the
sections section, the section is directed to the appropriate memory block.
Section Placement
The SECTIONS section will specify how you want the sections to be distributed through
memory. The following code is used to link the sections into the memory specified in the
previous example: