#raspberry-pi-pico #raspberry-pi #no-std

sys no-std pico-sdk-sys

FFI bindings to Raspberry Pi's Pico SDK

2 releases

0.1.1 Jul 14, 2024
0.1.0 Jul 14, 2024

#495 in Embedded development

MIT license

440KB
6.5K SLoC

pico-sdk-rs

Pico SDK bindings for the Rust programming language.

[!WARNING] Most bindings are generated by rust-bindgen. If any bindings are missing, create an issue.

Table of Contents

Getting Started

Since this crate depends on the Pico C SDK and other tools (see the official documentation), these must be downloaded or compiled first. This crate will automatically download or compile these tools for you, but it is also possible to manually download and the crate will pick it up accordingly.

Prerequisites

If the tools can already be found on your system, they will be used.

Otherwise, the following dependencies are needed to compile and build this crate:

Environment variables

  • PICO_SDK_PATH Path to Pico SDK.
  • PICO_EXTRAS_PATH Path to Pico SDK extras. (Optional)
  • PICO_TOOLCHAIN_PATH Path to Arm GNU Toolchain. It must contain arm-none-eabi, bin, include, lib folders.
  • PATH This crate searches ninja in the PATH so be sure ninja is in the PATH.

Usage

Add this to your Cargo.toml:

[dependencies]
pico-sdk-sys = "0.1.0"

See the official documentation for more details. Examples can be found in the kaganege/pico-sdk-rs-examples.

Features

By default enable-stdio-usb feature is enabled.

  • pico-w: Enables WiFi support.
  • extras: Adds pico-extras bindings.
  • alloc: Uses Arm GNU Toolchains allocators.
  • enable-stdio-uart: Enables logging over UART.
  • enable-stdio-usb: Enables logging over USB.
  • full: Enables extras and alloc features.

Rust version requirements

pico-sdk-rs works with stable Rust, and typically works with the most recent prior stable release as well.

Version of Pico SDK

Currently this library using pico-sdk 1.5.1 (or newer patch versions).

License

Licensed under MIT license (LICENSE or opensource.org/licenses/MIT)

Dependencies

~0.1–5MB
~95K SLoC