cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve Error Finishing Flash Operation in STM32CubeIDE?

Efty
Associate

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

18 REPLIES 18
Semer CHERNI
ST Employee

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
Associate II

@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

dhst
Associate

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.

 

 

blippy
Associate

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.

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

Spark_Mars
Associate

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.

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

RebelEngineer
Associate II

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!

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