Skip to main content
FValm.1
Associate III
October 28, 2021
Question

STM32CubeProgrammer cannot start a program after writing it to flash from an .hex file

  • October 28, 2021
  • 4 replies
  • 4372 views

Hello! I'm using a nucleo board with STM32F411RE MCU. I can connect to my board in DFU mode and program the flash with an hex file but it seems impossible to write a specific start address (0x08000000) to run the program after it is programmed in flash. That doesn't happen with .bin files where I can set the correct start address. Is there any reason for that strange behaviour?

This topic has been closed for replies.

4 replies

Houda GHABRI
ST Employee
November 9, 2021

Hi @FValm.1​ ,

Can you please share the hex file used ?

Houda

FValm.1
FValm.1Author
Associate III
November 10, 2021

This is just an example... I would like to highlight that the problem concerns the possibility to modify the start address field in STM32CubeProgrammer. That field is grayed/disabled when you program an HEX file while it is modifiable when you program a BIN file... Is there any reason for that?

Thanks!

Houda GHABRI
ST Employee
November 10, 2021

Hi @FValm.1​ ,

The specificity of Hex file compared to bin file is that address is already defined in file so you don't need to modified it in STM32ubeProgrammer start address field.

Hex file contains both address and application code.

Hope it's clear , If your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Houda

FValm.1
FValm.1Author
Associate III
November 11, 2021

Hi @Houda GHABRI​ ,

I have understood your answer but why, if start address is contained in the HEX file, then the program fail to start?

I get the following error in the log of STM32CubeProgrammer:

18:31:22 : Memory Programming ...

 18:31:22 : Opening and parsing file: prova_led_veloce.hex

 18:31:22 :  File     : prova_led_veloce.hex

 18:31:22 :  Size     : 27276 Bytes

 18:31:22 :  Address    : 0x08000000 

 18:31:22 : Erasing memory corresponding to segment 0:

 18:31:22 : Erasing internal memory sectors [0 1]

 18:31:23 : erasing sector 0000 @: 0x08000000 done

 18:31:23 : erasing sector 0001 @: 0x08004000 done

 18:31:23 : Download in Progress:

 18:31:24 : File download complete

 18:31:24 : Time elapsed during download operation: 00:00:01.349

 18:31:24 : RUNNING Program ... 

 18:31:24 :  Address:   : 0x00000000

 18:31:24 : Error: Start operation failed

Do I have to specify something to the builder to include the start address in the hex file?

Franco

Tesla DeLorean
Guru
November 11, 2021

prova_led_veloce.hex

:020000040800F2

:1000000000FC01208D090008290800082F080008BD

...

:106A7C00000000000000000000000000000000000A

:040000050800098D59

:00000001FF

Should be consistent with the Reset_Handler entry point.

I'd score this as a FAIL for STM32 Cube Programmer

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
November 10, 2021

The entry point is specifically called out in .ELF and .HEX ​files.

Based on the data it shouldn't be hard to make a reasonable determination from a .BIN, but it is not explicitly called out.

P​erhaps review Object Files

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