.\" Automatically generated by Pandoc 2.17.1.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "UFLASH" "1" "December 2018" "1.2.4+dfsg" "User Commands" .hy .SH NAME .PP \f[B]uflash\f[R] - utility for flashing the BBC micro:bit with Python scripts and the MicroPython runtime .SH SYNOPSIS .PP \f[B]uflash\f[R] [\f[B]--runtime\f[R] \f[I]RUNTIME\f[R]] [\f[B]--watch\f[R]] [\f[B]--minify\f[R]] [\f[I]source\f[R]] [\f[I]target\f[R] [\f[I]target\&...\f[R]]] .PP \f[B]uflash\f[R] \f[B]--extract\f[R] \f[I]HEXFILE\f[R] [\f[I]source\f[R]] .PP \f[B]uflash\f[R] \f[B]--version\f[R] .PP \f[B]uflash\f[R] \f[B]--help\f[R] .SH DESCRIPTION .PP \f[B]uflash\f[R] flashes Python onto a BBC micro:bit or extracts Python source from a .hex file. If no path to the micro:bit is provided, \f[B]uflash\f[R] will attempt to autodetect the correct path to the device. If no path to the Python script is provided, \f[B]uflash\f[R] will flash an unmodified MicroPython firmware onto the device. .SH OPTIONS .PP uflash supports the following options: .TP -r, --runtime \f[I]RUNTIME\f[R] use the specified MicroPython runtime file .TP -w, --watch watch the source file for changes .TP -m, --minify minify the source .TP -e, --extract \f[I]HEXFILE\f[R] extract Python source from given hex file .TP \f[I]source\f[R] the Python source file to flash or extract to .TP \f[I]target\f[R] path to one or more mounted micro:bit devices .TP -h, --help display usage information and exit .TP --version display current version and exit .SH EXAMPLES .PP If you type the command on its own then \f[B]uflash\f[R] will attempt to find a connected BBC micro:bit and flash an unmodified default version of the MicroPython runtime onto it: .IP .nf \f[C] $ uflash Flashing Python to: /media/ntoll/MICROBIT/micropython.hex \f[R] .fi .PP 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: .IP .nf \f[C] $ uflash my_script.py Flashing Python to: /media/ntoll/MICROBIT/micropython.hex \f[R] .fi .PP You can let \f[B]uflash\f[R] watch for changes of your script. It will be flashed automatically every time you save it: .IP .nf \f[C] $ uflash --watch my_script.py \f[R] .fi .PP At this point \f[B]uflash\f[R] 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: .IP .nf \f[C] $ uflash myscript.py /media/ntoll/MICROBIT Flashing Python to: /media/ntoll/MICROBIT/micropython.hex \f[R] .fi .PP You can even flash multiple devices at once: .IP .nf \f[C] $ 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 \f[R] .fi .PP To extract a Python script from a hex file use the \[lq]\[en]extract\[rq] flag like this: .IP .nf \f[C] $ uflash --extract something.hex myscript.py \f[R] .fi .PP This will save the Python script recovered from \[lq]something.hex\[rq] into the file \[lq]myscript.py\[rq]. If you don\[cq]t supply a target the recovered script will emit to STDOUT. .PP If you\[cq]re developing MicroPython and have a custom runtime hex file you can specify that \f[B]uflash\f[R] use it instead of the default version of MicroPython in the following way: .IP .nf \f[C] $ uflash --runtime=firmware.hex \f[R] .fi .SH FILES .PP The default MicroPython firmware file is located in \f[V]/usr/share/firmware-microbit-micropython/firmware.hex\f[R]. .SH REPORTING BUGS .PP Upstream bug tracker: https://github.com/ntoll/uflash/issues .SH COPYRIGHT .PP Copyright 2015-2018 Nicholas H.Tollervey and others. .SH AUTHOR .PP This manual page is based on the uflash documentation. It was created by Nick Morrott for the Debian GNU/Linux system, but may be used by others .SH SEE ALSO .PP \f[B]mu-editor\f[R](1) .PP https://uflash.readthedocs.io/en/latest/