2021-10-28 07:45 AM
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?
2021-11-09 08:09 AM
Hi @FValm.1 ,
Can you please share the hex file used ?
Houda
2021-11-09 10:53 PM
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!
2021-11-10 05:05 AM
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
2021-11-10 05:42 AM
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.
Perhaps review Object Files
2021-11-11 09:36 AM
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
2021-11-11 09:47 AM
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
2021-11-11 09:59 AM
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...
2021-11-11 11:16 AM
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?
2021-11-11 12:27 PM
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