Sections
Section Types
MCUez HC12 Assembler User’s Manual
MOTOROLA Sections 113
The linker PRM file contains at least:
The name of the absolute file (command LINK)
The name of the object file which should be linked (command NAMES)
Specification of a memory area where the sections containing variables
must be allocated. At least the predefined section .datamustbe placed
there (command SEGMENTS and PLACEMENT).
Specification of a memory area where the sections containing code or
constants must be allocated. At least the predefined section .text must
be placed there (command SEGMENTS and PLACEMENT).
Specification of application entry point (command INIT)
Definition of the reset vector (command VECTOR ADDRESS)
According to the PRM file in Figure 6-4:
The section dataSec will be allocated starting at 0x0800.
The section constSec will be allocated starting at 0x0B00.
The section codeSec will be allocated next to the section constSec.
When the constant, code, and data sections cannot be allocated consecutively,
the PRM file used to link the previous example can be defined like this:
LINK test.abs /* Name of the executable file generated. */
NAMES
test.o /* Name of the object files in the application. */
END
SEGMENTS
ROM_AREA_1= READ_ONLY 0xB00 TO 0xB7F; /* READ_ONLY memory area. */
ROM_AREA_2= READ_ONLY 0xC00 TO 0xC7F;/* READ_ONLY memory area. */
RAM_AREA_1= READ_WRITE 0x800 TO 0x87F;/* READ_WRITE memory area. */
RAM_AREA_2= READ_WRITE 0x900 TO 0x97F;/* READ_WRITE memory area. */
END
PLACEMENT
/* Relocatable variable sections are allocated in MY_RAM. */
dataSec INTO RAM_AREA_2;
.data INTO RAM_AREA_1;
/* Relocatable code and constant sections are allocated in MY_ROM. */
constSec INTO ROM_AREA_2;
codeSec, .text INTO ROM_AREA_1;
END
INIT entry /* Application entry point. */
VECTOR ADDRESS 0xFFFE entry /* Initialization of the reset vector. */
Figure 6-5. Defining Multiple RAM and ROM Areas