In-Application Flash Programming - Sanity Check
I've written many bootloaders for Freescale/NXP Kinetis mcus - this is my first for a STM32F4.
I'm not using Cube or HAL.
In my prior bootloaders, an executable program stub was moved to ram and executed because a flash read could not take place during a flash erase/program operation.
I'm using the STM32F427 mcu.
The documentation states the same (no flash read during a flash erase/program).. More specifically, it states the mcu will stall until the flash erase/program operation is completed.
In reviewing your HAL code - I don't see the use of ram based executable code and I see the following ...
FLASH->CR |= FLASH_CR_STRT; // Start Erase
while(FLASH->SR & FLASH_SR_BSY); // Wait til finish
Is the "while" processing taking place out of the ART or is it just stalling until the instructions associated with the while test can be executed?
Would it be a more robust process to have the code above executed from ram so that no buss stall will occur during the busy test?
Another question: If User option Read Protection Level 1 is set - can In-Application Erase and Programming still take place?
To re-program flash while in Level 1 - can the Level 1 protection stay active or do you have to take Read protection back to level 0 (I hope not since the documentation says all user data is erased - which would include the bootloader)
Thanks
