Forum Discussion
Altera_Forum
Honored Contributor
13 years agoA common technique to test for a stack and heap collision is to fill up the memory where the stack and heap reside with a known pattern like 0x5A5A5A5A before your code goes to access data on the stack and heap. Then you let the processor run for a bit and stop it, take a peak at the memory to see if your pattern can be found anywhere. If you can't find the pattern then the stack and heap probably collided and resulted in the CPU going off into the weeds.
Have you attempted other code footprint reduction optimizations? Download the software manual for Nios II and search for "footprint". There should be a section that talks about other things you can do to the BSP to reduce the code size further at the expense of functionality/speed.