Peter Kapteyn
Peter Kapteyn

Reputation: 405

How much of an .elf file gets flashed onto target MCU?

I'm working with a Cortex-M4 MCU, and I'm flashing it with a Jlink.

For this project my .bin file is about 18k and my .elf file is about 1.8M. I know the whole .elf doesn't get flashed onto the MCU, but how much of it does? Is it just the size of the .bin that gets flashed, or is there some extra debug information as well?

Is there a method by which I can determine the amount of data that actually gets flashed onto the MCU?

Upvotes: 0

Views: 587

Answers (1)

kkrambo
kkrambo

Reputation: 7057

The size of the .bin is probably the size of what gets flashed onto the MCU. (I say "probably" because it's possible that the .bin file is padded with some empty space depending on how it was created.)

Study the .map file produced by the linker. The .map file describes the address and size of everything located in the memories. The .text and .rodata sections are typically in flash. The .data and .bss sections are typically in RAM. If you know the address range of your memories then it will be easy to identify which sections are in which memory and the extent used in each memory.

Upvotes: 3

Related Questions