2024-10-25 17:46:21 +08:00
|
|
|
|
|
2024-10-28 15:51:12 +08:00
|
|
|
|
|
|
|
|
|
|
#include "custom_ops.S"
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-28 18:01:25 +08:00
|
|
|
|
.extern main
|
|
|
|
|
|
.globl _prog_start
|
|
|
|
|
|
.section .text.init
|
2024-10-28 15:51:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-10-28 18:01:25 +08:00
|
|
|
|
_prog_start:
|
2024-10-29 17:32:17 +08:00
|
|
|
|
li sp, 0
|
2024-10-28 18:01:25 +08:00
|
|
|
|
picorv32_maskirq_insn(zero, zero)
|
2024-10-29 17:32:17 +08:00
|
|
|
|
|
2024-10-28 18:01:25 +08:00
|
|
|
|
call main
|
2024-10-28 15:51:12 +08:00
|
|
|
|
|
2024-10-29 17:32:17 +08:00
|
|
|
|
|
2024-10-28 18:01:25 +08:00
|
|
|
|
ecall
|
2024-10-28 15:51:12 +08:00
|
|
|
|
|
2024-10-25 17:46:21 +08:00
|
|
|
|
|
2024-10-28 18:01:25 +08:00
|
|
|
|
.balign 32
|
2024-10-29 09:33:29 +08:00
|
|
|
|
.section .trap_entry, "ax", %progbits
|
2024-10-25 17:46:21 +08:00
|
|
|
|
trap_entry:
|
2024-10-28 18:01:25 +08:00
|
|
|
|
# q0 return address
|
|
|
|
|
|
# q1 bitmask of all IRQ to be handled, may be more than one IRQ
|
|
|
|
|
|
# q2 q3 unused, can be use as temp storage register
|
|
|
|
|
|
|
|
|
|
|
|
# q寄存器已经禁用, Without the q-registers, the irq return address will be stored in x3 (gp) and the IRQ bitmask in x4 (tp),
|
|
|
|
|
|
|
2024-10-30 17:11:59 +08:00
|
|
|
|
# io.interrupt(0) := intTxError
|
|
|
|
|
|
# io.interrupt(1) := intRxError
|
|
|
|
|
|
# io.interrupt(2) := intRxStart
|
|
|
|
|
|
# io.interrupt(3) := intRxEnd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
or sp, sp, x4
|
|
|
|
|
|
|
2024-11-15 14:35:39 +08:00
|
|
|
|
andi x4, x4, 0x2
|
|
|
|
|
|
beqz x4, 1f
|
|
|
|
|
|
li x4, 0
|
|
|
|
|
|
sw x3, 0x400(x0)
|
2024-10-30 17:11:59 +08:00
|
|
|
|
|
2024-11-15 14:35:39 +08:00
|
|
|
|
1:
|
2024-10-28 18:01:25 +08:00
|
|
|
|
picorv32_retirq_insn()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|