Listing: Separating assembly code into modules-Test2.prm
LINK test2.abs /* Name of the executable file generated. */
NAMES
test1.o
test2.o / *Name of the object files building the application. */
END
SECTIONS
MY_ROM = READ_ONLY 0x2B00 TO 0x2BFF; /* READ_ONLY mem. */
MY_RAM = READ_WRITE 0x2800 TO 0x28FF; /* READ_WRITE mem. */
END
PLACEMENT
/* variables are allocated in MY_RAM */
DataSec, DEFAULT_RAM INTO MY_RAM;
/* code and constants are allocated in MY_ROM */
CodeSec, ConstSec, DEFAULT_ROM INTO MY_ROM;
END
INIT entry /* Definition of the application entry point. */
VECTOR ADDRESS 0xFFFE entry /* Definition of the reset vector. */
Note: The CodeSec section is defined in both object files. In test1.o, the CodeSec section contains the symbol AddSource. In test2.o, the CodeSec section contains the entry symbol. According to the order in which the object files are listed in the NAMES block, the function AddSource is allocated first and the entry symbol is allocated next to it.