cancel
Showing results for 
Search instead for 
Did you mean: 

Hex file: adding dummy bytes - STM32 Cube IDE - GNU/LD

Sanjay8344
Associate II

within the STM32 Cube IDE After creating a hex file, I noticed that some lines had less data than others due to linker separation. How can I use the STM32 Cube IDE to add dummy bytes to the memory?

Sanjay8344_0-1720420608647.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

ALIGN(8) instead of ALIGN(4) at the end of each section ?

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

View solution in original post

12 REPLIES 12
AScha.3
Chief II

> that some lines had less data than others

Thats "normal" in a (Intel-)HEX file.

see:

https://developer.arm.com/documentation/ka003292/latest/

 

>to add dummy bytes to the memory

Why ?

If you feel a post has answered your question, please click "Accept as Solution".

In order to extract data from a hex file and write it into memory while working on the bootloader, I must do a remote update. In order to accomplish this, I must write 0xffff in a location where there is less data on the specific lines. I now know that the linker script can be used to change it but not How to do that.

Other (better) hex generators will add fill bytes for you but I could not see a way to do that here.

Instead you can use fill statements in your linker script as you already understood. There is a nice summary here about how to proceed:

FILLing unused Memory with the GNU Linker | MCU on Eclipse

Just - erased flash is anyway at 0xFFFF , so why write some extra FF there ?

If you feel a post has answered your question, please click "Accept as Solution".

You can do that without postbuild in the linker script and fill the sections by using Align command!

Sanjay8344_0-1720543631547.png

When I flashed the .hex file with the STM 32 utility, it automatically divided into two halves and was written appropriately. And I need to write 0xFFFFFFFF at that specific spot if I want to write it manually using the bootloader.

 

Sanjay8344_2-1720543904542.png

 

Kindly give the commands where it has to be written.

This is why it's best not to have your bootloader process Hex files!

Give it a .bin file instead!

ALIGN(8) instead of ALIGN(4) at the end of each section ?

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