S12XDP512, CW4.5, GPAGE, interrupts

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

S12XDP512, CW4.5, GPAGE, interrupts

跳至解决方案
2,839 次查看
gravity
Contributor I
Hi,
 
Is there any way to get the compiler to push the GPAGE register when invoking functions or interrupts?
 
I'm am trying to increment a globally addressed variable from an interrupt, which is altering the GPAGE, and therefore crashing the rest of the code.
 
Cheers
 
M
标签 (1)
标记 (1)
0 项奖励
1 解答
493 次查看
CompilerGuru
NXP Employee
NXP Employee
Or alternatively, use the -CpGPAGE option.
-CpGPAGE=0x10

When this option is used, the compiler will generate the register save code for GPAGE in all interrupt functions, but only if the GPAGE could possibly be modified.

The #pragma TRAP_PROC SAVE_ALL_REGS has the drawback that the compiler really saves all page registers, even the ones not used.

Daniel

Message Edited by CompilerGuru on 05-18-200602:38 PM

在原帖中查看解决方案

0 项奖励
2 回复数
493 次查看
Technoman64
Contributor III
I found this in Codewarrior Help. I think it is what you are looking for.
 
#pragma TRAP_PROC

Which page registers are saved is determined by the TRAP_PROC pragma. The syntax of this pragma is

#pragma TRAP_PROC [SAVE_ALL_REGS | SAVE_NO_REGS]

If TRAP_PROC SAVE_ALL_REGS is used, all page registers are saved, whether or not they are used in the interrupt procedure. If TRAP_PROC SAVE_NO_REGS is given, no page registers are saved. If only TRAP_PROC is given, all page registers specified with the -Cp option are saved. It is up to you to ensure that no other page registers are modified.

NOTE

The page registers are changed by paged data accesses. For details, see the Paged Variables section.

494 次查看
CompilerGuru
NXP Employee
NXP Employee
Or alternatively, use the -CpGPAGE option.
-CpGPAGE=0x10

When this option is used, the compiler will generate the register save code for GPAGE in all interrupt functions, but only if the GPAGE could possibly be modified.

The #pragma TRAP_PROC SAVE_ALL_REGS has the drawback that the compiler really saves all page registers, even the ones not used.

Daniel

Message Edited by CompilerGuru on 05-18-200602:38 PM

0 项奖励