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

NEED help in setting up partition Scheme/Table for ESP32-WROOM-32D (8MB) #4551

Closed
Electro-boy opened this issue Nov 18, 2020 · 26 comments · Fixed by #6758
Closed

NEED help in setting up partition Scheme/Table for ESP32-WROOM-32D (8MB) #4551

Electro-boy opened this issue Nov 18, 2020 · 26 comments · Fixed by #6758
Assignees
Labels
Status: Solved Type: Documentation Issue pertains to Documentation of Arduino ESP32 Type: For reference Common questions & problems

Comments

@Electro-boy
Copy link

Am trying to find partition table for enabling partition scheme with boards.txt.
Am using a 8MB flash version of ESP32-WROOM-32D from digikey.
https://www.digikey.in/product-detail/en/espressif-systems/ESP32-WROOM-32D-8MB/1904-1024-6-ND/9381749

I am trying to increase the APP size to 4MB and SPIFFS to 3MB without OTA.

how to create the partition table for the 8MB FLASH Module.

Please Someone guide me.

I have arrived at these lines for scheme. will it work?

# Name,Type,SubType,Offset,Size,Flags
nvs,      data,  nvs,     0x9000,    0x5000	,
phy_init, data,  phy,     0xe000,    0x2000	,
factory,  app,   factory, 0x10000,   0x3500000	,
spiffs,   data,  spiffs,  0x3510000,  0xF0000	,

@lbernstone
Copy link
Contributor

lbernstone commented Nov 18, 2020

arduino-esp32 includes OTA whether you need it or not. So, you need to have otadata and ota_0 rather than a factory partition. Note that the app will calculate offsets if not included. 8MB = 0x800000. If you save this file as partitions.csv in your sketch folder, Arduino IDE will use it instead of the selected partition scheme (but the maximum sketch size still comes from that...)

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000, 0x5000,
otadata,  data, ota,           , 0x2000,
app0,     app,  ota_0,         , 0x400000,
spiffs,   data, spiffs,        , 0x300000,

@lorol
Copy link
Contributor

lorol commented Nov 19, 2020

@lbernstone
If this is the case (mandatory including OTA), then could you please revise the examples proposed here for correctness?
What is the size difference between ota and ota_0 for?
https://github.com/espressif/arduino-esp32/tree/master/tools/partitions
There are 8M and 16MB templates
Also, some of them are rendered in a nice table by GitHub web, others not. I guess it depends of having enough commas matching first line.

@lbernstone
Copy link
Contributor

All the included partition schemes include otadata. https://docs.espressif.com/projects/esp-idf/en/v3.3.4/api-reference/system/ota.html#ota-data-partition. If you find the cosmetic discrepancies a problem, you are welcome to fix them.

@lorol
Copy link
Contributor

lorol commented Nov 19, 2020

Got it, I missed ota-data word. All good.

@lorol
Copy link
Contributor

lorol commented Nov 20, 2020

@lbernstone

If you save this file as partitions.csv in your sketch folder, Arduino IDE will use it instead of the selected partition scheme

I didn't know this and it is interesting ... I am testing it also on the Java arduino-esp32fs-plugin and it works well.
Just the Offset and Size values must be present (for now) so the tool can flash properly the data partition, unless offsets calculation is done as well ...

@lorol
Copy link
Contributor

lorol commented Nov 24, 2020

Hi @lbernstone again.
Slightly off-topic but on identical subject.
I have really hard time to let Arduino IDE under win10 zip installation to "take" the partition.csv from sketch folder.
Really annoying and spent a lot of time.
I see with debug that it copies from sketch to build place according to platform.txt line:

recipe.hooks.prebuild.1.pattern.windows=cmd /c if exist "{build.source.path}\partitions.csv" copy /y "{build.source.path}\partitions.csv" "{build.path}\partitions.csv"

And file is there,
Even later gen_esp32part.exe makes the bin from it.
But at the end, it always gives the default Sketch uses 239044 bytes (18%) of program storage space. Maximum is 1310720 bytes.
The partition.csv table is:

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x100000,
app1,     app,  ota_1,           ,0x100000,
spiffs,   data, spiffs,          ,0x1F0000,

app should not be 1310720 size, right? Any help on this?

@lbernstone
Copy link
Contributor

As mentioned above, Arduino decides the maximum sketch size from the chosen partition scheme. It is not looking at the partition table. Pick a scheme with a very large app size to get around this.

@lorol
Copy link
Contributor

lorol commented Nov 24, 2020

Actually, the Arduino IDE doesn't seem to really care about partition.csv at sketch folder!
Same as described here: #703
You need to modify boards.txt with 3 new entries for your board and add the custom csv together with others, example, I copied my custom partition.csv as my.csv where all others are for Arduino IDE pick-up, and modified the boards.txt:

ttgo-t1.menu.PartitionScheme.my=My with OTA (1MB APP/2MB SPIFFS)
ttgo-t1.menu.PartitionScheme.my.build.partitions=my
ttgo-t1.menu.PartitionScheme.my.upload.maximum_size=1048576

to get custom partition taken from IDE menu

@lorol
Copy link
Contributor

lorol commented Nov 24, 2020

I got that ... But why it copies the partition.csv from sketch to build and makes bin table anyway?
While it "works" (builds) by selecting large enough from menu, It messes-up when i use the tool to upload based on present partition.csv
In 2 words, the menu of IDE is not overridden only by having your custom partition.csv near the sketch .... too bad. I would be nice if it FW building takes directly if exists, as I get the tool to do it for DATA

