2024-08-31 09:24 AM
Currently I'm trying to implement custom [simple] bootloader for STM32F7 MCU and try to sum up all that I found so far to successfully running both bootloader and user application, which would be updating through SD-card or USB flash drive. Here I point in my opinion all thing need to be done as required steps.
Bootloader:
- determine size of bootloader and calculate application starting address, round up it to value multiplied as page size of flash MCU;
- set application jump address (e.g. 0x800F000);
- disable HAL (interrupts, GPIO, everything was initialized) before jumping to application.
- during application update process (read from SD/USB) need first clear some sectors of flash (amount to be calculated depend application size and flash sector/page size).
Application:
- update flash address in loader;
- set vector table base offset;
- set flag to relocate the vector table.
P.S. So far I'm not take into account things like flash protection, CRC, f/w file encryption, etc.
Please correct me if something missing, wrong or could be skipped or not implemented.
Thank for your attention.