2026-02-16 12:40 PM
Is there a build tool to insert two .hex files into my final image?
I am retroactively updating an existing firmware by moving a bootloader I've created from an unused place in the updated image into its proper sector. But to do this, I need to insert the bootloader into the image I am updating with.
(Update image contains existing code + boot image1 + boot image2)
My main update image will be contained in sector 0 - 5. My first separately built bootloader.hex file must be squeezed into sector 6, and my second separately build bootloader2.hex must be squeezed into sector 7.
I have found it is possible to use the linker file to insert raw hexadecimal bytes, but this requires converting the .hex file to an ascii hex array, copying it over and then building.
Is there a command line build tool alternative to do this cleanly?
Solved! Go to Solution.
2026-02-16 12:58 PM
You could use srec_cat to do this.
SRecord - Browse /srecord-win32 at SourceForge.net
Solved: Re: Production flash tool for dual core STM32H745 - STMicroelectronics Community
2026-02-16 12:58 PM
You could use srec_cat to do this.
SRecord - Browse /srecord-win32 at SourceForge.net
Solved: Re: Production flash tool for dual core STM32H745 - STMicroelectronics Community
2026-02-16 1:44 PM
I tried srec_cat and since my original .hex files are not at the address I need to insert them to the output is not correct. Tried doing this:
srec_cat update-image.hex -intel boot-stage1.hex -intel -offset 0x40000 boot-stage2.hex -intel -offset -0x80000 -o final_image.hex -intel
Output is not at correct addresses though... I'll go with the primitive method of just creating a hex ascii array and using the linker to keep the array.