DOKK / manpages / debian 12 / python3-uflash / uflash.1.en
UFLASH(1) User Commands UFLASH(1)

uflash - utility for flashing the BBC micro:bit with Python scripts and the MicroPython runtime

uflash [--runtime RUNTIME] [--watch] [--minify] [source] [target [target...]]

uflash --extract HEXFILE [source]

uflash --version

uflash --help

uflash flashes Python onto a BBC micro:bit or extracts Python source from a .hex file. If no path to the micro:bit is provided, uflash will attempt to autodetect the correct path to the device. If no path to the Python script is provided, uflash will flash an unmodified MicroPython firmware onto the device.

uflash supports the following options:

use the specified MicroPython runtime file
watch the source file for changes
minify the source
extract Python source from given hex file
the Python source file to flash or extract to
path to one or more mounted micro:bit devices
display usage information and exit
display current version and exit

If you type the command on its own then uflash will attempt to find a connected BBC micro:bit and flash an unmodified default version of the MicroPython runtime onto it:

$ uflash
Flashing Python to: /media/ntoll/MICROBIT/micropython.hex
    

To flash a version of the MicroPython runtime with a specified script embedded within it (so that script is run when the BBC micro:bit boots up) then pass the path to the Python script in as the first argument to the command:

$ uflash my_script.py
Flashing Python to: /media/ntoll/MICROBIT/micropython.hex
    

You can let uflash watch for changes of your script. It will be flashed automatically every time you save it:

$ uflash --watch my_script.py
    

At this point uflash will try to automatically detect the path to the device. However, if you have several devices plugged in and/or know what the path on the filesystem to the BBC micro:bit already is, you can specify this as a second argument to the command:

$ uflash myscript.py /media/ntoll/MICROBIT
Flashing Python to: /media/ntoll/MICROBIT/micropython.hex
    

You can even flash multiple devices at once:

$ uflash myscript.py /media/ntoll/MICROBIT /media/ntoll/MICROBIT1
Flashing Python to: /media/ntoll/MICROBIT/micropython.hex
Flashing Python to: /media/ntoll/MICROBIT1/micropython.hex
    

To extract a Python script from a hex file use the “–extract” flag like this:

$ uflash --extract something.hex myscript.py
    

This will save the Python script recovered from “something.hex” into the file “myscript.py”. If you don’t supply a target the recovered script will emit to STDOUT.

If you’re developing MicroPython and have a custom runtime hex file you can specify that uflash use it instead of the default version of MicroPython in the following way:

$ uflash --runtime=firmware.hex
    

The default MicroPython firmware file is located in /usr/share/firmware-microbit-micropython/firmware.hex.

Upstream bug tracker: https://github.com/ntoll/uflash/issues

Copyright 2015-2018 Nicholas H.Tollervey and others.

This manual page is based on the uflash documentation. It was created by Nick Morrott <nickm@debian.org> for the Debian GNU/Linux system, but may be used by others

mu-editor(1)

https://uflash.readthedocs.io/en/latest/

December 2018 1.2.4+dfsg