07-24-2017 04:21 AM
I am using spartan 6 FPGA with microblaze. Microblaze is running C code. In C code have written a for loop incrementing variable i from 0 to 26363. After executing the code I find that the statements after for loop is executed , but the for loop has executed incrementing variable from 0 to some smaller value only. Sometimes i is 63,sometimes 173 ...like that. But the program is not halted or stuck there since following instructions are executed. The variable i is not updated anywhere else. I have assured that. The issue is i increments from 0 to some smaller value, when I want it to increment from 0 to 26363.
Any suggestions to improve this.
Thanks in advance.
07-24-2017 04:29 AM - edited 07-24-2017 04:29 AM
07-24-2017 06:19 AM
Can you post the code?
The obvious explanation for a function leaving a loop early is that you've got something in teh loop telling it to leave early - either a break or a goto statement. If the loop contains function calls then it's also possible to mess up the stack badly enough that it'll return to somewhere outside of the loop - especially on something like Microblaze where there's not a whole lot of memory protection.
07-24-2017 10:49 PM
The problem was solved when I disabled my timer interrupt. May be the timer interrupt may have interrupted the loop. But I have no idea how the loop got stuck.
I tried volatile and tried with small numbers for stack overflow. But the issue was this. Thanks for suggestions.