LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

teensy_loader_cli

Command-line Teensy microcontroller firmware loader

TLDR

Program a Teensy 3.2/3.1 hex file (wait for button)
$ teensy_loader_cli --mcu=mk20dx256 -w [blink.hex]
copy
Program using a board name alias
$ teensy_loader_cli --mcu=TEENSY32 -w [firmware.hex]
copy
Program Teensy 4.0
$ teensy_loader_cli --mcu=TEENSY40 -w [firmware.hex]
copy
Soft reboot then program (Linux)
$ teensy_loader_cli --mcu=TEENSY32 -s -w [firmware.hex]
copy
Program without rebooting into application
$ teensy_loader_cli --mcu=TEENSY32 -n -w [firmware.hex]
copy
Verbose programming
$ teensy_loader_cli --mcu=TEENSY32 -v -w [firmware.hex]
copy

SYNOPSIS

teensy_loader_cli --mcu=MCU [-w] [-r] [-s] [-n] [-v] *file.hex*

DESCRIPTION

teensy_loader_cli is the command-line Teensy Loader from PJRC for automating firmware uploads (typically from a Makefile). Most interactive users prefer the graphical loader in Automatic Mode; this CLI is for advanced/CI workflows.You must specify the target MCU with --mcu=. Values match gcc-style chip names or logical board names such as TEENSY32, TEENSY40, TEENSY41, TEENSYLC, and others listed in the project README.On Linux, non-root access usually needs the Teensy udev rules from https://www.pjrc.com/teensy/00-teensy.rules. Building from source requires gcc and often libusb development packages (libusb-dev on Debian/Ubuntu).

PARAMETERS

--mcu=MCU

Required. Target processor or board alias (for example mk20dx256, TEENSY32, TEENSY40, imxrt1062, mkl26z64, atmega32u4).
-w
Wait for the device to appear (HalfKay / button press). Hex is read before waiting and again after detect.
-r
Hard reboot via a second Teensy running rebootor code (pin C7 to reset). Enables fully unattended programming.
-s
Soft reboot request on Linux: finds a Teensy running Teensyduino USB Serial and asks it to reboot into the bootloader.
-n
Do not reboot into the application after programming; leave HalfKay running.
-v
Verbose status output.
*file.hex*
Intel HEX firmware image to program.

INSTALL

sudo apt install teensy-loader-cli
copy
sudo pacman -S teensy_loader_cli
copy
brew install teensy_loader_cli
copy
nix profile install nixpkgs#teensy-loader-cli
copy

CAVEATS

Programming a HEX built for the wrong chip can hang USB PLL init and confuse the host USB port; recovery may need holding the reset button before connecting USB. Use matching udev rules. Graphical loader is easier for one-off flashing.

SEE ALSO

avrdude(1), dfu-util(1), openocd(1)

RESOURCES

Copied to clipboard
Kai