3 years, 8 months ago.

how to reduce the footprint of the binary image

Hi, I'm quite new to the mbed platform (and the ARM Cortex microcontrollers).

I am using the platformio build system (ie. gcc) which has support for mbed.

My question is about the generated .bin file, which I find huge. For example, the simple led blink example:

#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1;
        myled = 0;

produces a firmware.bin file of 12620 bytes (for a Nucleo f031k6). Note that I gave a quick try to the online IDE and the produced file is almost the same size.

I find this way too big, so I was wondering if there is a way to disable mbed features I don't need. I mean the little F031K6 only have 32k of flash, so it's very hard to make something useful of it if I cannot shrink somehow the binary firmware.

How do you make your firmware files smaller? I haven't found any clue on the mbed.org site, but I may have missed something.



Be the first to answer this question.