Skip to content

Commit 3fe3f04

Browse files
committed
RISC-V64 qemu_virt example support RVV Extension;
1 parent edffa04 commit 3fe3f04

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

ports/risc-v64/gnu/example_build/qemu_virt/csr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define MSTATUS_MIE (1L << 3) // machine-mode interrupt enable.
2222
#define MSTATUS_MPIE (1L << 7)
2323
#define MSTATUS_FS (1L << 13)
24+
#define MSTATUS_VS (1L << 9)
2425

2526
// Machine-mode Interrupt Enable
2627
#define MIE_MTIE (1L << 7)

ports/risc-v64/gnu/example_build/qemu_virt/demo_threadx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44

55
#include "tx_api.h"
66
#include "uart.h"
7+
#if defined(__riscv_vector)
8+
#define DEMO_STACK_SIZE (1024 + 16448) /* 16448 for RVV Extension */
9+
#define DEMO_BYTE_POOL_SIZE (9180 + 148032) /* 148032 for RVV Extension */
10+
#else
711
#define DEMO_STACK_SIZE 1024
812
#define DEMO_BYTE_POOL_SIZE 9180
13+
#endif
914
#define DEMO_BLOCK_POOL_SIZE 100
1015
#define DEMO_QUEUE_SIZE 100
1116

ports/risc-v64/gnu/example_build/qemu_virt/entry.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ _start:
4141
li x30, 0
4242
li x31, 0
4343
la t0, _sysstack_start
44-
li t1, 0x1000
44+
li t1, 0x5000
4545
add sp, t0, t1
4646
la t0, _bss_start
4747
la t1, _bss_end

ports/risc-v64/gnu/example_build/qemu_virt/link.lds

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SECTIONS
4141
.stack : {
4242
. = ALIGN(4096);
4343
_sysstack_start = .;
44-
. += 0x1000;
44+
. += 0x5000;
4545
_sysstack_end = .;
4646
}
4747

ports/risc-v64/gnu/example_build/qemu_virt/tx_initialize_low_level.S

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@
7070
#else
7171
addi sp, sp, -256 // Allocate space for all registers - without floating point enabled (32*8)
7272
#endif
73+
#if defined(__riscv_vector)
74+
/* Allocate space for vector registers */
75+
csrr t4, vlenb
76+
slli t4, t4, 5
77+
addi t4, t4, 5*8
78+
sub sp, sp, t4
79+
#endif
7380

7481
sd x1, 224(sp) // Store RA (28*8 = 224, because call will override ra [ra is a callee register in riscv])
7582

@@ -153,6 +160,10 @@ _tx_initialize_low_level:
153160
li t0, MSTATUS_FS
154161
csrrs zero, mstatus, t0 // set MSTATUS_FS bit to open f/d isa in riscv
155162
fscsr x0
163+
#endif
164+
#ifdef __riscv_vector
165+
li t0, MSTATUS_VS
166+
csrrs zero, mstatus, t0 // set MSTATUS_VS bit to open vector isa in riscv
156167
#endif
157168
addi sp, sp, -8
158169
sd ra, 0(sp)

0 commit comments

Comments
 (0)