This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Variable corruption

I'm having a hard time to figure out what is wrong with my code. My code is spread into one common area and additional 4 banks. I have some global variables, mainly structs, that are used throughout the application. These variables are filled with default values that are stored as code variables when the program runs for the first time(after JTAG programming). I have a small keyboard and display so I can check the values and navigate through menus.

The problem showed up after I added some more code to the application, but nothing connected to the variables themselves.

These variables are not being overlapped, the memory map shows it (I've tried NOOL directive just to be sure and nothing). The interrupts do not change by any way these variables.

The funny thing is that depending on which level of the menu I am I get either the correct values or the default values. It seems that for some reason the address of the variable is changed and pointed to the default values(code area) or the real values(ram area).
If I force the variables to be placed on a certain memory place using the _at_ command they don't get corrupted but the ones that were not corrupted get corrupted instead. If they were filled up with garbage I think it would be easier to say that they were getting overwritten by some other thing but they are not getting garbage, they are getting filled up with the default values stored in code area.

Was I too vague?

0