OpenWare
OpenWare copied to clipboard
Adding firmware header
I was unhappy with both solution that ST examples suggest for booting from QSPI flash, so trying to do something different. It's not working yet, but I think it will soon. This would rely on relocating different sections to specific regions of H7 memory (similar to how it's done for patch loader).
Currently it would be something like this:
struct FirmwareHeader {
uint32_t magic;
uint32_t section_0_start; /* ITCM */
uint32_t section_0_end;
uint32_t section_0_address;
uint32_t section_1_start; /* DTCM */
uint32_t section_1_end;
uint32_t section_1_address;
uint32_t section_2_start; /* Code + constant data except LUTs -> RAM */
uint32_t section_2_end;
uint32_t section_2_address;
uint32_t section_3_start; /* Reserved */
uint32_t section_3_end;
uint32_t section_3_address;
};
There was some discussion about such object usable for other purposes - https://community.rebeltech.org/t/make-owl-great-again/1392/33?u=antisvin
I think we could have a combined solution for both use cases. So the question is, what other info should we add? I'm considering something like this:
- Firmware version - actually not terribly useful, unless device has some display usable by bootloader
- Hardware ID - to prevent writing to wrong device, happened to me before :-)
- At least one word with option bits (could be used to toggle IWDG usage and other optional features if they would depend on bootloader actions)
- Checksum for previous fields, except that we can't generate it when linking FW. But we could reserve a field to do it when writing firmware and confirm that there was no accidental writes in this area before booting. Probably a good safety measure.
Ideas/suggestions?