2023-07-07 07:38 AM
Hi,
I need to develop a bootloader for my application using the STM32G030C8 and went through the "How to create a super simple bootloader" videos (https://www.youtube.com/playlist?list=PLnMKNibPkDnEb1sphpdFJ3bR9dNy7S6mO). These videos showed a very handy feature of the STM32CubeIDE when you can debug the bootloader and application together, thus being able to see a correct jump from the bootloader to the application. This is done by loading both the bootloader and application projects in the IDE and select both projects in the debug setting.
My question is, is there a similar way to compile a single HEX files which includes both the bootloader and application firmware?
Thanks
2023-07-07 09:54 AM
The usual method is to compile each program separately, then use srecord (the program at https://sourceforge.net/projects/srecord/ , not "srecord" the hex file format) or something like that to combine the hex or binary files into a single image.
2023-07-07 10:06 AM
Hello @DDeba.1
First let me thank you for posting.
Such feature is not supported stock on STM32CubeIDE. However you can use srec_cat.exe utility as a post command in the build setting.
This utility will combine the two .hex files to a single one.
If this proposition helped you, don't hesitate to select it as a solution.
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-07-10 12:18 AM
Hi,
Thank you all for the replies.
I am trying to add srec_cat.exe to the post build options but I'm not managing. I never used post build options before. I am currently using the syntax "srec_cat app -intel boot -intel -o outfile -intel" to have the files in intel hex format merged in a single file. Im am getting errors that the system cannot find the specified path. Can anyone tell me about additional steps I need to take for the IDE to find the paths for my app.hex, boot.hex, and the srec_cat.exe. file?
PS: I am putting the post-build command in the app build settings and building the app. Is the the correct way or should it be placed in the boot project?
Thanks
2023-07-10 10:55 AM
The pre and post-build steps take place in the target directory. For example, for "debug" builds the current directory is "MyProject/Debug". You will need to specify paths to your hex files accordingly (typically relative paths unless you can always assume the exact same directory structure where ever that project might be built).
Typically the bootloader is built first, then the app. So combining them is (in my experience) done in the app build process. In my case, the same bootloader is used for multiple applications.
2024-05-15 10:21 PM
if issue was sloved please provide solution
2024-05-16 06:09 AM
Hi,
Not really. Right now, I'm opening both the bootloader and the application hex files and merge them manually (literally copy and past in a single hex file). Would be of help if there is a way where this is done automatically.
2024-05-16 10:13 AM
in this topic is my solution, bin or hex doesn't matter.
Good luck
2024-05-16 10:30 AM
Bin is usable only when memories continues and between boot and app area isnt other thinks.
Most simple way is use system command
copy file1.hex + file2.hex result.hex
or append
type file2.hex >> file1.hex
or many more utils in any OS