beautypg.com

Initializing vector table in assembly source files, Using a relocatable section – Motorola HC12 User Manual

Page 225

background image

Operating Procedures

Initializing the Vector Table

MCUez HC12 Assembler

User’s Manual

MOTOROLA

Operating Procedures

225

NOTE:

The functions

XIRQFunc, SWIFunc,

and

ResetFunc

are published. This

is required because they are referenced in the linker PRM file. All interrupt
functions must be terminated with an RTI instruction.

The vector table is initialized using the linker command VECTOR ADDRESS.

Example:

LINK test.abs

NAMES

test.o

END

SEGMENTS

MY_ROM = READ_ONLY 0x0800 TO 0x08FF;

MY_RAM = READ_WRITE 0x0B00 TO 0x0CFF;

END

PLACEMENT

.data INTO MY_RAM;

.text INTO MY_ROM;

END

INIT ResetFunc

VECTOR ADDRESS 0xFFF2 IRQFunc

VECTOR ADDRESS 0xFFF4 XIRQFunc

VECTOR ADDRESS 0xFFF6 SWIFunc

VECTOR ADDRESS 0xFFF8 OpCodeFunc

VECTOR ADDRESS 0xFFFE ResetFunc

NOTE:

The statement

INIT ResetFunc

defines the application entry point. Usually,

this entry point is initialized with the same address as the reset vector. The
statement

VECTOR ADDRESS 0xFFF4 XIRQFunc

specifies that the

address of function

XIRQFunc

should be written at address

0xFFF4

.

11.4.2 Initializing Vector Table in Assembly Source Files Using a Relocatable Section

Initializing the vector table in the assembly source file requires that all entries
in the table are initialized. Interrupts that are not used must be associated with
a standard handler.

The labels or functions, which should be inserted in the vector table, must be
implemented in the assembler source file or an external reference must be
available for them. The vector table can be defined in an assembly source file
in an additional section containing constant variables.