Topic : vector table relocation

Forum : ST7/STM8

Original Post
Post Information Post
July 14, 2009 - 7:10pm
Guest

I have a bootloader located at 0x8000. I would like to locate my application and its vector table starting at 0xA000 and am having trouble relocating the vector table. I would like the vector table to start at 0xA000 with the code to follow

In my linker options I have defined: CODE(0xA000)

My map file shows the following:

* * * * * * * * C O D E M E M O R Y * * * * * * * *
CODE 008000H 000004H AT ?CO?STARTUP_V_Z00
008004H 000038H *** GAP ***
CODE 00803CH 000004H AT ?IT?VECTOR#13
008040H 001FC0H *** GAP ***
CODE 00A000H 00000EH INSECTION0 ?STR?MAIN
CODE 00A00EH 000008H INSECTION0 ?PR?XCP
...

I tried modifying the startup.asm file as follows:

from:
CSEG AT 8000h ; Interrupt vectors start at 8000h on STM8

to:
CSEG AT A000h ; Interrupt vectors start at 8000h on STM8

My map file now shows the following:

* * * * * * * * C O D E M E M O R Y * * * * * * * *
008000H 00003CH *** GAP ***
CODE 00803CH 000004H AT ?IT?VECTOR#13
008040H 001FC0H *** GAP ***
CODE 00A000H 000004H AT ?CO?STARTUP00
CODE 00A004H 00000EH INSECTION0 ?STR?MAIN
....

I have a timer interrupt declared as:

void timer_handler_5_ms(void) interrupt 13

How can I inform the linker that I want the vector table located at 0xA000, instead of 0x8000 such that the above interrupt handler is placed at 00A03CH rather than 00803CH?

Please respond ASAP as this is time critical.

John

Replies
Post Information Post
+1
0
-1
July 15, 2009 - 11:24am
Raisonance Support Team

Hi John,

Although the linker does its job, the interrupt vectors other than main are directly emitted (as absolute code) by the compiler.

So you need to use the INTVECTOR(0xA000) compiler directive so that your absolute segment ?IT?VECTOR#13 will be at the required address.

Regards,
Bruno