binary size on filesystem of new empty project (MKL04Z16) is 35kB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

binary size on filesystem of new empty project (MKL04Z16) is 35kB

383 Views
mpankopf
Contributor I

Hello,

I am using the MKL04Z16 MCU. Our project app called LPTV30 has a bin size of 10740 on file system.

Invoking: Cross ARM GNU Print Size
arm-none-eabi-size --format=berkeley "LPTV30.elf"
text data bss dec hex filename
8800 1108 392 10300 283c LPTV30.elf
Finished building: LPTV30.siz

 

We are thinking about a bootloader on our 16kB MCU. I created a new project called LPTV30-bl and the size output is

Invoking: Cross ARM GNU Print Size
arm-none-eabi-size --format=berkeley "LPTV30-bl.elf"
text data bss dec hex filename
1136 1080 28 2244 8c4 LPTV30-bl.elf
Finished building: LPTV30-bl.siz

 10300 from the app vs 2244 from the empty project, OK

BUT the size on file system is 34984!

I am running

arm-none-eabi-objcopy -O binary --gap-fill=0xff LPTV30-bl.elf LPTV30-bl.bin

 

hexdump shows me a really large gap

0000430 431e f8c4 618c e7e1 f506 74a6 f8c6 4148
0000440 e7b9 bf00 8460 0000 0000 0000 e7fe bf00
0000450 b5f8 bf00 bcf8 bc08 469e 4770 0043 0000
0000460 0480 0001 fc38 7fff 0001 0000 0000 0000
0000470 ffff ffff ffff ffff ffff ffff ffff ffff
*
0008470 8035 0000 806d 0000 8049 0000 0000 0000
0008480 0000 0000 076c 0001 07d4 0001 083c 0001
0008490 0000 0000 0000 0000 0000 0000 0000 0000
*
00084b0 0000 0000 845c 0000 0000 0000 0000 0000
00084c0 0000 0000 0000 0000 0000 0000 0000 0000
*
0008520 0000 0000 0000 0000 0001 0000 0000 0000
0008530 330e abcd 1234 e66d deec 0005 000b 0000
0008540 0000 0000 0000 0000 0000 0000 0000 0000
*
00088a8

 

What happens and how can I reduce the bin size to approx. 2.5k?

 

Thank you for your answer. Kind regards, Marcus

0 Kudos
1 Reply

376 Views
ErichStyger
Senior Contributor V

By default the project include lots of things you might not need. You could have a look here what you can get removed:

https://mcuoneclipse.com/2019/08/17/tutorial-how-to-optimize-code-and-ram-size/

I hope this helps,

Erich

0 Kudos