Page 405 - Programming Microcontrollers in C
P. 405
390 Chapter 7 Advanced Topics
get.o
“C:\COSMIC\CX12\lib\libi.h12”
“C:\COSMIC\CX12\lib\libm.h12”
+seg .const -b 0xffce# vectors start address
vector.o # interrupt vectors
+def __memory=@.bss # symbol used by library
+def __stack=0xc00 # stack pointer initial value
Listing 7-20: Linker Command File
This file can be broken into three sections. The first section
specifies all of the important memory locations needed for the
program. The first instruction identifies the text section as beginning
at the hex address 0x8000. That is the beginning of the FLASH
EEPROM on this chip. The designation text identifies the executing
portion of the program. The next line says that all program constants
shall be placed in the text section. Since the text section is
placed in internal nonvolatile FLASH, nothing in this section can be
changed by the program.
The internal RAM on this part is the 1024 bytes beginning at the
hex address 0x800. The ending address of RAM is 0xBFF. The next
instruction places data, variables and stack at the starting address 0x800.
Jump to the end of this command file. Note that the parameter __stack
is given a value of 0xC00. This value is used because the M68HC12
stack pointer points at the top of the stack rather than the next open
location on the stack as was seen with the M68HC11 family of parts.
The final segment designation is that of the EEPROM location. This
segment has a beginning address of 0xD00 and it contains 768 bytes.
The next section of the file contains the files to be linked. There
are twelve applications files to be linked. With the exception of the
crts.o file, these files are those created and tested earlier in this
chapter. After the application program files, two standard compiler
libraries are included. These libraries contain all functions needed to
complete the program.
The last section links the vector table discussed above to the correct
address in the program, establishes the value for the initial stack
pointer, and remembers the address of the end of the bss section for
use in the program.
The program was compiled, linked and an srecord of the code
created. This code was loaded into an M68EVB912B32 evaluation