| Crates.io | pico-otp |
| lib.rs | pico-otp |
| version | 0.2.0 |
| created_at | 2025-11-07 15:40:04.944163+00 |
| updated_at | 2025-11-08 18:33:47.221581+00 |
| description | Generate and decode OTP data for the Raspberry Pi RP2350/Pico 2 |
| homepage | https://github.com/piersfinlayson/pico-otp |
| repository | https://github.com/piersfinlayson/pico-otp.git |
| max_upload_size | |
| id | 1921747 |
| size | 254,790 |
A Rust crate and tool for generating and parsing OTP data for the Raspberry Pi RP2350/Pico 2 microcontroller. It specifically targets generating and decoding USB white labelling and related information.
⚠️ WRITING TO OTP MEMORY IS PERMANENT AND MAY IRREPARABLY BRICK YOUR DEVICE IF DONE INCORRECTLY. PROCEED WITH CAUTION ⚠️
There is no warranty provided with this software. Use at your own risk. See the LICENSE file for details.
Raspberry Pi's picotool can be used to read and write OTP white label data.
pico-otp's primary purpose is to provide a programmatic API and library for working with this data, including generating the required OTP row data from JSON files, and converting OTP row data from real devices back into JSON format.
pico-otp is used by pico⚡flash, which provides an accessbile web interface for white labelling and also erasing, reading and writing RP2350-based devices.
In addition, it useful to have a well commented and thoroughly tested parallel implemenation of the white labelling logic, to help understand and verify the behaviour of picotool and the RP2350, as some of Raspberry Pi's documentation on this topic was found to be incomplete or unclear.
{
"$schema": "https://raw.githubusercontent.com/raspberrypi/picotool/develop/json/schemas/whitelabel-schema.json",
"device": {
"manufacturer": "piers.rocks",
"product": "pico-otp",
"serial_number": "1234abcd"
},
"scsi": {
"vendor": "piersrks",
"product": "pico-otp",
"version": "v123"
},
"volume": {
"label": "PIERS.ROCKS",
"redirect_url": "https://piers.rocks/",
"redirect_name": "piers.rocks",
"model": "pico-otp",
"board_id": "pico-otp board id"
}
}
cargo run --bin pico-otp -- -i json/sample-wl.json -o /tmp/otp.bin
Sample output:
Processed json/sample-wl.json and wrote OTP rows to /tmp/otp.bin as LE data
-----
USB boot flags: 0x0040FF77
-----
To use this output to white label your RP2350:
- Write the contents of the output to file to OTP memory as ECC rows
starting at a known free OTP region, typically 0x100
- Write the offset you selected to OTP row 0x05c (USB_WHITE_LABEL_ADDR)
- Write the USB boot flags 0x0040FF77 to OTP rows 0x059, 0x5a and 0x5b
(USB_BOOT_FLAGS, USB_BOOT_FLAGS_R1 and USB_BOOT_FLAGS_R2)
as raw (not ECC) data
use pico_otp::OtpData;
// Load the JSON file
let json = std::fs::read_to_string("json/sample-wl.json")
.expect("Failed to read sample JSON file");
// Parse it and create the OTP data object
let otp_data = OtpData::from_json(&json)?;
// Generate the required OTP row data as a Vec<u16>
let otp_rows = otp_data.rows();
// And the boot flags
let usb_boot_flags = otp_data.usb_boot_flags();
// Now write these to OTP memory on the RP2350.
no-std support, for use in WASM and embedded environmentsSee the Technical Overview file for more information on the technical details of RP2350 One Time Programmable memory.
See the USB White Labelling document for more information on the RP2350's USB white labelling specifically.
This project is licensed under the MIT OR Apache 2.0 Licenses, at your option. See the LICENSE file for details.
Raspberry Pi's OTP white labelling JSON schema has been reproduced here and is licensed at described here