Skip to content

Commit caf56d7

Browse files
committed
feat: low level, bringup
1 parent 65a9615 commit caf56d7

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

libcpu/risc-v/t-head/c906/SConscript

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# RT-Thread building script for component
22

33
from building import *
4-
54
cwd = GetCurrentDir()
65
src = Glob('*.c') + Glob('*.cpp') + Glob('*_gcc.S')
76
CPPPATH = [cwd]
87

8+
if not GetDepend('ARCH_USING_ASID'):
9+
SrcRemove(src, ['asid.c'])
10+
911
group = DefineGroup('libcpu', src, depend = [''], CPPPATH = CPPPATH)
1012

1113
Return('group')

libcpu/risc-v/t-head/c906/sbi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ static struct sbi_ret sbi_get_impl_version(void)
6868

6969
void sbi_print_version(void)
7070
{
71-
unsigned int major;
72-
unsigned int minor;
71+
uint32_t major;
72+
uint32_t minor;
7373

7474
/* For legacy SBI implementations. */
7575
if (sbi_spec_version == 0)

libcpu/risc-v/t-head/c906/sbi.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#ifndef _MACHINE_SBI_H_
4949
#define _MACHINE_SBI_H_
5050

51+
#include <stdint.h>
5152
#include <rtdef.h>
5253

5354
/* SBI Specification Version */
@@ -140,7 +141,7 @@ struct sbi_ret
140141
long value;
141142
};
142143

143-
static inline struct sbi_ret
144+
rt_inline struct sbi_ret
144145
sbi_call(uint64_t arg7, uint64_t arg6, uint64_t arg0, uint64_t arg1,
145146
uint64_t arg2, uint64_t arg3, uint64_t arg4)
146147
{

libcpu/risc-v/t-head/c906/startup_gcc.S

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ _start:
7575
li x31,0
7676

7777
/* set to disable FPU */
78+
li t0, SSTATUS_FS + SSTATUS_VS
79+
csrc sstatus, t0
7880
li t0, SSTATUS_SUM
7981
csrs sstatus, t0
8082

libcpu/risc-v/t-head/c906/syscall_c.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "riscv_mmu.h"
2727
#include "stack.h"
2828

29-
typedef rt_size_t (*syscallfunc_t)(rt_size_t, rt_size_t, rt_size_t, rt_size_t, rt_size_t, rt_size_t, rt_size_t);
29+
typedef rt_ubase_t (*syscallfunc_t)(rt_ubase_t, rt_ubase_t, rt_ubase_t, rt_ubase_t, rt_ubase_t, rt_ubase_t, rt_ubase_t);
3030

3131
void syscall_handler(struct rt_hw_stack_frame *regs)
3232
{

libcpu/risc-v/virt64/SConscript

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# RT-Thread building script for component
22

33
from building import *
4-
5-
Import('rtconfig')
6-
74
cwd = GetCurrentDir()
85
src = Glob('*.c') + Glob('*.cpp') + Glob('*_gcc.S')
9-
src = src + ['../common/atomic_riscv.c']
106
CPPPATH = [cwd]
117

8+
if not GetDepend('ARCH_USING_ASID'):
9+
SrcRemove(src, ['asid.c'])
10+
11+
if not GetDepend('ARCH_RISCV_VECTOR'):
12+
SrcRemove(src, ['vector_gcc.S'])
13+
1214
group = DefineGroup('libcpu', src, depend = [''], CPPPATH = CPPPATH)
1315

1416
Return('group')

libcpu/risc-v/virt64/sbi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct sbi_ret
141141
long value;
142142
};
143143

144-
static __inline struct sbi_ret
144+
rt_inline struct sbi_ret
145145
sbi_call(uint64_t arg7, uint64_t arg6, uint64_t arg0, uint64_t arg1,
146146
uint64_t arg2, uint64_t arg3, uint64_t arg4)
147147
{

libcpu/risc-v/virt64/startup_gcc.S

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
* 2018/10/01 Bernard The first version
99
* 2018/12/27 Jesven Add SMP support
1010
* 2020/6/12 Xim Port to QEMU and remove SMP support
11+
* 2024-06-30 Shell Support of kernel remapping
1112
*/
1213

1314
#include <encoding.h>
1415
#include <cpuport.h>
1516

1617
.data
1718
.global boot_hartid /* global varible rt_boot_hartid in .data section */
18-
boot_hartid:
19+
boot_hartid:
1920
.word 0xdeadbeef
2021

2122
.global _start

0 commit comments

Comments
 (0)