cancel
Showing results for 
Search instead for 
Did you mean: 

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

FValm.1
Associate III

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?

9 REPLIES 9
Houda GHABRI
ST Employee

Hi @FValm.1​ ,

Can you please share the hex file used ?

Houda

FValm.1
Associate III

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

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

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 Venmo
Up vote any posts that you find helpful, it shows what's working..

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

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 Venmo
Up vote any posts that you find helpful, it shows what's working..

Do you mean that the STM32CubeProgrammer is failing to get the correct start address which should be 0x0800098D which is written correctly in the HEX file? Actually it seems that STM32CubeProgrammer is trying to start program at 0x00000000 address...

The .HEX file is consistent with applicable standards/expectations, so this isn't a tool-chain/linker issue

Does it work if you pull the .ELF file? What address does that present?

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

Doesn't work also with .elf file. This is the log after promming job:

 21:25:28 : Memory Programming ...

 21:25:28 : Opening and parsing file: prova_led_veloce.elf

 21:25:28 :  File     : prova_led_veloce.elf

 21:25:28 :  Size     : 27276 Bytes

 21:25:28 :  Address    : 0x08000000 

 21:25:28 : Erasing memory corresponding to segment 0:

 21:25:28 : Erasing internal memory sectors [0 1]

 21:25:28 : erasing sector 0000 @: 0x08000000 done

 21:25:29 : erasing sector 0001 @: 0x08004000 done

 21:25:29 : Download in Progress:

 21:25:29 : File download complete

 21:25:29 : Time elapsed during download operation: 00:00:01.346

 21:25:29 : RUNNING Program ... 

 21:25:29 :  Address:   : 0x00000000

 21:25:30 : Error: Start operation failed