How to get the full capacity of an 8MB or 16MB flash chip?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by Roberthh » Wed Feb 10, 2021 4:50 pm

Good. I had prepared that hint for you a few hours ago, but somehow that got lost? You can also set FLASH_SIZE in the call to make, so you do not have to change the Makefile.

make FLASH_SIZE=8MB deploy

esptool.py tries to determine the flash size. If that fails it falls back to automatic.

bertel
Posts: 27
Joined: Tue Feb 09, 2021 3:55 pm
Location: Tokyo

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by bertel » Thu Feb 11, 2021 7:55 am

Thank you!

While I have your ear, I have another, most likely simpler question for you, but for that, I'll open another thread.

wangshujun@tom.com
Posts: 61
Joined: Fri Feb 15, 2019 9:22 am

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by wangshujun@tom.com » Sun Feb 14, 2021 3:30 am

I use the method of modifying partitions files to recompile the firmware and get the firmware that is suitable for 16 megabytes. I actually store and test more than 8 mega bytes of files and confirm that they are normal

wangshujun@tom.com
Posts: 61
Joined: Fri Feb 15, 2019 9:22 am

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by wangshujun@tom.com » Wed Apr 14, 2021 1:21 am

wangshujun@tom.com wrote:
Sun Feb 14, 2021 3:30 am
I use the method of modifying partitions files to recompile the firmware and get the firmware that is suitable for 16 megabytes. I actually store and test more than 8 mega bytes of files and confirm that they are normal
After upgrading to 1.14 + cmake, if you modify the partition table separately, compilation will report an error, and at the same time modify the config.base The flash size in the file can be compiled, but burning to the device will still report an error

entry 0x4008063c
[0;31mE (57) flash_parts: partition 3 invalid - offset 0x200000 size 0xe00000 exceeds flash chip size 0x400000[0m
[0;31mE (57) boot: Failed to verify partition table[0m


Trying to add parameters to make has no effect

make FLASH_SIZE?=16MB
make FLASH_SIZE=16MB

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by Roberthh » Wed Apr 14, 2021 6:11 am

By chance I tried yesterday to build firmware which uses 8 MB flash. What I had to to:

a) create a partition table for that 8 MB flash and place it in the esp32 directory. The name is arbitrary. I named it partitions_8mb.csv. My copy:

Code: Select all

# Name,   Type, SubType, Offset,  Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 0x1F0000,
vfs,      data, fat,     0x200000, 0x600000,
b) create a board definition subdirectory for that board. That could be a copy of the most similar board. I called it GENERIC_SPIRAM_8MB. But you can give it any suitable name. That name is used in the make command and in the changed mpconfigboard.cmake (see below).
c) create a file sdkconfig.board in the board directory which sets the flash size and partition table name. My version:

Code: Select all

CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_8mb.csv"
c) change the mpconfigboard.cmake file in adding the name of the sdkconfig.board file. Mine looks as follows after the change:

Code: Select all

set(SDKCONFIG_DEFAULTS
    boards/sdkconfig.base
    boards/sdkconfig.ble
    boards/sdkconfig.spiram
    boards/GENERIC_SPIRAM_8MB/sdkconfig.board
)

set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
Then you can build & flash the image with

make BOARD=<new_board_name> deploy

I do not know if that works for 16MB flash too. You have to try.

wangshujun@tom.com
Posts: 61
Joined: Fri Feb 15, 2019 9:22 am

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by wangshujun@tom.com » Thu Apr 15, 2021 3:29 am

Confirm that all three steps are required:
1. Modify partition table
2. Modification sdkconfig.base Flash size in
3. make FLASH_ SIZE?=8MB

The attachment is the script I use now. It's a stupid method, but it seems to be effective
Attachments
build-all.rar
(455 Bytes) Downloaded 210 times

jamonda
Posts: 36
Joined: Thu May 21, 2020 3:48 pm

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by jamonda » Fri Jun 18, 2021 12:04 am

Roberthh wrote:
Wed Apr 14, 2021 6:11 am
By chance I tried yesterday to build firmware which uses 8 MB flash. What I had to to:

...

I do not know if that works for 16MB flash too. You have to try.

Hi, dear Roberthh.
I tryed but I guess that recipy dos not work anymore.
I see this error:

-- Configuring incomplete, errors occurred!
See also "/home/alexandre/mp/micropython/ports/esp32/build-GENERIC_SPIRAM_8MB/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1
make: *** [Makefile:34: all] Erro 2

What am I doing wrong?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by Roberthh » Fri Jun 18, 2021 6:18 am

That mechanism should still work. Compare it to the setup for the board UM_FEATHERS2

jamonda
Posts: 36
Joined: Thu May 21, 2020 3:48 pm

Re: How to get the full capacity of an 8MB or 16MB flash chip?

Post by jamonda » Fri Jun 18, 2021 3:40 pm

I tried again and it worked. Maybe I forgot something in the process.
Thank you!

Post Reply