Skip to main content
Associate
July 29, 2024
Solved

Unable to flash with STM32CubeProgrammer

  • July 29, 2024
  • 13 replies
  • 12364 views

Hi,

I just installed STM32CubeProgrammer v2.17.0 on Linux.

When I connect to the board (tried with several different ones), I get the following error;

flash loader cannot be loaded. FlashLoaderPath = /home/[yadayada]/bin/FlashLoader/0x

I can read the flash, I can do everything, with the exception of flashing. This fails.

I first thought it might be a truncated log message. But when I just copied any of the loader files and gave it the file name "0x", I didn't get the error message. So it really looks for a file named "0x". It looks like in the code, the assembly of the file name (all the files match the pattern 0x*.stldr)

 

I tried to do an software update, but this also fails: "The updater package on server is corrupted"

 

 

Best answer by Kouthair

Hello everyone,

This issue has been fixed in STM32CubeProgrammer v2.22. You can download it via this link.

13 replies

AScha.3
Super User
July 29, 2024

Hi,

I have IDE and Cube Programmer on Linux since years, no such problem.

So maybe you do something wrong or the package was damaged ( but very rare ).

So show, what Cube Programmer showing...

Or try full chip erase - if something crazy is there. Check option bytes for protection on some flash areas, set on unprotected then.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
July 29, 2024

Thanks for the respone! I tried full erase. Also fails, with an error stating I should check write protection flags. But when I try to unset them, I again get an error. I just installed the program and started it. With and without sudo, no change. But what I do not have yet is the IDE. Maybe this sets an environment variable which is used by the programmer... Will try later today. I mean - what could I do wrong which results in the tool trying to open a flashLoader file named "0x"? It definetly is an error of the assembly of the file name (filename = "0x" + something + ".stldr")

Of course it is probably something with my configuration as it works for you. Maybe the missing IDE, even though it shouldn't.

 

Or do I miss something? Do I have to explicitely configure the FlashFile somewhere?

AScha.3
Super User
July 29, 2024

If you dont have IDE - how you make the program ?

For flash you just need a bin or HEX file, for the cpu you have. No mods needed,.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
July 29, 2024

I am about to install the IDE. I just started with the programmer to check if I can talk to an eval board. That's why I wonder. My tool chain is not even yet installed, and to my understanding the programmer should be standalone. So no real room for me to do things wrong. My best suggestion is some env var provided by the ide, so it works for all who have the IDE installed, which I would consider a bug (production site for example needs a programmer but no IDE. I will try later today

Associate
July 29, 2024

Hm, very strange. I installed the IDE, and using it, I can debug my code on the device. Also, after power-cycling the device, I can connect to Cube Programmer, and I see my code. So the IDE can flash without a problem. Just the standalone programmer can't. You sure can also flash your devices with the programmer standalone tool, right? I tried uninstalling, reinstalling - no luck. But at least at the moment I don't really need it as I can flash using the IDE. But it's strange....

Associate
July 30, 2024

I have no idea why, but upgrading to Ubuntu 24.04 (from 22.04) resolved the issue.

Jyrki Koivisto
Explorer
August 20, 2024

I have similar problem. These started after I updated STM32CubeProgrammer to v2.17.0.

All works fine if a have that correct flash loader renamed to "0x", MCU flashes and it boots and the code in it works.

 

Here's the log with that "0x" file present

21:34:16:721 : UR connection mode is defined with the HWrst reset mode
21:34:16:760 : ST-LINK SN : 13001200042D363637365744
21:34:16:760 : ST-LINK FW : V2J37S7
21:34:16:760 : Board : --
21:34:16:761 : Voltage : 3.23V
21:34:16:761 : SWD freq : 4000 KHz
21:34:16:761 : Connect mode: Under Reset
21:34:16:761 : Reset mode : Hardware reset
21:34:16:761 : Device ID : 0x431
21:34:16:761 : Revision ID : Rev A
21:34:16:762 : Database: Config 0 is active.
21:34:16:762 : flash loader /home/jyko/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/FlashLoader/0x is loaded <--- Had loader for my MCU (f411) named to "0x" without any extension
21:34:16:762 : Debug in Low Power mode is not supported for this device.
21:34:16:922 : UPLOADING OPTION BYTES DATA ...
21:34:16:922 : Bank : 0x00
21:34:16:922 : Address : 0x40023c14
21:34:16:922 : Size : 8 Bytes
21:34:16:922 : UPLOADING OPTION BYTES DATA ...
21:34:16:923 : Bank : 0x00
21:34:16:923 : Address : 0x40023c14
21:34:16:923 : Size : 8 Bytes
21:34:16:923 : UPLOADING ...
21:34:16:923 : Size : 1024 Bytes
21:34:16:923 : Address : 0x8000000
21:34:16:923 : Read progress:
21:34:16:923 : Data read successfully
21:34:16:923 : Time elapsed during the read operation is: 00:00:00.008
21:34:38:205 : Memory Programming ...
21:34:38:205 : Opening and parsing file: Blackpill_f411.elf
21:34:38:206 : File : Blackpill_f411.elf
21:34:38:206 : Size : 18.78 KB
21:34:38:206 : Address : 0x08000000
21:34:38:206 : Erasing memory corresponding to segment 0:
21:34:38:206 : Memory Erase via FlashLoader!
21:34:38:206 : Memory erase...
21:34:38:206 : halt ap 0
21:34:38:238 : Erasing internal memory sectors [0 1]
21:34:38:238 : Init flashloader...
21:34:38:238 : halt ap 0
21:34:38:241 : run ap 0
21:34:38:242 : halt ap 0
21:34:38:242 : Loader sector erase...
21:34:38:249 : run ap 0
21:34:38:628 : halt ap 0
21:34:38:629 : Download in Progress:
21:34:38:629 : Size : 19232 Bytes
21:34:38:629 : Address : 0x08000000
21:34:38:629 : halt ap 0
21:34:38:649 : Loader write range...
21:34:38:708 : Init flashloader...
21:34:38:709 : halt ap 0
21:34:38:716 : run ap 0
21:34:38:717 : halt ap 0
21:34:38:728 : run ap 0
21:34:38:809 : run ap 0
21:34:38:886 : Segment[0] downloaded successfully
21:34:38:887 : File download complete
21:34:38:900 : Time elapsed during download operation: 00:00:00.682
21:34:43:348 : Disconnected
21:34:43:348 : Disconnected from device.

