Stack Overflow Failure Recovery of S32K3XX

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

Stack Overflow Failure Recovery of S32K3XX

跳至解决方案
771 次查看
raj12
Contributor III

Hello,

I am injecting the stack overflow error of S32K3XX MCU, and after successfully injection of error DebugMon_Handler exception triggering.

I have a query Related to recovering methods. during testing observed only After power on reset MCU is able to recover from Stack Overflow exception.

Please let me know is there any other methods of recovery.
Thanks

标记 (2)
0 项奖励
回复
1 解答
745 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @raj12,

Any reset can recover it.

The SP is set during the startup process.

Use the Power_Ip RTD driver to trigger a SW reset from the exception handler.

 

Regards,

Daniel

在原帖中查看解决方案

0 项奖励
回复
3 回复数
746 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @raj12,

Any reset can recover it.

The SP is set during the startup process.

Use the Power_Ip RTD driver to trigger a SW reset from the exception handler.

 

Regards,

Daniel

0 项奖励
回复
704 次查看
raj12
Contributor III
Hello @danielmartynek,

Thanks for your reply.

Now, I am now able to recover from stack overflow error after doing the functional reset.

Below is the pseudo code which currently, I am using for injection of stack overflow.

*DEMCR_reg = (1 << 24) | (1 << 16);
/* Get implemented values for num of comparators in DWT registers*/
numcomp = (DWT->CTRL & (0xF << 28)) >> 28;

DWT->NUMCOMP[0].COMP = (uint32_t)stackPointer - (1016 * sizeof(uint32_t));
DWT->NUMCOMP[0].MASK = 0;
DWT->NUMCOMP[0].FUNCTION = 0x7;
DWT->NUMCOMP[0].FUNCTION &= ~((1 << | /* Perform address comparison */
(1 << 7));
for (counter = 0, reg0 = 0; counter < 1016; counter++, reg0++)
{
__asm("PUSH {r0}");
}

Can you please let me know the other method to inject the stack over flow error.

because, I not want to use below variable there is some limitation on GHS compiler not allowing me to save the stack pointer (__asm("SP")) in register type variable.

register uint32_t* stackPointer __asm("sp");

Please let me know the other method for injecting the stack overflow/underflow error error it will be helpful for my development.

Thanks
0 项奖励
回复
697 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @raj12,

Call a recursive function (that calls itself) or create a large local variable.

 

Regards,

Daniel

0 项奖励
回复