Showing results for 
Search instead for 
Did you mean: 

programming flash bank 2 sometimes fails with cli


I am using STM32CubeProgrammer (2.14.0) on Linux/Ubuntu 22.04 with NUCLEO-H563ZI.

I do not observe any problem when I use the GUI application but I would like to use the CLI.

I do not observe any issue when I write/download a program (elf or bin) to bank 1 (no bank swap) at 0x08000000 (or 0x0C000000). When I write to 0x08100000, I usually experience a problem, like this:

Opening and parsing file: firmware.elf
File : firmware.elf
Size : 4.28 KB
Address : 0x08100000

Erasing memory corresponding to segment 0:
Erasing internal memory sector 128
Download in Progress:

Error: failed to download Segment[0]
Error: failed to download the File

I realized if a mass erase (-e all) first, then the problem does not happen, and not happen in subsequent tries. But if I write to bank 1 once, then it fails again. Is there something special writing to bank 1 vs. bank 2 ? What could be the reason ? The device has trust zone enabled but product state is open.

ST Employee

Hello @mete , 

1- modify the start address to 0x08100000 in the linker file and generate a binary file .
2- change the NSBOOTADD to 0x08100000 in STM32Cubeprogrammer.
3- Set the start address to 0x08100000 when start programming.

Hope It helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

It is a trustzone project so I have two binaries for both banks. I think the issue is somehow unrelated to stlink but related to my linker script but not 100% sure yet.