-
Hi, I am following the document below to build and flash the However, I encountered an error when running Error Output:(.venv) kurodash@ubuntu:~/zephyrproject/zephyr$ west flash
-- west flash: rebuilding
[0/15] Performing build step for 'tfm'
ninja: no work to do.
[2/3] Performing install step for 'tfm'
-- Install configuration: "MinSizeRel"
----- Installing platform NS -----
[3/3] Completed 'tfm'
-- west flash: using runner stm32cubeprogrammer
-------------------------------------------------------------------
STM32CubeProgrammer v2.18.0
-------------------------------------------------------------------
ST-LINK SN : 00380025313751XXXXXXXXXX
ST-LINK FW : V3J15M7
Board : STM32L562E-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
Opening and parsing file: tfm_merged.hex
Memory Programming ...
File : tfm_merged.hex
Size : 177.99 KB
Address : 0x0C000000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 22]
Erasing memory corresponding to segment 1:
Erasing internal memory sector 31
Erasing memory corresponding to segment 2:
Erasing internal memory sectors [50 107]
Erasing memory corresponding to segment 3:
Erasing internal memory sectors [169 179]
Download in Progress:
Error: flash loader cannot be loaded.
Error: failed to download Segment[0]
Error: failed to download the File
FATAL ERROR: command exited with status 1: /home/kurodash/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI --connect 'port=swd reset=HWrst' --download /home/kurodash/zephyrproject/zephyr/build/zephyr/tfm_merged.hex --start Commands Used:west build -b stm32l562e_dk/stm32l562xx/ns samples/tfm_integration/tfm_ipc/
./build/tfm/api_ns/regression.sh
west flash Running the following command manually works fine, but STM32_Programmer_CLI --connect port=swd reset=HWrst --erase all Environment Details:
VERSION_MAJOR = 4
VERSION_MINOR = 0
PATCHLEVEL = 99
VERSION_TWEAK = 0
EXTRAVERSION =
Additional Notes:
=== Traceback (enabled by -vvv):
Traceback (most recent call last):
File "/home/kurodash/zephyrproject/.venv/lib/python3.12/site-packages/west/app/main.py", line 561, in run_command
self.run_extension(args.command, argv)
File "/home/kurodash/zephyrproject/.venv/lib/python3.12/site-packages/west/app/main.py", line 716, in run_extension
self.cmd.run(args, unknown, self.topdir, manifest=self.manifest,
File "/home/kurodash/zephyrproject/.venv/lib/python3.12/site-packages/west/commands.py", line 194, in run
self.do_run(args, unknown)
File "/home/kurodash/zephyrproject/zephyr/scripts/west_commands/flash.py", line 33, in do_run
do_run_common(self, my_args, runner_args, domain_file=domains_file)
File "/home/kurodash/zephyrproject/zephyr/scripts/west_commands/run_common.py", line 331, in do_run_common
prev_runner = do_run_common_image(command, user_args, user_runner_args, used_cmds,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kurodash/zephyrproject/zephyr/scripts/west_commands/run_common.py", line 506, in do_run_common_image
runner.run(command_name)
File "/home/kurodash/zephyrproject/zephyr/scripts/west_commands/runners/core.py", line 720, in run
self.do_run(command, **kwargs)
File "/home/kurodash/zephyrproject/zephyr/scripts/west_commands/runners/stm32cubeprogrammer.py", line 247, in do_run
self.flash(**kwargs)
File "/home/kurodash/zephyrproject/zephyr/scripts/west_commands/runners/stm32cubeprogrammer.py", line 301, in flash
self.check_call(cmd + flash_and_run_args)
File "/home/kurodash/zephyrproject/zephyr/scripts/west_commands/runners/core.py", line 864, in check_call
subprocess.check_call(cmd, **kwargs)
File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/kurodash/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI', '--connect', 'port=swd reset=HWrst', '--download', '/home/kurodash/zephyrproject/zephyr/build/zephyr/tfm_merged.hex', '--start']' returned non-zero exit status 1.
(.venv) kurodash@ubuntu:~/zephyrproject/zephyr$ ./build/tfm/api_ns/regression.sh
regression script started
Regression to RDP 0 and tzen=1
-------------------------------------------------------------------
STM32CubeProgrammer v2.18.0
-------------------------------------------------------------------
ST-LINK SN : 00380025313751XXXXXXXXXX
ST-LINK FW : V3J15M7
Board : STM32L562E-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: rdp, value: 0xAA, was not modified.
Warning: Option Byte: tzen, value: 0x1, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
Time elapsed during option Bytes configuration: 00:00:00.003
Remove bank1 protection and erase all
-------------------------------------------------------------------
STM32CubeProgrammer v2.18.0
-------------------------------------------------------------------
ST-LINK SN : 00380025313751XXXXXXXXXX
ST-LINK FW : V3J15M7
Board : STM32L562E-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: wrp1a_pend, value: 0x0, was not modified.
Warning: Option Byte: wrp1a_pstrt, value: 0x7F, was not modified.
Warning: Option Byte: wrp1b_pend, value: 0x0, was not modified.
Warning: Option Byte: wrp1b_pstrt, value: 0x7F, was not modified.
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
Reconnecting...
Reconnected !
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
OPTION BYTE PROGRAMMING VERIFICATION:
Option Bytes successfully programmed
Time elapsed during option Bytes configuration: 00:00:02.153
Mass erase ...
Mass erase successfully achieved
Remove bank2 protection and erase all
-------------------------------------------------------------------
STM32CubeProgrammer v2.18.0
-------------------------------------------------------------------
ST-LINK SN : 00380025313751XXXXXXXXXX
ST-LINK FW : V3J15M7
Board : STM32L562E-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: wrp2a_pend, value: 0x0, was not modified.
Warning: Option Byte: wrp2a_pstrt, value: 0x7F, was not modified.
Warning: Option Byte: wrp2b_pend, value: 0x0, was not modified.
Warning: Option Byte: wrp2b_pstrt, value: 0x7F, was not modified.
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
Reconnecting...
Reconnected !
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
OPTION BYTE PROGRAMMING VERIFICATION:
Option Bytes successfully programmed
Time elapsed during option Bytes configuration: 00:00:02.154
Mass erase ...
Mass erase successfully achieved
Remove hdp protection
-------------------------------------------------------------------
STM32CubeProgrammer v2.18.0
-------------------------------------------------------------------
ST-LINK SN : 00380025313751XXXXXXXXXX
ST-LINK FW : V3J15M7
Board : STM32L562E-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Hot Plug
Reset mode : Software reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: hdp1_pend, value: 0x0, was not modified.
Warning: Option Byte: hdp1en, value: 0x0, was not modified.
Warning: Option Byte: hdp2_pend, value: 0x0, was not modified.
Warning: Option Byte: hdp2en, value: 0x0, was not modified.
Warning: Option Bytes are unchanged, Data won't be downloaded
Time elapsed during option Bytes configuration: 00:00:00.003
Set default OB 1 (dual bank, swap bank, sram2 reset, secure entry point, bank 1 full secure)
-------------------------------------------------------------------
STM32CubeProgrammer v2.18.0
-------------------------------------------------------------------
ST-LINK SN : 00380025313751XXXXXXXXXX
ST-LINK FW : V3J15M7
Board : STM32L562E-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Hot Plug
Reset mode : Software reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: dbank, value: 0x1, was not modified.
Warning: Option Byte: secbootadd0, value: 0x180030, was not modified.
Warning: Option Byte: sram2_rst, value: 0x0, was not modified.
Warning: Option Byte: swap_bank, value: 0x0, was not modified.
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
Reconnecting...
Reconnected !
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
OPTION BYTE PROGRAMMING VERIFICATION:
Option Bytes successfully programmed
Time elapsed during option Bytes configuration: 00:00:02.153
Set default OB 2 (bank 2 full secure)
-------------------------------------------------------------------
STM32CubeProgrammer v2.18.0
-------------------------------------------------------------------
ST-LINK SN : 00380025313751XXXXXXXXXX
ST-LINK FW : V3J15M7
Board : STM32L562E-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Hot Plug
Reset mode : Software reset
Device ID : 0x472
Revision ID : Rev Z
Device name : STM32L5xx
Flash size : 512 KBytes (default)
Device type : MCU
Device CPU : Cortex-M33
BL Version : --
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
PROGRAMMING OPTION BYTES AREA ...
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
Reconnecting...
Reconnected !
UPLOADING OPTION BYTES DATA ...
Bank : 0x00
Address : 0x50022040
Size : 40 Bytes
[==================================================] 100%
Bank : 0x01
Address : 0x50022060
Size : 16 Bytes
[==================================================] 100%
OPTION BYTE PROGRAMMING VERIFICATION:
Option Bytes successfully programmed
Time elapsed during option Bytes configuration: 00:00:02.154
regression script Done Any insights on resolving this issue would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
After downgrading STM32CubeProgrammer to v2.17.0, the writing process completed without errors, and the TF-M sample was able to start. It seems that STM32CubeProgrammer v2.18.0 has some issues.
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@kurodash Would you be able to test on v2.19.0 before I raise a bug on STM32CubeProgrammer tool internally ? |
Beta Was this translation helpful? Give feedback.
-
@erwango I have checked the behavior of STM32CubeProgrammer with v2.19.0, as well as the newly released v2.20.0 and a few other versions. Here is a summary of the results:
It seems that the issue only occurs with v2.18.0. |
Beta Was this translation helpful? Give feedback.
@erwango I have checked the behavior of STM32CubeProgrammer with v2.19.0, as well as the newly released v2.20.0 and a few other versions. Here is a summary of the results:
It seems that the issue only occurs with v2.18.0.