Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core versions 3.0.0 and newer use 14% more flash memory after compiling for LOLIN ESP32-S2 Mini #10386

Open
1 task done
jhsa opened this issue Sep 28, 2024 · 5 comments
Open
1 task done
Labels
Type: Question Only question

Comments

@jhsa
Copy link

jhsa commented Sep 28, 2024

Board

LOLIN S2 MINI

Device Description

Rotary Encoder, OLED display, External EEprom, Buttons..

Hardware Configuration

i2c - SCL on GPIO 35, SDA on GPIO 33
SPI - MOSI 11, MISO 9, and SCK 7
Rotary Encoder is connected to GPIO 2 and 4.

Version

v3.0.4

IDE Name

Arduino IDE 2.3.3

Operating System

Windows 10

Flash frequency

240MHz

PSRAM enabled

yes

Upload speed

115200

Description

I tried to compile some code I wrote a few months ago and it compiled , but using 14% more flash memory. The code should use 66% of flash and now it compiles at 80%. also, when I flash the code to my device, the Encoder only work in General Settings, once it starts running through the main loop, the rotary encoder stops working. If I downgrade the ESP core to version 2.0.17, everything works fine again and the code compiles at 66% flash memory usage.
The same happens when I tried some library example, like for example the WifiManager. With the newer versions of the ESP core, the example "OnDemandConfigPortal" uses 80% of flash memory, and it only uses 74% when compiled with version 2.0.17.

Sketch

here is the WiFi Manager exaample code:

/**
 * OnDemandConfigPortal.ino
 * example of running the configPortal AP manually, independantly from the captiveportal
 * trigger pin will start a configPortal AP for 120 seconds then turn it off.
 * 
 */
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager

// select which pin will trigger the configuration portal when set to LOW
#define TRIGGER_PIN 0

int timeout = 120; // seconds to run for

void setup() {
  WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP  
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("\n Starting");
  pinMode(TRIGGER_PIN, INPUT_PULLUP);
}

void loop() {
  // is configuration portal requested?
  if ( digitalRead(TRIGGER_PIN) == LOW) {
    WiFiManager wm;    

    //reset settings - for testing
    //wm.resetSettings();
  
    // set configportal timeout
    wm.setConfigPortalTimeout(timeout);

    if (!wm.startConfigPortal("OnDemandAP")) {
      Serial.println("failed to connect and hit timeout");
      delay(3000);
      //reset and try again, or maybe put it to deep sleep
      ESP.restart();
      delay(5000);
    }

    //if you get here you have connected to the WiFi
    Serial.println("connected...yeey :)");

  }

  // put your main code here, to run repeatedly:
}

Debug Message

None.

Other Steps to Reproduce

No response

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

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@jhsa jhsa added the Status: Awaiting triage Issue is waiting for triage label Sep 28, 2024
@lbernstone
Copy link
Contributor

Yes, frameworks rarely get smaller as they accumulate more cruft.
Libraries may need to be updated to work in v3.x as there are breaking changes in the APIs.

@jhsa
Copy link
Author

jhsa commented Sep 28, 2024

Yes, frameworks rarely get smaller as they accumulate more cruft. Libraries may need to be updated to work in v3.x as there are breaking changes in the APIs.

Thanks.. But the IDE says that all the libraries are updated.
I understand code tend to get bigger. But 14% bigger is a bit too much I think..

@Jason2866 Jason2866 added Type: Question Only question and removed Status: Awaiting triage Issue is waiting for triage labels Sep 28, 2024
@me-no-dev
Copy link
Member

majority of the size difference comes from the extra cyphers that need to be supported for newer SSL and WiFi authentication. We are looking into ways to make that optional, but do not have a concrete plan or way to provide that yet.

@Rob58329
Copy link
Contributor

This is a similar issue for the ESP32C3 with (for example) the standard "examples/wifi/SimpleWiFiServer" sketch which gives:

ESP_ARDUINO_VERSION v2.0.6
Sketch uses 694996 bytes (53%) of program storage space. Maximum is 1310720 bytes.
Global variables use 39268 bytes (11%) of dynamic memory, leaving 288412 bytes for local variables. Maximum is 327680 bytes.

ESP_ARDUINO_VERSION v3.0.5
Sketch uses 931690 bytes (71%) of program storage space. Maximum is 1310720 bytes.
Global variables use 35460 bytes (10%) of dynamic memory, leaving 292220 bytes for local variables. Maximum is 327680 bytes.

That's an increase of 236,694 bytes or about 34% of the original sketch size (and no SSL for this, just Wifi).

@me-no-dev
Copy link
Member

WiFi is enough to increase the size, because it now supports more security models. WPA3, etc. We looked into providing an options with less security supported, but that ended up being not possible for a few reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question Only question
Projects
None yet
Development

No branches or pull requests

5 participants