All Projects â†’ atsamd-rs â†’ Atsamd

atsamd-rs / Atsamd

Licence: other
Target atsamd microcontrollers using Rust

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Atsamd

tutorials
Tutorials written by me.
Stars: ✭ 17 (-93.46%)
Mutual labels:  embedded
awesome-automotive-can-id
🚜 unpretentious attempt to collect CAN IDs and payloads for various car brands/models in one place.
Stars: ✭ 104 (-60%)
Mutual labels:  embedded
async
🔀 Asynchronous framework in C.
Stars: ✭ 16 (-93.85%)
Mutual labels:  embedded
hruby
Embed Ruby in your Haskell program.
Stars: ✭ 22 (-91.54%)
Mutual labels:  embedded
o1heap
Constant-complexity deterministic memory allocator (heap) for hard real-time high-integrity embedded systems
Stars: ✭ 119 (-54.23%)
Mutual labels:  embedded
houseflow
Home automation platform for microcontrollers(including ESP8266/ESP32), Raspberry Pi, and others. Made with Rust and C++.
Stars: ✭ 88 (-66.15%)
Mutual labels:  embedded
libpicrin
Super Tiny Scheme Interpreter for Freestanding Environment
Stars: ✭ 54 (-79.23%)
Mutual labels:  embedded
Tock
A secure embedded operating system for microcontrollers
Stars: ✭ 3,258 (+1153.08%)
Mutual labels:  embedded
esm
Lightweight communicating state machine framework for embedded systems
Stars: ✭ 21 (-91.92%)
Mutual labels:  embedded
littlefs2
Idiomatic Rust API for littlefs
Stars: ✭ 19 (-92.69%)
Mutual labels:  embedded
drone-cortexm
ARM® Cortex®-M platform crate for Drone, an Embedded Operating System.
Stars: ✭ 31 (-88.08%)
Mutual labels:  embedded
diy-linux-guide
An LFS like guide for cross-bootstrapping a small system for the Raspberry Pi
Stars: ✭ 26 (-90%)
Mutual labels:  embedded
NMSIS
Nuclei Microcontroller Software Interface Standard Development Repo
Stars: ✭ 24 (-90.77%)
Mutual labels:  embedded
EmbeddedML
EmbeddedML was created to be an alternative to the limited options available for Artificial Neural Networks in C. It is designed to be efficient without sacrificing ease of use. It is meant to support students as well as industry experts as it is built to be expandable and straightforward to manipulate.
Stars: ✭ 24 (-90.77%)
Mutual labels:  embedded
pigpiox
An Elixir wrapper around pigpiod for the Raspberry PI
Stars: ✭ 29 (-88.85%)
Mutual labels:  embedded
gdbstub
An ergonomic and easy-to-integrate implementation of the GDB Remote Serial Protocol in Rust, with full no_std support.
Stars: ✭ 158 (-39.23%)
Mutual labels:  embedded
STM32Keyboard
No description or website provided.
Stars: ✭ 15 (-94.23%)
Mutual labels:  embedded
Qmlcore
QML to Javascript/HTML5 translator, both for mobile and desktop targets
Stars: ✭ 258 (-0.77%)
Mutual labels:  embedded
project-migration-tools
Project Migration tools to help you migrating to IAR Embedded Workbench more efficiently.
Stars: ✭ 36 (-86.15%)
Mutual labels:  embedded
InfiniTime
Firmware for Pinetime smartwatch written in C/C++ and based on FreeRTOS
Stars: ✭ 1,303 (+401.15%)
Mutual labels:  embedded

atsamd & atsame support for Rust

This repository holds various crates that support/enable working with Atmel samd11, samd21, samd51 and same5x based devices using Rust.

CI Build

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

The Hardware Abstraction Layer (HAL) is the result of reading the datasheet for the device and encoding a type-safe layer over the raw PACs. This crate implements traits specified by the embedded-hal project, making it compatible with various drivers in the embedded rust ecosystem.

In addition to the PACs and HAL, there numerous Board Support Packages (BSPs) for popular development boards. They aim to rename pins to match silk screens or Arduino pin assignments, add helpers for initialization, and re-export the atsamd-hal crate. These BSPs are listed beside their respective PACs below.

Crate Version Board Support Packages
atsamd11c Crates.io
atsamd21e Crates.io Gemma M0, Serpente, Trinket M0
atsamd21g Crates.io Arduino Nano 33 IOT, Circuit Playground Express, Feather M0, Metro M0, MKR1000, MKR Vidor 4000, MKR ZERO, SAMD21 Mini, SODAQ ONE, Wio Lite MG126, Xiao M0
atsamd21j Crates.io SODAQ SARA AFF
atsamd51g Crates.io ItsyBitsy M4, Trellis M4
atsamd51j Crates.io EdgeBadge, Feather M4, Metro M4, PyPortal
atsame51n Crates.io
atsamd51p Crates.io Grand Central M4 Express, Wio Terminal
atsame51g Crates.io
atsame51j Crates.io
atsame51n Crates.io
atsame53j Crates.io
atsame53n Crates.io
atsame54n Crates.io
atsame54p Crates.io PathfinderZA Proto1, SAM E54 Xplained Pro Evaluation Kit
atsamd-hal Crates.io

