Example 30. Linker Command File, demo.cmd

/****************************************************************************/ /* Specify Linker Options */ /****************************************************************************/ --entry_point=SETUP /* Define the program entry point */ --output_file=demo.out /* Name the output file */ --map_file=demo.map /* Create an output map file */ /****************************************************************************/ /* Specify Input Files */ /****************************************************************************/ demo.c.obj ctrl.c.obj tables.c.obj /****************************************************************************/ /* Specify 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 Output Sections */ /****************************************************************************/ SECTIONS { .text : {} > FLASH /* Link all .text section into flash */ .intvecs : {} > 0xFFE0 /* Link interrupt vectors. at 0xFFE0 */ .data : /* Link .data sections */ { tables.c.obj(.data) . = 0x400; /* Create hole at end of block */ } > FLASH, fill = 0xFF00 /* Fill and link into FLASH */ ctrl_vars : /* Create new sections for ctrl variables */ { ctrl.c.obj(.bss) } > RAM, fill = 0x0100 /* Fill with 0x0100 and link into RAM */ .bss : {} > RAM /* Link remaining .bss sections into RAM */ } /****************************************************************************/ /* End of Command File */ /****************************************************************************/

Invoke the linker by entering the following command:

cl430 --run_linker demo.cmd

This creates the map file shown in Example 31 and an output file called demo.out that can be run on an MSP430.