Closed ianlevesque closed 1 year ago
I'm one of the contributors to littlefs-python and actually added some CI for some of the prebuilt wheels 😄 .
I'd be totally onboard with replacing mklittlefs
with littlefs-python
and a script. I'd actually prefer if we add a CLI to the littlefs-python
package (seems generically useful, and would avoid another script in this repo), it'd be pretty easy to do. I wonder if @jrast would be on board.
I'm spread a little thin at the moment between several projects, but if you could open a PR, I'd be available to review/merge.
Well that's a small world! This is all a hobby outside $DAYJOB so I'm not sure when, but I'll clean up / move the script part of this over to a PR against littlefs-python then and adjust the cmake changes here to use it.
If making a PR to littlefs-python, I'd recommend adding a __main__.py
and all that so that it can be accessed as a normal CLI app. You can see an example of that here:
https://github.com/pazzarpj/micropython-ustubby/pull/25/files
Not sure if geky is using the littlefs
cli name, but it might be good to name this cli littlefs-python
to prevent future colllisions.
I had some spare time and put together a minimal (and ugly coded) CLI for littlefs-python: https://github.com/jrast/littlefs-python/pull/50
Please add your ideas and inputs in the comments of the pull request.
Please add your ideas and inputs in the comments of the pull request.
I added two suggestions that would make it easier to integrate here. A lot cleaner than my hack!
Updated to use the (prerelease) version of https://github.com/jrast/littlefs-python/pull/50 for discussion. Not quite mergeable until there's an actual release.
I like this a lot more 😄 . I don't think I have any feedback on anything that needs to change, but yeah lets wait for a new littlefs-python release.
New Version 0.7.0 of littlefs-python is released! Enjoy!
@ianlevesque before merging this, I need to think about LFS_NAME_MAX a little more. I think it's actually fine if it's anything <=255, but I don't think its fully piped through in littlefs-python. My main fear/thoughts:
64
, which might be a bit on the short side, but we're kind of stuck with it.Basically, I just don't want to accidentally break anyones workflow or systems.
Yes I believe 3 & 4 to be true based on playing with the earlier version of this PR. I believe setting a high compile-time default on the python binaries and passing the value through will solve the issue.
alright, I'll try and make an upstream littlefs-python PR for that tonight!
once https://github.com/jrast/littlefs-python/pull/55 is merged/released, we'll need to perform the following actions here.
CONFIG_LITTLEFS_OBJ_NAME_LEN
value check in project_include.cmake
. We could increase the value, but the downstream CLI will error our anyways, making the check a bit redundant.--max-len=${CONFIG_LITTLEFS_OBJ_NAME_LEN}
to the littlefs-python
call.Appreciate all the effort to get this right!
@ianlevesque jrast has merged in the PR and released 0.7.1
that has these changes. If you could make the changes mentioned above, i'll merge and cut a release!
@ianlevesque sorry for mucking up your branch a little, i'll try and merge this tomorrow; esp-idf's provided docker containers for building have some absolutely ancient code (super old git, super old python) and it's been a pain. Will try and get this sorted soon.
No worries, change whatever.
merged via #143
included in release v1.9.0
This is a completely different approach, so I am curious what your thoughts are. I struggled with the, essentially total lack of, Windows support for mklittlefs in this component and came up with this alternative. Fundamentally ESP-IDF doesn't guarantee that you'll have a working host-targeting compiler present on your machine, and CMake doesn't support targeting both the host and ESP from one project either, making the previous shelling out to make with a Makefile for mklittlefs approach a bit of a hack. For SPIFFS, Espressif made a pure python 'spiffsgen.py' - probably because the ESP-IDF itself does depend upon, and guarantee a python environment. littlefs-python exists, and includes a code sample to make an image, which I adapted here. It seems to be actively maintained, and avoids the lack of host compiler situation, despite using the native littlefs, by providing prebuilt binary wheels on pypi.
I tried to keep this correct and clean by using the ESP-IDF python to create an isolated virtualenv in the cmake build directory, installing a known-compatible version of littlefs-python there, and then using it to create littlefs partition images. This avoids polluting the ESP-IDF python environment with our extra package, even though doing so would probably be harmless. I tested this on Windows 11 and macOS 13, with ESP-IDF 5.1.1.
If acceptable, this would make everything 'just work' on Windows (and not break existing platforms).