Building

Make sure that you have a new enough version of the gcc toolchain; the one installable even on recent versions of Ubuntu can fail to correctly link the vector table:

Note: you may be able to avoid this step if using cargo-binutils. See board specific instructions in boards/ for more details.

$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y
$ sudo apt update
$ sudo apt install gcc-arm-embedded

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

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

Since a number of different MCUs are used, building the examples requires changing directory into one of the board support package directories prior to building. For example:

$ cd metro_m0
$ cargo build --examples
$ cd ../gemma_m0
$ cargo build --examples

Building everything locally

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

Please note that this script requires Python 3.

Getting code onto the device: Gemma M0

If you want to flash the device using the tools that come with the Adafruit arduino support package:

$ cd gemma_m0
$ cargo build --example blinky_basic
$ arm-none-eabi-objcopy -O binary \
    target/thumbv6m-none-eabi/debug/examples/blinky_basic \
    target/thumbv6m-none-eabi/debug/examples/blinky_basic.bin
# if using cargo-binutils, you can `rust-objcopy` with the same flags, or combine the previous 2 steps with `cargo objcopy`
$ stty -F /dev/ttyACM1 ospeed 1200
$ ~/.arduino15/packages/arduino/tools/bossac/1.7.0/bossac -i -d \
    --port=ttyACM1 -U -e -w -v \
    target/thumbv6m-none-eabi/debug/examples/blinky_basic.bin -R

This same technique should work for all of the Adafruit M0/M4 boards, as they all ship with a bossac compatible bootloader. Note that M0 devices may need -o 0x2000 and M4 devices may need -o 0x4000 added to the bossac parameter lists.

Getting code onto the device: JLink

If you have a board with a SWD debug header, such as the Metro M0, or if you attached the header yourself, you can use your JLink together with gdb. @wez prefers using the JLinkGDBServer, but you can also use OpenOCD.

In one window, run JLinkGDBServer -if SWD -device ATSAMD21G18, then in another, run these commands from the root of this repo so that you pick up its .gdbinit file:

$ cargo build --manifest-path metro_m0/Cargo.toml --example blinky_basic
$ arm-none-eabi-gdb metro_m0/target/thumbv6m-none-eabi/debug/examples/blinky_basic

If you prefer or otherwise need to use OpenOCD, then you'd run it in place of the JLinkGDBServer and then modify the .gdbinit file to comment out the JLink section and uncomment the OpenOCD section.

Semihosting

If you want to enable semihosting to be able to see debugging messages, this will enable them in some of the example crates. Note that when you enable semihosting, the resultant firmware will only run when a debugger is attached to your board; it will fault the MCU if the debugger is absent:

$ cargo build --manifest-path metro_m0/Cargo.toml \
    --example blinky_basic --features use_semihosting

Getting code onto the devices with bootloaders: hf2-rs

hf2-rs implements Microsofts HID Flashing Format (HF2) to upload firmware to UF2 bootloaders. UF2 is factory programmed extensively by Microsoft MakeCode and Adafruit hardware.

The cargo-hf2 crate replaces the cargo build command to include flashing over USB to connected UF2 devices, using hf2 flashing over HID protocol.

$ cargo install cargo-hf2
$ cargo hf2 --manifest-path metro_m0/Cargo.toml \
    --example blinky_basic --features unproven --release

For more information, refer to the README files for each crate:

Getting code onto the devices with bootloaders: uf2conv-rs

uf2conv adds a uf2 header Microsofts HID Flashing Format (UF2) for copying over to UF2 bootloader mass storage devices. UF2 is factory programmed extensively by Microsoft MakeCode and Adafruit hardware. cargo-binutils replaces the cargo build command to find and convert elf files into binary.

Install the dependencies

$ rustup component add llvm-tools-preview
$ cargo install uf2conv cargo-binutils

Then for say, metro_m0 examples

$ cargo objcopy --example blinky_basic --features unproven --release -- -O binary blinky_basic.bin
$ uf2conv blinky_basic.bin --base 0x2000 --output blinky_basic.uf2
$ cp blinky_basic.uf2 /Volumes/PYGAMERBOOT/

For more information, refer to the README files for each crate:

Adding a new board

See our wiki page for a complete guide on adding a new board.

License

The included SVD files are sourced from http://packs.download.atmel.com/ and are licensed under the Apache License, Version 2.0 (LICENSE-APACHE or http://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 the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].