Introduction to Generating Boot Loader Code
C-24
Example C–15. Linker Command File
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 */
{
.text :{} > EX1_PM PAGE 0
}
Example C–16. Hex Conversion Utility Command File
dsphex boot.cmd
/* boot.cmd file an example */
test.out /* File for boot code in COFF format*/
–i /* option to generate Intel hex format */
–o test.i0 /* Name of the output file */
–byte /* 16–bit code is converted into byte */
/* stack to suit 8–bit ROM. */
–order MS /* The byte order is higher byte first followed by */
/* lower order byte */
–memwidth 8
–romwidth 8
–boot
SECTIONS
{ .text:boot }