I am having trouble recently. I dont understand why but suddenly some local variables are being created in the USB memory space (0x7FD00000-0x7FD03FFF). Normally it would be fine but some of the variables are then used to the flash via IAP. I first found this issue when the FLASH row backup buffer was being created in the USB memory space. I was able to make a messy fix to make it work but now it is happening with other variables. Is it just a result of having code that is growing too large? Is there a way to force the compiler not to create any variables in that space?
The compiler don't care much about memory ranges. It's the linker that maps variables to memory addresses. And it is your project settings that tells the linker what memory regions it may make use of. Don't show the USB memory to the linker, and the linker will not place anything there. Potentially failing the build because the amount of variables is too large in relation to the amount of memory you specify in your project settings.
But right now, you are talking about local variables, i.e. auto variables. They are stored on the stack. How have you specified your stack in the startup file? Remember that the linker will use your project settings for finding room for the stack just as it does for your global variables. And neither compiler nor linker will care the slightest if your stack is big enough, or if you manage to get a stack overflow at runtime.
Next thing - doesn't IAP require the top 32 byte of RAM to be reserved? Have you done that, making sure the linker gets a linking errors instead of using this region for variables/stack?
Ah it was the project settings. And I guess I misspoke about local variables. I meant just regular, old variables.
I dont think we have been having a problem with the IAP. How can I make sure?