How to add header on beginning of FW for bootloader use
I’m using STM32L053 and there is a bootloader will check the application FW’s header.
The application firmware should have a header of 3 words (12 bytes):
attribute((section(“.fwhdr”)))
const volatile boot_fwhdr fwhdr = {
// CRC and size will be patched by external tool
.crc = 0,
.size = BOOT_MAGIC_SIZE,
.entrypoint = (uint32_t) _start,
};
The bootloader will check the CRC and length(after run python tool to create).
The third word is the pointer to your entry point function.
The bootloader will jump to that address upon startup.
And the question is how to add the header on beginning of FW for bootloader use ?
How to add the pointer of entry point function as the header on my FW?
The bootloader is create by gcc and some .ld file, but I don’t know how to add the header on my current project by using Keil or SW4STM32.
Nick