diff options
author | Damien George <damien@micropython.org> | 2025-05-20 10:33:21 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-06-14 01:03:44 +1000 |
commit | 2a0e2b578265bac43e158bccb195ca88ffea64c4 (patch) | |
tree | 3df5ad34836a0ef36f744517e1b2a0243214e51e /extmod/asyncio/core.py | |
parent | 398da22492d9e593f87f0b9ae4fc043f8b2b8a11 (diff) | |
download | micropython-2a0e2b578265bac43e158bccb195ca88ffea64c4.tar.gz micropython-2a0e2b578265bac43e158bccb195ca88ffea64c4.zip |
esp32/main: Auto detect the size of flash and auto create vfs partition.
Currently in the esp32 port the size of the SPI flash must be configured at
build time, eg 4MiB, 8MiB, etc. Also, the esp32 partition table must be
configured at build time, which depends on the size of the SPI flash. A
bigger flash means more can be allocated to the user filesystem.
This commit makes it so the SPI flash size is automatically determined at
runtime, and the filesystem size is automatically set to take up as much
room as possible (a "vfs" partition is created automatically if it doesn't
exist).
This works by:
- Setting the SPI flash size to be 4MiB in the build (or some other value,
as long as the firmware app fits).
- Removing the vfs partition from the esp32 partition table (only nvs,
phy_init and firmware, and maybe romfs, remain in the partition table).
- At boot, query the physical size of the SPI flash and use that as the
actual size in the code.
- If it doesn't already exist, automatically create a "vfs" partition which
takes up the flash from the end of all existing partitions to the end of
flash.
This allows simplifying a lot of board configurations, and removing some
board variants that just change the flash size (to be done in a following
commit).
It's also fully backwards compatible, in the following sense:
- Existing boards with MicroPython firmware will continue to work with the
same filesystem, ie the filesystem won't be erased when the firmware is
updated.
- If a user has a custom esp32 partition table and installs MicroPython as
a bare app into the app partition, the new MicroPython firmware will
honour the esp32 partition table and use either "vfs" or "ffat"
partitions as the filesystem.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/asyncio/core.py')
0 files changed, 0 insertions, 0 deletions