cancel
Showing results for 
Search instead for 
Did you mean: 

Download verification failure when using .elf generated from STMCubeIDE

nollstead
Associate III

Hello, everytime I try to download a file (in STM32CubeProgrammer) that was generated using STM32CubeIDE I get a data mismatch error at address 0x08000004.  

Interestingly, if I write a simple blink sketch using the arduino IDE and upload that it works fine (And arduino is set to use STM32CubeProgrammer to upload - when in boot mode of course).  So I can take either the .elf or .bin that the Arduino IDE generates and upload just fine with STM32CubeProgrammer but NOT a .elf file that I create using STM32CubeIDE.

I'm completely new to STM32 so any ideas on where I should look would be appreciated.  

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

Aha! the plot thickens! Tomorrow will be the great day!

 

View solution in original post

7 REPLIES 7
TDK
Guru

If you do a full erase before programming, does it work? What chip? Attach your ELF if you can.

If you feel a post has answered your question, please click "Accept as Solution".
Pierre_Paris
ST Employee

Hello @nollstead and @TDK,

Welcome to the STM32 Community ! 😉

Same questions as @TDK.

And I add this : Can you share your OB configuration ?

I suggest you to have a look on the UM2237 (chapter 2.2) and AN5054 if you want to secure programming.

Best Regards,

Pierre

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.

I didn't do a full erase in either case as I wasn't sure if that would mess anything up.  The Arduino upload output shows that it erases sectors 0 and 1 so i tried that with no luck.

 

Attached are the ELF files - I can't upload zip files so I used WinRAR.  Blink.ino.rar is the version from the Arduino IDE and the other is from STM32CubeIDE.  Both are just simple blink sketches.

The board is a SparkFun STM32 Thing Plus that uses an STM32F450RGT6.  

Note, it's not completely lost to me that there may be something in SparkFun's compiling and/or linking that does something special that isn't done in the CubeIDE and maybe I should be asking them this but I figured I'd start with what I have so far (error in uploading).

I'm not sure what you mean by the OB configuration - do you mean the .ioc file from CubeIDE?

Pavel A.
Evangelist III

@nollstead You're using the DFU mode rather than the debugger interface (ST-LINK or J-Link)?

As a beginner, consider using the debugger way, it is more reliable and (among other benefits) lets you debug.

I am at the moment but this board has SWD and JTAG interfaces and I have an ST-Link arriving from DigiKey tomorrow.  So I'll certainly try that but I had to sort of figure out / reverse engineer the CubeIDE settings based on SparkFun's schematic.  So there's the possibility that I missed something there and uploading a simple blink sketch would help me at least determine that in the meantime.

Looking at the schematic there's nothing really all that special in the hardware:  USB differential pair going to the chip, some charging and power regulation and connectors.  It does have something labeled "CORTEX_DEBUG" and while I have no idea what that is it's connected to the SWD pins so shouldn't effect the DFU part (I don't think).  

So, if the error is related to me missing something in the chip setup (I've hunted and can't find anything missed) then the SWD would likely fail too.  I suppose I'll find out tomorrow but was hoping someone saw this error before and had a "you forgot to check this button in the IDE" sort of advice 🙂

 

Pavel A.
Evangelist III

Aha! the plot thickens! Tomorrow will be the great day!

 

Well, it's uploading now.  The magic trick was to uncheck "Skip flash erase before programming".  

Issue now is that while I'm sure the code is uploaded (I compared what is loaded to the .elf file and they match) nothing runs - my USB doesn't initialize and the LED doesn't blink.  But I guess that's another problem to figure out.