Electronics > Microcontrollers

ELF file size discrepancy

(1/2) > >>

peter-h:
This is the Cube Build Analyser



but the resulting binary file is 463k (473092 bytes).

The ELF is 5.2MB :)

My post build batch file is


--- Code: ---arm-none-eabi-objcopy -S --strip-all -R .bss -R .main_heap -R .ccmram -O binary xxx.elf bin.dat

--- End code ---

Probably I am not quite "stripping all" but what can I do to narrow it down?

The bin.dat is the file which is actually programmed into the CPU FLASH. I know this because I wrote all that code; the boot loader and all. That file is loaded from a FAT12 file system (FatFS) and its actual size in bytes is programmed. So if there is some excess in bin.dat, it doesn't do anything, or there is no excess and the Build Analyser display is BS.

The only reason this actually matters is because I have a code size ceiling of 510k in this version of the project, due to unrelated factors (the CPU is 1MB FLASH).

Of the total code size, about 300k is MBEDTLS :) The "MBED" is a bit of a joke... Next year they will be calling a PC with 24GB RAM "embedded".

hans:
A bin file cannot "jump" memory sections. Your BL uses 12.39kB, but reserves 32kB. So around 19.6kB of space will be filled with 0s to get to the memory address of the main program.

32kB+429.8kB=461.8kB = 472883b

Pretty close to your 473092b .bin file.

If you want a program file that can write memory at any arbritrary location, you need .hex.

Concerning usage.. your main program last memory address is at 462kB out 510kB. So it is the actual usage. Perhaps a bit more than expected because the BL is healthily proportioned at 32kB, even though 16kB at this point would fit, but not sure about the FLASH pages on that chip.

eutectique:
Do objdump of your elf file. You will find hefty .debug* sections.

Also, consider "fill=0xff' option for objcopy. Otherwise unused areas are filled with zeros.

Or consider .hex or .srec format, as already suggested.

eutectique:

--- Quote from: peter-h on November 25, 2022, 09:45:30 pm ---Next year they will be calling a PC with 24GB RAM "embedded".

--- End quote ---

Inside a tomograph, it is embedded.

SiliconWizard:
What was the original question? ::)

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod