Hi,
I am writing an integration-test for my bootloader (running on a Cortex M3, STM32F217) which has several fallback-facilities. To test these, I need to corrupt a part of my executable flash.
My idea was to have a const dummy variable, placed at the end of my integration-test-firmware. I use the address of this variable to then corrupt the flash, intending not to destroy any important contents of the flash to not run into hard-fault-exceptions.
static const unsigned char dummy[1024] __attribute__((at(0x08060000)));
0x08060000 is beyond the contents of the firmware (next sector of flash). After that, I read a byte from &dummy, modify it and write back. Of course, the whole flash-sector is erased.
Now, if I restart my application, the contents of RW-Data is not initialized correctly anymore (through ARM c-lib). As I have read, the linker places this initialization-data at the very end of the image. So now I want to place this init-data _before_ 0x08060000 using scatter-loading. But my problem is that I don't know the "symbol"-name to use in the scatter-load file that references this init-data.
Any tips and tricks highly appreciated!
Thanks!
-- Regards, Marco
Hi Marco,
I'm planning to have a boot loader with fallback mechanisms as well but my testing strategy isn't as ambitions - I'm planning on generating corrupt .bin files to load through my field upgrade mechanism and then ensuring the fallback image gets loaded.
This link may offer some clues how to position the scatter load tables in a way that would enable your strategy:
infocenter.arm.com/.../index.jsp
In my map files I see this:
Region$$Table$$Base 0x0804095c Number 0 anon$$obj.o(Region$$Table) Region$$Table$$Limit 0x0804097c Number 0 anon$$obj.o(Region$$Table)
so I think if you manage to pull these symbols before your corruption test symbol you should be ok.
Hope that helps, Andrew