How can i make the smallest OTA firmware

Hello,I would like to make the smallest ota firmware for esp-01.
This code does the job

#include <ESP8266WiFi.h>
//#include <ESP8266mDNS.h>
//#include <WiFiUdp.h>
#include <ArduinoOTA.h>

#ifndef STASSID
#define STASSID "xxxxxxxxxxxxxxxxxx" 
#define STAPSK  "xxxxxxxxxxxxxxxxxxx"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;


void setup() {
  Serial.begin(115200);
  Serial.println("Booting");
  Serial.println(ssid);
  Serial.println(password);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }

  ArduinoOTA.begin();
  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.println("minOTA");

}

void loop() {
  ArduinoOTA.handle();
}

but the firmware size is 312 kb
with the same code arduino ide makes a 285 kb firmware.

What can I do to minimize the firmware with platformio ?

this is my platformio.ini

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp01_1m]
platform = espressif8266
board = esp01_1m
framework = arduino
board_build.flash_mode = dout
upload_resetmethod = nodemcu

Thank you

Not enough info. What Arduino-ESP8266 core version is installed in the Arduino IDE? (Tools->Board->Board Manager → esp8266).

What are the Arduino IDE → Tools settings?

Are you using the latest platform-espressif32 4.2.0 version in PlatformIO? This is visible in the build output.

Hello max, thank you for your answer.
I have started my project few years ago with 2.7.4 esp8266 core, so in a first time, i would prefer to keep it. I’ll get a newer version when all will be ok with platformio.

For this test I have forgotten to set the core version in the platformio.ini so I used framework-arduinoespressif8266 @ 3.30101.0 (3.1.1)

I change platformio.ini to use the same core than arduino ide framework-arduinoespressif8266 @ 3.20704.0 (2.7.4)

[env:esp01_1m]
platform = espressif8266@2.6.2
board = esp01_1m
framework = arduino
board_build.flash_mode = dout
upload_resetmethod = nodemcu

I get a 308kb firmware.

This is my Arduino IDE setting :

No, when I use the Arduino IDE with core 2.7.4 and your code I get

Executable segment sizes:
IROM   : 280628          - code in flash         (default or ICACHE_FLASH_ATTR) 
IRAM   : 27828   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 
DATA   : 1276  )         - initialized variables (global, static) in RAM/HEAP 
RODATA : 1080  ) / 81920 - constants             (global, static) in RAM/HEAP 
BSS    : 25464 )         - zeroed variables      (global, static) in RAM/HEAP 
Bibliothek ESP8266WiFi in Version 1.0 im Ordner: C:\Users\Max\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi  wird verwendet
Bibliothek ArduinoOTA in Version 1.0 im Ordner: C:\Users\Max\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ArduinoOTA  wird verwendet
Bibliothek ESP8266mDNS in Version 1.2 im Ordner: C:\Users\Max\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266mDNS  wird verwendet
"C:\\Users\\Max\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-size" -A "C:\\Users\\Max\\AppData\\Local\\Temp\\arduino_build_123446/sketch_apr02a.ino.elf"
Sketch uses 310812 Bytes (32%) of the program space. Maximum is 958448 Bytes.
Globale variables use 27820 Bytes (33%) of the dynamic memory, 54100 Bytes remain for local variables. The maximum is 81920 Bytes.

So thats 310812 bytes in the Arduino IDE.

I compile in verbose mode and I get

Executable segment sizes:
IROM   : 257924          - code in flash         (default or ICACHE_FLASH_ATTR) 
IRAM   : 27448   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 
DATA   : 1276  )         - initialized variables (global, static) in RAM/HEAP 
RODATA : 944   ) / 81920 - constants             (global, static) in RAM/HEAP 
BSS    : 25352 )         - zeroed variables      (global, static) in RAM/HEAP 

