2023-11-02 12:50 PM
Hello,
I have a Bootloader and Application Project using STM32F030CCT6TR controller with 256KB flash.
I am using 32KB for Bootloader starting from 0x8000000 address and Application of 220KB from 0x8008000 address.
Can I generate a unified hex file to program controller with Both the Project with their respective addresses in STM32CubeIDE.
Solved! Go to Solution.
2023-11-03 07:01 AM
Hello @TShet.2
First let me thank you for posting.
ARM provide an utility to merge hex files you can check it from ARM web site.
If you could run this command line successfully, you can make an automatic generation by adding it to the build configuration : Post build command.
BR,
Semer.
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.
2023-11-02 12:55 PM
If you can use an editor or write an AWK script, or a basic C program app on the host system, you can probably just merge the two, striping the terminating line on the first, and appending the second file.
2023-11-03 07:01 AM
Hello @TShet.2
First let me thank you for posting.
ARM provide an utility to merge hex files you can check it from ARM web site.
If you could run this command line successfully, you can make an automatic generation by adding it to the build configuration : Post build command.
BR,
Semer.
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.
2023-11-03 07:26 AM
Yes, they are point to SRecords, a HEX file tool. But in all honesty the formats are pretty trivial. It's the terminal record in the Intel HEX format that you need to remove when concatenating files.
Do it once, or twice, in an editor to understand the mechanics, and then automate.
2023-11-03 07:39 AM
STMCubeIDE is multiproject Eclipse envi , then you have one project for bootloader in same workspace next project app. What you setup into build or run sequence result to create one hex for every project or more hex based on scripting etc.
2023-11-04 01:40 AM
As alternative to external tools, is to write a top level linker script and let GCC (linker) do this job.
This linker script is from one of my projects, but for a AVR MCU. But with some modifications, it should also work on STM32 devices:
top.ld:
OUTPUT_FORMAT(elf32-avr)
OUTPUT_ARCH(avr51)
MEMORY {
FLASH_APP (rx) : ORIGIN = 0x00000000, LENGTH = 120K
FLASH_BOOT (rx) : ORIGIN = 0x0001E000, LENGTH = 8K
SRAM (rw) : ORIGIN = 0x00800100, LENGTH = 16K
}
SECTIONS {
.bootldr : {
bootldr.o
} > FLASH_BOOT
.application : {
application.o
} > FLASH_APP
}
Then invoke GCC with the the (modified) linker script:
$ arm-none-eabi-gcc -o out.elf -T top.ld bootldr.o application.o
(You can also link ELF executables directly, but you might get a warning from the linker, that the symbol _start occurs twice.)
After that simple use objcopy, to get the hex file:
$ arm-none-eabi-objopy -I elf32-littlearm -O ihex out.elf out.hex