Skip to content

Commit 9a8dec3

Browse files
BernardXiongRbb666
authored andcommitted
[BSP][K230] Add soft-fpu option for k230
1 parent ad2de6e commit 9a8dec3

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

bsp/k230/Kconfig

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ source "$RTT_DIR/Kconfig"
1010
source "$PKGS_DIR/Kconfig"
1111
rsource "board/Kconfig"
1212

13-
config BOARD_fpgac908
13+
config BOARD_C908
1414
bool
1515
select ARCH_RISCV64
1616
select RT_USING_COMPONENTS_INIT
1717
select RT_USING_USER_MAIN
1818
select RT_USING_CACHE
1919
select ARCH_MM_MMU
20-
select ARCH_RISCV_FPU_D
20+
select ARCH_RISCV_FPU
2121
select ARCH_REMAP_KERNEL if RT_USING_SMART
2222
default y
2323

@@ -38,3 +38,17 @@ choice BSP_ROOTFS_TYPE
3838
select RT_USING_DFS_CROMFS
3939
select PKG_USING_ZLIB
4040
endchoice
41+
42+
choice BSP_RISCV_USING_FPU
43+
prompt "FPU precision"
44+
default BSP_RISCV_FPU_D
45+
46+
config BSP_RISCV_FPU_SOFT
47+
bool "Software floating-point"
48+
select ARCH_RISCV_FPU
49+
50+
config BSP_RISCV_FPU_D
51+
bool "Double-precision floating-point with Vector"
52+
select ARCH_RISCV_FPU_D
53+
select ARCH_RISCV_VECTOR
54+
endchoice

bsp/k230/SConstruct

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ from rtconfig import RTT_ROOT
88
import sys
99

1010
def generate_ldscript(input, output):
11-
1211
if not os.path.exists(input):
1312
print('Error: file', input, 'not found')
1413
return
@@ -30,12 +29,20 @@ def generate_ldscript(input, output):
3029

3130
print(output, 'is generated from', input)
3231

33-
3432
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
3533
from building import *
3634

3735
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
3836

37+
# apply soft-FPU config
38+
options = LocalOptions("rtconfig.h")
39+
soft_fpu = GetLocalDepend(options, 'BSP_RISCV_FPU_SOFT')
40+
if soft_fpu:
41+
rtconfig.DEVICE = rtconfig.DEVICE.replace('-march=rv64imafdcv -mabi=lp64d', '-march=rv64imafdc -mabi=lp64')
42+
rtconfig.CFLAGS = rtconfig.CFLAGS.replace('-march=rv64imafdcv -mabi=lp64d', '-march=rv64imafdc -mabi=lp64')
43+
rtconfig.LFLAGS = rtconfig.LFLAGS.replace('-march=rv64imafdcv -mabi=lp64d', '-march=rv64imafdc -mabi=lp64')
44+
rtconfig.AFLAGS = rtconfig.AFLAGS.replace('-march=rv64imafdcv -mabi=lp64d', '-march=rv64imafdc -mabi=lp64')
45+
3946
DefaultEnvironment(tools=[])
4047
env = Environment(tools = ['mingw'],
4148
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,

0 commit comments

Comments
 (0)