If you are using the Linker ( SmartLinker) build tool utility for a relocatable assembly project, you will use a PRM file for the Linker to allocate ROM and RAM memory areas.
/* This is a linker parameter file for the MC9S12ZVH64 */ LINK Model_T.elf /* Absolute executable file */ NAMES main.o /* Input object-code files are listed here. */ END SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */ Z_RAM = READ_WRITE 0x0080 TO 0x00FF; RAM = READ_WRITE 0x0100 TO 0x107F; ROM = READ_ONLY 0x182C TO 0xFFAF; ROM1 = READ_ONLY 0x1080 TO 0x17FF; ROM2 = READ_ONLY 0xFFC0 TO 0xFFCB; /* INTVECTS = READ_ONLY 0xFFCC TO 0xFFFF; Reserved for Interrupt Vectors */ END PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */ DEFAULT_RAM, /* non-zero page variables */ INTO RAM; _PRESTART, /* startup code */ STARTUP, /* startup data structures */ ROM_VAR, /* constant variables */ STRINGS, /* string literals */ VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */ DEFAULT_ROM, COPY /* copy down information: how to initialize variables */ INTO ROM; /* ,ROM1,ROM2: To use "ROM1,ROM2" as well, pass the option -OnB=b to the compiler */ _DATA_ZEROPAGE, /* zero page variables */ MY_ZEROPAGE INTO Z_RAM; END STACKSIZE 0x50 VECTOR 0 _Startup /* Reset vector: this is the default entry point for an application. */
The default size for the stack using the New Bareboard Project wizard for MC9S08GT60 is 80 bytes - ( STACKSIZE 0x50). This Linker statement and __SEG_END_SSTACK in the assembly-code snippet below determine the size and placement of the stack in RAM:
MyCode: SECTION ; code section main: _Startup: LDHX #__SEG_END_SSTACK ; initialize stack pointer TXS
The statements in the linker parameter file are described in the Linker portion of the Build Tool Utilities manual.
Use the same <project.ini> file that the Assembler used for its configuration - the project.ini file in the project directory.
The following image displays the Loading configuration dialog box.
The project directory is now the current directory for the Linker.
The Smart Linker links the object-code files in the NAMES section to produce the executable *.elf file, as specified in the LINK portion of the Linker PRM file.
The following image displays the smart linker window after linking.
The messages in the linker's project window indicate that:
The TEXTPATH environmental variable was not used for this project. Therefore, the Linker generates its *.map Linker Map file in the same folder that contains the PRM file for the project. Because the ABSPATH environment variable was not used, the *.elf executable file is generated in the same folder as the Linker PRM file. The following image shows the contents of the project directory after the relocatable assembly project is linked.