Files
micropython/ports/samd/samd_flash.c
robert-hh c07b178dbd samd: Add support for VfsRom filesystem for SAMD21 and SAMD51.
The flash driver is update to support the new `mp_vfs_rom_ioctl()`
function, and the buffer protocol is added to `samd_flash_type` (it is
needed for VfsRom on devices without external flash).

For SAMD21, only boards with external SPI flash have VfsRom enabled, due
to size constraints.  For such boards, the VfsRom filesystem has a size of
12k and is placed at the upper end of the flash.  The `onewire`, `ds18x20`
and `dht` drivers have been removed from frozen bytecode as they can be
placed into the VfsRom files when needed.

For SAMD51, the VfsRom filesystem has a default size of 64k for SAMD51x19
and 256K for SAMD51x20.  It is placed at the upper end of the flash.
For boards with external SPI flash, the code size is reduced from 496K to
432K.  If that is not sufficient for some boards or configurations, it can
be changed for each board or board variant.

Tested with ADAFRUIT_ITSYBITSY_M0_EXPRESS, ADAFRUIT_ITSYBITSY_M4_EXPRESS,
SPARKFUN_SAMD51_THING_PLUS, SEEED_XIAO_SAMD21, SAMD_GENERIC_D51X19, and
SAMD_GENERIC_D51X20.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
2026-01-02 15:23:49 +11:00

9.2 KiB