Skip to main content
JP_RS
Associate II
August 10, 2021
Question

How to generate fixed length hex file using STM32CUBEIDE ?

  • August 10, 2021
  • 2 replies
  • 1388 views

I am trying to develop a boot-loader for STM32H7xx micro-controller. For that i need a hex file of my program, i am using STM32CUBEIDE for that but the problem is that my generated hex file length is not same some line is short but i need fixed length hex file for my boot-loader.

How can i create fixed length hex file using stm32cubeide .

This topic has been closed for replies.

2 replies

TDK
Super User
August 10, 2021

You can use command line options to achieve this.

https://community.st.com/s/question/0D50X0000Bq9QQO/post-build-armnoneeabiobjcopy-gapfill0xff-in-stm32cubeide

In case the link breaks in the future, something like: 

arm-none-eabi-objcopy --verbose -S -O binary --gap-fill 0xFF --pad-to 0x08020000 "project.elf" "project.bin"

"If you feel a post has answered your question, please click ""Accept as Solution""."
Tesla DeLorean
Guru
August 10, 2021

Perhaps code the loader more robustly, or pre-process the .HEX on the PC side to get it into a normalized/simplified form your loader can digest. Or package it as a binary, with size and signing data to validate its integrity.

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