Skip to content

Flash memory use way up with v3.0.0 #9741

Closed
@moose4lord

Description

@moose4lord

Board

MH ET Live ESP32MiniKit

Device Description

Plain module on a breadboard

Hardware Configuration

none

Version

v3.0.0

IDE Name

Arduino IDE 2.3.2

Operating System

macOS 14.5

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

115200

Description

I have a reasonably complex sketch that uses quite a few large libraries (WiFi, BluetoothLE, ArduinoJson, ESPAsyncWebServer, HTTPClient, FastLED, ESP_HTTPS_OTA). With the 2.0.17 version of the arduino-esp32 core I've always been able to squeeze everything into 4M of flash memory (using an OTA partition scheme with a minimal SPIFFS partition).

Sketch uses 1870801 bytes (95%) of program storage space. Maximum is 1966080 bytes.
Global variables use 74044 bytes (22%) of dynamic memory, leaving 253636 bytes for local variables. Maximum is 327680 bytes.

Unfortunately, with v3.0.0 of arduino-esp32 core my sketch is now too big.

Sketch uses 2051421 bytes (104%) of program storage space. Maximum is 1966080 bytes.
Global variables use 72076 bytes (21%) of dynamic memory, leaving 255604 bytes for local variables. Maximum is 327680 bytes.

I guess I would expect a new major release of arduino-esp32 to require more memory, but a 9% increase seems like a lot. I used avr-nm to look at where all the flash is being used, but I don't see anything that's grossly out of whack (although I'm admittedly not an avr-nm expert and it produces a ton of information that's hard to parse).

Anyway, in trying to hack out some code to make room, avr-nm does show some things I don't understand. For example, here's what avr-nm shows are the largest linked modules for a sketch with empty setup() and loop() functions:

00002071 t mbedtls_sha256_software_process
00003400 T _dtoa_r
00007510 T _svfiprintf_r
00007908 T _vfiprintf_r
00012262 T _svfprintf_r
00012582 T _vfprintf_r

Why are the large 'printf' modules still linked into the executable when there's no print features in the sketch? And why would mbedtls be included when there's no encryption being done? Does the arduino-esp32 core need them behind the scenes for some reason?

If anyone has any tips on reducing the flash memory requirements for v3.0.0, please chime in.

Thanks

Sketch

// this is what I used just to get a feel for what avr-nm would show for a minimal sketch. my real application sketch is way more complicated. :)
void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

// Sketch uses 252537 bytes (12%) of program storage space. Maximum is 1966080 bytes.

Debug Message

Sketch too big; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.

Compilation error: text section exceeds available space in board

Other Steps to Reproduce

Here's the avr-nm command I used to get iinfo about flash memory use:

$AVR_PATH/avr-nm --size-sort -Ctd { path-to-elf-file }

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions