mbed footprint

16 Nov 2016

Has the code size changed from mbed 2 online, to mbed 5 offline ?

it seems to be 50k larger ?

16 Nov 2016

I can think of two things that might be driving up code size.

1. Keil MDK vs GCC

Online compiler uses Keil MDK, which is very good at generating small code. What did you use when compiling offline? I am going to guess GCC compiler since it is free? GCC reliably produces much larger code size than Keil's compiler.

2. Newlib vs Newlib Nano

This may or may not be affecting you, but it does cause mbed OS 5 to generate larger code. If you are using GCC and mbed OS 5 with multithreads you must use GCC Newlib, not Newlib Nano (in MDK nano is called microlib). Offline, this linker option sets newlib nano. If doing multithread, this must not be included. Unfortunately, compiling without nano increases the baseline code size.

--specs=nano.specs

Here is a simple program I compiled in GCC with and without newlib nano.

  • compile with nano: 32k
  • compile without nano: 58k

-Graham

17 Nov 2016

Hi,

Thanks for the advice,

Yes, it is definitely GCC_ARM 5.3.1 I don't use newlib ...

my code was 103k online , now it is 177k offline the processor only has 128k space.

I have ordered a new board with more space...

Nick

17 Nov 2016

I installed the MDK522 and licensed for M0 core. it compiles now...

luckily I am using an M0

:)