Run my RISC-V emulator on an ARM Cortex-M0+ (SAMD21)
RISC-V-emulator-SAM
No external RAM, no SPI flash, no SD-card. The AVR port of the emulator needed all of those; this one proves the same RISC-V core runs on nothing but the SAMD21's internal SRAM.
Two files and a library
- `src/main.cpp` and `src/firmware.c` — the whole application
- `include/memory.h` with the 8 KiB RAM array
- `RiscvEmulatorImplementationSpecific.h`, glue between the emulator and the SAMD21 address space
- The `[env:mzeroUSB]` PlatformIO environment with M, A and Zicsr extensions enabled
The memory map
ROM sits at 0x20000000, the 8 KiB RAM at 0x80000000, and stores to 0x10000000 land on the native USB CDC. On power-on the core starts fetching at address 0 of the compiled-in ROM. Anything the RISC-V program writes to the UART shows up in a serial monitor at 115200 8N1.