This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi All,
I have a issue regarding Illegal isr generation.
Earlier when my stack was initialized to RAMM0 (.stack : > RAMM0_1, PAGE = 1) , and when my stack pointer used access a memory out of the stack max size address, illegal isr was getting triggered. But now I had change my stack to RAML0(.stack : > RAML0, PAGE = 0), and when the stack overflow occurs , the illegal isr is not getting generated and my progam gets stuck.
What can be the problem if i just change the stack in my .cmd file from RAMM0 to RAML0. I need to get the illegal isr when stack pointer is accessing a memory out of the stack max address
Regards,
Chandrakant Pal
Chandrakant,
It depends what's in the memory beyond your stack.
When you were allocating the stack previously, my guess is you had made M0 & M1 memory contiguous (from the section name you were using) so you had 0x800 words of stack space and when it over-flowed [SP] was fetching from peripheral frame 0, which resulted in an invalid opcode - possibly from an invalid return address. This is not a reliable way of reacting to a stack overflow.
Now you are allocating the stack to L0 memory, an overflow will be fetching from valid memory which may contain valid data, depending on what you have loaded there.
The best way to handle stack overflow on this device is to use the internal hardware analysis units to detect [SP] accesses in a memmory range close to the end of the stack. There is an application note with code at:
Regards,
Richard