From 4a503484aa0e2615add92f0e2e014ea26bb6dff1 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 30 Sep 2026 18:36:21 +0000 Subject: [PATCH] [bsp][qemu-virt64-riscv] Allow optional C-only Picolibc builds --- bsp/qemu-virt64-riscv/SConstruct | 3 +++ bsp/qemu-virt64-riscv/rtconfig.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bsp/qemu-virt64-riscv/SConstruct b/bsp/qemu-virt64-riscv/SConstruct index ae0e3375e111..71e1b82dea06 100644 --- a/bsp/qemu-virt64-riscv/SConstruct +++ b/bsp/qemu-virt64-riscv/SConstruct @@ -27,6 +27,9 @@ rtconfig.ARCH='risc-v' # prepare building environment objs = PrepareBuilding(env, RTT_ROOT, has_libcpu = False) +if not GetDepend('RT_USING_CPLUSPLUS'): + env['LINKFLAGS'] = env['LINKFLAGS'].replace(' -lsupc++', '') + stack_size = 4096 if GetDepend('RT_USING_SMART'): diff --git a/bsp/qemu-virt64-riscv/rtconfig.py b/bsp/qemu-virt64-riscv/rtconfig.py index 09d530af4a1c..82d1719efd38 100644 --- a/bsp/qemu-virt64-riscv/rtconfig.py +++ b/bsp/qemu-virt64-riscv/rtconfig.py @@ -33,6 +33,9 @@ OBJCPY = PREFIX + 'objcopy' DEVICE = ' -mcmodel=medany -march=rv64imafdc -mabi=lp64 ' + # Optional Picolibc toolchain; leave the default libc selection unchanged. + if os.getenv('RTT_PICOLIBC_SPECS'): + DEVICE += '--specs=' + os.environ['RTT_PICOLIBC_SPECS'] + ' ' CFLAGS = DEVICE + '-ffreestanding -flax-vector-conversions -Wno-cpp -fno-common -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fdiagnostics-color=always' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__ASSEMBLY__ ' LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,_start -T link.lds' + ' -lsupc++ -lgcc -static'