Skip to main content
Efty
Visitor II
May 28, 2023 9:11 PM UTC
Question

How to solve Error Finishing Flash Operation in STM32CubeIDE?

Recurring Error Message in STM32CubeIDE When Running or Debugging a Project. It shows-

'Launching pain Debug' Has encountered a problem.

Error in final launch sequence:

Failed to execute MI command: load

C:\\Users\\USER\\STM32CubelDE\\workspace_1.12.1\\pain\\ Debug\\pain.elf

Error message from debugger back end:

Error finishing flash operation.

and also it showing

"Error in final launch sequence:

Failed to execute MI command:

load C:\\Users\\USER\\STM32CubeIDE\\workspace_1.12.1\\try\\Debug\\try.elf 

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load C:\\Users\\USER\\STM32CubeIDE\\workspace_1.12.1\\try\\Debug\\try.elf 

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load C:\\Users\\USER\\STM32CubeIDE\\workspace_1.12.1\\try\\Debug\\try.elf 

Error message from debugger back end:

Error finishing flash operation

Error finishing flash operation"

How to solve this problem? We are using STM32 NUCLEO-F446RE Board

This topic has been closed for replies.

18 replies

Semer CHERNI
ST Employee
May 29, 2023 10:20 AM UTC

Hello @Efty​ 

First let me thank you for posting.

Could you provide the entire debug log.

KR,

Semer.

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.
GLee.12
Visitor II
Jun 8, 2023 11:47 PM UTC

@Efty​ any luck on figuring this out? Since about a few months ago, I haven't been able to debug through STM32CubeIDE either. I've tried STLink v2 clones as well as the official STLink v3 that all used to be able to debug and flash through the IDE. They both work through the STM32CubeProgrammer to flash firmware files.

@Semer CHERNI​ If @Efty​ 's issue is like mine, that is the full debug log.
_legacyfs_online_stmicro_images_0693W00000dDRAAQA4.png

Visitor II
Sep 8, 2023 8:05 AM UTC

Hi, I've got the same issue. Here's the error log that appears in the failure message:

Error in final launch sequence:

Failed to execute MI command:
load C:\\TouchGFXProjects\\MyApplication\\STM32CubeIDE\\Debug\\STM32U5A9J-DK.elf

Error message from debugger back end:
Error finishing flash operation
Failed to execute MI command:
load C:\\TouchGFXProjects\\MyApplication\\STM32CubeIDE\\Debug\\STM32U5A9J-DK.elf

Error message from debugger back end:
Error finishing flash operation
Failed to execute MI command:
load C:\\TouchGFXProjects\\MyApplication\\STM32CubeIDE\\Debug\\STM32U5A9J-DK.elf

Error message from debugger back end:
Error finishing flash operation
Error finishing flash operation

Here are the messages from the console:

 

STMicroelectronics ST-LINK GDB server. Version 7.4.0

Copyright (c) 2023, 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

Waiting for debugger connection...

Debugger connected

Waiting for debugger connection...

-------------------------------------------------------------------

STM32CubeProgrammer v2.14.0

-------------------------------------------------------------------

 

Warning: The external loader file does not exist:

MX25LM51245G_STM32U599J-DK.stldr

Encountered Error when opening C:\ST\STM32CubeIDE_1.13.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.0.202305091550\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer

Shutting down...

Exit.

 

 

Explorer
Sep 10, 2023 7:09 PM UTC

I was trying to programmatically access the flash on an stm32f411re. I had similar problems when I tried to use the debugger. What fixed it for me was to go to

menu item Project : Properties : Run/Debug Settings.

Edit the launch configuration. Tab Debugger. Change the Reset type behaviour to None.

Explorer
Sep 30, 2023 8:37 AM UTC

Changing Reset type to None does not work for STM32U5A9J-DK.

Visitor II
Jan 5, 2024 2:19 AM UTC

Hello @Efty​ 

I've got the same issue, there is the anwser:

change rtconfig.h, adjust your board stack size. in addition, you can use rt-thread setting, adjust you main thread, system thread .., the stack is overflow or whatever, It works.

Associate
Jan 23, 2024 8:06 AM UTC

Hi @Spark_Mars 

Could you explain more about this solution? Where can I get rtconfig.h or adjust my board stack size. I can not find them (I'm new for STM, please helps me). Thank you so much

Visitor II
Mar 3, 2024 12:50 PM UTC

Hi everyone!

 

For those dealing with the same problem.. Have you checked your BOOT0 pin (jumper)?

I had the same issue on a custom hardware (my first PCB design with an STM32) using an STM32H503 in an LQFP64 package. Maybe I misread the datasheet for what to do with the BOOT0 pin, but I only soldered in the pullup resistor to VDD, thinking that should be enough. I had not placed the 2 pin header to connect it to ground yet. But after I soldered in the header and placed a jumper (pulling the BOOT0 pin to ground), the error no longer appeared and I was able to program, debug, trace through a program, and run it without a problem, using pretty much the default debugger config settings. Hope that helps!

Associate III
Mar 18, 2024 1:21 PM UTC

Erase flash memory  from cubeProgrammer and flash again my firmware from CubeIDE worked for me :thumbs_up:

Associate
Jun 5, 2024 3:40 AM UTC

I also encountered a similar issue like you, and I resolved it by connecting the NRST pin of the MCU with the NRST pin of the ST LINK V2.

Associate II
Oct 2, 2024 7:05 PM UTC

Same (similar) story (STM32IDE v1.15.1, NUCLEO-U5A5ZJ-Q e.g.: STM32U5A5ZJTQ, Cortex-M33).

Different solution:

just rebooted Windows ... :)

FranzCreva
Associate II
Oct 17, 2024 7:33 AM UTC

Hi Guys,

I had this same problem and I tried all your solution but none of all worked.
There is one problem about STM32CubeIDE and STM32CubeProgrammer.. they don't tell us if the flash memory is in Read Out Protection.

Solution:
I went on the Option Bytes and I found out that my STM32 had a Read Out Protection level 1, so I changed it to 0.
It worked!

I hope this may help someone

Daiyujiuhao
Associate
Oct 18, 2024 4:08 PM UTC

Can you show me where is the Option Bytes? How to do find it, and how to change it to 0? Please 

FranzCreva
Associate II
Oct 18, 2024 4:19 PM UTC

Hi @Daiyujiuhao ,

You have to open the "STM32CubeProgrammer", or the "STM32 ST_Link Utility", and you have to go on the OptionByte voice (step 1), then search for the voice ReadOutProtection (step 2) and change the value to 0 (step 3).

 

I attached a screenshot with the steps.

 

I hope this will help