cancel
Showing results for 
Search instead for 
Did you mean: 

Post build arm-none-eabi-objcopy --gap-fill=0xff in STM32CubeIDE

ASchw.1
Associate

Hello,

I'm using the IDE project properties "MCU Post build outputs" section to enable bin file generation.

0690X00000BuWlAQAV.png

The default behavior though is filling non used gaps in output bin with 0x00, Is it possible to override the "arm-none-eabi-objcopy" with "--gap-fill=0xff" to change default behavior? I couldn't find any place to override this in project properties inside the IDE itself... only run it via post build steps manually and disable the "output bin generation" checkbox above.

Thank you.

4 REPLIES 4
Ozone
Lead

I don't know CubeIDE, but filling gaps (unused space) in actual Flash with 0xFF is common practice.

This avoids Flash wear, and keeps the programming times low.

> The default behavior though is filling non used gaps in output bin with 0x00,

This makes sense for RAM areas, or PC/host-based applications.

danalog
Associate

I have the same question. I've even set the post-build step command to:

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

Set in the STM32CubeIDE project settings as so:

0690X00000BwIIwQAN.png

But my binary is not padded to 128 KB even though it is produced. The only output I receive, despite the --verbose setting, is:

copy from `project.elf' [elf32-littlearm] to `project.bin' [binary]

How can I pad my binary out to the full 128 KB flash size using STM32CubeIDE?

Try --pad-to 0x08020000

JW

Perfect, that did work. Thanks JW. I didn't realize the pad-to value is an absolute reference relative to the elf file, not a relative offset.