How to start "C" functions from HCS12 assembler ??

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to start "C" functions from HCS12 assembler ??

4,430 次查看
Gizzzmo
Contributor I
Hello,

I would make a "secondary interrupt vector table" on a HCS12E128 in order to modify my "interrupt vectors" on the fly (they are in a protected part of the flash). I've made this "secondary interrupt vector table" with a assembler file and i wanna start "C" functions from this file but i dont find how (with a CALL or a JSR for example).

Gizmo.

P.S:smileyfrustrated:orry for my approximative english, i'm french
标签 (1)
0 项奖励
回复
4 回复数

735 次查看
Sten
Contributor IV

If your C functions are ordinary ISR routines (like interrupt void TimerISR(void) ) then you should call them with a plain JMP TimerISR. ISR C-routines are ended with a RTI instruction, and they must be called directly from the interrupt (and they must be in the non-paged area of the memory).

An other way to do it would be that your assembler routine calls ordinary C functions (like void TimerSecISR(void)) with a CALL TimerSecISR (if TimerSecISR is in paged memory) or JSR TimerSecISR (non-paged memory), but then your assembler routine must be aware of that the control will return to it after the routine completes and the RTI must be in the assembler code.

 

0 项奖励
回复

735 次查看
Gizzzmo
Contributor I
I've tried this but the assembler file doesn't find my C-routine.

How can I make him find my routine ?

Thx
0 项奖励
回复

735 次查看
Sten
Contributor IV
You have to use the XREF directive to tell the assembler that the routines are external. The linker will then take care of inserting the correct addresses into the generated code.
 
0 项奖励
回复

735 次查看
Gizzzmo
Contributor I
Thx a lot, it works really well :smileywink:
0 项奖励
回复