Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Target atsamd microcontrollers using Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

atsamd-rs/atsamd

Repository files navigation

This repository holds various crates that support/enable working with Microchip (nee Atmel)samd11,samd21,samd51 andsame5x based devices using Rust.

CI Build

CI Build

HAL - Hardware Abstraction Layer

The Hardware Abstraction Layer (HAL -Crates.io) crate encodes a type-safe layer over the raw PACs. This crate implements traits specified by theembedded-hal project, making it compatible with various drivers in the embedded Rust ecosystem. Cargo features are used to enable support for specific hardware variations and features. Online documentation for commonly-used feature sets is provided:

Chip familyDocumented features
samd11csamd11c
samd11dsamd11d
samd21gsamd21g usb
samd21jsamd21j usb
samd51gsamd51g usb
samd51jsamd51j usb
samd51nsamd51n usb
samd51psamd51p usb

PAC and BSP - Peripheral Access Crate and Board Support Package

The Peripheral Access Crates (PACs) are automatically generated from Microchip SVD files, and provide low-level access to the peripherals specified by a device's SVD file.

BoardSupportPackages (BSPs) are provided for popular development boards, which rename pins to match silk screens or Arduino pin assignments, add helpers for initialization, and re-export theatsamd-hal crate. The BSPs included inatsamd-rs are separated in to two tiers: Tier 1 BSPs use the latest version ofatsamd-hal, Tier 2 BSPs use a specific version ofatsamd-hal that is not necessarily the latest.

PAC docscrates.ioProvided BSPs
atsamd11cCrates.ioBare atsamd11*
atsamd21eCrates.ioGemma M0,Serpente,Trinket M0,Neo Trinkey,NeoKey Trinkey,QT Py
atsamd21gCrates.ioArduino Nano 33 IOT,Circuit Playground Express,Feather M0*,ItsyBitsy M0,Metro M0*,MKR1000,MKR Vidor 4000,MKR ZERO,P1AM-100,SAMD21 Mini,SODAQ ONE,Wio Lite MG126,Wio Lite W600,Xiao M0
atsamd21jCrates.ioSODAQ SARA AFF
atsamd51gCrates.ioItsyBitsy M4,Trellis M4
atsamd51jCrates.ioEdgeBadge,Feather M4*,Metro M4*,PyGamer*,PyPortal,Matrix Portal M4
atsame51nCrates.io
atsamd51pCrates.ioGrand Central M4 Express,Wio Terminal
atsame51gCrates.io
atsame51jCrates.io
atsame51nCrates.io
atsame53jCrates.io
atsame53nCrates.io
atsame54nCrates.io
atsame54pCrates.ioPathfinderZA Proto1,SAM E54 Xplained Pro Evaluation Kit*

* Tier 1 BSP

async APIs

atsamd_hal provides APIs for usingasync/await constructs with some of its peripherals. To enableasync support, use theasync Cargo feature.Detailed documentation is provided in theatsamd_hal::async_hal module. Themetro_m4 andfeather_m0 feature complete examples showing how to use async APIs.

Please note that you must bring your own executor runtime such asembassy-executor orrtic to be able touse the async APIs.

Supported peripherals

  • SPI
  • I2C
  • USART
  • DMAC
  • EIC (GPIO interrupts)
  • Timers

Examples

The BSPs include examples to quickly get up and running with the board. Building the examplesrequires changing directory into one of the board support package directories, and some exampleswill require additional features:

$cd boards/metro_m0$ cargo build --examples --features="usb"

A new firmware can be made from one of the examples:

  1. Create a new Cargo package for the firmwarecargo new my_firmware,cd my_firmware
  2. Copy the BSP example source filecp feather_m0/examples/blinky_basic.rs src/main.rs
  3. Copy Cargo config and memory layoutcp -R feather_m0/.cargo feather_m0/memory.x .
  4. Add the BSP and any other required dependencies toCargo.toml:
[dependencies]feather_m0 ="0.13"panic-halt ="0.2"
  1. cargo build should create an ELF intarget/thumbv6m-none-eabi/debug/my_firmware

Building

You'll need to add the proper compilation target prior to building:

$# for samd11, samd21:$ rustup target add thumbv6m-none-eabi$# for samd51, same51, same53, same54:$ rustup target add thumbv7em-none-eabihf

CI

If you'd like to build all the same things that the CI would build but on your local system, you can run:

$ ./build-all.py

Running and debugging firmware on target hardware

See our wiki page aboutloading code onto the device.

Adding a new board

See our wiki page aboutadding a new board.

License

The included SVD files are sourced fromhttp://packs.download.atmel.com/ andare licensed under the Apache License, Version 2.0 (LICENSE-APACHE orhttp://www.apache.org/licenses/LICENSE-2.0).

The remainder of the code is licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in thework by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without anyadditional terms or conditions.


[8]ページ先頭

©2009-2025 Movatter.jp