增加代码,将从站代码也改成RV32E和RV32I混合编程的版本

This commit is contained in:
2025-02-03 14:56:04 +08:00
parent 2dc822da1b
commit 6b6258ffa9
7 changed files with 133 additions and 32 deletions

View File

@@ -1,8 +1,17 @@
#include "tl2cdr.h"
.extern main
.extern plic_handle
.extern int_svr_code
.extern plic_claim
.extern flag_intTxEnd
.extern flag_intRxError
.extern flag_intRxStart
.extern flag_intRxEnd
.globl _prog_start
.section .text.init
@@ -26,6 +35,7 @@ _prog_start:
li x13, 0
li x14, 0
li x15, 0
#ifdef __RV32I_MARCH__
li x16, 0
li x17, 0
li x18, 0
@@ -42,14 +52,26 @@ _prog_start:
li x29, 0
li x30, 0
li x31, 0
#endif
li sp, 0x40011000
la t0, trap_entry
lui t0, %hi(plic_claim)
lw a0, %lo(plic_claim)(t0)
la a1, flag_intTxEnd
la a2, flag_intRxError
la a3, flag_intRxStart
la a4, flag_intRxEnd
call int_svr_code
mv t0, a0 #trap_entry,RV32I
#la t0, trap_entry #trap_entryRV32E
csrw mtvec, t0
li t0, 1 << 11
csrw mie, t0
li sp, 0x40011000
csrr t0, mstatus
ori t0, t0, 1<<3
csrw mstatus, t0
@@ -80,6 +102,7 @@ trap_entry:
sw a3,52(sp)
sw a4,56(sp)
sw a5,60(sp)
#ifdef __RV32I_MARCH__
sw a6,64(sp)
sw a7,68(sp)
sw s2,72(sp)
@@ -96,26 +119,10 @@ trap_entry:
sw t4,116(sp)
sw t5,120(sp)
sw t6,124(sp)
csrr t0, mstatus # mstatus
andi t0, t0, ~(1 << 3) # MIE ()
csrw mstatus, t0 # mstatus
#endif
call plic_handle
csrr t0, mstatus
ori t0, t0, 1<<3
csrw mstatus, t0
lw ra,4(sp)
lw sp,8(sp)
lw gp,12(sp)
@@ -131,6 +138,7 @@ trap_entry:
lw a3,52(sp)
lw a4,56(sp)
lw a5,60(sp)
#ifdef __RV32I_MARCH__
lw a6,64(sp)
lw a7,68(sp)
lw s2,72(sp)
@@ -147,6 +155,7 @@ trap_entry:
lw t4,116(sp)
lw t5,120(sp)
lw t6,124(sp)
#endif
addi sp,sp,136