HW Stack Overflow on MC56F8035

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

HW Stack Overflow on MC56F8035

ソリューションへジャンプ
1,326件の閲覧回数
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,229件の閲覧回数
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,230件の閲覧回数
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,229件の閲覧回数
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 件の賞賛
返信