Hi,
In F28377S, it is possible to detect stack overflow (see www.ti.com/.../spra820.pdf). Is there a similar way to detect stack overflow in Tiva-C processors? If so, what are the addresses of the relevant registers?
Thanks,
Dhammika
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,
In F28377S, it is possible to detect stack overflow (see www.ti.com/.../spra820.pdf). Is there a similar way to detect stack overflow in Tiva-C processors? If so, what are the addresses of the relevant registers?
Thanks,
Dhammika
Hi,
One thing you can do is to use MPU to catch the stack overflow. The SRAM is memory mapped to 0x20000000. See below. If you set up a MPU region for the SRAM then an overflow can be detected when CPU tries to access spaces that is outside the defined MPU region. When stack overflow happens, the CPU address will be less than 0x20000000 (e.g. 1FFFFFFF). This will become a MPU fault and you can catch it.
Hi Charles,
One problem with this method is it is going to crash the system, especially we are running the processor in the supervisory mode.
Thanks,
Dhammika
Hi,
I'm not familiar with the C28x Emulation Analysis Block so can't really comment for it. TM4C129 uses Arm Cortex-M4F core and it certainly has the debug unit that can be setup for watchpoints too. I don't think these registers can be accessed by application directly as they are usually accessed by the debugger using a different bus (APB bus) via JTAG and DAP. I'm not sure if C28x has a built-in MPU either. The method I describe will trap your code in an exception handler and your code can take the corrective action for it.
Hi Charles,
F28377x does not have an MPU. Even in that processor, locations of the debug unit are not publicly available except in the document I gave as a link in my original post.
Thanks,
Dhammika