AnsweredAssumed Answered

issue with setjump instuction used in ISR call

Question asked by Vikas Vikas on Jul 27, 2015
Latest reply on Aug 7, 2015 by Errico Guidieri

I'm using PowerPC MPC5553. I'm compiling an application that uses setjmp/longjmp. The code compiles fine but when executing the code.
It runs for several cycles in which setjump/longjump being called for context switching. Below are the macro being called in application.

#define RTS_CPU_STORE_CONTEXT(context, piResult) /*lint -e64 */(*((int*)piResult) = setjmp(context))
#define RTS_CPU_RESTORE_CONTEXT(context, parameter) longjmp(context, parameter)

There after Controller get memory crash & does not give even watchdog reset.
Why is it so? Do I need to add any extra library?

 

 

 

I had tried to increase the stack but no  success. I’m using the C project with stack size allocated

in linker file as 64KiB, I tried to increase it to 128KiB but same issue persist.

 

The context switching happens in ISR  function call which has lower priority compare to few other ISRs.

If I call the context switching function from Main while loop instead of ISR, it just work fine.

 

Is there issue for use of instruction setjump & longjump in ISR call?

Outcomes