IT lexicon › Programming › objcopy

objcopy

Programming På svenska → Updated: 2026-11-04

The GNU tool that turns the linker's ELF file into the raw format a flash programmer or bootloader actually wants.

The linker produces an ELF file full of sections, symbols and debug information. The microcontroller only wants bytes at the right addresses. objcopy from GNU binutils does the translation: arm-none-eabi-objcopy -O binary app.elf app.bin gives a raw image, -O ihex gives Intel HEX and -O srec gives S-record. With -j and --remove-section you keep or drop individual sections.

The classic trap is the raw binary format, which cannot contain gaps. If a single section lands at a distant address — a misplaced initialised variable in RAM, say — objcopy pads the whole space in between, and the firmware grows from 40 kB to half a gigabyte. The fix is almost always in the linker script.

← Back to the lexicon