Aiming to be a calculator implemented in RISC-V assembly
Find a file
2025-03-09 20:15:33 +10:00
tests WIP 2025-03-09 20:15:33 +10:00
.gitignore Add fmt_decimal and count_digits routines 2025-02-27 22:21:33 +10:00
calc.h WIP 2025-03-09 20:15:33 +10:00
calc.s Add tests for add64 2025-02-11 22:08:32 +10:00
cmain.c Fix segfault with the help of gdb via Nix 2025-02-09 21:36:54 +10:00
debug.s Make code compatible with LLVM 2025-02-13 20:32:18 +10:00
exit.s Add some sample files 2025-02-09 11:09:13 +10:00
fmt.s Add fmt_decimal and count_digits routines 2025-02-27 22:21:33 +10:00
hello.s Fix hello.s so that it only prints 5 times and exits 2025-02-09 11:32:46 +10:00
hex.s Add tests for add64 2025-02-11 22:08:32 +10:00
link.ld Add linker script to make bss work 2025-02-09 15:09:53 +10:00
main.s Add some sample files 2025-02-09 11:09:13 +10:00
Makefile WIP 2025-03-09 20:15:33 +10:00
math.s Implement mul, div, divmod, clz 2025-02-15 19:45:25 +10:00
mem.s Extract more bits from calc.s; use qemu for testing 2025-02-10 15:51:18 +10:00
README.md Make code compatible with LLVM 2025-02-13 20:32:18 +10:00
shell.nix Fix segfault with the help of gdb via Nix 2025-02-09 21:36:54 +10:00

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

Syscalls on RV32E

Syscalls supported by rv32emu.

Consensus seems to be pass the syscall number in t0: