Git Product home page Git Product logo

rp-microcontroller-rs's Introduction

Rust support for RP2040 microcontrollers

This repository contains peripheral access crates (PAC), hardware abstraction layers (HAL) and board support packages for the RP2040 and related microcontroller and boards using it, like the Raspberry Pi Pico.

Related projects

There is a similar project called rp-rs which currently contains more code than this one. As both are under development and far away from a stable release, please have a look at both and pick whatever you like.

Prerequisites

The Rasperry Pi Pico contains a microcontroller using the Arm architecture. To cross-compile for that architecture, the matching target needs to be installed:

rustup target add thumbv6m-none-eabi

Repository structure

The structure is modelled after the repository for atsamd.

This assumes that the RP2040 will be accompanied by a family of relatec microcontrolles. (See chapter "Why is the chip called RP2040?" in the RP2040 datasheet).

Current state / TODO

Currently, there is a PAC generated from the SVD file, a minimal board support crate and a stub HAL.

The goal is to first get a working firmware which can be uploaded to the Raspberry Pi Pico, and then implement the embedded-hal interface.

For now, a simple blinky example can be compiled. It is completely untested, as I do not yet have access to the hardware.

A TODO list can be found in the wiki.

Usage

An example blinking a LED can be compiled with:

cd boards/rp-pico
cargo build --target thumbv6m-none-eabi --example=blink  --release

To re-generate the rust source code from svd files, some tools are necessary. Once they are installed, use generate.sh to call svd2rust and format the source code using form.

cargo install svd2rust
cargo install form
sh generate.sh

On how to setup on chip debugging please check out ON-CHIP_DEBUGGING.md

License

The register definition file rp2040.svd was downloaded from the raspberrypi/pico-sdk repo. It is Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd. and is licensed under the BSD-3-Clause License.

The rest of this repository is licensed under the terms of both the MIT license and the Apache License (Version 2.0), at your option.

Parts of this code was copied from rp-rs, which is published under the same license.

rp-microcontroller-rs's People

Contributors

florind avatar jannic avatar johnbatty avatar tacdom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.