How do I jump to the reset vector on an S12G?

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

How do I jump to the reset vector on an S12G?

1,419件の閲覧回数
DDuckDDuck
Contributor II

I did this on my old S08DZ... but the S12 compiler won´t like the assembler instructions.... How do I do the same on an S12G?

 

 

   __asm LDHX   $FFFE                // reset vector

    __asm JMP    ,X                            / /Jump and reset!

 

 

 

Many thanks,

 

Lars

ラベル(1)
タグ(2)
2 返答(返信)

1,095件の閲覧回数
kef2
Senior Contributor V

From C you can simply

   ((void (*__near)(void))0xFFFE)();

, where __near is pointer type modifier, which you can remove. No matter what memory model, it still will work for S12 and S08.

There's no LDHX instruction in S12. Also ,X addressing mode is not supported. You need to modify your code like this

   __asm LDX   #$FFFE                // reset vector

    __asm JMP    0,X                            / /Jump and reset!

1,095件の閲覧回数
keli
Contributor I

The suggested C code violate MISRA C-1998: rule 45. Is there walk-around?

0 件の賞賛
返信