c4ev3 / ev3duder

The LEGO® EV3 Downloader/UploaDER.
http://c4ev3.github.io/ev3duder/doc/html/globals_func.html
GNU General Public License v3.0
34 stars 12 forks source link

[Feature Request] Support for UF2 files #15

Closed JakubVanek closed 4 years ago

JakubVanek commented 4 years ago

Hi!

I think that it might be useful for ev3duder to have the ability to handle UF2 files. The format is seems like just a block-based file container. It is documented here and here is a reference implementation that looks like some older version of it is running on the actual brick.

In particular, I have the following functionality in mind:

Best regards,

Jakub

JakubVanek commented 4 years ago

It turns out path mapping does not need to be configurable. The uf2d executable in the stock firmware contains some strings looking exactly like https://github.com/microsoft/uf2-linux/blob/751b0f4e589583012ab6e3fac4a86f239933257b/uf2daemon/fat.c#L246.

"Projects"       -> "/mnt/ramdisk/prjs/BrkProg_SAVE"
"SD Card"        -> "/media/card/myapps"
"USB Stick"      -> "/media/usb/myapps"
"Temporary Logs" -> "/tmp/logs"
"Permanent Logs" -> "/mnt/ramdisk/logs"

However, compared to how uf2d handles this currently, I'd always create a separate directory for a given program. This would help with program deletion not only Linux, but all platforms, as it seems that it is not possible to bypass the directory mapping.

Therefore I propose the following command line interface:

ev3 uf2 pack <output uf2 file> <brick directory> <files...>
ev3 uf2 unpack <output directory> [--no-paths] <uf2 files...>
ev3 uf2 upload [--uf2d] <uf2 files...>
ev3 uf2 remove [--uf2d] <uf2 files...>