#222 More Memory for the ESP32 without Soldering (How-to adapt partition sizes)

preview_player
Показать описание
Sometimes we need more memory for our sketches. In this quickie, I show you how you get it without heating up your soldering iron.

Most of the ESP32 modules have 4Mbyte flash memory chips. But if you look at the usable memory size, you only get 1310720 bytes, which is roughly one-quarter of your flash memory. With a blink sketch, this is no problem. It only uses 13% of the available space. But if you use the simple BLE_server example, which is just a few lines long, it occupies already 85% of your flash memory. If you add some other libraries, you quickly get an “out of memory” error.
Partitioning and ESP32 partition tables provide the solution.

Links:

My Bitcoin address: 19FSmqbBzb5zsYB1d8Bq4KbxVmezToDNTV
If you want to support the channel, please use the links below to start your shopping. No additional charges for you, but I get a commission (of your purchases the next 24 hours) to buy new stuff for the channel

Please do not try to Email me or invite me on LinkedIn. These communication channels are reserved for my primary job

Рекомендации по теме
Комментарии
Автор

Cool - I'm using the Adafruit HUZZAH32 and the Partition Scheme menu item doesn't exist but a quick edit of boards.txt put that right and I'm now using Minimal SPIFFS with no problems :) Thank you.

robfenwitch
Автор

Hello Andreas.
Thank you for another great video.
Why there is no possibility to use No OTA AND minimum SPIFFS at the same time?

malleusmaleficarum
Автор

Awesome information Andreas, very useful indeed!

lescarneiro
Автор

Thank you very much! Today you saved my life!! 👊🏻

josealcazarbartlett
Автор

Thanks this might come in handy for my home automation project :)

frankalvarez
Автор

Oh my god, thank you so much ! You are a very-pretty-you-tuber yourself
I was wondering where are my lost 3 MB for a very long time and always felt a bit ... cheated
Until you came along :) so easy, and so many new exciting possibilities

HereIM
Автор

THANK YOU, YOUR VIDEO WAS VERY HELPFUL. 🤯

miguelrequena
Автор

I will have to check this next time I'm connected to a board. I have over 500 lines of code with 6-7 libraries loaded and it tells me about 50% used. Maybe I found this setting months ago and just didn't know? I'll edit this comment when I know more.

OldCurmudgeonDP
Автор

Great topic! I was having to fiddle with this a while back too.

reanimationxp
Автор

Hey Andreas, can you do a video over Esp32 Cam and/or m5stack?
Thank you

Автор

Is it possible to allocate the total available SPIFFS for the sketch only, I don’t require the OTA or the capability to store other files I want all the memory available for the sketch only. Please help.

VikiLab
Автор

Technically, OTA doesn't need two equal sized partitions. You could copy the program directly over the original program as it's already loaded on RAM. The reason why there are two partitions is safety. If there's a problem when downloading and the program file is corrupted, a Serial reflash would be needed (which would be difficult and expensive to do in a consumer electronic product). And also, don't forget Secure Boot, used for anti-hacking, important in IoT products so that someone can't upload a malicious code exploiting the OTA update. If an error in the signature is found and the program is on the original partition, it would refuse to boot and, again, a Serial reflash would be needed. And if flash encryption is enabled, it's even more difficult to reflash via Serial. It might even be impossible depending on how you set it up, forcing you to replace the ESP32 chip (even more difficult and expensive). That means an attacker could disable an IoT alarm, for example, by simply uploading an arbitrary, not signed, program! And it would take hours to fix in a best case scenario (the victim has an electronics lab with ESP32s) to days in a worst case scenario (the product has to be sent to a technician and back to the victim)

GRBtutorials
Автор

used custom partiton table in platformIO and can confirm that you can make your main partition 3Mb


add *board_build.partitions = partitions_custom.csv* to your *platformio.ini* and your partitions_custom.csv file to the root of the project.

Dno
Автор

Hi. I was trying to get the partition plugin for arduinoIDE (francis94c/ESP32Partitions) working but did not succeed. I noticed your conversation with this plugin writer and is seems as if you got it to work. I wonder if you would consider making a video as how you manged to install it and getting it to work. thanks....

matthewnazmi
Автор

very interesting subject. thanks for sharing your knowledge. would be possible to do the same using micropython instead of Arduino IDE?

manuelcarriedo
Автор

I didn't need SPIFFS but still needed OTA, i tried this configuration and it works with HTTP OTA + BLE + MQTT. please do comment if you think there is an issue with this.

# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, , 0x1f7f00,
app1, app, ota_1, , 0x1f7f00,
eeprom, data, 0x99, , 0x200,
spiffs, data, spiffs, , 0x0,

bangonkali
Автор

I can't find a partition scheme in the tools bar, I am using Arduino IDE 1.8.12.
is there any way to solve this?

dhaniyanuar
Автор

This didn't really show the functions to fetch the partition sizes...is that available? I'm curious, because I have a v2 Heltec Lora, which has 8MB QSPI flash and I wanted to just check the allocations. I would love to find this function. Also, I might mention I'm running in VSC with platformIO and not sure if you can set those default partitions there or how. As usual, you, sir, are a master and make very excellent/quick videos that answer some very complex questions! Thank you!

jeffmcclain
Автор

They also sell ESP32 with 8/16/32Mb flash size for like $1 or $2 more

browaruspierogus
Автор

I didn´t understand what is OTA in ESP32. What is it useful for? Thanks

luissantiagoyaurikacyacuri