User’s Manual MCUez HC12 Assembler
112 Sections MOTOROLA
Sections
In the previous example, two bytes of storage are allocated in section
constSec. Symbol cst1 will be allocated at offset 0 and cst2 at offset 1
from the beginning of the section. All subsequent instructions or data allocation
directives will be located in the relocatable section constSec until another
section is specified using the ORG or SECTION directive.
When using relocatable sections, the user does not need to worry about
overlapping sections. The linker will assign a start address to each section
according to the input from the linker parameter file.
The customer can define one memory area for the code and constant sections
and another one for the variable sections or split sections over several memory
areas.
When all constant and code sections as well as data sections can be allocated
consecutively,thePRMfileusedtoassembletheexampleinFigure6-4canbe
defined as follows:
LINK test.abs /* Name of the executable file generated. */
NAMES
test.o /* Name of the object files in the application. */
END
SEGMENTS
/* READ_ONLY memory area. */
MY_ROM = READ_ONLY 0x0B00 TO 0x0BFF;
/* READ_WRITE memory area. */
MY_RAM = READ_WRITE 0x0800 TO 0x08FF;
END
PLACEMENT
/* Relocatable variable sections are allocated in MY_RAM. */
.data INTO MY_RAM;
/* Relocatable code and constant sections are allocated in MY_ROM. */
.text INTO MY_ROM;
END
INIT entry /* Application entry point. */
VECTOR ADDRESS 0xFFFE entry /* Initialization of the reset vector. */
Figure 6-4. Defining One RAM and One ROM Area