cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H573 in-application programming using the dual bank approach

saeedraf
Associate

Hi, I'm following the steps on the reference manual to perform in-application programming by first writing the new firmware to bank 2 and then swapping the banks after doing some checks.

Screenshot 2025-03-21 115828.png

 

After completing the steps and performing a software reset, the new firmware was updated. However, after closing the st-link debugger and reopening it, the debugging session immediately closes. I'm trying to figure out why. 


I have written the new firmware starting at address 0x0810 0000 according to the following:
Screenshot 2025-03-21 114025.png

 

I was wondering whether I need to offset by a couple sectors from the 0x810 0000 start address before flashing new firmware. Please let me know I'm mistaken, thanks.

3 REPLIES 3

Well if you have common code at 0x0800000 and 0x08100000 you can at least fork() between the two regions with the bank switch. Perhaps a couple of KB for a loader/recovery method.

You need to link the image for the address it's going to physically execute, not necessarily where you have it parked before it's swapped around.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
saeedraf
Associate

Thanks for your helpful response! And, I'm assuming that I have to update the vector table offset to point to the new firmware location at 0x0810000 (i.e., starting address of bank 2), right? Thanks again.

To execute at 0x08100000 the Vector Table would need to reflect that in it's content, or you can move a fixed-up copy in RAM and point SCB->VTOR at that. 512-byte aligned.

But if you use the SWAP_BANK method to map the active image at 0x08000000, the vectors and table would need to built for that address

 

ie you build/link the content for 0x08000000, your update/park the FLASH at 0x08100000, at next boot you determine the most up to date firmware, at map it via SWAP_BANK

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..