Forum Discussion
Altera_Forum
Honored Contributor
12 years agoAssuming it's software, and not hardware:
Did your changes include things like shrinking the size of the stack or the size of fixed buffers? Your problem description overall sounds like memory corruption leading to an erroneous branch to the reset vector, which is kind of easy to do if your stack is too small and you use a "big" function like printf(). When you're changing code and seeing the change in behavior, what you're doing is changing the layout of the memory, so the same bug is trashing different parts of your program. You can try things like increasing the size of the stack / allocated buffers and see if the problem "goes away". You can also do things like comment out functions (e.g. your printing to buffer) and remove increasingly large quantities of code until the problem "goes away" so you get a hint what area of the program your bug is in. Finally, since your behavior is repeatable / fixed with a given compile, you should be able to use a hardware breakpoint immediately before the apparent reset happens, and single step until it does. Theres lots of debugging tricks, but what you want to do will depend on the details of your program.