Hi Tomasz,

from what I can understand from the below I think you're running the scripts from the wrong directory (i.e. /c/Temp/tf-m/trusted-firmware-m/platform/ext/target/stm/common/scripts) while instead they should be run from the `api_ns` directory inside the secure build directory. Regarding the syntax errors below I am not really sure, they probably look like a genuine issue but as this is all specific to STM32, somebody from ST should comment.

Thanks,
Antonio


From: Tomasz Jastrzębski via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Wednesday, January 24, 2024 23:53
To: tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>
Subject: [TF-M] STM32 target provisioning difficulties
 

After successful compilation I tried to provision B-U585I-IOT02A board following the steps described here: STM32U5 provisioning.

Process did not succeed due to the errors described below.

What am I missing?

 

postbuild.sh results in:

Thomas@AMDMINIATX MINGW64 /c/Temp/tf-m/trusted-firmware-m/platform/ext/target/stm/common/scripts (main)

$ ./postbuild.sh

./postbuild.sh: line 22: /c/Temp/tf-m/trusted-firmware-m/platform/ext/target/stm/common/scripts/preprocess.sh: No such file or directory

preprocess bl2 file

./postbuild.sh: line 36: preprocess: command not found

C:\Python312\python.exe: can't open file 'C:\\Temp\\tf-m\\trusted-firmware-m\\platform\\ext\\target\\stm\\common\\scripts\\scripts\\stm_tool.py': [Errno 2] No such file or directory

postbuild.sh failed

 

There are 3 versions of preprocess.sh script, it is compiler specific.

 

TFM_UPDATE.sh has some syntax errors which reveal themselves under GitBash

Thomas@AMDMINIATX MINGW64 /c/Temp/tf-m/trusted-firmware-m/platform/ext/target/stm/common/scripts (main)

$ ./TFM_UPDATE.sh

TFM UPDATE started

./TFM_UPDATE.sh: line 52: [: ==: unary operator expected

./TFM_UPDATE.sh: line 56: [: ==: unary operator expected

./TFM_UPDATE.sh: line 59: [: ==: unary operator expected

 

These are easy to fix.
Eg. if [ $encrypted == "0x1" ]; then
-> if [ "$encrypted" == "0x1" ]; then

 

It looks postbuild.sh and TFM_UPDATE.sh take two additional parameters which are not documented.

regression.sh takes one undocumented parameter.