Skip to main content
MAesc.1
Associate
December 11, 2019
Question

Debug error only at second session, but without even first run the program

  • December 11, 2019
  • 0 replies
  • 586 views

Hello

I have a strange bug when I try to debug. The first time I can start (only start, not run!) the debugger. The second time I receive an error message when I start the debugger (only start, not run!) :

"Failed to execute MI Command. Error Message from debugger back end: Error finishing flash operation"

I have a very simple program with only three lines of code added:

HAL_FLASH_Unlock();

FLASH_Erase_Sector(11, FLASH_VOLTAGE_RANGE_3);

HAL_FLASH_Lock();

With the fallowing Code I can start the debugger multiple times without error messages:

HAL_FLASH_Unlock();

//FLASH_Erase_Sector(11, FLASH_VOLTAGE_RANGE_3);

HAL_FLASH_Lock();

The strange thing is, in don't run the program, so the Erase-Command won't erase anything.

Remark: When I debug when the error message appears, the code did not even reach the startup-code.

After the error message I have to erase the flash with the STM32 ST-LINK Utility.

I have an STM32F207ZG Nucleo, I use STM32CubeIDE V.1.10 with St-Link GDB-Server and SWD

Does anyone have an idea what steps I could do to get to the source of this error?

This topic has been closed for replies.