Showing results for 
Search instead for 
Did you mean: 

Error:Flash Download failed - "cortex-M4"

Lucky Dog
Associate III

         Issue Description:  My code is divided into two parts, namely the APP area and the TRIM area. When I merge the code of these two areas together, there is no problem with programming through Keil. However, when I separate the code for these two areas (with the APP area located in the middle of Flash and the TRIM area at the end of Flash), the programming process results in an error (see Figure 1). My project configuration is shown in Figures 2 and 3.

        Phenomenon Description:  It's worth noting that this issue has not occurred on my computer but rather on a colleague's computer. I have attempted to troubleshoot by replacing the development board and using a different ST LINK on my colleague's computer, but the error persists.

      Platform Environment:

  1. Keil Version: V5.36.0.0
  2. Microcontroller (MCU): STM32L451CEUx
  3. Programmer: ST_LINK



(Figures 1)


(Figures 2)


(Figures 3)

     Can you please advise on the cause of this error and how I can resolve it?

ST Employee

Hi @Lucky Dog ,

Could you please try the following:

  • perform the ST-Link Firmware upgrade
  • try to connect using the STM32CubeProgrammer and erase flash content before using Keil again


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.

What exactly does the pop-up error say when failing?

Check the Keil website, I think there is an updated ST-LINK driver/dll

Check power and VCAP situation. These could make the flash fail.

Have Keil generate a .HEX file, try programming that with STM32 Cube Programmer.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..