diff options
| author | cheapie <cheapiephp@gmail.com> | 2026-06-23 18:54:53 -0500 |
|---|---|---|
| committer | cheapie <cheapiephp@gmail.com> | 2026-06-23 18:54:53 -0500 |
| commit | 3acb10122050d710845a7c35e84423cc1aae5632 (patch) | |
| tree | 2eadd0c8514b7fd046621b26f79db156349c22e9 /assembly/landingpad-test | |
| parent | 41a6282fb32a3a7dbeca64191ddd804585bca5f4 (diff) | |
| download | rvcontroller-3acb10122050d710845a7c35e84423cc1aae5632.tar rvcontroller-3acb10122050d710845a7c35e84423cc1aae5632.tar.gz rvcontroller-3acb10122050d710845a7c35e84423cc1aae5632.tar.bz2 rvcontroller-3acb10122050d710845a7c35e84423cc1aae5632.tar.xz rvcontroller-3acb10122050d710845a7c35e84423cc1aae5632.zip | |
Add Zicfilp extension and some CSR improvements
Diffstat (limited to 'assembly/landingpad-test')
| -rw-r--r-- | assembly/landingpad-test/Makefile | 24 | ||||
| -rw-r--r-- | assembly/landingpad-test/landingpad-test.S | 52 | ||||
| -rwxr-xr-x | assembly/landingpad-test/landingpad-test.elf | bin | 0 -> 5788 bytes | |||
| -rw-r--r-- | assembly/landingpad-test/landingpad-test.hex | 20 | ||||
| -rw-r--r-- | assembly/landingpad-test/landingpad-test.o | bin | 0 -> 1992 bytes | |||
| l--------- | assembly/landingpad-test/rvcontroller.ld | 1 |
6 files changed, 97 insertions, 0 deletions
diff --git a/assembly/landingpad-test/Makefile b/assembly/landingpad-test/Makefile new file mode 100644 index 0000000..139d2c3 --- /dev/null +++ b/assembly/landingpad-test/Makefile @@ -0,0 +1,24 @@ +MARCH ?= rv32imacbzicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zawrs_zbkb_zbkx_zcb_zcmp_zcmt_zicfilp + +.PHONY: all dump load clean + +all: landingpad-test.hex + +landingpad-test.o: landingpad-test.S + riscv32-none-elf-as -I../rvcontroller-libraries -march=${MARCH} -o landingpad-test.o landingpad-test.S + +landingpad-test.elf: landingpad-test.o + riscv32-none-elf-ld -T rvcontroller.ld --no-warn-rwx-segments -o landingpad-test.elf landingpad-test.o + +dump: landingpad-test.elf + riscv32-none-elf-objdump -d landingpad-test.elf + +landingpad-test.hex: landingpad-test.elf + riscv32-none-elf-objcopy -O ihex landingpad-test.elf landingpad-test.hex + +load: landingpad-test.hex + bash -c "wl-copy < landingpad-test.hex" + +clean: + rm -f landingpad-test.hex landingpad-test.elf landingpad-test.o + diff --git a/assembly/landingpad-test/landingpad-test.S b/assembly/landingpad-test/landingpad-test.S new file mode 100644 index 0000000..21c1712 --- /dev/null +++ b/assembly/landingpad-test/landingpad-test.S @@ -0,0 +1,52 @@ +li t0,0x400 +csrw mseccfg,t0 # Turn on MLPE (enable Zicfilp) + +li t0,1 +csrw 0x800,t0 # Enable lightweight mode (will make each pause 1s long) + +li a7,4 +la a0,test1msg +ecall # Display test 1 explanation + +pause +pause + +la s0,test1jump +jalr zero,s0,0 # This jump lands on a landing pad + +.word 0 # Invalid instruction just to make sure the jump really happened + +test1jump: +lpad 0 +li a7,4 +la a0,test1done +ecall # Tell user we got here + +pause +pause + +li a7,4 +la a0,test2msg +ecall # Display test 2 explanation + +pause +pause + +la s0,test2jump +jalr zero,s0,0 # This jump doesn't land on a landing pad + +.word 0 # Another invalid instruction to jump over + +test2jump: +# No landing pad! This should crash +li a7,4 +la a0,test2done +ecall # Tell user we got here (we shouldn't have!) + +li a7,10 +ecall + +test1msg: .asciz "Testing OK jump\nThis should work\n\n\n\n" +test1done: .asciz "OK jump jumped\nThis is expected\n\n\n\n" +test2msg: .asciz "Testing bad jump\nThis should crash\n\n\n\n" +test2done: .asciz "Bad jump jumped!\nThis shouldn't\nhappen\n\n\n" diff --git a/assembly/landingpad-test/landingpad-test.elf b/assembly/landingpad-test/landingpad-test.elf Binary files differnew file mode 100755 index 0000000..b08c3a0 --- /dev/null +++ b/assembly/landingpad-test/landingpad-test.elf diff --git a/assembly/landingpad-test/landingpad-test.hex b/assembly/landingpad-test/landingpad-test.hex new file mode 100644 index 0000000..4d8d8c5 --- /dev/null +++ b/assembly/landingpad-test/landingpad-test.hex @@ -0,0 +1,20 @@ +:10000000930200407390727485427390028091480D
+:100010001705000013058507730000000F0000019D
+:100020000F0000011704000013040401670004001E
+:10003000000000001700000091481705000013059C
+:100040003507730000000F0000010F000001914808
+:100050001705000013051508730000000F000001CC
+:100060000F000001170400001304040167000400DE
+:1000700000000000914817050000130525087300D3
+:100080000000A9487300000054657374696E67200E
+:100090004F4B206A756D700A546869732073686FDE
+:1000A000756C6420776F726B0A0A0A0A004F4B2046
+:1000B0006A756D70206A756D7065640A546869733D
+:1000C0002069732065787065637465640A0A0A0A9A
+:1000D0000054657374696E6720626164206A756D8F
+:1000E000700A546869732073686F756C642063725A
+:1000F0006173680A0A0A0A00426164206A756D70B9
+:10010000206A756D706564210A546869732073688C
+:100110006F756C646E27740A68617070656E0A0A88
+:020120000A00D3
+:00000001FF
diff --git a/assembly/landingpad-test/landingpad-test.o b/assembly/landingpad-test/landingpad-test.o Binary files differnew file mode 100644 index 0000000..3534749 --- /dev/null +++ b/assembly/landingpad-test/landingpad-test.o diff --git a/assembly/landingpad-test/rvcontroller.ld b/assembly/landingpad-test/rvcontroller.ld new file mode 120000 index 0000000..bc01402 --- /dev/null +++ b/assembly/landingpad-test/rvcontroller.ld @@ -0,0 +1 @@ +../../rvcontroller.ld
\ No newline at end of file |
