ESP32 sketches take more space than Arduino Uno

tomxygen
Posts: 5
Joined: Thu Jan 03, 2019 7:28 pm

ESP32 sketches take more space than Arduino Uno

Postby tomxygen » Thu Jan 03, 2019 7:32 pm

I just connected my ESP32 to the Arduino IDE.
I noticed however that the same sketch (blinking the onboard LED) takes 174860 bytes (13%) of program storage space. Maximum is 1310720 bytes. Global variables use 13748 bytes (4%) of dynamic memory, leaving 313932 bytes for local variables. Maximum is 327680 bytes, while on the Arduino UNO takes 928 bytes (2%) of program storage space. Maximum is 32256 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

Why?

Is there a way to fix it?

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: ESP32 sketches take more space than Arduino Uno

Postby Vader_Mester » Sat Jan 05, 2019 2:03 pm

The 2 chips are very very different! The uno is an 8bit device, the ESP32 is a 32bit device. So in a nutshell, an instruction and a simple variable in the uno only takes up 1 or 2 bites of memory, while in the ESP, 1 instruction and one variable takes up 4bytes. About 4x the size

Additionally the functionality and software framework is very different.
Consider this analogy:
Arduino Uno: Nokia 3310
ESP32: Samsung Galaxy S9 :D

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

Who is online

Users browsing this forum: No registered users and 109 guests