Motorola HC12 User Manual

Page of 328
General Information
Getting Started
MCUez HC12 Assembler
User’s Manual
MOTOROLA
General Information
33
The list file generated by the macro assembler looks like this:
Motorola HC12-Assembler
(c) COPYRIGHT MOTOROLA 1991-1997
Abs. Rel.
Loc.
Obj. code    Source line
---- ----
 ------
---------    -----------
1    1
XDEF entry
...
4
4
0000
0AFE
initStk: EQU $AFE ; SP Init
; value
5
5
dataSec: SECTION
;
6
6
000000 0005
var1: DC.W 5
; Assign 5 to
; var1
7
7
8
codeSec: SECTION
;
9
9
entry:
10
10
000000 CF 0AFE
LDS #initStk
; Load stack
11
11
000003 FC xxxx
LDD var1
12
12
000006 20F8
BRA entry
1.4.4  Linking an Application
Once the object file is available, the application can be linked. The linker will
organize code and data sections according to the linker parameter file. Follow
this procedure to link an application:
1.
Start the editor and create the linker parameter file. Copy the file fibo.prm
to test.prm.
2.
In the file test.prm, change the name of the executable and object files to
test.
3.
Additionally, modify the start and end addresses for the ROM and RAM
memory areas.
The test.prm module appears like this:
LINK test.abs
/* Name of the executable file generated.*/
NAMES test.o END
/*Name of the object files in the application*/
SEGMENTS
  MY_ROM = READ_ONLY  0x800 TO 0x8FF;
/*READ_ONLY memory area */
  MY_RAM = READ_WRITE 0xB00 TO 0xBFF;
/*READ_WRITE memory area */
END
PLACEMENT
  .data    INTO MY_RAM; /* Variables should be allocated in MY_RAM */
  .text    INTO MY_ROM; /* Code should be allocated in MY_ROM */
END
INIT   entry
/* entry is the entry point to the application */
VECTOR ADDRESS 0xFFFE entry
/* Initialization for Reset vector */