Part of the tinyboot project — start with the top-level README and the handbook.
Host-side CLI for flashing firmware to tinyboot devices over UART / RS-485.
cargo install tinybootOr from source:
cargo install --path cliEvery command that talks to a device takes --port, --baud and --uid. --uid picks one device on a shared bus by its unique id, in hex as tinyboot discover prints it. A unique prefix of whole bytes is enough. Without --uid the CLI selects the only device on the bus, and stops with an error when more than one answers. A device without addressing is used as it is. See the shared bus guide.
List the addressable devices on the bus by unique id, with mode, versions and compatibility key. With --uid, only the devices under that prefix.
tinyboot discover [--port /dev/ttyUSB0] [--baud 115200] [--uid 10]Query device info (capacity, erase size, versions, mode).
tinyboot info [--port /dev/ttyUSB0] [--baud 115200] [--uid 1032]Flash firmware to device. Accepts ELF or raw binary files.
tinyboot flash firmware.elf [--port /dev/ttyUSB0] [--baud 115200] [--reset]Erase the entire app region.
tinyboot erase [--port /dev/ttyUSB0] [--baud 115200]Reset the device. Use --bootloader to reboot into the bootloader instead of the app.
tinyboot reset [--port /dev/ttyUSB0] [--baud 115200] [--bootloader]Store the baud the bootloader runs at from its next start, then reset the device back into its current mode. In bootloader mode the CLI reconnects at the new rate to check that the bootloader answers. default restores the bootloader's build default.
tinyboot baud 1000000 [--port /dev/ttyUSB0] [--baud 115200]
tinyboot baud default [--port /dev/ttyUSB0] [--baud 1000000]Convert an ELF to a flat binary (same extraction logic as flash).
tinyboot bin firmware.elf -o firmware.binIf --port is omitted, the CLI probes USB serial ports (usbmodem, ttyACM, ttyUSB) by sending a Select with an empty prefix and listening for any reply. Non-USB serial ports are skipped. Addressable devices answer with their id, others with Unsupported, in the bootloader and in apps running poll() alike, so auto-detection works in either mode.
On a single-wire bus where the host's TX and RX are tied to the data line (DXL chains, most RS-485 hookups), the host hears its own request frame before the device replies. The CLI skips any frame whose status is Request — devices never reply with that status — so single-wire setups work without extra flags.
When given an ELF file, the CLI extracts ALLOC sections using physical addresses (LMA) from PT_LOAD segments. Sections named .uninit* are skipped. LMAs below 0x0800_0000 are adjusted by adding the CH32 flash base offset.
Raw binary files (no ELF magic) are used as-is.
Use -v (debug) or -vv (trace) for protocol-level diagnostics:
tinyboot -v flash firmware.elf
tinyboot -vv flash firmware.elfOr set RUST_LOG directly:
RUST_LOG=debug tinyboot flash firmware.elf