Skip to content

ports: Provide VFS ROM support for the MIXRT, SAMD, NRF and Renesas port. #17452

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

robert-hh
Copy link
Contributor

Provide VFS ROM support for the MIXRT, SAMD, NRF and Renesas port.

This is a combined PR with commits for each of the mentioned ports. It's based on the implementation already merged
for ESP8266, ESP32 and RP2. The PR is meant as reminder that the implementation is still due for these ports.

Testing

Tested with a set of boards from each of the ports. Details are shown in the respective commit messages.

robert-hh added 4 commits June 6, 2025 21:00
The default size is 256k. It can be changed in mpconfigboard.h by
defining MICROPY_HW_ROMFS_BYTES to a different value, but it must
not be smaller than a single sector.

Define and use vfsrom_start and vfsrom_end for the VfsRom file system.
The way they are set in the MCU loader files, VfsRom will be placed
between the text segment and the existing vfs files system area.
The size of the VfsRom file system is set in Makefile or one of the
board .mk files by setting the symbol MICROPY_HW_ROMFS_BYTES.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
SAMD21:

The VfsRom file system has a size of 15k or 16k and is placed at the
upper end of the flash. Implication:

- Without SPIFLASH: Reduce the internal LFS file system from 64k to 42k,
  leaving about 7k headroom for future code changes.
  Use the object-based capabilities for VfsRom. The VfsRom size is 15k.
- With SPIFLASH: Remove the onewire, ds18x20 and dht drivers from
  frozen bytecode as they can be placed into the vfsRom files when
  needed. The VfsRom size is 16k.
  Use the rom_ioctl functions for VfsRom, since the flash devices for
  the regular file system and VfsRom are different.

SAMD51:

The VfsRom file system has a size default of 64k for SAMD51x19 and
256K for SAMD51x20. It is placed at the upper end of the flash.
Implication:

- Without SPIFLASH: Reduce the internal LFS file system from 128k to
  64k.
- With SPIFLASH: Reduce the code size from 496K to 432K. If that is
  not sufficient for some boards or configurations, it can be
  changed for each board or board variant.

Genneral:

- Update to use new rom_ioctl protocol.
- Add the buffer protocol to samd_flash_type.
  It is needed for VfsRom at devices without external flash.

- samd/samd_flash: Round up number of pages.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
VfsRom file system sizes:

EK_RA4M1: 12K
RA4M1_CLICKER: 12k
EK_RA4W1: 64k
EK_RA6M1: 64k
EK_RA6M2: 128k
EK_RA6M5: 256k
ARDUINO_PORTENTA_C33: 192k

Tested with Weact RA4M1 core board with EK_RA4M1 firmware and EK_RA6M2.
More boards have to be tested.

renesas-ra: Update to use new rom_ioctl protocol.

Signed-off-by: robert-hh <robert@hammelrath.com>
Signed-off-by: Damien George <damien@micropython.org>
Using the object based capabilities, which avoids complication about
different flash block sizes. VfsROM fs sizes:

NRF51x22: 12K
NRF52632: 128K
NRF52840: 128K
NRF9160:  128K

Tested with Microbit and  Arduino Nano Connect. Problem with the test:
the MicroBit RAM is too small to run mpremote even if that is the board
where VfsROM would be most helpful. So a special small loader would be
needed.

Use frozen _boot.py to set up and mount the file system, replacing a
mix of C-Code and Python code. The mkfs part has been
simplified to save code.

Update to use new rom_ioctl protocol.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
Copy link

github-actions bot commented Jun 7, 2025

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt: +2232 +0.599% TEENSY40[incl +12(data)]
        rp2:    +0 +0.000% RPI_PICO_W
       samd:  +696 +0.259% ADAFRUIT_ITSYBITSY_M4_EXPRESS[incl +36(bss)]
  qemu rv32:    +0 +0.000% VIRT_RV32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy