Converting 4MB demo partition table for 8MB ESP32-WROVER

I’m trying to use the AWS FreeRTOS OTA demo code for the Espressif ESP32 WROVER module, but I’m using the 8 MB version of the module and a different “partition table” than the 4 MB version the demo code is configured for.

I first edited the sdkconfig.defaults file in the …/aws_demos/ directory mentioned above to the name of my partition table, but cmake rejected it as “conflicting” with the “partition-table.csv” settings. So I then edited the “partition-table.csv” file in the same directory to use my “partitions”, but now cmake is telling me my 8MB of partitions won’t fit in a 4 MB flash ( as shown in the cmake output below ).

[416/960] Generating …/…/…/partition_table/partition-table.bin

FAILED: partition_table/partition-table.bin

cmd.exe /C “cd /D C:\Work\FreeRTOS\Git_Ver\build\amazon-freertos\esp-idf\partition_table && python C:/Work/FreeRTOS/Git_Ver/amazon-freertos/vendors/espressif/esp-idf/components/partition_table/gen_esp32part.py -q --offset 0x8000 --disable-md5sum --flash-size 4MB C:/Work/FreeRTOS/Git_Ver/amazon-freertos/vendors/espressif/boards/esp32/aws_demos/partition-table.csv C:/Work/FreeRTOS/Git_Ver/build/partition_table/partition-table.bin”

Partitions defined in ‘C:/Work/FreeRTOS/Git_Ver/amazon-freertos/vendors/espressif/boards/esp32/aws_demos/partition-table.csv’ occupy 8.0MB of flash (8388608 bytes) which does not fit in configured flash size 4MB. Change the flash size in menuconfig under the ‘Serial Flasher Config’ menu.

[421/960] Building C object amazon-freertos/esp-idf/spi_flash/CMakeFiles/idf_component_spi_flash.dir/cache_utils.c.obj

ninja: build stopped: subcommand failed.

I don’t understand how to “Change the flash size in menuconfig under the ‘Serial Flasher Config’ menu” so I have two questions.

1 ) What is the “best/correct” way to change the partition table?

2 ) How do I change the partition to support 8 MB instead of 4MB?

I did change the sdkconfig.defaults file mentioned above from

CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y

to

CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y

But that didn’t help.

From some of the dozens of sdkconfig files in the FreeRTOS code, including the following “clip” from a “sdkconfig.json” file I know it should be able to be set to 8MB, but I’m not sure which sdkconfig file and which of the sdkconfig files will get “over-written” by cmake.

"ESPTOOLPY_FLASHSIZE": "4MB", 
"ESPTOOLPY_FLASHSIZE_16MB": false, 
"ESPTOOLPY_FLASHSIZE_1MB": false, 
"ESPTOOLPY_FLASHSIZE_2MB": false, 
"ESPTOOLPY_FLASHSIZE_4MB": true, 
"ESPTOOLPY_FLASHSIZE_8MB": false,

Thanks for bringing this issue to our attention.
Engineers at ESP would be able to better assist you with this ESP specific question. ESP Forums(https://www.esp32.com/viewforum.php?f=23) would be a good resource to check out for ESP support. Please get back to us if you think you would need any further support.

@tom, I have moved this question into the Espressif partner category so that you can have lineage of your conversation without needing to duplicate. The @Espressif team monitors this forum and will be able to better assist you with ESP-IDF issue and can pull in the @AWS @FreeRTOS teams as necessary so you don’t have to go back and forth.

Originally posted in the thread Custom partition table location.

@tom After running cmake command (cmake -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 -S . -B build -GNinja), please execute ./vendors/espressif/esp-idf/tools/idf.py menuconfig.

This will open configuration menu. In configuration menu, goto Serial flasher config and select Flash Size as 8MB.

Building the application after this should work.

To set flash size as 8MB by default, sdkconfig.defaults for aws_demos should be changed. Please refer to the patch attached below. In order to use updated sdkconfig.defaults, you need to remove build folder and run cmake command again.
flash_size.patch.zip (482 Bytes)

Hope this solves your issue.

Thanks
Shubham

Thanks for the help Rashed!

Hi Shubham,

Thanks for your reply!

I’m “new” to using CMake and sdkconfig files. How do I “run” the patch you sent?

Tom

@tom, Copy the patch in Amazon FreeRTOS root directory and run git apply flash_size.patch in the same directory.

1 Like

Thank you, that worked!

But now I’m having another problem.

I originally changed from the 4 MB partition table of

image

to the 8 MB partition table of

image

But I wasn’t sure if FreeRTOS needed the phy_init partition so I tried to modify the 8 MB partition table to

image

where the otadata partition is moved from 0xe000 to 0xd000 to make space for phy_init.

But now, I can’t get the new partition to “compile and link” as when the code tries to set the “state flag” into the otadata partition, it still goes to 0xe000.

So how do I get the new partition table addresses to change in the code?

I’ve tried deleting the build directory, but that didn’t help. So what else do I need to change?

I asked in another forum post, but didn’t get an answer, so what is the phy_init partition used for?

Any guidance would greatly be appreciated!

Tom

1 Like

Hello @tom,

phy_init partition is used for storing PHY initialisation data per device. Use of this partition depends on CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION configuration in menuconfig.

I don’t see any issue with partition table which will lead to compilation errors.

For more information related to partition tables and PHY partition, you can refer to documentation.

Thanks,
Shubham

1 Like