Relocate the INTERRUPT VECTOR

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Relocate the INTERRUPT VECTOR

ソリューションへジャンプ
1,597件の閲覧回数
dan78
Contributor I

Dear all Hello,

 

I'm using CodeWarrior 5.9.0 for my application with MC9S12P128.

In my application I need to relocate the interrupt vector address.
For example: I need to put the Timer Overflow Interrupt in the location 0x7FDE.
I've done this by this entry in the .prm file:

VECTOR ADDRESS 0x7FDE TOV_Interrupt

My applicatin runs correctly, even if I reset it by the debugger.
But if i do an hardware reset turning off the power supply, the application doesn't handle the interrupt correctly and it enters in a infinite loop.

 

Is corretc to use the entry in the .prm file or do I have to use another method?

Thank you.

ラベル(1)
0 件の賞賛
返信
1 解決策
675件の閲覧回数
Sten
Contributor IV

Hi DAN78

 

I assume you are using a bootloader? I am using the same approach: a bootloader in protected flash occupying the address range 0xF800..FFFF. Because the standard vector area is in protected flash, I have relocated my applications vectors to 0xF7xx. In my applications I set the IVBR to 0xF7 before enabling interrupts. But!!! All the Reset-vectors you must handle with your bootloader in the way Lundin suggests. For example the Bootloaders Reset-ISR must, depending of if the bootloader is running or not, either do bootloader-stuff or jump to the address pointed toby the aplications reset-vector (in my case at 0xF7FE).

 

Hope this helps you to find your problem.

 

Sten

 

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
676件の閲覧回数
Sten
Contributor IV

Hi DAN78

 

I assume you are using a bootloader? I am using the same approach: a bootloader in protected flash occupying the address range 0xF800..FFFF. Because the standard vector area is in protected flash, I have relocated my applications vectors to 0xF7xx. In my applications I set the IVBR to 0xF7 before enabling interrupts. But!!! All the Reset-vectors you must handle with your bootloader in the way Lundin suggests. For example the Bootloaders Reset-ISR must, depending of if the bootloader is running or not, either do bootloader-stuff or jump to the address pointed toby the aplications reset-vector (in my case at 0xF7FE).

 

Hope this helps you to find your problem.

 

Sten

 

0 件の賞賛
返信
675件の閲覧回数
dan78
Contributor I

Hi Sten,

I've just done an example like the way you suggested to me and it works.

Thanks a lot!

0 件の賞賛
返信
675件の閲覧回数
Lundin
Senior Contributor IV

Why on earth would you need to move the vector table? This seems like needless obfuscation to me. Even if you are make some mysterious bootloader, I still don't see the need to move the vector table. Flash the vector table when you switch from bootloader to live application.

 

Or simpler still:

 

// prm

VECTOR ADDRESS 0xFFDE TOV_Interrupt

 

#pragma TRAP_PROC

void TOV_Interrupt (void)

{

  if(something)

   {

    execute_this();

  }

  else

  {

    execute_that();

  }

}

 

 

0 件の賞賛
返信
675件の閲覧回数
dan78
Contributor I

Hi Ludlin,

Yes I've have to use a bootloader.

But I can't flash the vector table when I'm in my main program (bootloader and reset vector are in the same flash bank,

 so i want to flash the vector table I have to erase the whole bolck, erasing the bootloader... )

 

Thanks

0 件の賞賛
返信