@lorol
Copy link
Contributor

lorol commented Nov 24, 2020

Wow! It is very confusing,
Sorry ... after tests it turns out that IDE considers the partition.csv at sketch folder but is really gray zone.
IDE is taking the upload.maximum_size from selected menu scheme and what you see for % usage and "Maximum is 1310720 bytes." may not be not exactly the truth ...

Also I found another reason of my ongoing troubles: in my custom partition file, I had non-ascii invisible symbol paste from value copied from M$ Windows Calculator app in Programmer mode, and it even was in a commented line:
#4M total 0x400000 :: 23 34 4d 20 74 6f 74 61 6c 20 30 78 34 30 30 30 30 30 0d 0a 23 30 78 31 30 30 30 30 30 20 e2 80 ad 31 30 34 38 35 37 36 e2 80 ac

@jshep321
Copy link

jshep321 commented Jan 18, 2021

Hi,
I made a quick reference excel sheet for the ESP32-WROOM (4MB flash) partition tables. It's quick and dirty, but gives an overview of what is available in the commonly used settings.
image

And the worksheet:
calcs for ESP32 partitions.xlsx

@stale
Copy link

stale bot commented Jun 22, 2021

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jun 22, 2021
@capedra
Copy link

capedra commented Jul 5, 2021

Wait. What if I want to put 4 mb for the app and 4 mb for the ota?

@stale
Copy link

stale bot commented Jul 5, 2021

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Jul 5, 2021
@capedra
Copy link

capedra commented Jul 5, 2021

What about 8 mb for the app and 8 mb for the ota? Does the ESP-32 still have the 2 mb limit for the sketch? I'm already using almost 100% of the 2 megabytes.

@lbernstone
Copy link
Contributor

ESP32 has no restriction on the app size. Arduino will complain if you exceed the partition size as listed by the selected scheme. This can be changed in boards.txt

@aminbaig
Copy link

Hi all,

I tweaked my esp32 cam module and removed the 4mb flash chip, instead replaced it with a 16mb chip. It is detected and working with the standard 16mb partition scheme, I have been trying to change the partition to have 6mb capacity for ota_0 and OTA_1. that should leave me with 4mb for other needed partitions.

Can anyone share a partition scheme to achieve that or point me to the right direction?

@stale
Copy link

stale bot commented Oct 2, 2021

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Oct 2, 2021
@VojtechBartoska VojtechBartoska added Status: Awaiting triage Issue is waiting for triage Status: To be implemented Selected for Development and removed Status: Stale Issue is stale stage (outdated/stuck) labels Mar 30, 2022
@VojtechBartoska
Copy link
Collaborator

Hello, we will take a look on this issue and evaluate it soon. Thanks for your contribution.

@igrr
Copy link
Member

igrr commented Apr 5, 2022

It seems that the partition tables can be customized at sketch level. The task here is to document this capability and maybe add an example.

@igrr igrr added Type: For reference Common questions & problems Type: Documentation Issue pertains to Documentation of Arduino ESP32 Status: Opened and removed Status: To be implemented Selected for Development Status: Awaiting triage Issue is waiting for triage labels Apr 5, 2022
@VojtechBartoska
Copy link
Collaborator

@zekageri
Copy link

zekageri commented Apr 27, 2022

# Name,     Type,   SubType,    Offset, Size,       Flags
nvs,        data,   nvs,        0x9000, 0x5000,
otadata,    data,   ota,        ,   0x2000,
app0,       app,    ota_0,          ,   0x2DC6C0,
app1,       app,    ota_1,          ,   0x2DC6C0,
spiffs,     data,   spiffs,         ,   0x982680,

On sketch upload:
WARNING: Partition spiffs not aligned to 0x1000.This is deprecated and will be considered an error in the future release.

On flash upload:

Auto-detected Flash size: 16MB
WARNING: Flash address 0x005c8d80 is not aligned to a 0x1000 byte flash sector. 0xd80 bytes before this address will be erased.

What is up with that?

Board is ESP32-WROVER-E 16mb flash and 8mb psram :O

On boot:
FS - Failed to mount the filesystem

@me-no-dev
Copy link
Member

means that the last digits of partition addresses and sizes must end on 0x000 instead of 0x6C0

@zekageri
Copy link

I see. Thanks. So it can not calculate the offsets by itself? Or the problem is that i added rounded numbers. 👍 ( i cant find the exact flash size it's says just 16mb :| )

@hamza765
Copy link

@zekageri use binary bytes. So 16M = 16777216 Bytes. In hex, that's 0x1000000

This is included in the repo: https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/large_spiffs_16MB.csv

@zekageri
Copy link

@zekageri use binary bytes. So 16M = 16777216 Bytes. In hex, that's 0x1000000

This is included in the repo: https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/large_spiffs_16MB.csv

Yeah, thank you that was obvious. Iam dumb a.f. thanks

@VojtechBartoska VojtechBartoska moved this from To do to Selected for Development in Documentation Roadmap May 4, 2022
@pedrominatel pedrominatel moved this from Selected for Development to In progress in Documentation Roadmap May 16, 2022
@pedrominatel pedrominatel moved this from In progress to In Review in Documentation Roadmap May 16, 2022
@VojtechBartoska VojtechBartoska moved this from In Review to Done in Documentation Roadmap May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Solved Type: Documentation Issue pertains to Documentation of Arduino ESP32 Type: For reference Common questions & problems
Development

Successfully merging a pull request may close this issue.