Closed carlosperate closed 3 years ago
Test are failing on formatting, I'll resolved that a bit later today.
Edit: formatting resolved but there are Python 2 compatibility issues
Edit 2: All resolved now.
@carlosperate let's talk about this at the Mu-moot this evening. I understand what's going on but, as you suggest, we need to work out how to support v2 fs copy in uFlash.
This PR has been updated with support for adding files to a Universal Hex and is ready for merge.
Things are not yet wired here, but I've done that in a different PR to simply review. It's in my fork to be able to show only the breaking changes: https://github.com/carlosperate/uflash/pull/1
LGTM :+1:
Also, I've looked at the changes on your https://github.com/carlosperate/uflash/pull/1 branch. They also look fine. The remaining work (before a new release) is to revise the docs.
This PR currently only adds a function and its tests for initial fs support. It will convert a Python script into a main.py file in the micro:bit MicroPython filesystem. However, this function is not called anywhere (only the tests), as we should discuss how we want to support this feature within uFlash (cc @ntoll).
My initial impression is that we should uprev uFlash to v2, and only support adding a main.py file. Not adding support to add more files, or to be able to read files back from the hex file.
This simple filesystem implementation will be useful for V2 support, as a replacement to the "attach a script to a known flash location" which is deprecated and not supported in V2. This is because the "add files to the hex and flash the hex" method is used in Mu as a fallback if microFS doesn't work.
Adding more fs support to uFlash would require a lot more code and tests, which we probably won't need. It is also a lot of work that we should probably route to something else, like getting Mu feature ready for the next release.
Just as reference, even the current small use-case already has to make a lot of assumptions:
bytes_to_ihex()
(these assumptions are from the original implementation):script_to_fs()
: