2018-12-10 16:31:33 +08:00
|
|
|
Import('rtconfig')
|
|
|
|
from building import *
|
2022-12-03 12:07:44 +08:00
|
|
|
import os
|
2018-12-10 16:31:33 +08:00
|
|
|
|
|
|
|
cwd = GetCurrentDir()
|
|
|
|
src = []
|
2019-03-14 17:25:04 +08:00
|
|
|
CPPPATH = [cwd]
|
2018-12-10 16:31:33 +08:00
|
|
|
|
2022-12-03 12:07:44 +08:00
|
|
|
support_arch = {"arm": ["cortex-m3", "cortex-m4", "cortex-m7", "arm926", "cortex-a"],
|
|
|
|
"aarch64":["cortex-a"],
|
|
|
|
"risc-v": ["rv64"],
|
|
|
|
"x86": ["i386"]}
|
|
|
|
platform_file = {'armcc': 'rvds.S', 'gcc': 'gcc.S', 'iar': 'iar.S'}
|
2018-12-10 16:31:33 +08:00
|
|
|
|
2022-12-03 12:07:44 +08:00
|
|
|
platform = rtconfig.PLATFORM
|
|
|
|
arch = rtconfig.ARCH
|
|
|
|
cpu = rtconfig.CPU
|
|
|
|
|
|
|
|
# fix the cpu for risc-v
|
|
|
|
if arch == 'risc-v':
|
2024-09-13 15:42:13 +08:00
|
|
|
if GetDepend('ARCH_CPU_64BIT'):
|
2022-12-03 12:07:44 +08:00
|
|
|
cpu = 'rv64'
|
|
|
|
|
|
|
|
if platform in platform_file.keys(): # support platforms
|
|
|
|
if arch in support_arch.keys() and cpu in support_arch[arch]:
|
|
|
|
asm_path = 'arch/' + arch + '/' + cpu + '/*_' + platform_file[platform]
|
|
|
|
arch_common = 'arch/' + arch + '/' + 'common/*.c'
|
2024-07-15 17:58:29 +08:00
|
|
|
if not GetDepend('RT_USING_VDSO'):
|
|
|
|
vdso_files = ['vdso_data.c', 'vdso.c']
|
|
|
|
src += [f for f in Glob(arch_common) if os.path.basename(str(f)) not in vdso_files]
|
|
|
|
else:
|
|
|
|
src += Glob(arch_common)
|
2022-12-03 12:07:44 +08:00
|
|
|
if not GetDepend('ARCH_MM_MMU'):
|
|
|
|
excluded_files = ['ioremap.c', 'lwp_futex.c', 'lwp_mm_area.c', 'lwp_pmutex.c', 'lwp_shm.c', 'lwp_user_mm.c']
|
2024-07-15 17:58:29 +08:00
|
|
|
src += [f for f in Glob('*.c') if os.path.basename(str(f)) not in excluded_files] + Glob(asm_path)
|
2022-12-03 12:07:44 +08:00
|
|
|
else:
|
2024-07-15 17:58:29 +08:00
|
|
|
src += Glob('*.c') + Glob(asm_path)
|
2022-12-03 12:07:44 +08:00
|
|
|
src += Glob('arch/' + arch + '/' + cpu + '/*.c')
|
2018-12-10 16:31:33 +08:00
|
|
|
CPPPATH = [cwd]
|
2022-12-03 12:07:44 +08:00
|
|
|
CPPPATH += [cwd + '/arch/' + arch + '/' + cpu]
|
2018-12-10 16:31:33 +08:00
|
|
|
|
2024-03-28 23:42:56 +08:00
|
|
|
# Terminal I/O Subsystem
|
|
|
|
termios_path = ['./terminal/', './terminal/freebsd/']
|
|
|
|
for item in termios_path:
|
|
|
|
src += Glob(item + '*.c')
|
|
|
|
CPPPATH += ['./terminal/']
|
|
|
|
|
2022-12-16 18:38:28 +08:00
|
|
|
group = DefineGroup('lwP', src, depend = ['RT_USING_SMART'], CPPPATH = CPPPATH)
|
2018-12-10 16:31:33 +08:00
|
|
|
|
2024-07-15 17:58:29 +08:00
|
|
|
group = group + SConscript(os.path.join('vdso', 'SConscript'))
|
2018-12-10 16:31:33 +08:00
|
|
|
Return('group')
|