Hi there,
Sorry for the delayed followup, I had to put this project down for a bit.
The answer is – no, I have not been able to resolve this issue.
Here’s an easily-duplicable example to hopefully demonstrate.
The following code snippet:
#include <ArduinoJson.h> // version 5.13.4
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial)
;
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
StaticJsonBuffer<128> jbuf;
char tester[64];
strcpy(tester, "{\"key\": \"value\"}");
JsonObject &obj = jbuf.parseObject((const char *)tester);
obj.printTo(Serial);
Serial.printf("'%s'", tester);
}
void loop()
{
// put your main code here, to run repeatedly:
}
When built with Arduino/Teensyduino, the sketch uses 17008 (of 63488) bytes of program storage and 2316 (of 8192) bytes of dynamic memory.
The exact same code compiled in PlatformIO with the default settings comes out to 41636 (of 63488) bytes of program storage and 3516 (of 8192) bytes of dynamic memory. This is utilizing the “smallest code” board setting in Arduino.
Here are the board build settings for teensyLC in Arduino/Teensyduino:
teensyLC.build.board=TEENSYLC
teensyLC.build.core=teensy3
teensyLC.build.mcu=mkl26z64
teensyLC.build.warn_data_percentage=88
teensyLC.build.toolchain=arm/bin/
teensyLC.build.command.gcc=arm-none-eabi-gcc
teensyLC.build.command.g++=arm-none-eabi-g++
teensyLC.build.command.ar=arm-none-eabi-gcc-ar
teensyLC.build.command.objcopy=arm-none-eabi-objcopy
teensyLC.build.command.objdump=arm-none-eabi-objdump
teensyLC.build.command.size=arm-none-eabi-size
teensyLC.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdlib
teensyLC.build.flags.dep=-MMD
teensyLC.build.flags.cpu=-mthumb -mcpu=cortex-m0plus -fsingle-precision-constant
teensyLC.build.flags.defs=-D__MKL26Z64__ -DTEENSYDUINO=145
teensyLC.build.flags.cpp=-fno-exceptions -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti
teensyLC.build.flags.c=
teensyLC.build.flags.S=-x assembler-with-cpp
teensyLC.build.flags.ld=-Wl,--gc-sections,--relax,--defsym=__rtc_localtime={extra.time.local} "-T{build.core.path}/mkl26z64.ld" -lstdc++
teensyLC.build.flags.libs=-larm_cortexM0l_math -lm
teensyLC.menu.opt.osstd=Smallest Code
teensyLC.menu.opt.osstd.build.flags.optimize=-Os --specs=nano.specs
teensyLC.menu.opt.osstd.build.flags.ldspecs=
I’ve tried applying different combinations of these settings using build_flags and unbuild_flags in platformio.ini to no apparent effect.
Really hoping that we can figure this out because I really hate the Arduino UI, but this also makes PlatformIO unusable.