HW Stack Overflow on MC56F8035

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

HW Stack Overflow on MC56F8035

跳至解决方案
1,244 次查看
petercernan
Contributor I

Hello, I'm working on solar microinverter with MC56F8035 DSC. I  use Quickstart / CW 5.9.0 for software development. I faced the issue with HW stack overflow. My program includes ADC converter and Timer A0 controlled by coresponding interrupts (level 1/level2). Both interrupt service routines and its subfunctions use # pragma interrupt on/off to store/restore data/registers correctly. I reviewed linker command file SDM_pflash.cmd where stack size is defined. I increased it from 0x100 to 0x200 but there was no improvement, HW stack overflow occured again. Any idea what's wrong? Thanks in advance for your advise. Have a nice day. Peter

标签 (1)
0 项奖励
1 解答
1,147 次查看
johnlwinters
NXP Employee
NXP Employee

I have not seen the source code but at first glance it seems that the interrupt handler is defined incorrectly.

Interrupt handler definition using

“#pragma interrupt on/off”

can only be used when

the interrupt handler does not call any function/routine and

entire “raw” source code is written inside the interrupt handler.

If at least one function is called from the interrupt handler, the definition above leads to software crash and the HW stack overflow condition.

Solution: Use “#pragma interrupt saveall” before the interrupt handler definition.

Example of correct definition of the interrupt handler:

#pragma interrupt saveall

void HandlerISR(void)

{

/* user source code including function calls */

}

在原帖中查看解决方案

0 项奖励
2 回复数
1,148 次查看
johnlwinters
NXP Employee
NXP Employee

I have not seen the source code but at first glance it seems that the interrupt handler is defined incorrectly.

Interrupt handler definition using

“#pragma interrupt on/off”

can only be used when

the interrupt handler does not call any function/routine and

entire “raw” source code is written inside the interrupt handler.

If at least one function is called from the interrupt handler, the definition above leads to software crash and the HW stack overflow condition.

Solution: Use “#pragma interrupt saveall” before the interrupt handler definition.

Example of correct definition of the interrupt handler:

#pragma interrupt saveall

void HandlerISR(void)

{

/* user source code including function calls */

}

0 项奖励
1,147 次查看
petercernan
Contributor I

Hello John,

first of all, thank you very much for your advice. It works!

You are right, my interrupt service routines included subfunctions.

HW stack overflow didn't occur again once I changed all the ISR's to "#pragma interrupt saveall" (while keeping subfunctions called by ISR's with “#pragma interrupt on/off”).

Have a nice day

Peter

0 项奖励