SLAU132Y September 2004 – June 2021
Linker Command File shows a typical linker command file that links a 32-bit C program. The command file in this example is named lnk32.cmd and lists several link options:
−−rom_model | Tells the linker to use autoinitialization at run time |
--stack_size | Tells the linker to set the C stack size at 0x140 bytes |
--heap_size | Tells the linker to set the heap size to 0x120 bytes |
--library | Tells the linker to use an archive library file, rts430.lib |
To link the program, enter:
cl430 --run_linkerobject_file(s) --output_file=file --map_file=file lnk.cmd
--rom_model
--stack_size=0x0140
--heap_size=0x120
--library=rts430.lib
/*****************************************************************************/
/* SPECIFY THE SYSTEM MEMORY MAP */
/*****************************************************************************/
MEMORY
{
SFR(R) : origin = 0x0000, length = 0x0010
PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
PERIPHERALS_16BIT: origin = 0x0100, length = 0x0100
RAM(RW) : origin = 0x0200, length = 0x0800
INFOA : origin = 0x1080, length = 0x0080
INFOB : origin = 0x1000, length = 0x0080
FLASH : origin = 0x1100, length = 0xEEE0
VECTORS(R) : origin = 0xFFE0, length = 0x001E
RESET : origin = 0xFFFE, length = 0x0002
}
/****************************************************************************/
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
/****************************************************************************/
SECTIONS
{
.bss : {} > RAM /* UNINITIALIZED GLOBAL, STATIC */
.sysmem : {} > RAM /* DYNAMIC MEMORY ALLOCATION AREA */
.stack : {} > RAM /* SOFTWARE SYSTEM STACK */
.cio : {} > RAM /* C I/O BUFFER */
.text : {} > FLASH /* PROGRAM CODE */
.data : {} > FLASH /* INITIALIZED GLOBAL, STATIC */
.const : {} > FLASH /* CONSTANT DATA */
.args : {} > FLASH /* PROGRAM ARGUMENTS */
.cinit : {} > FLASH /* GLOBAL INITIALIZATION DATA */
.init_array : {} > FLASH /* EABI C++ GLOBAL CONSTRUCTOR TABLE */
.mspabi.exidx : {} > FLASH /* EABI TDEH METADATA */
.mspabi.extab : {} > FLASH /* EABI TDEH METADATA */
.intvecs : {} > VECTORS /* INTERRUPT VECTORS */
.reset : > RESET