AVR device definitions

Related tags

Utilities avrd
Overview

avrd

Crates.io Build Status license

AVR device definitons in Rust.

Documentation

This crate exposes information about different AVR microcontrollers so it can be used pragmatically.

You can use this crate directly as a depencency on the AVR bare metal, or on different architectures.

The constants defined in this library facilitate raw IO port operations on AVR chips.

For example

extern crate avrd;
use avrd::current::*; // Import constants for the target MCU

volatile_store(PORTB, 0x1f);

Usage on AVR

Just include the crate as a dependency and it will work.

Enabling all microcontrollers at once

You may want to compile with the all-mcus feature enabled, which enables modules for all microcontrollers to be compiled and included at once.

Comments
  • Optimize debug builds by default

    Optimize debug builds by default

    During the build of this crate, the main bottleneck is the generation of the mcu description files. The compilation itself takes far less time. Therefore, optimizing the build will lead to faster builds.

    opened by dsprenkels 5
  • Fixed long compilation issue and made code a bit more idiomatic

    Fixed long compilation issue and made code a bit more idiomatic

    Due to the bug in https://github.com/avr-rust/avr-mcu (CARGO_CFG_TARGET_CPU environment variable actually is not being set by avr-rust compiler), and also because cfg!(arch = "avr") doesn't work for unknown reason, build.rs always generates files for ALL microcontrollers, even if you specify one in custom target *.json file via "cpu": "atmega88pa" line, like in blink example.

    So I decided to take a look at the code. Now avr-mcu uses TARGET environment variable to get the name of *.json file. It should be the same as -mmcu flag passed to avr-gcc. I understand that this change breaks blink example and other projects, so I bumped minor version number instead of patch.

    PR for avr-mcu: https://github.com/avr-rust/avr-mcu/pull/9

    opened by Logarithmus 2
  • Revert

    Revert "Fixed long compilation issue and made code a bit more idiomatic"

    Reverts avr-rust/avrd#16

    avrd-tests.log

    @Logarithmus it looks like this breaks the tests (I'm not sure why Travis didn't catch that), I have reverted and I can re-merge it once fixed.

    opened by dylanmckay 1
  • Use explicit dyn for trait types in build.rs

    Use explicit dyn for trait types in build.rs

    This patch is only cosmetic. It silences these warnings:

    warning: trait objects without an explicit `dyn` are deprecated
       --> build.rs:136:47
        |
    136 |     pub fn mcu_module_code(mcu: &Mcu, w: &mut Write)
        |                                               ^^^^^ help: use `dyn`: `dyn Write`
        |
        = note: `#[warn(bare_trait_objects)]` on by default
    
    opened by dsprenkels 0
  • Implement parsing of value groups

    Implement parsing of value groups

    This PR implements the parsing of value groups. Because the values in value groups represent a group, I have generated modules with constants.

    I feel the code may be a little messy. Feedback would be appreciated.

    This PR fixes issue #1.

    opened by dsprenkels 0
  • build script always generates all mcus

    build script always generates all mcus

    The check for the target arch in the build script doesn't work.

    https://github.com/avr-rust/avrd/blob/6072399dfe037d2807abb4058d4da6f045cc3f6c/build.rs#L13 Checking the environment variable CARGO_CFG_TARGET_ARCH would probably be the correct way (like avr_mcu::is_compiling_for_avr()).

    I would have submitted a pull request, but with rustc 1.47.0-nightly (6c8927b0c 2020-07-26) I get the following error when retrieving the current mcu.

    thread 'main' panicked at 'cannot retrieve mcu name, use a version of the avr-rust compiler that exposes the 'target_cpu' configuration option', avr-mcu-0.2.6\src\current.rs:35:24

    I'm guessing, this will have to wait until a solution for exposing target_cpu is found.

    opened by FlyingGaz 0
  • Documentation build fail

    Documentation build fail

    It seems that documentation failed to build for 0.3.0: https://docs.rs/crate/avrd/0.3.0

    If you look at the build log, there's a panic with message "Read-only filesystem". I think it's docs.rs problem. But why 0.2.0 built successfully? Is it a regression?

    opened by Logarithmus 3
  • Link to bitfield constants in generated documentation for registers

    Link to bitfield constants in generated documentation for registers

    At the moment, all registers have their associated bitfields in the crate docs.

    We should insert a link so it is clickable and takes the user to the bitfield constant.

    opened by dylanmckay 0
  • Consider the case where a PORT register is only partly used

    Consider the case where a PORT register is only partly used

    I imagine that there are AVR devices which have IO ports where only half of the bits are actually connected to pins.

    We might want to look into something like defining PB1, PB2, ... registers for each generated module. That way, if you're using the library and you try to use a pin that doesn't exist, it will hit a hard error.

    opened by dylanmckay 1
  • Consider committing generated files into VCS

    Consider committing generated files into VCS

    It may make sense for us to convert the build script into a normal script and committing all generated cores to VCS.

    This makes it quicker, and also means that we can very easily see the diff between changes in generated files.

    It also means that diffs would be larger.

    opened by dylanmckay 0
