cancel
Showing results for 
Search instead for 
Did you mean: 

SBSFU | FLASH sector segmentation

Jakub Standarski
Associate III

Hello all,
I have a question about possibility of splitting/dividing FLASH sector for active/download image slots.
A bit more context... My target MCU is STM32F756ZGTx, here is its FLASH memory map:

JakubStandarski_0-1694618438213.png
What we want to do is: assign sector 4 (128 kB) and sector 5 (256 kB) as a download image slot; assign sector 6 (256 kB) and half of sector 7 (1/2 * 256 kB = 128 kB) as an active image slot.
My question is: can we do that?

As far as I understand, SWAP and active/download slots should be aligned with FLASH sectors, so the answer would be "NO", but maybe I'm wrong.

Thank in advance!

6 REPLIES 6
TDK
Guru

What's going in the other half of sector 7? If nothing, then maybe it could work out.

When the firmware needs to update, it will erase the entire sector and you'll lose whatever is on the other half of it, since you can't erase only half of it.

If you feel a post has answered your question, please click "Accept as Solution".

Rest of that sector would stay empty/unused.

Jakub Standarski
Associate III

Looks like we can use only half of FLASH sector for active/download image slot to match sizes of them. At leas SBSFU doesn't complain about such configuration.

That closes the topic.

Sector 4 + 5 are used for download, I don't divide them i.e., download slot starts with sector 4 and end ups with sector 5. On the other hand, active image slot uses whole sector 6 and 1/2 of sector 7.
To my surprise this works fine. Now I have other problem with the SWAP area which is placed under sector 3. In short I am unable to either download new image to empty slot (i.e., only SBSFU is installed and I'm trying to upload UserApp) or swap image stored in download with active one (assuming that SBFU is installed with UserApp at once at the very beginning).

Jakub Standarski
Associate III

Small update on that topic. Looks like dividing Flash sector (i.e. using only half of it) doesn't work as I thought.
SBSFU starts up completely fine, but when it comes to swapping the image, which includes erasing FLASH sectors, it breaks during FLASH erasure. My suspicion comes to the fact, that FLASH sectors must be erased "fully" as a whole i.e., if FLASH sector is of 256 kB size, one cannot just erase half of it.

I can be completely wrong, so if anyone has better knowledge please let me know.

PS. When I've switched to full sectors instead of full sector + 1/2 of another one, it has started working fine or at least FLASH erasure part works fine. In other words, SBSFU erases FLASH for new download image successfully and then it downloads new image properly. Unfortunately it still breaks on swapping procedure. That might be related with the fact, that we put SWAP area where normally SBSFU resides (MPU protection is turned off if anybody wants to ask).

Jakub Standarski
Associate III

I would suggest checking VoltageRange, that's something which can affect at least SWAP procedure. You can find that setting inside SFU_LL_FLASH_INT_Erase_Size() function.
But the best way to update it, is to search of every occurrence of VoltageRange and then set up it to the same level everywhere.