Showing results for 
Search instead for 
Did you mean: 

How to download ELF file to a STM32L4R9 board that I could program a few weeks ago but can't now - it didn't just stop working, it got worse.


Programming my board worked fine for a long time, but then it started to fail with the error messages shown below but I could get it working again by closing the IDE (STM32CubeIDE) and unplugging the ST-Link/V2 then plug in and restart the IDE - but now I can't get it to program even once - so it was not a sudden failure, it was a gradual deterioration.

The IDE was updated at least once and the project was migrated before the failures started (I think).

I have tried installing the IDE on a virtual machine then recreating the project - didn't work.

Tried installing the IDE on another machine that had never had any ST stuff installed on it - didn't work.

Tried creating a new, small project - didn't work.

Interesting that installing the IDE on another machine doesn't reset the problem - I would have expected a new installation to not have the problem and that the problem might reappear as it did originally, but it doesn't - the problem is at the same stage of deterioration as it was in the original installation.

There is a second issue that may be linked - even if I get the program to download it hits an uninitialized pointer-to-function in the code generated by the IDE.

Here's the output that I get.

STMicroelectronics ST-LINK GDB server. Version 5.8.0

Copyright (c) 2020, STMicroelectronics. All rights reserved.

Starting server with the following options:

    Persistent Mode      : Disabled

    Logging Level       : 1

    Listen Port Number     : 61234

    Status Refresh Delay    : 15s

    Verbose Mode        : Disabled

    SWD Debug         : Enabled

    InitWhile         : Enabled

Waiting for debugger connection...

Debugger connected


            STM32CubeProgrammer v2.7.0-RC1          


ST-LINK SN : 54FF6A066684565521351687


Board    : --

Voltage   : 2.70V

SWD freq  : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x470

Revision ID : Rev Y

Device name : STM32L4Rxxx/STM32L4Sxxx

Flash size : 63 KBytes (default)

Device type : MCU

Device CPU : Cortex-M4

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_a05820.srec

 File     : ST-LINK_GDB_server_a05820.srec

 Size     : 84064 Bytes

 Address    : 0x08000000 

Erasing memory corresponding to segment 0:

Erasing external memory sectors [0 20]

File segment @0x08000000 is not 255-bytes aligned. It will be aligned to @0x07FFFFF8

Download in Progress:

Error: failed to download Segment[0]

Error: failed to download the File

Encountered Error when opening C:\ST\STM32CubeIDE_1.5.0\STM32CubeIDE\plugins\\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer

Debugger connection lost.

Shutting down...

ST Employee

Hi @IHodg.1​ ,

In order to try identifying problem root cause, could you please answer the following:

  • Is the same issue faced with only one board? If yes try to check if same issue is faced with another board.
  • is the issue faced with an empty project generated by STM32CubeIDE that you download on your board?

Also, please make sure that you don't have one of the conditions that prevent your board from working properly (see Why my STM32 doesn't start?).


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.

ST Employee

Hi @IHodg.1​ ,

If your initially described issue is already fixed, it will be interesting to keep us informed what you did exactly to resolve it.



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.

Associate III

I'm getting this error, too. Were you able to solve it?