2021-11-02 03:06 AM
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"
2021-11-02 03:24 AM
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.
2021-11-02 04:20 AM
Thanks! So basically if I am not using anti-rollback, I can always leave the value to, say, "1"?
2021-12-06 05:42 AM
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)