Stack Overflow Failure Recovery of S32K3XX

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

Stack Overflow Failure Recovery of S32K3XX

ソリューションへジャンプ
769件の閲覧回数
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 解決策
743件の閲覧回数
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 返答(返信)
744件の閲覧回数
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 件の賞賛
返信
702件の閲覧回数
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 件の賞賛
返信
695件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @raj12,

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

 

Regards,

Daniel

0 件の賞賛
返信