In order to write applications for the Potato Processor, you need to have an updated RISC-V toolchain. To obtain such a toolchain, go to https://github.com/riscv/riscv-tools and follow the instructions to build and install the necessary tools.
In addition to supporting the interrupts specified in the machine mode part of the RISC-V supervisor extensions, the Potato Processor also supports 8 IRQ inputs as interrupt sources.
To enable an interrupt, the corresponding bit has to be set in the mie register, where bits 24 to 31 correspond to IRQs 0 to 7. In addition, the master interrupt enable bit (bit 0) has to be set in the mstatus register as defined by the specification.
When handling an interrupt, the mip register can be used to check for pending IRQs. Just as in the mie register, bits 24 to 31 correspond to IRQs 0 to 7. Note that the bits in the mie register shows whether an interrupt is pending regardless of whether the interrupt is enabled in the mie register.
To determine which interrupt caused the interrupt handler to be run, the mcause register should be used. An IRQ interrupt causes the interrupt bit (bit 31) to be set and the interrupt number to be set to 16 plus the IRQ number.
To disable an interrupt, clear the corresponding bit in the mie register.
There are some issues to keep in mind when programming for the Potato Processor: