Files
rt-thread/components/lwp/vdso/user/arch/risc-v/SConstruct
bernard 721dfbfe01 [smart] Add vDSO support for RISC-V architecture and refactor related components
- Implemented vDSO functionality for the RISC-V architecture, including the necessary source files and linker scripts.
- Introduced a new `vdso_sys.c` file for RISC-V, containing functions to handle time retrieval using the vDSO mechanism.
- Created architecture-specific linker scripts (`vdso.lds.S`) for both AArch64 and RISC-V.
- Updated the build system to support vDSO compilation for RISC-V, including necessary adjustments in `SConstruct` files.
- Refactored existing vDSO code to improve compatibility and maintainability across architectures.
- Adjusted the maximum number of PTY devices in the terminal configuration from 64 to 32 for better resource management.
- Fixed minor issues in existing code, including correcting the path for the vDSO shared library and ensuring proper function definitions.
2025-05-19 18:29:26 +08:00

34 lines
1.1 KiB
Python

import os
import sys
arguments = sys.argv[2]
vdso_usr = arguments
vdso_path = os.path.join(vdso_usr, '..', '..', '..')
EXEC_PATH = os.getenv('RTT_EXEC_PATH') or '/usr/bin'
PREFIX = os.getenv('RTT_CC_PREFIX') or 'riscv64-none-elf-'
DEVICE = os.getenv('RTT_DEVICE') or ' -march=rv64imafdc -mabi=lp64'
CC = PREFIX + 'gcc'
CPP = PREFIX + 'cpp'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
AFLAGS = ' -x assembler-with-cpp'
CFLAGS = DEVICE + ' -Wall -Wno-cpp -std=gnu99 -fdiagnostics-color=always -fPIC -O2'
LFLAGS = DEVICE + ' -Bsymbolic -Wl,--gc-sections -T {path}/vdso.lds'.format(path=vdso_usr)
CFLAGS += " -I . -I {vdso_path} ".format(vdso_path=vdso_path)
src = Glob('*.c')
env = Environment(tools=['gcc', 'link'],
AS = AS, ASFLAGS = AFLAGS,
CC = CC, CFLAGS = CFLAGS,
CPP = CPP, AR = AR,
LINK = LINK, LINKFLAGS = LFLAGS)
env.PrependENVPath('PATH', EXEC_PATH)
target = os.path.join(vdso_path, 'user', 'build', 'libvdso.so')
shared_lib = env.SharedLibrary(target=target, source=src)
env.Default(shared_lib)