Skip to content

rp2: FatFS filesystem is not recreated after erasing the flash. #15779

@iabdalkader

Description

@iabdalkader

Port, board and/or hardware

rp2 port, Arduino Nano-RP2040

MicroPython version

MicroPython v1.24.0-preview.260.g09d070aa5

Reproduction

This particular board has a 16MBytes flash, 2MBytes of which are reserved for the firmware, the rest is for the filesystem. A write of about ~3MBs should be enough to erase the firmware + the filesystem's partition table, but I tested with 16MBytes:

dd if=/dev/zero of=flash.bin bs=1M count=16

Get the board in bootloader mode, with double tap (on Arduino board) or jumper on other boards etc.. then write the binary to flash (erasing everything):

picotool load flash.bin

After it's done, and reset, the ROM bootloader runs. Load MicroPython, for example:

picotool load -x ARDUINO_NANO_RP2040_CONNECT.uf2

Try to use the filesystem:

>>> import os
>>> os.stat(".")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

Expected behaviour

I expected it to detect that there's no valid filesystem and re-create it.

Observed behaviour

The board boots MicroPython, the storage device is mounted, however it doesn't have a valid filesystem now:

>>> import os
>>> os.stat(".")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

>>> import vfs
>>> import machine, rp2
>>> bdev = rp2.Flash()
>>> fs = vfs.VfsFat(bdev)
>>> vfs.mount(fs, "/")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      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