3 releases

Uses old Rust 2015

0.0.3 Feb 13, 2021
0.0.2 Oct 20, 2017
0.0.1 Sep 17, 2016

#373 in Simulation

Download history 1/week @ 2023-11-06 7/week @ 2023-11-13 4/week @ 2023-11-20 12/week @ 2023-11-27 1/week @ 2023-12-04 1/week @ 2023-12-11 4/week @ 2023-12-18 7/week @ 2023-12-25 4/week @ 2024-01-01 1/week @ 2024-01-08 8/week @ 2024-01-15 1/week @ 2024-01-22 14/week @ 2024-01-29 2/week @ 2024-02-05 17/week @ 2024-02-12 96/week @ 2024-02-19

129 downloads per month

MIT license

48KB
1K SLoC

AVR emulator

Build Status Crates.io MIT licensed

This program emulates an 8-bit AVR microcontroller. It supports the trivial C "Hello World!" program.

NOTE: This emulator isn't quite complete. One notable thing is that not all status register updates are implemented for all instructions (#2).

Given some C++ source.

#include <avr/io.h>
#include <util/delay.h>

int main() {
  DDRB |= _BV(PB6);

  for(uint8_t i=0; i<5; i++) {
    PORTB |= _BV(PB6);
    _delay_ms(500);

    PORTB &= ~_BV(PB6);
    _delay_ms(500);
  }

  return 0;
}
# Generate an ELF object file for the Atmega328p
avr-g++ hello_world.c -DF_CPU=8000000 -mmcu=atmega328p -O2 -o hello_world.o

# Generate a raw binary
avr-objcopy -I elf32-avr -O binary hello_world.o hello_world.bin

cargo run hello_world.bin

No runtime deps