cancel
Showing results for 
Search instead for 
Did you mean: 

When using X-cube-sbsfu, why is swap area size constrained to be at least equal to the size of the largest flash sector? Is there a way to modify SBSFU to work with a smaller swap area?

tomptz
Associate II

On STM32F746, largest sector is 256K and total flash size is 1M. This means that 1/4th of our flash is lost to the swap area. As a result, we do not have enough flash memory left to implement the dual image variant. We are now trying to optimize the memory layout. Is there some aspect of SBSFU or the STM32 memory layout that would make it impossible to work with a smaller swap area?

2 REPLIES 2
Jocelyn RICARD
ST Employee

Hello,

I'm sorry for late answer.

first, the SWAP area is used to store one flash sector in order to be able to recover in case of power failure during update.

So, the SWAP are cannot be smaller than the bigger sector size.

One alternative would be to use RAM instead but this wouldn't be resistant to power failure.

Another way to overcome this firmware size limitation is to remove the swap process in a way that the new firmware erases the old one. In case of power failure, the new one is still there in slot1, so the update can complete when power comes back.

This would allow using the following mapping which gives 128 bytes more per slot.

Sector 0 0x0800 0000 - 0x0800 7FFF 0x0020 0000 - 0x0020 7FFF 32 Kbytes

Sector 1 0x0800 8000 - 0x0800 FFFF 0x0020 8000 - 0x0020 FFFF 32 Kbytes

Sector 2 0x0801 0000 - 0x0801 7FFF 0x0021 0000 - 0x0021 7FFF 32 Kbytes

Sector 3 0x0801 8000 - 0x0801 FFFF 0x0021 8000 - 0x0021 FFFF 32 Kbytes

Sector 4 0x0802 0000 - 0x0803 FFFF 0x0022 0000 - 0x0023 FFFF 128 Kbytes => Slot0

Sector 5 0x0804 0000 - 0x0807 FFFF 0x0024 0000 - 0x0027 FFFF 256 Kbytes => Slot0

Sector 6 0x0808 0000 - 0x080B FFFF 0x0028 0000 - 0x002B FFFF 256 Kbytes => Last 128K : Slot1

Sector 7 0x080C 0000 - 0x080F FFFF 0x002C 0000 - 0x02F FFFF 256 Kbytes => Slot1

Another way would be to use external flash to store the update file. This will also be supported in future release but I cannot share anything right now.

I hope this answer your question.

Best regards

Jocelyn

Hi Jocelyn,

thank you for your feedback. The idea of the new firmware erasing the old one is an interesting one. We will explore it further.

Kind regards,

Tom