PlatformIO Community

Code size increased on ItsyBitsy M0 by 20k!

I moved my project from Arduino to PlatformIO earlier this year as
I am compiling my project for two similar boards: Sparkfun RedTurbo and Adafruit Itsy Bitsy M0.
For both these the compiled uf2 file was, in March, 121k. I have just made a small update by deleting one line of code and recompiled. Now the Sparkfun code/image is still 121k but the Adafruit is 149k !

Where did 28k of code come from? What might cause this and how can I track it down?
I am concerned that a library or libraries have been updated and bloated the code. These are the library includes:
“Arduino.h” , “delay.h”, <Wire.h>, <Time.h>,<TimeLib.h>,<Timezone.h>
<SPI.h> ,<Adafruit_SPIFlash.h> //use older version 2 0 2
<Adafruit_SPIFlash_FatFs.h> ,<IniFileSDFat.h>

Any advice would be welcomed.

Use GCC map file generation and an evaluation tool as explained in STM32 mbed: very large compile size to see what function code and other objects are contained in the compiled ELF files.

PIO also has a built in memory analyzer that can give you a better overview. See and 🔥 PlatformIO Home 3.0 Beta and powerful Project Inspection announcement.

1 Like

Thanks for the suggestion. I could not get the PIO analyser to run.
To try and isolate the problem I reloaded the ‘sketch’ into the Arduino IDE and compiled for each board.
I downloaded and ran the python script from Adafruit
Code size for the SparkFun Red Turbo was reported as 61619
Code size for the Adafruit ItsyBitsy M0 was reported as 76353
In almost all cases the code size reported is significantly larger for the Adafruit Board both for ‘core’ files and libraries.
Also the listing of core files differ. I don’t know enough about Arduino under the hood to say why one map has libc_nano.a and the other not.

I have tried to layout the map to make easier comparison below. If anyone with greater knowledge can help my understanding I would be most grateful.

I have loaded the file here:


A quick update.
I tested by compiling code in Arduino IDE, platformio and Sloeber for both the Adafruit ItsyBitsy M0 and the Sparkfun Red Turbo boards. With similar code discrepancies.
From the Adafruit Forum it was noted by ‘westfw’ that the Adafruit SPI library had a call to assert that in turn pulled in the printf library.
Adding the following dummy assert:
extern “C” void __assert_func() {};
seemed to solve the problem and now the code for both boards in all three environments is similar.
So [Solved]