Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThanks to all who replied... The first poster's remark about stack overflow reminded me to go back and double-check the stack size... Turns out that after linking the latest version of my firmware to the 64K RAM I had defined, I had only about 1,800 bytes left for stack + heap! Even without any recursion, no big objects on the stack, and nothing except maybe a handful of serial buffers and FD structures allocated by the system runtime on the heap, 1.5K RAM sounded pretty tight... So, I doubled my RAM size from 64K to 128K in SOPC Builder, and this seems to have completely solved the problem!
So, the stack must have just been stomping over some heap items, or vice-versa. This accounts for the weird behavior I saw, with nondeterministic crashes & occasional garbled output. The unrelated features that I had added to the code since the last time it was working must have grown the program text just large enough so that inadequate space then remained for the run-time memory requirements. Thanks again for everyone's help! I'm glad it wasn't an IP problem.