2024-08-13 09:39 AM
I am looking at strategies for updating flash over CAN for the F446 (STM32F446RET6). A small loader program resides in addresses 0-0x8000, and loads the addresses above 0x8000 while there is other CAN traffic running. (This has been done and works with the STM32L431.) The knotty problem with the F446 is that the last three flash sectors are 128KB and the normal sram is 128K. If the procedure requires updating any addresses in flash and preserving the data not in the update, then the existing data in a sector needs to be saved before the erase and write. Reading in these 128K sectors takes all of sram.
One approach would be to set the stack vars in common to the backup sram. After reading the various posts on backup sram, it looks like it would work on the F4 series, however I wonder if interrupts (and the possibility of tail-chaining) would work correctly, hence the question.
An alternative would be to save the 128K sector data in the first 124K of flash and the remaining 4K in the backup sram. This adds a bit of logic to the program, however the stack, etc., would then be operating with the normal flash.
There are all sorts of variations if the requirements can be relaxed a bit, e.g. rearrangement of memory layouts so that sectors 0-4 preserve not-updated data, etc. At the moment, my interest is with the backup sram and ways it can and cannot be used.
Solved! Go to Solution.
2024-08-13 06:05 PM
Sure, you could use Backup SRAM as stack memory (via linker script to set stack top address to it).
There are some things to consider:
Good luck (by "trying" this approach).
2024-08-13 10:46 AM
Just test it. Should work. Maybe use MPU to tweak attributes of backup ram.
2024-08-13 06:05 PM
Sure, you could use Backup SRAM as stack memory (via linker script to set stack top address to it).
There are some things to consider:
Good luck (by "trying" this approach).