The begining

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Cyril Blanc\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:xtal=80,vt=flash,exception=legacy,ssl=all,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=1M64,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -ide-version=10812 -build-path C:\Users\CYRILB~1\AppData\Local\Temp\arduino_build_953765 -warnings=none -build-cache C:\Users\CYRILB~1\AppData\Local\Temp\arduino_cache_414662 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.mklittlefs.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.mklittlefs-2.5.0-4-fe5bb56.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.python3.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.python3-3.7.2-post1.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-4-b40a506.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -prefs=runtime.tools.mkspiffs.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -prefs=runtime.tools.mkspiffs-2.5.0-4-b40a506.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -verbose C:\Users\CYRILB~1\AppData\Local\Temp\arduino_modified_sketch_47206\sketch_apr01a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Cyril Blanc\Documents\Arduino\libraries -fqbn=esp8266:esp8266:generic:xtal=80,vt=flash,exception=legacy,ssl=all,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=40,FlashMode=dout,eesz=1M64,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 -ide-version=10812 -build-path C:\Users\CYRILB~1\AppData\Local\Temp\arduino_build_953765 -warnings=none -build-cache C:\Users\CYRILB~1\AppData\Local\Temp\arduino_cache_414662 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.mklittlefs.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.mklittlefs-2.5.0-4-fe5bb56.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mklittlefs\2.5.0-4-fe5bb56 -prefs=runtime.tools.python3.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.python3-3.7.2-post1.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1 -prefs=runtime.tools.xtensa-lx106-elf-gcc.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -prefs=runtime.tools.xtensa-lx106-elf-gcc-2.5.0-4-b40a506.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506 -prefs=runtime.tools.mkspiffs.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -prefs=runtime.tools.mkspiffs-2.5.0-4-b40a506.path=C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\tools\mkspiffs\2.5.0-4-b40a506 -verbose C:\Users\CYRILB~1\AppData\Local\Temp\arduino_modified_sketch_47206\sketch_apr01a.ino
Using board 'generic' from platform in folder: C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4
Using core 'esp8266' from platform in folder: C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4
Detecting libraries used...
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/include" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/lwip2/include" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10812 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\cores\\esp8266" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\variants\\generic" "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765\\sketch\\sketch_apr01a.ino.cpp" -o nul
Alternatives for ESP8266WiFi.h: [ESP8266WiFi@1.0]
ResolveLibrary(ESP8266WiFi.h)
  -> candidates: [ESP8266WiFi@1.0]
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/include" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/lwip2/include" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10812 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\cores\\esp8266" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\variants\\generic" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\libraries\\ESP8266WiFi\\src" "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765\\sketch\\sketch_apr01a.ino.cpp" -o nul
Alternatives for ArduinoOTA.h: [ArduinoOTA@1.0]
ResolveLibrary(ArduinoOTA.h)
  -> candidates: [ArduinoOTA@1.0]
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/include" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/lwip2/include" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -ffunction-sections -fdata-sections -fno-exceptions -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10812 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\cores\\esp8266" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\variants\\generic" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\libraries\\ESP8266WiFi\\src" "-IC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\libraries\\ArduinoOTA" "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765\\sketch\\sketch_apr01a.ino.cpp" -o nul

and the end of the logs

Compiling library "ArduinoOTA"
Utilisation du fichier déjà compilé : C:\Users\CYRILB~1\AppData\Local\Temp\arduino_build_953765\libraries\ArduinoOTA\ArduinoOTA.cpp.o
Compiling core...
Using precompiled core: C:\Users\CYRILB~1\AppData\Local\Temp\arduino_cache_414662\core\core_cff777a73ce7c71703498ed3b91139a8.a
Linking everything together...
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-gcc" -CC -E -P -DVTABLES_IN_FLASH "C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/local.eagle.app.v6.common.ld"
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-gcc" -fno-exceptions -Wl,-Map "-Wl,C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.map" -g -w -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static "-LC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/lib" "-LC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/lib/NONOSDK22x_190703" "-LC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/ld" "-LC:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sdk/libc/xtensa-lx106-elf/lib" -Teagle.flash.1m64.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.elf" -Wl,--start-group "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765\\sketch\\sketch_apr01a.ino.cpp.o" "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765\\libraries\\ESP8266WiFi\\ESP8266WiFi.a" "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765\\libraries\\ArduinoOTA\\ArduinoOTA.cpp.o" "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_cache_414662\\core\\core_cff777a73ce7c71703498ed3b91139a8.a" -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group "-LC:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765"
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\python3\\3.7.2-post1/python3" "C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/elf2bin.py" --eboot "C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/bootloaders/eboot/eboot.elf" --app "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.elf" --flash_mode dout --flash_freq 40 --flash_size 1M --path "C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin" --out "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.bin"
Creating BIN file "C:\Users\CYRILB~1\AppData\Local\Temp\arduino_build_953765/sketch_apr01a.ino.bin" using "C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4/bootloaders/eboot/eboot.elf" and "C:\Users\CYRILB~1\AppData\Local\Temp\arduino_build_953765/sketch_apr01a.ino.elf"

"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\python3\\3.7.2-post1/python3" "C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/signing.py" --mode sign --privatekey "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_modified_sketch_47206/private.key" --bin "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.bin" --out "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.bin.signed" --legacy "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.bin.legacy_sig"
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\python3\\3.7.2-post1/python3" "C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4/tools/sizes.py" --elf "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.elf" --path "C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin"
Executable segment sizes:


IROM   : 257924          - code in flash         (default or ICACHE_FLASH_ATTR) 


IRAM   : 27448   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 


DATA   : 1276  )         - initialized variables (global, static) in RAM/HEAP 


RODATA : 944   ) / 81920 - constants             (global, static) in RAM/HEAP 


BSS    : 25352 )         - zeroed variables      (global, static) in RAM/HEAP 


Utilisation de la bibliothèque ESP8266WiFi version 1.0 dans le dossier: C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi 
Utilisation de la bibliothèque ArduinoOTA version 1.0 dans le dossier: C:\Users\Cyril Blanc\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ArduinoOTA 
"C:\\Users\\Cyril Blanc\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\2.5.0-4-b40a506/bin/xtensa-lx106-elf-size" -A "C:\\Users\\CYRILB~1\\AppData\\Local\\Temp\\arduino_build_953765/sketch_apr01a.ino.elf"
Le croquis utilise 287592 octets (30%) de l'espace de stockage de programmes. Le maximum est de 958448 octets.
Les variables globales utilisent 27572 octets (33%) de mémoire dynamique, ce qui laisse 54348 octets pour les variables locales. Le maximum est de 81920 octets.

Regardless differences with arduino ide, how can I minimize the frimware with platformio ?
I thnk there is many core functions I don’t use in this simple OTA firmware

I tried to add

build_flags = -Os -ffunction-sections -fdata-sections -Wl,--gc-sections

in platformio.ini, but the firmware size is the same.