From d239b952b03685c1753366550aee1a51e17566b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=85gren?= Date: Thu, 13 Mar 2025 15:33:20 +0100 Subject: [PATCH] fw: Replace custom picorv32 instructions in qemu target --- hw/application_fpga/Makefile | 1 + hw/application_fpga/fw/tk1/start.S | 11 +++++++++++ hw/application_fpga/fw/tk1/syscall_enable.S | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/hw/application_fpga/Makefile b/hw/application_fpga/Makefile index 75d076d..3a6db4b 100644 --- a/hw/application_fpga/Makefile +++ b/hw/application_fpga/Makefile @@ -204,6 +204,7 @@ simfirmware.elf: $(FIRMWARE_OBJS) $(P)/fw/tk1/firmware.lds $(CC) $(CFLAGS) $(FIRMWARE_OBJS) $(LDFLAGS) -o $@ > $(basename $@).map qemu_firmware.elf: CFLAGS += -DQEMU_DEBUG +qemu_firmware.elf: ASFLAGS += -DQEMU_DEBUG qemu_firmware.elf: firmware.elf mv firmware.elf qemu_firmware.elf diff --git a/hw/application_fpga/fw/tk1/start.S b/hw/application_fpga/fw/tk1/start.S index f9b72fc..cdfb39f 100644 --- a/hw/application_fpga/fw/tk1/start.S +++ b/hw/application_fpga/fw/tk1/start.S @@ -4,8 +4,19 @@ */ #include + +#ifdef QEMU_DEBUG + +#define picorv32_retirq_insn(...) \ + mv ra, x3; \ + ret + +#else + #include "picorv32/custom_ops.S" // PicoRV32 custom instructions +#endif + #define illegal_insn() .word 0 // Variables in bss diff --git a/hw/application_fpga/fw/tk1/syscall_enable.S b/hw/application_fpga/fw/tk1/syscall_enable.S index 2bcd357..58cc62a 100644 --- a/hw/application_fpga/fw/tk1/syscall_enable.S +++ b/hw/application_fpga/fw/tk1/syscall_enable.S @@ -1,5 +1,13 @@ +#ifdef QEMU_DEBUG + +#define picorv32_maskirq_insn(...) + +#else + #include "../tk1/picorv32/custom_ops.S" +#endif + .section ".text" .globl syscall_enable