Compile ESP32 with Wifi and BLE library included, compile error with oversize


I am using PIO core 4.3.1 Home 3.1.1, Arduino ESP32, include Wifi and BLE library
#include <WiFi.h>
//#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <BLEDevice.h>
#include <BLEServer.h>

and just only around 180 lines of code, it already compiled error with 13% oversize of Flash.
Flash: [==========] 113.7% (used 1490441 bytes from 1310720 bytes)

Would like to see if it is possible to increase the compiling Flash size?
Which files need to set?

I checked and see the already had those line
if data_max_size and data_size > data_max_size:
commend out.

Thanks a lot!

o_O that should have failed to link the binary with a overflow in IROM0 message if the linker script also has the maximum size set. What is your exact platformio.ini?

I had the same issue.
I set the compiler options to ‘release’ instead of ‘debug’ but what I recall making the most reduction was to remove the Ethernet support in the menuconfig settings.

You can make a new partition of the Flash memory to have more space for the code.
Try to include this in your platformio.ini:

board_build.partitions = min_spiffs.csv