Build arduino code (for AVR) and allow test in qemu

This commit is contained in:
Toby Jaffey 2025-12-11 11:53:23 +00:00
parent 7c9d56ee69
commit 6b2063c6ab
4 changed files with 24 additions and 8 deletions

View file

@ -1,8 +1,10 @@
# The purpose of this Makefile is to auto-generate the Arduino example
# Auto-generate the Arduino example
# Arduino cannot set -DUVM32_MEMORY_SIZE, so add a config file
# Arduino expects .cpp files
make:
# make test, runs in qemu
all:
echo '#include "config.h"' > uvm32.cpp
cat ../uvm32/uvm32.c >> uvm32.cpp
cp ../uvm32/uvm32.h uvm32.h
@ -10,6 +12,10 @@ make:
cp ../common/uvm32_common_custom.h uvm32_common_custom.h
cp ../common/uvm32_sys.h uvm32_sys.h
xxd -i ../precompiled/mandel.bin | sed -e "s/unsigned char/const unsigned char/" > mandel.h
arduino-cli compile -b arduino:avr:uno -e
test: all
qemu-system-avr -machine uno -bios build/arduino.avr.uno/host-arduino.ino.elf -nographic -serial mon:stdio
clean:
rm -f uvm32.cpp uvm32.h mini-rv32ima.h uvm32_common_custom.h uvm32_sys.h mandel.h
rm -rf uvm32.cpp uvm32.h mini-rv32ima.h uvm32_common_custom.h uvm32_sys.h mandel.h build

View file

@ -1,2 +1,2 @@
// Arduino cannot do -DUVM32_MEMORY_SIZE, so set this explicitly
#define UVM32_MEMORY_SIZE 1024
#define UVM32_MEMORY_SIZE 512