Debugging bootloader + app: How to get a CRC header to the target, too?
I have a workspace in CubeIDE that has two STM32F0 projects: A bootloader and an app.
To be able to debug both, bootloader, and then jumping through to the app code, I made an additional Debug Configuration where I added the source folder, and the symbol file of the application.
In principle, this works, and I can jump from bootloader right through my app code at source level (to land in the hardfault handler, see other thread ;) But it's in the app nonetheless)
But only if I comment out my bootloader line "if (check_app_CRC()) ...".
Because what I do is, as a post build step of the application, run a custom program I wrote to generate a header with e.g. CRC for the app.
This is a separate file, and for update via my bootloader, I just concatenate header + app binary.
But for debugging, and loading everything onto the target flash:
Now, I can't add that custom header blob file to CubeIDE (Eclipse)'s Startup / Load Image and Symbols tab - as that requires an ELF file.
I guess since an ELF file really is for programs I can't fake one that contains only my special binary data blob, right?
Also, the header is smaller than 1 flash sector, so I'm not even sure the IDE would do it right, flashing one after another, without earsing the first again...
I have thought about whether one could somehow make the header a part of the application firmware image itself - then this problem would just go away.
But I would need to execute my CRC & info compilation programlet over the basically completely linked executable and then the linker would somehow have to integrate that header still.
My GNU linker chops are nowhere near the required level here.
Perhaps one might just reserve one empty region in the app image as some array at a fixed location, and then have my programlet write the CRC etc data over that part of the image file, calculating the CRC over all but that region.
It does seem kinda hacky.
What ways are there to tackle this? I guess there is some tried & proven standard way to do it?