Owner
The AVR-Rust project
A fork of Rust with AVR microcontroller support
The AVR-Rust project
Progmem utility for the AVR architecture

avr-progmem Progmem utilities for the AVR architectures. This crate provides unsafe utilities for working with data stored in the program memory of an

null 15 Nov 20, 2022
Hardware Abstraction Layer for AVR microcontrollers and common boards

avr-hal Hardware Abstraction Layer for AVR microcontrollers and common boards (for example Arduino). Based on the avr-device crate. This is a new vers

Rahix 776 Jan 1, 2023
Register access crate for AVR microcontrollers

avr-device Auto-generated wrappers around registers for AVR microcontrollers. Usage Add the following to Cargo.toml: [dependencies.avr-device] version

Rahix 103 Dec 23, 2022
Functional testing framework for AVR binaries, powered by simavr.

Functional testing framework for AVR binaries, powered by simavr. tl;dr get your microcontroller's firmware black-box-tested in seconds!

Patryk Wychowaniec 14 Nov 16, 2022
Interface definitions for the Compute@Edge platform in witx.

?? compute-at-edge-abi This repository contains witx definitions for the Compute@Edge platform ABI. About witx The witx file format is an experimental

Fastly 14 Apr 5, 2022
Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code

Diplomat is an experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code. With Diplomat, you can simply define Rust APIs to be exposed over FFI and get high-level C, C++, and JavaScript bindings automatically!

null 255 Dec 30, 2022
A library for generating TypeScript definitions from rust code.

Tsify is a library for generating TypeScript definitions from rust code. Using this with wasm-bindgen will automatically output the types to .d.

Madono Haru 60 Dec 30, 2022
Open-source NI maschine device handling

Open-source NI maschine device handling

william light 69 Dec 1, 2022
A cross-platform serial port library in Rust. Provides a blocking I/O interface and port enumeration including USB device information.

Note: This is a fork of the original serialport-rs project on GitLab. Please note there have been some changes to both the supported targets and which

Serialport 128 Jan 4, 2023
Rust usb-device support for ATmega chips

atmega-usbd usb_device support for ATmega microcontrollers. NOTE: This is an experimental library, and certainly not production-ready. Expect bugs, an

Adam Gausmann 20 Jan 8, 2023
Garden monitoring system using m328p Arduino Uno boards. 100% Rust [no_std] using the avr hardware abstraction layer (avr-hal)

uno-revive-rs References Arduino Garden Controller Roadmap uno-revive-rs: roadmap Components & Controllers 1-2 Uno R3 m328p Soil moisture sensor: m328

Ethan Gallucci 1 May 4, 2022
Definitions from the Virtual I/O Device (VIRTIO) specification.

virtio-spec-rs This crate contains the Rust equivalents of the definitions from the Virtual I/O Device (VIRTIO) Specification. This crate aims to be u

Rust OSDev 12 Oct 13, 2024
Android Device Pool - A tool to run device tests against a pool of devices.

adp (Android Device Pool) What is this? A tool to run device tests against a pool of devices. It will 'checkout' a device to run your tests against an

Evan Tatarka 1 Oct 21, 2021
A blinking LED program written in Rust for the AVR

blink A small Hello World Rust application for the AVR. The program itself toggles a LED on PORTB periodically. Designed for the ATmega328p. The AVR-R

The AVR-Rust project 208 Jan 4, 2023
CHIP-8 implementation in Rust targeting AVR microcontrollers

CHIP-8 implementation for a very simple breadboard toy This is a CHIP-8 virtual machine implementation running on AVR. Its big party trick is that it

Gergő Érdi 44 Dec 31, 2022
Progmem utility for the AVR architecture

avr-progmem Progmem utilities for the AVR architectures. This crate provides unsafe utilities for working with data stored in the program memory of an

null 15 Nov 20, 2022
Hardware Abstraction Layer for AVR microcontrollers and common boards

avr-hal Hardware Abstraction Layer for AVR microcontrollers and common boards (for example Arduino). Based on the avr-device crate. This is a new vers

Rahix 776 Jan 1, 2023
Register access crate for AVR microcontrollers

avr-device Auto-generated wrappers around registers for AVR microcontrollers. Usage Add the following to Cargo.toml: [dependencies.avr-device] version

Rahix 103 Dec 23, 2022
A template for AVR executable (non-library) projects

Rust AVR executable template A template for Rust based AVR executables. NOTE: This software template repository is offered in the public domain. It is

The AVR-Rust project 16 Sep 18, 2022
Functional testing framework for AVR binaries, powered by simavr.

Functional testing framework for AVR binaries, powered by simavr. tl;dr get your microcontroller's firmware black-box-tested in seconds!

Patryk Wychowaniec 14 Nov 16, 2022