Skip to content

Add littlefs component, with submodule and VFS bindings (WIP) - #3847

Closed
dpgeorge wants to merge 12 commits into
micropython:masterfrom
dpgeorge:littlefs-add
Closed

dpgeorge wants to merge 12 commits into
micropython:masterfrom
dpgeorge:littlefs-add

Conversation

@dpgeorge

@dpgeorge dpgeorge commented Jun 7, 2018 •

Copy link
Copy Markdown
Member

This PR is work-in-progress to add littlefs as a new component for a new VFS. Currently works on unix coverage build and stm32 (pyboard etc). See tests/extmod/vfs_little.py for a demo/test, and ports/stm32/pyblittlefs.c for stm32 configuration.

Still to do:

  • allow to open more than one file at a time (likely requires patching littlefs library to make it work smoothly with uPy)
  • properly define a new "block" device protocol at the Python level (can't be the same as the one used for FAT FS because it's not really a "block" device but rather requires read/write/erase)
  • support for better compile-time configuration on stm32, to select which SPI flash device and blocks to use for the storage

@chuckbook chuckbook left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that extmod/vfs.h should be included in pyblittlefs.c if MICROPY_VFS_LITTLEFS is true.

@dpgeorge

Copy link
Copy Markdown
Member Author

It seems that extmod/vfs.h should be included in pyblittlefs.c if MICROPY_VFS_LITTLEFS is true.

Thanks, now fixed!

@dpgeorge

Copy link
Copy Markdown
Member Author

Some of the commits here were merged to master (the ones related to a refactoring of the drivers/memory/spiflash driver), and this PR was rebased and force-pushed.

Comment thread .gitmodules Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I go to https://github.com/geky/littlefs in my web browser it automatically redirects to https://github.com/ARMmbed/littlefs ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I made this PR the littlefs project moved to the ARMmbed organisation. I'll update the link.

Comment thread extmod/vfs_littlefs.c Outdated

@lurch lurch Jun 20, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm probably missing something obvious, but a) the functionality of strspn and strcspn appears to be identical, and b) neither of these functions actually seem to be used?

EDIT: Ooops, I finally spotted that one is doing != NULL and the other is doing == NULL 😊

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither of these functions actually seem to be used?

They are used within littlefs itself. The linker will complain if they are not defined.

dpgeorge added 7 commits June 28, 2018 13:50
As a test/example, external SPI flash is mounted automatically on boot.
The configuration for this is defined at the top of pyblittlefs.c.
Runs on unix coverage and stm32.
This needs to be enabled by a particular board when it wants to have a
native littlefs filesystem.
@dpgeorge

Copy link
Copy Markdown
Member Author

I pushed some changes to this branch:

  • littlefs updated to v1.5
  • add support for opening multiple littlefs files at the same time

@andrewleech

Copy link
Copy Markdown
Contributor

For reference, I've got a rebased copy of this with some minor additional patches available at: https://github.com/andrewleech/micropython/tree/littlefs

@dpgeorge dpgeorge mentioned this pull request May 29, 2019
13 of 17 tasks
@andrewleech

Copy link
Copy Markdown
Contributor

Chatting about this on slack, "Scott (tannewt)" brought up GhostFat from https://github.com/lancaster-university/codal-core/blob/master/source/drivers/GhostFAT.cpp as a possible avenue for maintaining mass storage support with littlefs etc in a safer way. It' implements fake block interface for mass storage, pretending to be fat.

This looks to be very similar too: https://github.com/mmoskal/uf2-stm32f/blob/master/ghostfat.c
Originally by microsoft, used for the same purpose but in this case part of a stm32 mass storage based bootloader.

@dpgeorge

Copy link
Copy Markdown
Member Author

Superseded by #5330, which was merged at 6b3404f

@dpgeorge dpgeorge closed this Nov 25, 2019
@dpgeorge
dpgeorge deleted the littlefs-add branch November 25, 2019 13:26
dhalbert pushed a commit to tannewt/circuitpython that referenced this pull request Dec 24, 2020
adafruit_bus_device: Don't transmit STOP condition in write_then_readinto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants