cancel
Showing results for 
Search instead for 
Did you mean: 

Error at start of debugging while Flash write test

Thoufiel
Associate III

I am testing Flash write using a custom board with STM32H562VG.

For debugging, I use IAR I-jet and VSCode's C-SPY extension.

The following HAL API is used for Flash writing, addr starts at 0x08030000 in the User area.

HAL_FLASH_Program(FLASH_TYPEPROGRAM_QUADWORD, addr, pData)
 
I was able to confirm that I could write data to 0x08030000 with HAL_FLASH_Program,
but then when I stopped debugging and restarted, the debugger would not start.
 
When debugging is aborted, a log message “Failed to execute flash loader” is displayed.
 
After that, I was able to write the relevant program using STM32CubeProgrammer,
but the debugger did not start and the error message status did not change.
 
I debugged the relevant program on another board using the same CPU and the debugger started.
(I did not try writing Flash because that board might not start up either.)
 
Is there some kind of memory protection mechanism in effect?
2 REPLIES 2
TDK
Guru

Is 0x08030000 in use by your program?

No reason that memory in flash would be causing problems unless that memory was used for some reason.

> For debugging, I use IAR I-jet and VSCode's C-SPY extension.

Could also just be a bug with the tools.

If you feel a post has answered your question, please click "Accept as Solution".
Thoufiel
Associate III

Thank you for replying.

 

> Is 0x08030000 in use by your program?

No, I just did a test write to the Flash area and did not refer to the content.

 

Also, although I don’t know the exact reason, after performing a MASS ERASE using STM32CubeProgrammer,

I was able to debug again.