diff --git a/README.md b/README.md new file mode 100644 index 0000000..42fb9ca --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# AVR Playground + +```bash +sudo dnf install avr-binutils avr-libc avr-gcc avr-gcc-c++ avrdude qemu-system-avr +``` diff --git a/makefile b/makefile index 272b3ff..5a7ee9f 100644 --- a/makefile +++ b/makefile @@ -6,6 +6,7 @@ PROGRAMMER = usbasp # MCU MCU = atmega328p +QEMU_MACHINE_NAME = uno # Compiler flags CFLAGS = -std=c99 -Wall -Wno-array-bounds -mmcu=$(MCU) -DF_CPU=16000000UL -O3 @@ -38,6 +39,10 @@ $(TARGET).hex: $(TARGET).elf flash: $(TARGET).hex avrdude -p $(MCU) -c $(PROGRAMMER) -U flash:w:$(TARGET).hex +# Run the program in QEMU +qemu: $(TARGET).elf + qemu-system-avr -machine $(QEMU_MACHINE_NAME) -bios $(TARGET).elf + # Clean clean: rm -f $(OBJS) $(TARGET).elf $(TARGET).hex