cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve "Failed to execute MI command" due to elf file ,while loading project.

BA.1
Associate II

I am working on STM32H7B3I-DK with Touchgfx interface (using FreeRTOS ).The project was working well ,where the loading and running was successful but we started facing "Failed to Execute MI command" issue while loading. At end we created new project from scratch and it worked well. But after working fine for 2 day, with given no change or modification , the next very day while loading at first attempt ,we again started to face the same error.

The error itself is not consistent

Kindly note that we are using on board ADC and the same project (with same configurations) but has no Touchgfx or any FreeRTOS is loading and running fine.

Kindly find the uploaded error message image and hardware configuration file (.ioc) for reference

8 REPLIES 8
Romain DIELEMAN
ST Employee

Arh this is an error I have faced many times as well that can have different error origin... Something I could recommend would be to always manually unplug and plug the board before running on target. Sounds like an odd solution but it is what works when you face an error running on target multiple times in a row (issue writing in flash if i recall) in TouchGFX Designer with the exact same STM32H7B3dk board. Not sure where the error comes from.

Give it a try next time, if it does not fix it, well we'll need to further investigate 😅

/Romain

Hello,@Romain DIELEMAN​ Thank you for your reply. I have faced "Failed in erasing flash" issue sometimes, as you said it occurred when we run multiple times debugging on target and hence unplug and plug did the magic . But , this issue is different I feel , as you can see the below image , once the debug is selected, we are getting the error message immediately, and as you can see the console , only few lines have been printed and terminated . I think it has not yet reached erasing flash step .Kindly correct me if I am wrong and provide further solution .

0693W00000Y9h1BQAR.pngThank you.

JAlbr.1
Associate III

Were you ever able to find a solution to this? I'm experiencing something very similar.

I also am experiencing something very similar.

For a while I thought it was due to mving from Windows 10 to Windows 11.

In Device Manager, my STLINK appears and is reportedly using the latest drivers.

I've tried making a new project with no user code and same problem occurs.

I've tried uninstalling and reinstalling CubeIDE.

Desperate for a solution, I may start buying and trying other debuggers.

 

VL.3
Associate III

Got the same problem with STM32H750-based custom board. TouchGFX version 4.23.0, never had this problem on earlier versions like 2 years ago.
OP's error message pops up while trying to Run code from CubeIDE.
CubeProgrammer also fails to program MCU with "Error: failed to download the file" for .hex and .elf both.
Unpluging board or st-link didn't help. Project without TouchGFX runs successfully.

What I've tried: rellocate all code generated into internal flash, leaving external qspi flash empty - didn't help.
Any help appreciated

 

Pavel A.
Evangelist III

@VL.3 STM32H750 has only 128 KB of internal flash. Since you mention TouchGFX you probably have content in external memory, so this error is caused by so called "external loader" - it is wrongly configured or not specified at all.

 

JAlbr.1
Associate III

Hey everybody. I solved my issue back then. As Pavel suggested, it was an issue with my .stldr file. Make sure you have the correct configurations for your given app in conjunction with whatever loader file you're using. If you get this wrong, you may be trying to stuff way too much data into the internal flash.

Thx for response.

Even though I moved all the code to internal flash and the project compiled successfully, my linker script still had an ExtFlashSection. After clearing the linker file - the code runs.