8000 Add littlefs component, with submodule and VFS bindings (WIP) by dpgeorge · Pull Request #3847 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

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

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

Closed
wants to merge 12 commits into from

Conversation

dpgeorge
Copy link
Member
@dpgeorge dpgeorge commented Jun 7, 2018

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

Copy link
@chuckbook chuckbook left a comment

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
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
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.

.gitmodules Outdated
@@ -15,3 +15,6 @@
path = lib/stm32lib
url = https://github.com/micropython/stm32lib
branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0
[submodule "lib/littlefs"]
path = lib/littlefs
url = https://github.com/geky/littlefs.git
Copy link
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
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.

++s;
}
return s - ss;
}
Copy link
Contributor
@lurch lurch Jun 20, 2018

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
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.

8000

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
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
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

@andrewleech
Copy link
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
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
0