Skip to main content
sute
Associate III
May 24, 2023
Solved

SBSFU with two active and two download slots

  • May 24, 2023
  • 16 replies
  • 5026 views

Hi,

I have an application using STM32H7B3, SBSFU and TouchGFX. We are running out of flash space so we want to place TouchGFX images to external flash. I understand that to achieve this, we need two SBSFU active and download slots. The first active slot and download slot are for application code, and they need to be placed in the internal flash with read protection. Images don't need read protection, so the second active slot and download slot can be used for them in the external flash.

I am wondering can this be achieved with SBSFU and are there any examples? There is the 2_Images_ExtFlash example for B-L475E-IOT01A, but it has both download slots placed in the external flash which we cannot do since the active firmware slot would be swapped there and it has no read protection. Although, I am a bit confused since the example has no SWAP area so how does it even work?

Thanks!

This topic has been closed for replies.
Best answer by Jocelyn RICARD

Hello @MS.12utela​ 

you should be able to have this working rapidly.

You first need to update the external flash driver in SBSFU (sfu_low_level_flash_ext.c )and possibly in your application if it in charge of downloading the update.

You need to create the slots in the mapping file in linker_common (mapping_fwimg.ld if you use STM32CubeIDE)

You will need to put the headers of the 2 active slots just after the SBSFU so they can be protected.

About the swap area, it depends on the swap configuration.

You can disable the swap by defining SFU_NO_SWAP

In that case, no swap area is needed and update is done by simply erasing old firmware by new one.

Best regards

Jocelyn

16 replies

Jocelyn RICARD
Jocelyn RICARDBest answer
ST Employee
May 24, 2023

Hello @MS.12utela​ 

you should be able to have this working rapidly.

You first need to update the external flash driver in SBSFU (sfu_low_level_flash_ext.c )and possibly in your application if it in charge of downloading the update.

You need to create the slots in the mapping file in linker_common (mapping_fwimg.ld if you use STM32CubeIDE)

You will need to put the headers of the 2 active slots just after the SBSFU so they can be protected.

About the swap area, it depends on the swap configuration.

You can disable the swap by defining SFU_NO_SWAP

In that case, no swap area is needed and update is done by simply erasing old firmware by new one.

Best regards

Jocelyn

sute
suteAuthor
Associate III
May 25, 2023

Thank you!

Fred
ST Employee
May 30, 2023

Hi,

be careful that the idea is also that the slots stored in external FLASH are encrypted:


_legacyfs_online_stmicro_images_0693W00000bl7YbQAI.png 

Fred
ST Employee
May 30, 2023

Which gives when running your application:


_legacyfs_online_stmicro_images_0693W00000bl7Z0QAI.png

sute
suteAuthor
Associate III
May 30, 2023

Hi,

Thanks for the reply. This is interesting and I think I may have misunderstood something then, as I remember reading that the external flash is not encrypted (can't remember where though). If this is the case then what if I have one active slot in the internal flash for which there is a corresponding download slot in the external flash. Is the data in the external flash always encrypted?

Fred
ST Employee
May 30, 2023
Fred
ST Employee
June 1, 2023

Another possibility to consider if you really want to optimize the FLASH usage: do you really need the backup feature?

If this is not needed, then let's skip the backup and then you are on the safe side I guess.

You download the encrypted image in EXTERNAL flash.

You decrypt and install it in the active slot in INTERNAL flash.

We do not have any example demonstrating it, but probably you can give a try with SFU_NO_SWAP as a starting point?

As stated by Jocelyn, it would just replace the content of the active slot by the (decrypted) content of the download slot.

In this case, you do not need OTFDEC at all.

So, as you can see, you have several options depending on your exact needs and priorities.

sute
suteAuthor
Associate III
June 5, 2023

Yes, backup is needed. Thanks anyway, we now have plenty of information to go forward!