abin2uf22

Deprecated, use makeuf2 now.

Overview

abin2uf22 is a Python program that

  • transmogrifies Astrobe’s .bin file into UF2 format,
  • can optionally directly upload the UF2 file to the Pico2.

The transmogrification has two aspects:

  • chop up the binary into 256 bytes blocks, inserting the required headers, and
  • add the required meta data.

The Python version used to develop the program is 3.12.

Note: abin2uf22 is a temporary placeholder name.

Installation for Command Line Usage

This is how I install abin2uf22:1

  • put abin2uf22.py into any directory, which must be on $PYTHONPATH;
  • one possibility is to leave the file in its directory in the repo structure, so you get and “install” any updates automatically. Just put the directory on $PYTHONPATH;
  • run the program with the -m option for Python (without the .py extension).

Hence, to transmogrify one of the examples, I run in the Windows PowerShell, assuming the Pico2’s drive is ‘E:’:

PS python -m abin2uf22 BlinkPlus.bin -d E:

Of course you can copy the UF2 file manually to the Pico2’s drive, without using the -d option.

Run python -m abin2uf22 -h for some help.

Installation for Astrobe’s Tool Menu

Install as outlined above, then add this – mutatis mutandis – to your Tools.ini file in the corresponding Astrobe configs folder:

[Command3]
MenuItem=Create and Upload &UF2
Path=C:\Users\gray\AppData\Local\Programs\Python\Python312\python.exe
Parameters=-m abin2uf22 %FileDir%\%FileRoot%.bin -d E:
WorkingFolder=%FileDir%
ConsoleApp=TRUE
Prompt=FALSE

The drive letter is “hard-coded”, since I don’t want to enter it with the parameter dialog of Astrobe again and again, and the Pico2 always appears at the same letter on my machine. I am sure it would be possible to extend the Python program to search for the Pico2’s drive name (it’s RP2350), ie. not the drive letter, but…

BOOTSEL

Don’t forget to put the Pico2 into BOOTSEL mode before running abin2uf2 with uploading, ie. by using option -d.

Do yourself a big favour and wire up a reset button to the RP2350’s RUN pin if you use a board without one, such as the Pico2.

Repository


  1. Which may not the “right” way to do it, but it works. ↩︎