AMacd.1
Senior
February 7, 2025

How did you identify which of the loader files in STM32CubeProgrammer/bin/FlashLoader was the right one to rename?  I'm trying to flash an stm32f3discovery (stm32f303vc) but I can't figure out which of the files to rename.  I can find files that are named close such as

0x32.stldr

but I couldn't find a file name that suggests it is appropriate for the target.

It would be nice if ST would fix this bug.  It looks like the search path name is truncated.

In the mean time, I will continue to use tools that actually work (st-flash, openocd, gdb-multiarch etc).

 

Jyrki Koivisto
Explorer
February 12, 2025

That external flash loader file is just some thumb code that runs inside the micro and programs the EXTERNAL flash if even present. Internal flash is programmed differently.

 

Look at the Device ID in the bottom right corner under the st-link configuration. I believe that should be the name of the correct external flash programmer.

 

If you don't need to flash any external memory then it should not matter what you name "0x"

Aziz BRIGUI
Technical Moderator
February 10, 2025

Hello @AMacd.1 ,

Try using CubeProgrammer v2.18, the issue might be resolved. If not please specify the exact steps to reproduce. Since on my side I have tried reproducing this issue many times but failed.

Aziz

In order 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.
AMacd.1
Senior
February 10, 2025

You did not actually answer my question.

Nevertheless, here is the information you requested:

I am using v2.18 - the issue is not fixed.  My OS: Ubuntu 22.04LTS.  Steps:

1. Install cube from ST.COM (en.stm32cubeprg-lin-v2-18-0.zip):

  Note: installation directory is not the home directory.  It is installed in

    /home/username/Data/STMicroelectronics/STM32Cube

  where

    /home/username/Data is a simlink to /media/username/Data

2. Run cube application

3. Plug in stm32f3discovery

4. Press refresh button in ST-LINK Configuration sidebar

5. Observe device serial number.

6. Click "Connect"

Error happens:

5:01:45 : Error: flash loader cannot be loaded. FlashLoaderPath = /media/username/Data/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/FlashLoader/0x

Notice that path is truncated.  The workaround that appears in other postings in this thread and on another site (https://stackoverflow.com/questions/78850472/stm32cubeprogrammer-flash-loader-cannot-be-loaded) seem to be aware of this path truncation.

That's all I am going to contribute to this thread at this time.

Explorer
February 17, 2025

Note that the Workaround for renaming the Loader file to just 0x requires the correct loader for the MCU be used.

I found this today when I switched project and needed to erase the Read Protection Bytes. Errors out with the wrong loader. Works only with the correct loader. I would assume other program operations would be the same.

MRech.1
Associate II
October 14, 2025

Same issue with both 2.18 and 2.20 on Linux. What is strange is that 2.18 used to work on my box (Arch). I assume that some recent system update broke something.

Aziz BRIGUI
Technical Moderator
October 14, 2025
In order 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.
Explorer
October 31, 2025

I have tried removing the file and it does not work. The only way to get this to work is to rename the correct loader file to 0x.

I am on an Arch based linux distribution. 

Associate II
December 4, 2025

V2.21 still has this problem. 

Workaround: using symlink.

Is there any progress regarding this issue???

ST Employee
December 22, 2025

Hello everyone,

We are currently investigating this error (internal ticket number: 224132) as it has been reported in the following threads:
Ubuntu 25.10 - STM32CubeProgrammer : Flash Loader ... - STMicroelectronics Community
FlashLoader not set correctly - STMicroelectronics Community

For now, you can create a copy of the corresponding file from "0x<your_device_id>.stldr" and rename it to "0x" in the "STM32Cube\STM32CubeProgrammer\bin\FlashLoader" and try reconnecting again.

PS: Ticket number: 224132 is an internal tracking number and is not accessible or usable by customers.


Kouthair

In order 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.
debugging
Lead
January 8, 2026

I have exactly the same issue with STV3MOD.  Ubuntu 25.10. 

Actually, I wrote code I against the  STV3MOD libraries and it works fine, for example for using the CAN interface. 

But when using SWD I get this same error.  Tried v 2.16, 2.18, 2.20 and 2.21. I Also need to start the programmer with sudo otherwise it does not detect the STV3MOD.

Using the programmer usingh USB with the same target device (STM32F072) with STprogrammer works fine.

Copying the file  $ cp 0x448.stldr 0x.stldr did not fix it

I went back to an older copy I had installed  2.14 and everything works fine with STV3MOD. So 2.14 seems the better version to use when using STLINK.

debugging_0-1767855619964.png

debugging_1-1767855707072.png

 

 

 

 

 

ST Employee
January 12, 2026

Hello @debugging ,

Use this instead as this workaround requires the file to be named " 0x " without any file extension.

cp 0x448.stldr 0x

We will keep you updated as soon as this issue is resolved.
Kouthair.

In order 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.