Qemu testing

This commit is contained in:
Imbus 2024-02-10 14:37:38 +01:00
parent a6ab36790f
commit 8b99dd4753
2 changed files with 10 additions and 0 deletions

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# AVR Playground
```bash
sudo dnf install avr-binutils avr-libc avr-gcc avr-gcc-c++ avrdude qemu-system-avr
```

View file

@ -6,6 +6,7 @@ PROGRAMMER = usbasp
# MCU # MCU
MCU = atmega328p MCU = atmega328p
QEMU_MACHINE_NAME = uno
# Compiler flags # Compiler flags
CFLAGS = -std=c99 -Wall -Wno-array-bounds -mmcu=$(MCU) -DF_CPU=16000000UL -O3 CFLAGS = -std=c99 -Wall -Wno-array-bounds -mmcu=$(MCU) -DF_CPU=16000000UL -O3
@ -38,6 +39,10 @@ $(TARGET).hex: $(TARGET).elf
flash: $(TARGET).hex flash: $(TARGET).hex
avrdude -p $(MCU) -c $(PROGRAMMER) -U flash:w:$(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
clean: clean:
rm -f $(OBJS) $(TARGET).elf $(TARGET).hex rm -f $(OBJS) $(TARGET).elf $(TARGET).hex