cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to switch between slots(active slot) in SBSFU example

Kpate.3
Associate

I converted code from one of the example from sbsfu for stwinkt1 board.This converted example is for 2 image and working fine on serial port.

As far as i get for 2 image example configuration will like,

SBSFU s;ot+1 active slot + 1 DWL slot + swap area.

When i download new firmware,Encrypted image is downloaded in DWL slot and on next reset it decrypted and swapped with active slot image so after installing new firmware result will be like,

before swapping,

Active slot-image(decrypted) 1.0.0

DWL slot  -image(encrypted) 1.0.1

after swapping,

Active slot-image(decrypted) 1.0.1

DWL slot  -image(decrypted) 1.0.0

is this understanding correct?

can i roll back to older version once new one is installed(like from 1.0.1 to 1.0.0)? 

can i choose any slot as active firmware image?

Second question is ,In stm32 based project is partial firmware update is possible. 

I mean if we consider stm32 based project than most of the time once controller is finalized than hal layer and lower layer will hardly changed and most of the change will be in application layer. 

So is there any example available for ,How to make project compatible for partial update with sbsfu?

1 REPLY 1
Jocelyn RICARD
ST Employee

Hello,

yes, your understanding is correct. The old firmware is not re-encrypted.

There is a rollback mechanism you can activate through the compilation flag "ENABLE_IMAGE_STATE_HANDLING"

The principle is that after swap, new image is launched. New image performs self test and calls the function SE_APP_ValidateFw if everything is ok.

SBSFU will then make this new firmware definitive and no more rollback is possible.

If the self test fails, application should just reset the chip.

SBSFU will see that application was not validated, and will perform a rollback.

Partial firmware is possible, it is supported by SBSFU.

Now, to be efficient you need to split your code in different sections so that only one section will be updated.

The partial update can only update one contiguous range of address.

I don't have any example for performing this split.

Now, you can test the partial update just changing few bytes in your binary.

The SBSFU will perform a binary diff and generate adequate update file.

To activate this you can see how this is done in the postbuild script.

You need to copy the original binary as RefUserApp.bin in the output directory that is "Binary" in user app.

Best regards

Jocelyn