Skip to main content
sute
Associate III
November 2, 2021
Question

Meaning of "version" flag in prepareimage

  • November 2, 2021
  • 1 reply
  • 1010 views

Hello,

I am trying to get familiar with X-CUBE-SBSFU. I am currently confused about the meaning of "-v, --version" flag for "prepareimage.py header" and "prepareimage.py pack" commands, e.g. from readme:

python prepareimage.py pack -k OEM_KEY_COMPANY1_key.bin -r 28 -p 1 -v 2 -n nonce.bin -f UserApp.sfu -t UserApp.sign UserApp.sfb

What is the version 2 supposed to signify in the snippet above and what effect does it have? Version of what? It only accepts integer values so it cannot have a version value of, e.g., "1.2.0"

This topic has been closed for replies.

1 reply

Arno1
Senior
November 2, 2021

Hello MSute,

The version is a 16 bit number that's embedded in the header of the SFU/SFB file (bytes 6 and 7, see se_def_metadata.h). It is a number you can increment when making a new update file.

It is used in the SBSFU code for the anti-rollback for example or you can set a minimum version of the firmware which the FwVersion is compared to.

sute
suteAuthor
Associate III
November 2, 2021

Thanks! So basically if I am not using anti-rollback, I can always leave the value to, say, "1"?

jrgert
Associate III
December 6, 2021

Yes. Or, you can keep version 1 as the factory image and change version for field release and never increment it again.

Search for SFU_FW_VERSION_START_NUM and you'll see how it's used.

Look at SE_FwRawHeaderTypeDef and its Reserved member. You can use it for whatever you want, i.e. Version info (v1.2.0)