Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 3 months ago.
mbed-dev Minimum application size using external compiler
Hello, I tried to build a blinky application compiling mbed-dev as a library using LpcXpresso (so the GCC/G++ compilers). The result is that in debug mode the minimum application size is around 50KB using mbed1768.
1. Is that normal? 2. What is the part of mbed causing a so big executable file? Using mbed-dev as a library shouldn't link unused modules so seems to me that to blink a led is too much (DigitalOut + wait_ms()). 3. Any suggestion or trick I missed?
1 Answer
8 years, 3 months ago.
As default the standard build will include the stdio library which is fairly large, this is used for outputting error messages if the IO config is invalid.
If you look in targets/hal/TARGET_NXP/TARGET_LPC176X/TARGET_MBED_LPC1768/device.h and change
#define DEVICE_STDIO_MESSAGES 1
to
#define DEVICE_STDIO_MESSAGES 0
then it should save some space.
update--
I just did a quick test. For the program
#include "mbed.h" DigitalOut led(LED1); int main() { while(true) { led=!led; wait(1); } }
the default build size is 17,572 bytes using the online system.
Making that change it is 3,084 bytes
If I also remove debug awareness and error pattern then it's down to 2,812 bytes. (hardly worth the change)