cmdline support

This commit is contained in:
Luxferre
2026-06-19 08:09:18 +03:00
parent e79d71d323
commit bcceaf6aae
5 changed files with 151 additions and 9 deletions
+13 -3
View File
@@ -5,7 +5,7 @@ EMULATOR = ./amach
ASFLAGS = -march=rv32imac -mabi=ilp32 -nostdlib -s -static -fno-pic -fno-pie -mno-relax
LDFLAGS = -Wl,-Ttext=0x100b0 -Wl,--build-id=none
all: rv32imac_tests.bin rv32imac_syscall_tests.bin rv32imac_tests.elf rv32imac_syscall_tests.elf
all: rv32imac_tests.bin rv32imac_syscall_tests.bin rv32imac_args_tests.bin rv32imac_tests.elf rv32imac_syscall_tests.elf rv32imac_args_tests.elf
rv32imac_tests.elf: rv32imac_tests.s
$(CC) $(ASFLAGS) $(LDFLAGS) rv32imac_tests.s -o rv32imac_tests.elf
@@ -19,7 +19,13 @@ rv32imac_syscall_tests.elf: rv32imac_syscall_tests.s
rv32imac_syscall_tests.bin: rv32imac_syscall_tests.elf
$(OBJCOPY) -O binary rv32imac_syscall_tests.elf rv32imac_syscall_tests.bin
run: rv32imac_tests.bin rv32imac_syscall_tests.bin rv32imac_tests.elf rv32imac_syscall_tests.elf
rv32imac_args_tests.elf: rv32imac_args_tests.s
$(CC) $(ASFLAGS) $(LDFLAGS) rv32imac_args_tests.s -o rv32imac_args_tests.elf
rv32imac_args_tests.bin: rv32imac_args_tests.elf
$(OBJCOPY) -O binary rv32imac_args_tests.elf rv32imac_args_tests.bin
run: rv32imac_tests.bin rv32imac_syscall_tests.bin rv32imac_args_tests.bin rv32imac_tests.elf rv32imac_syscall_tests.elf rv32imac_args_tests.elf
@echo "Running CPU instruction tests (binary)..."
$(EMULATOR) rv32imac_tests.bin
@echo "Running CPU instruction tests (ELF)..."
@@ -32,6 +38,10 @@ run: rv32imac_tests.bin rv32imac_syscall_tests.bin rv32imac_tests.elf rv32imac_s
rm -rf test_dir test_link.txt test_output.txt test_output_new.txt
ln -sf test_output_new.txt test_link.txt
$(EMULATOR) rv32imac_syscall_tests.elf
@echo "Running command line arguments tests (binary)..."
$(EMULATOR) rv32imac_args_tests.bin arg1 arg2
@echo "Running command line arguments tests (ELF)..."
$(EMULATOR) rv32imac_args_tests.elf arg1 arg2
@echo "Testing standard ebreak..."
@echo "115 0 16 0" | awk -f amach.awk 2>&1 | grep -q "Fatal: EBREAK"
@echo "Testing compressed c.ebreak..."
@@ -39,6 +49,6 @@ run: rv32imac_tests.bin rv32imac_syscall_tests.bin rv32imac_tests.elf rv32imac_s
@echo "All tests PASSED!"
clean:
rm -rf rv32imac_tests.elf rv32imac_tests.bin rv32imac_syscall_tests.elf rv32imac_syscall_tests.bin test_dir test_link.txt test_output.txt test_output_new.txt
rm -rf rv32imac_tests.elf rv32imac_tests.bin rv32imac_syscall_tests.elf rv32imac_syscall_tests.bin rv32imac_args_tests.elf rv32imac_args_tests.bin test_dir test_link.txt test_output.txt test_output_new.txt
.PHONY: all run clean