4 releases (2 breaking)

0.3.0 Sep 23, 2023
0.2.1 Sep 23, 2023
0.2.0 Jan 29, 2020
0.1.0 Jan 20, 2020

#865 in Hardware support

22 downloads per month

ISC license

658 lines


CI badge docs.rs badge

This is a library for the experimental minimal USB bootloader punt's PC side.


This code is ISC licenced. See LICENCE.md for details.


This crate provides a way to interact with a microcontroller with the punt bootloader connected via USB and exposes all bootloader functions.

Example: Basic flashing

use punt::{Context, UsbContext, Operation};
use std::fs::File;
use std::io::{Read, Write};

// Open binary file and read contents
let mut file = File::open("test.bin")?;
let mut buff = Vec::new();
file.read_to_end(&mut buff)?;

// Find a bootloader target
let mut context = Context::new()?;
let mut target_handle = context.pick_target(None)?.open()?;

// Fetch information about the target's bootloader
let start_address = target_handle.bootloader_info()?.application_base;

// Erase the necessary flash area
target_handle.erase_area(start_address, buff.len())?.execute()?;

// Program the buffer into flash
target_handle.program_at(buff.as_slice(), start_address)?.execute()?;

// Verify flash contents
target_handle.verify(buff.as_slice(), start_address)?;


In addition to this very basic API, it also provides functionality for progress feedback during operations like reading, erasing and flashing. See the Operation trait for details.


~34K SLoC