Main Menu

UF2 Files

Started by simonb65, March 17, 2021, 06:23:12 AM

simonb65

I'm looking for some advice on how to create UF2 files. I currently use the Arduino IDE but my CurrentRanger has the new UF2 drag/drop bootloader feature (which is a new bit of tech for me). So, I don't want to flash directly from the IDE for fear of loosing the UF2 bootloader, I'd much prefer creating the required UF2 file.

So, how do you convert a .bin file from Arduino to a compatible .UF2 file?

A step by step guide (i.e. third party tools required and method) specifically for the Current Ranger would be most welcome. Do you need the bootloader image specifically for the Current Ranger as part of that process. If so, where can I get that from

Thanks in advance.

Felix

Very straight forward. Official documentation here.

You enter the bootloader with double-tap RST.
That brings up the CR as a flash drive where you see a file called Current.uf2. That is the current main firmware running on the CR including calibration settings. Back that up whenever you want to experiment programming the CR on your own.
To restore it, enter the bootloader again, and overwrite whatever Current.uf2 firmware is running at that time.

You can program the CR with new firmware either from the IDE by compiling/uploading code straight to the CR, or by overwriting the current.uf2 with another uf2 file, which you can obtain by converting a compiled .bin file to .uf2 using a python script.

simonb65

#2
Perfect, thanks Felix. It was the python script that I needed :)

Do you have an example python command line for the CurrentRanger using the python script?

If you compile/update directly to the CR with the IDE, does that remove/overwrite the UF2 bootloader support, or does that remain intact?

Felix

I don't use that script, hence no brain space allocated to remember command lines for it  ;)
Replacing the *firmware* (via UF2 drag drop or IDE upload) does not affect the bootloader. The bootloader is what makes replacing the firmware in the first place.
However you can also replace the bootloader itself, which can be done via the same mechanism. Read the UF2 docs for more on that.

simonb65

Quote from: Felix on March 17, 2021, 11:24:30 AM
I don't use that script, hence no brain space allocated to remember command lines for it  ;)

So, which script do you use? If you already have something that generates the UF2's for the CurrentRanger, is it possible to share that? I'd prefer to use the UF2 drag and go mechanism, but the settings for generating UF2 in the script you referred to look like a mine field (and very alien to me), so if you have a method/process that already works, please could you share it.

Thanks in advance Felix.

Felix

I don't use any script. The CR itself generates the uf2 once you upload from the IDE.