c4ev3/ev3duder

How to upload an uf2 file

Opened this issue · 2 comments

Hi,

With the new uf2 pack(#15) command it is my understanding that you can upload and run an UF2 file from makecode.org directly on an EV3, but I have somehow failed to understand the steps. I try:

  1. Create a file and download it (named lego-untitled.uf2)
  2. ev3duder uf2 pack /home/user/lego-untitled.uf2 Projects test
  3. ...

That is, step 3 does not return anything meaningful - nor do I find the file on my EV3. Any tips on what I'm doing wrong? What is the correct usage of the third argument (test) - what does it do?

Regards,
Tarjei

Hi!

I originally planned to implement uploading as well, but so far I only implemented packing & unpacking. pack should create a UF2 archive from a specified set of files, unpack should extract files from a UF2 archive.

Currently there are two ways of uploading a UF2 file:

  • Manually copy the UF2 file into the emulated USB drive that appears after an EV3 with firmware >=1.10E is plugged into a PC. This should work well on Windows, but on Linux there is an issue with the format of the emulated filesystem. I found a workaround for this, but it relies on some commands:
sudo mkdir /mnt/ev3                                     # prepare temporary directory
sudo umount /dev/<name of the emulated device>          # unmount, if mounted (OK if it fails)
sudo mount /dev/<name of the emulated device> /mnt/ev3  # remount it in the temporary directory
cp file.uf2 /mnt/ev3/                                   # copy over the UF2 (do not run ls or other commands!)
sudo umount /mnt/ev3                                    # unmount the filesystem
sync                                                    # force changes to propagate to the brick
  • Unpack the files from the UF2 file using ev3duder uf2 unpack test.uf2 tmpdir and upload them using ev3duder up:
ev3duder up tmpdir/file.rbf /home/root/lms2012/prjs/file.rbf
ev3duder up tmpdir/file.elf /home/root/lms2012/prjs/file.elf

It should be possible to build uf2 uploading into ev3duder. However, I think some refactoring may be needed to prevent code duplication. I don't currently have much free time, but I'll try to look into that in the coming months.

With regards,
Jakub

@JakubVanek thanks!

At least now I got some pointers to where I should start :)