Aiming to be a calculator implemented in RISC-V assembly
tests | ||
.gitignore | ||
calc.h | ||
calc.s | ||
cmain.c | ||
debug.s | ||
exit.s | ||
fmt.s | ||
hello.s | ||
hex.s | ||
link.ld | ||
main.s | ||
Makefile | ||
math.s | ||
mem.s | ||
README.md | ||
shell.nix |
Calculator
Aims to be a calculator implemented in 32-bit RISC-V assembly, initially targeting the inexpensive CH32V003 RV32EC microcontroller: 48Mhz 2KB SRAM, 16KB Flash.
Notes
Disassemble
riscv64-unknown-elf-objdump -D main.o
List Symbols
riscv64-unknown-elf-nm calc.o
List segment info
readelf -l calc.elf
Build with LLVM
make AS=clang ASFLAGS="-g -mabi=ilp32e --target=riscv32-unknown-elf -nostdlib -c"
Resources
- https://riscv-programming.org/book/riscv-book.html
- CH32V003 Datasheet
- QingKeV2 Processor Manual — core used in the CH32V003
Syscalls on RV32E
Syscalls supported by rv32emu.
Consensus seems to be pass the syscall number in t0
: