Register access crate for AVR microcontrollers

Overview

avr-device crates.io page docs.rs Continuous Integration

Auto-generated wrappers around registers for AVR microcontrollers.

Usage

Add the following to Cargo.toml:

[dependencies.avr-device]
version = "0.3.2"
features = ["atmega32u4"]

Via the feature you can select which chip you want the register specifications for. The following list is what is currently supported:

ATmega ATmega USB ATmega 0,1 Series AT90 ATtiny
atmega8 atmega8u2 atmega4809 at90usb1286 attiny167
atmega48p atmega32u4 attiny202
atmega64 attiny84
atmega644 attiny85
atmega168 attiny88
atmega328p attiny816
atmega328pb attiny841
atmega1280 attiny861
atmega2560 attiny1614
attiny2313
attiny2313a

Build Instructions

The version on crates.io is pre-built. The following is only necessary when trying to build this crate from source.

You need to have atdf2svd (= 0.3.1), svd2rust (= 0.19), form (>= 0.8), rustfmt(for the nightly toolchain) and svdtools (>= 0.1.9) installed:

cargo install atdf2svd --version 0.3.1
cargo install svd2rust --version 0.19
cargo install form
rustup component add --toolchain nightly rustfmt
pip3 install --user svdtools

Next, clone this repo and build the device definitions:

git clone https://github.com/Rahix/avr-device
cd avr-device
make
# You can build for just one specific chip using
# make atmega32u4
# I suggest building documentation as well
cargo +nightly doc --features <chip> --open

Internals

avr-device is generated using atdf2svd and svd2rust. The vendor-provided atdf files can be found in vendor/. The intermediate svd files are patched by svdpatch.py (Adapted from svdpatch.py in stm32-rs) with device-dependent patches in patch/, mainly to improve undescriptive names and missing descriptions.

Adding a new Chip

To add a new chip, download the atdf from http://packs.download.atmel.com/ (or avr-mcu/packs/) and place it in vendor/. Be sure to name it like the Rust module that should be generated. Next, you need to integrate it into the base crate and build system. Follow what was done in commit 290613454fbd ("Add basic support for ATmega64"). Please adhere to the alphabetical sorting that is present so far.

Next, you must create a <chipname>.yaml in patch/ which has at least the following content:

_svd: ../svd/<chipname>.svd

If more patches need to be applied (most likely!), they should be added into this file as well. The patching format is documented in the svdtools README. Ideally, try to reuse the exisiting patches in patch/common/ or patch/timer/.

Finally, try building the crate for your MCU with make <chipname>.

License

avr-device is licensed under either of

at your option.

The vendored atdf files are licensed under the Apache License, Version 2.0 (LICENSE-VENDOR).

Comments
  • ATMega328P Support

    ATMega328P Support

    Opening another issue here for stuff specifically related to this repo

    Related to: https://github.com/Rahix/avr-hal/issues/2

    @Rahix In your first comment on that issue you said the first place to start is working on the chip patch. I see that there is already an atmega328p patch file, but it has fewer _includes. My guess is that it's incomplete in its current form.

    Luckily, the ATmega328P is very similar to the already implemented ATmega32U4. This should mean that you can for the most part copy the patches from that chip.

    That sounds good... the only issue is that I don't know where to find the differences between the 32u4 and the 328p. Is that info I can find in the data sheet? Or documented elsewhere on the Microchip website? Again please pardon my extreme ignorance here.

    mcu-support 
    opened by jonahbron 16
  • Escaping/Renaming `ASYNC` register

    Escaping/Renaming `ASYNC` register

    Trying to compile for attiny412 following error occurs, due to the naming of the ASYNC register in the TCB0 and TCD0 peripheral:

    error: expected identifier, found keyword `async`
       --> src/devices/attiny412/tcb0/ctrlb.rs:248:12
        |
    248 |     pub fn async(&self) -> ASYNC_R {
        |            ^^^^^ expected identifier, found keyword
        |
    help: you can escape reserved keywords to use them as identifiers
        |
    248 |     pub fn r#async(&self) -> ASYNC_R {
        |            ^^^^^^^
    
    error: expected identifier, found keyword `async`
       --> src/devices/attiny412/tcb0/ctrlb.rs:270:12
        |
    270 |     pub fn async(&mut self) -> ASYNC_W {
        |            ^^^^^ expected identifier, found keyword
        |
    help: you can escape reserved keywords to use them as identifiers
        |
    270 |     pub fn r#async(&mut self) -> ASYNC_W {
        |            ^^^^^^^
    
    error: expected identifier, found keyword `async`
       --> src/devices/attiny412/tcd0/evctrla.rs:256:12
        |
    256 |     pub fn async(self) -> &'a mut W {
        |            ^^^^^ expected identifier, found keyword
        |
    help: you can escape reserved keywords to use them as identifiers
        |
    256 |     pub fn r#async(self) -> &'a mut W {
        |            ^^^^^^^
    
    error: expected identifier, found keyword `async`
       --> src/devices/attiny412/tcd0/evctrlb.rs:256:12
        |
    256 |     pub fn async(self) -> &'a mut W {
        |            ^^^^^ expected identifier, found keyword
        |
    help: you can escape reserved keywords to use them as identifiers
        |
    256 |     pub fn r#async(self) -> &'a mut W {
        |            ^^^^^^^
    
    

    Not sure if this should be fixed in atdf2svd by renaming ASYNC registers, or here.

    buildsystem 
    opened by trembel 10
  • ATmega4809 support

    ATmega4809 support

    Looks like I need to spend more time on this chip. Require probably same changes as in https://github.com/Rahix/avr-device/issues/26#issuecomment-679831658

    @Rahix can you please advice which topic in atdf2svd I should progress

    Warning: Unhandled register node: "<register-group name=\"SINGLE\" offset=\"0\" name-in-module=\"TCA_SINGLE\" union-tag-value=\"0\" ...>"
    Warning: Unhandled register node: "<register-group name-in-module=\"TCA_SPLIT\" name=\"SPLIT\" offset=\"0\" union-tag-value=\"1\" ...>"
    Error: Register "DIR" has a weird name!
    Error: Register "DIRCLR" has a weird name!
    Error: Register "DIRSET" has a weird name!
    Error: Register "DIRTGL" has a weird name!
    Error: Register "IN" has a weird name!
    Error: Register "INTFLAGS" has a weird name!
    Error: Register "OUT" has a weird name!
    Error: Register "OUTCLR" has a weird name!
    Error: Register "OUTSET" has a weird name!
    Error: Register "OUTTGL" has a weird name!
    Error: Register "PIN0CTRL" has a weird name!
    Error: Register "PIN1CTRL" has a weird name!
    Error: Register "PIN2CTRL" has a weird name!
    Error: Register "PIN3CTRL" has a weird name!
    Error: Register "PIN4CTRL" has a weird name!
    Error: Register "PIN5CTRL" has a weird name!
    Error: Register "PIN6CTRL" has a weird name!
    Error: Register "PIN7CTRL" has a weird name!
    Error: Register "PORTCTRL" has a weird name!
    Error: Register "DIR" has a weird name!
    Error: Register "DIRCLR" has a weird name!
    Error: Register "DIRSET" has a weird name!
    Error: Register "DIRTGL" has a weird name!
    Error: Register "IN" has a weird name!
    Error: Register "INTFLAGS" has a weird name!
    Error: Register "OUT" has a weird name!
    Error: Register "OUTCLR" has a weird name!
    Error: Register "OUTSET" has a weird name!
    Error: Register "OUTTGL" has a weird name!
    Error: Register "PIN0CTRL" has a weird name!
    Error: Register "PIN1CTRL" has a weird name!
    Error: Register "PIN2CTRL" has a weird name!
    Error: Register "PIN3CTRL" has a weird name!
    Error: Register "PIN4CTRL" has a weird name!
    Error: Register "PIN5CTRL" has a weird name!
    Error: Register "PIN6CTRL" has a weird name!
    Error: Register "PIN7CTRL" has a weird name!
    Error: Register "PORTCTRL" has a weird name!
    Error: Register "DIR" has a weird name!
    Error: Register "DIRCLR" has a weird name!
    Error: Register "DIRSET" has a weird name!
    Error: Register "DIRTGL" has a weird name!
    Error: Register "IN" has a weird name!
    Error: Register "INTFLAGS" has a weird name!
    Error: Register "OUT" has a weird name!
    Error: Register "OUTCLR" has a weird name!
    Error: Register "OUTSET" has a weird name!
    Error: Register "OUTTGL" has a weird name!
    Error: Register "PIN0CTRL" has a weird name!
    Error: Register "PIN1CTRL" has a weird name!
    Error: Register "PIN2CTRL" has a weird name!
    Error: Register "PIN3CTRL" has a weird name!
    Error: Register "PIN4CTRL" has a weird name!
    Error: Register "PIN5CTRL" has a weird name!
    Error: Register "PIN6CTRL" has a weird name!
    Error: Register "PIN7CTRL" has a weird name!
    Error: Register "PORTCTRL" has a weird name!
    Error: Register "DIR" has a weird name!
    Error: Register "DIRCLR" has a weird name!
    Error: Register "DIRSET" has a weird name!
    Error: Register "DIRTGL" has a weird name!
    Error: Register "IN" has a weird name!
    Error: Register "INTFLAGS" has a weird name!
    Error: Register "OUT" has a weird name!
    Error: Register "OUTCLR" has a weird name!
    Error: Register "OUTSET" has a weird name!
    Error: Register "OUTTGL" has a weird name!
    Error: Register "PIN0CTRL" has a weird name!
    Error: Register "PIN1CTRL" has a weird name!
    Error: Register "PIN2CTRL" has a weird name!
    Error: Register "PIN3CTRL" has a weird name!
    Error: Register "PIN4CTRL" has a weird name!
    Error: Register "PIN5CTRL" has a weird name!
    Error: Register "PIN6CTRL" has a weird name!
    Error: Register "PIN7CTRL" has a weird name!
    Error: Register "PORTCTRL" has a weird name!
    Error: Register "DIR" has a weird name!
    Error: Register "DIRCLR" has a weird name!
    Error: Register "DIRSET" has a weird name!
    Error: Register "DIRTGL" has a weird name!
    Error: Register "IN" has a weird name!
    Error: Register "INTFLAGS" has a weird name!
    Error: Register "OUT" has a weird name!
    Error: Register "OUTCLR" has a weird name!
    Error: Register "OUTSET" has a weird name!
    Error: Register "OUTTGL" has a weird name!
    Error: Register "PIN0CTRL" has a weird name!
    Error: Register "PIN1CTRL" has a weird name!
    Error: Register "PIN2CTRL" has a weird name!
    Error: Register "PIN3CTRL" has a weird name!
    Error: Register "PIN4CTRL" has a weird name!
    Error: Register "PIN5CTRL" has a weird name!
    Error: Register "PIN6CTRL" has a weird name!
    Error: Register "PIN7CTRL" has a weird name!
    Error: Register "PORTCTRL" has a weird name!
    Error: Register "DIR" has a weird name!
    Error: Register "DIRCLR" has a weird name!
    Error: Register "DIRSET" has a weird name!
    Error: Register "DIRTGL" has a weird name!
    Error: Register "IN" has a weird name!
    Error: Register "INTFLAGS" has a weird name!
    Error: Register "OUT" has a weird name!
    Error: Register "OUTCLR" has a weird name!
    Error: Register "OUTSET" has a weird name!
    Error: Register "OUTTGL" has a weird name!
    Error: Register "PIN0CTRL" has a weird name!
    Error: Register "PIN1CTRL" has a weird name!
    Error: Register "PIN2CTRL" has a weird name!
    Error: Register "PIN3CTRL" has a weird name!
    Error: Register "PIN4CTRL" has a weird name!
    Error: Register "PIN5CTRL" has a weird name!
    Error: Register "PIN6CTRL" has a weird name!
    Error: Register "PIN7CTRL" has a weird name!
    Error: Register "PORTCTRL" has a weird name!
    Warning: Could not apply 'signals_to_port_fields' patch!
    Warning: Description missing for peripheral "AC0"
    Warning: Description missing for peripheral "ADC0"
    Warning: Description missing for peripheral "BOD"
    Warning: Description missing for peripheral "CCL"
    Warning: Description missing for peripheral "CLKCTRL"
    Warning: Description missing for peripheral "CPU"
    Warning: Description missing for peripheral "CPUINT"
    Warning: Description missing for peripheral "CRCSCAN"
    Warning: Description missing for peripheral "EVSYS"
    Warning: Description missing for peripheral "FUSE"
    Warning: Description missing for peripheral "GPIO"
    Warning: Description missing for peripheral "LOCKBIT"
    Warning: Description missing for peripheral "NVMCTRL"
    Warning: Description missing for peripheral "PORTA"
    Warning: Description missing for peripheral "PORTB"
    Warning: Description missing for peripheral "PORTC"
    Warning: Description missing for peripheral "PORTD"
    Warning: Description missing for peripheral "PORTE"
    Warning: Description missing for peripheral "PORTF"
    Warning: Description missing for peripheral "PORTMUX"
    Warning: Description missing for peripheral "RSTCTRL"
    Warning: Description missing for peripheral "RTC"
    Warning: Description missing for peripheral "SIGROW"
    Warning: Description missing for peripheral "SLPCTRL"
    Warning: Description missing for peripheral "SPI0"
    Warning: Description missing for peripheral "SYSCFG"
    Warning: No registers found for peripheral "TCA0"
    Warning: Description missing for peripheral "TCB0"
    Warning: Description missing for peripheral "TCB1"
    Warning: Description missing for peripheral "TCB2"
    Warning: Description missing for peripheral "TCB3"
    Warning: Description missing for peripheral "TWI0"
    Warning: Description missing for peripheral "USART0"
    Warning: Description missing for peripheral "USART1"
    Warning: Description missing for peripheral "USART2"
    Warning: Description missing for peripheral "USART3"
    Warning: Description missing for peripheral "USERROW"
    Warning: Description missing for peripheral "VPORTA"
    Warning: Description missing for peripheral "VPORTB"
    Warning: Description missing for peripheral "VPORTC"
    Warning: Description missing for peripheral "VPORTD"
    Warning: Description missing for peripheral "VPORTE"
    Warning: Description missing for peripheral "VPORTF"
    Warning: Description missing for peripheral "VREF"
    Warning: Description missing for peripheral "WDT"
    Warning: Description missing for field "NMI"
    Warning: Description missing for field "VLM"
    Warning: Description missing for field "CNT"
    Warning: Description missing for field "PIT"
    Warning: Description missing for field "CCL"
    Warning: Description missing for field "LUNF"
    Warning: Description missing for field "OVF"
    Warning: Description missing for field "HUNF"
    Warning: Description missing for field "CMP0"
    Warning: Description missing for field "LCMP0"
    Warning: Description missing for field "CMP1"
    Warning: Description missing for field "LCMP1"
    Warning: Description missing for field "CMP2"
    Warning: Description missing for field "LCMP2"
    Warning: Description missing for field "TWIS"
    Warning: Description missing for field "TWIM"
    Warning: Description missing for field "AC"
    Warning: Description missing for field "RESRDY"
    Warning: Description missing for field "WCOMP"
    Warning: Description missing for field "EE"
    Warning: Description missing for field "PORT"
    Warning: Description missing for field "INT"
    Warning: Description missing for field "RXC"
    Warning: Description missing for field "DRE"
    Warning: Description missing for field "TXC"
    
    mcu-support 
    opened by explicite 9
  • llvm_asm! removed in latest nightly rust

    llvm_asm! removed in latest nightly rust

    rust-lang/rust#92816 removes the llvm_asm! macro. Since avr_device still uses this macro, the last version that can build this crate is nightly-2022-01-17

    asm! is the supported replacement

    opened by Outurnate 8
  • Add atmega328pb

    Add atmega328pb

    This adds support for the atmega328pb device. It's basically a atmega328p with 4 more pins available as PORTE and additional TWI, SPI, USART and timers.

    I added new functionality to svdtool for stripping prefix from registers and fields from the additional peripherals to make them work with avr-hal without too many modifications. My WIP changes to the hal are in this branch: https://github.com/jkristell/avr-hal/tree/add-atmega328pb

    I need confirmation if this is the right way to do it, and then I need to look at the timers as well.

    mcu-support 
    opened by jkristell 7
  • Error if the wrong architecture is being used

    Error if the wrong architecture is being used

    There have been a couple times where an incorrectly set target file has caused errors that don't immediately point to the problem. Instead, we should show an error immediately telling the user that the wrong architecture has been selected.

    opened by lights0123 7
  • Implement interrupts

    Implement interrupts

    This PR adds a new feature-flag rt which, when enabled, adds the #[interrupt] procedural macro to define an interrupt handler. Unlike the implementation in cortex-m, this version needs an attribute which is the name of the chip the interrupt is for. In code, an interrupt handler might look like this:

    #![feature(abi_avr_interrupt)]
    
    #[avr_device::interrupt(atmega32u4)]
    fn INT6() {
        // Do Something
    }
    
    opened by Rahix 7
  • irq: Optimize interrupt save/restore

    irq: Optimize interrupt save/restore

    Avoid unnecessary mask and branch instructions.

    The basic reasoning behind this is that all other flags in the SREG can be clobbered without ill effects. The restore() function is an optimization fence and the compiler is not allowed to make assumptions about memory or SREG state after execution.

    This avoids an and and a breq instruction or similar in every critical section.

    This is an API breakage that requires an incompatible version bump. Question: Should we return a struct instead of u8? That would give us the opportunity to change semantics without breaking API in the future.

    I hope I got the llvm_asm! part of restore() right. I didn't test it. What about removing all llvm_asm!?

    opened by mbuesch 6
  • atmega328p: Make PRR register writable

    atmega328p: Make PRR register writable

    changed atmega328p to use patch and allow writing of PRR register Fixed field names in PRR register to match datasheet

    I am porting an existing C project to rust to learn how to do avr embedded programming. I needed access to the PRR register, which i did using unsafe pointer writes for now. I tried this fix to avr-device, and it seems to generate the rust code correctly, but when i try to use it in my project I get the following error:

    warning: Linking globals named 'DEVICE_PERIPHERALS': symbol multiply defined!

    error: failed to load bc of "avr_device-ee0b56ac06c1c352.avr_device.f0xkhm9n-cgu.7.rcgu.o":

    opened by gpgreen 6
  • fix: attiny84 ADCSRA should be read-write

    fix: attiny84 ADCSRA should be read-write

    Haven't found any other variants which are affected by this, but it may be worth pulling all of the access-related patches into common or creating a common/tiny/adc patch.

    opened by pitaj 6
  • Add static-mut vodoo from cortex-m-rt

    Add static-mut vodoo from cortex-m-rt

    cortex-m-rt has a really nice feature where static mut variables in main() and interrupts are transformed into a safe &'static mut _ reference. It would be great to add the same here.

    Ideally the common code can be split out from cortex-m-rt so we can reuse it without duplication.

    help wanted runtime 
    opened by Rahix 6
  • Add patches for ATmega8

    Add patches for ATmega8

    This PR adds patches for ATmega8 needed to implement ATMega8 to avr-hal easily.

    Unfortunately I had to edit the vendor file, because there is a field WGM2 consisting of WGM21 and WGM20 that are not directly next to each other. Any idea on how to patch this correctly?

    opened by Rutherther 2
  • RFC: Add statically checked macro for safe struct Peripherals creation

    RFC: Add statically checked macro for safe struct Peripherals creation

    The Peripherals::take() function has two disadvantages:

    • It uses one byte of precious RAM for runtime memory safety checking.
    • It uses a couple of bytes of precious program memory for establishing a critical section.

    This change uses the linker to statically ensure that only one Peripherals instance is constructed globally. It introduces a new macro to avr_device that is used just like:

    let dp = avr_device::peripherals!(atmega328p);
    

    In case of multiple macro invocations, the linker will abort with

    multiple definition of `__ERROR__avr_device__peripherals__macro_must_only_be_used_once__'
    

    TODO:

    • For actually not wasting the one byte of memory, the DEVICE_PERIPHERALS access has to be removed from the generated Peripherals::steal() function.
    • In order to be sound, all Peripherals::take() function have to be removed from the generated code.
    opened by mbuesch 1
  • No `ctc` function for `atmega328p`'s `WGM1_W`

    No `ctc` function for `atmega328p`'s `WGM1_W`

    I'm a bit puzzled, why is there no ctc function on atmega328p::tc1::tccr1a::WGM1_W, as it is the case for WGM0_W and WGM2_W?

    This inconsistency came up while I was working on https://github.com/Rahix/avr-hal/pull/257. Not having this or a comparable function makes it hard to use timers in a generic way.

    opened by Cryptjar 7
  • Investigate crate-size optimizations

    Investigate crate-size optimizations

    Right now we're calling form and rustfmt to split out the auto-generated modules into many files. I don't think this provides much value as nobody is going to look at those file anyway.

    I have a suspicion that we could reduce the crate (download) size a bit by not calling form. For rustfmt on the other hand I am completely unsure whether it helps or not. svd2rust does generate a lot of unnecessary whitespace but I do not know whether rustfmt generates more or less (due to indentation). A rust minifier would of course be the best solution here ;)

    help wanted buildsystem 
    opened by Rahix 4
  • Better Mutex

    Better Mutex

    We're currently relying on the mutex type from bare-metal which is actually being removed upstream so now is a good time to think about adding a similar mechanism here and maybe improving it. For starters, I'd want the mutex to actually hand out &mut _ references because 99% of use-cases need this.

    It would be interesting to explore the concept of a critical-section handle a bit more:

    • Maybe ISRs should optionally get a cs-handle as an argument as nothing could interrupt them?
    • Even further, maybe main should get a cs-handle in the beginning? Interrupts are disabled so it would be sound. Then, later an interrupt::enable() function should consume the handle when enabling interrupts for the first time. Is there a problem I'm missing?
    runtime 
    opened by Rahix 8
Releases(v0.4.0)
  • v0.4.0(Sep 8, 2022)

    Added

    • Support for ATmega164PA (#101 by @tronje).
    • Added a new, safer, API for manually managing interrupts (#104 by @mbuesch).

    Changed

    • Fixed timer registers for ATtiny167 (#102 by @dalpil).
    • Improved codegen of the interrupt management functions (#104 by @mbuesch).
    • Updated to bare-metal version 1.0.0. This changes the interrupt::free() function slightly. Please check the docs for details (#108 by @mbuesch).

    Removed

    • Support for very old rustc versions which need llvm_asm!() (#106, #109 by @mbuesch).
    Source code(tar.gz)
    Source code(zip)
  • v0.3.4(Jun 23, 2022)

  • v0.3.3(May 10, 2022)

    Added

    • Support for ATtiny1614 (#90 by @justinlatimer).
    • Support for ATmega128RFA1 (#93 by @the6p4c).
    • Support for ATmega1284P (#94 by @mguillemot).
    • Support for avr-device now being a huge crate... My advice: Don't build with --all-features!

    Fixed

    • avr-device now compiles with newer rustc versions (> 1.59) where the llvm_asm!() macro was removed in favor of asm!() (#97 by @Patryk27).
    Source code(tar.gz)
    Source code(zip)
  • v0.3.2(Oct 14, 2021)

    Added

    • Support for ATtiny202 (#82 by @anall).
    • Support for ATtiny167 (#84 by @quentinmit).
    • Support for ATtiny2313 and ATtiny2313A (#85 by @USA-RedDragon).

    Changed

    • Upgraded to svd2rust version 0.19 (#86). Please check the upstream changelog for details about what changes this has lead to.
    • interrupt::disable() now returns a boolean, indicating whether interrupts were previously enabled (#89 by @torrancew).

    Fixed

    • Fixed enumerated values for TWAA field in ATtiny841 (c0db0422b9ca).
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Jun 29, 2021)

    Added

    • Support for ATmega8U2 (#77 by @drmorr0).
    • Support for AT90USB1286 (#80 by @khimaros).
    • Convert static muts into &mut references inside #[entry] and interrupt handlers. This behavior mirrors what cortex-m-rt does (#79 by @tones111).
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Feb 7, 2021)

    Added

    • Support for ATmega4809 (#63 by @explicite).
    • Support for ATtiny841 and ATtiny861 (#67 by @jaxter184).

    Changed

    • BREAKING: Updated the enumerated values for the SPI clock prescaler field (#64).
    • BREAKING: Split the EIMSK register fields into per-bit fields on ATmega328P and ATmega328PB (#74 by @gpgreen).
    • Switched to using the svd interrupts command for extracting a list of interrupts instead of parsing generated rust source files for this (#69 by @explicite).

    Fixed

    • ATmega64: Fixed wrong field size for UMSELn fields in USART peripherals (#64).
    • (via atdf2svd v0.2.0): Removed invalid enumerated values from all fields.
    • Fixed an error in the 16-bit timer documentation (#67 by @jaxter184).
    • Fixed the PRR, PRR0, and PRR1 registers for ATmega328P and ATmega328PB wrongly being read-only (#73, #74 by @gpgreen)
    Source code(tar.gz)
    Source code(zip)
  • v0.2.3(Oct 24, 2020)

    Added

    • Support for ATmega644
    • Support for ATmega328PB

    Changed

    • Rewired svd-patching infrastructure to use upstream svdtools instead of the locally vendored script.

    Fixed

    • Made ADCSRA for ATtiny84 read-write.
    • Made TIFR registers for ATmega timers read-write.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Oct 24, 2020)

    Added

    • Support for ATmega168
    • Support for ATmega48P
    • Support for ATtiny84

    Changed

    • #[entry] causes a (readable) compile-error when attempting to build for non-AVR targets.
    • PINx registers are now writeable, which enables efficient toggling of bits in the corresponding PORTx register.

    Fixed

    • inline-assembly is now only emitted when building for AVR targets to prevent weird compiler errors where AVR instructions are emitted on e.g. x86_64.
    • Fixed an issue in the build-system in preparation for the next svd2rust release.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Oct 24, 2020)

  • v0.2.0(Oct 24, 2020)

    Added

    • Support for ATtiny88.
    • An asm module with wrapper functions for various assembly instructions.

    Changed

    • Various patches for ATtiny85, fixing up a lot of the remaining inconsistencies.
    • interrupt::enable() is now unsafe, as it would otherwise be possible to enable interrupts safely inside a critical section.
    Source code(tar.gz)
    Source code(zip)
Owner
Rahix
Rahix
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
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
AVR device definitions

avrd AVR device definitons in Rust. Documentation This crate exposes information about different AVR microcontrollers so it can be used pragmatically.

The AVR-Rust project 32 Dec 28, 2022
Convert an MCU register description from the EDC format to the SVD format

edc2svd Convert an MCU register description from the EDC format to the SVD format EDC files are used to describe the special function registers of PIC

Stephan 4 Oct 9, 2021
Generate Rust register maps (`struct`s) from SVD files

svd2rust Generate Rust register maps (structs) from SVD files This project is developed and maintained by the Tools team. Documentation API Minimum Su

Rust Embedded 518 Dec 30, 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
ICSP (2-wire) dongle for flashing PIC32 microcontrollers

Pic32Probe This is an ICSP (2-wire) dongle for flashing PIC32 microcontrollers implemented on an Raspberry Pi RP2040 microcontroller. Use a simple RP2

Stephan 3 Sep 26, 2022
HAL for the CH58x family of microcontrollers. BLE 5.3, RISC-V Qingke V4.

ch58x-hal HAL for the CH58x RISC-V BLE microcotrollers from WCH. This crate is under random and active development. DO NOT USE in production. This sho

WCH MCU for Rust 3 Oct 24, 2023
Rust crate which provides direct access to files within a Debian archive

debarchive This Rust crate provides direct access to files within a Debian archive. This crate is used by our debrep utility to generate the Packages

Pop!_OS 11 Dec 18, 2021
SubStrings, Slices and Random String Access in Rust

SubStrings, Slices and Random String Access in Rust This is a simple way to do it. Description Rust string processing is kind of hard, because text in

João Nuno Carvalho 2 Oct 24, 2021
Low level access to ATmega32U4 registers in Rust

Deprecation Note: This crate will soon be deprecated in favor of avr-device. The approach of generating the svd from hand-written register definitions

Rahix 9 Jan 27, 2021
A simple interpreter for the mathematical random-access machine

Random-access machine runner A simple Rust RAM program runner. Lexer/Parser Program executor Code formatter Web Compiled to WASM to run in the browser

Marcin Wojnarowski 5 Jan 14, 2023
Rust wrapper for the Google Places API. Access their hundreds of millions of places, reviews, and ratings.

Google Places API Working Examples cargo run --example nearby_search cargo run --example place_details cargo run --example find_place cargo run --exam

Jared Ucherek 4 Jun 12, 2023
microtemplate - A fast, microscopic helper crate for runtime string interpolation.

microtemplate A fast, microscopic helper crate for runtime string interpolation. Design Goals Very lightweight: I want microtemplate to do exactly one

_iPhoenix_ 13 Jan 31, 2022
A fancy diagnostics & error reporting crate

A fancy diagnostics & error reporting crate

Joshua Barretto 1.1k Dec 30, 2022
Debug2 is a pretty printing crate based on std::fmt

debug2 is a pretty printing crate based on std::fmt Why not just use Debug The Debug trait is good, but the problem is it is not very good at n

Nixon Enraght-Moony 18 Jun 23, 2022
Granular locking crate for Rust

Granular locking crate for Rust. Instead of using coarse-grained Mutex or RwLock which can be used to lock an entire structure, glock provides more granular locking.

Ayman Madkour 9 Jul 22, 2022
A crate to implement leader election for Kubernetes workloads in Rust.

Kubernetes Leader Election in Rust This library provides simple leader election for Kubernetes workloads.

Hendrik Maus 33 Dec 29, 2022
This crate allows writing a struct in Rust and have it derive a struct of arrays layed out in memory according to the arrow format.

Arrow2-derive - derive for Arrow2 This crate allows writing a struct in Rust and have it derive a struct of arrays layed out in memory according to th

Jorge Leitao 29 Dec 27, 2022