SConscript 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Import('rtconfig')
  2. from building import *
  3. import os
  4. cwd = GetCurrentDir()
  5. src = []
  6. CPPPATH = [cwd]
  7. support_arch = {"arm": ["cortex-m3", "cortex-m4", "cortex-m7", "arm926", "cortex-a"],
  8. "aarch64":["cortex-a"],
  9. "risc-v": ["rv64"],
  10. "x86": ["i386"]}
  11. platform_file = {'armcc': 'rvds.S', 'gcc': 'gcc.S', 'iar': 'iar.S'}
  12. platform = rtconfig.PLATFORM
  13. arch = rtconfig.ARCH
  14. cpu = rtconfig.CPU
  15. # fix the cpu for risc-v
  16. if arch == 'risc-v':
  17. if GetDepend('ARCH_CPU_64BIT'):
  18. cpu = 'rv64'
  19. if platform in platform_file.keys(): # support platforms
  20. if arch in support_arch.keys() and cpu in support_arch[arch]:
  21. asm_path = 'arch/' + arch + '/' + cpu + '/*_' + platform_file[platform]
  22. arch_common = 'arch/' + arch + '/' + 'common/*.c'
  23. common = 'arch/common/*.c'
  24. common_excluded = []
  25. if not GetDepend('RT_USING_VDSO'):
  26. common_excluded.append('vdso_kernel.c')
  27. src += Glob(arch_common)
  28. src += [f for f in Glob(common) if os.path.basename(str(f)) not in common_excluded]
  29. else:
  30. CPPPATH += [cwd + '/vdso', cwd + '/vdso/kernel']
  31. src += Glob(arch_common)
  32. src += Glob(common)
  33. if not GetDepend('ARCH_MM_MMU'):
  34. excluded_files = ['ioremap.c', 'lwp_futex.c', 'lwp_mm_area.c', 'lwp_pmutex.c', 'lwp_shm.c', 'lwp_user_mm.c']
  35. src += [f for f in Glob('*.c') if os.path.basename(str(f)) not in excluded_files] + Glob(asm_path)
  36. else:
  37. src += Glob('*.c') + Glob(asm_path)
  38. src += Glob('arch/' + arch + '/' + cpu + '/*.c')
  39. CPPPATH = [cwd]
  40. CPPPATH += [cwd + '/arch/' + arch + '/' + cpu]
  41. # Terminal I/O Subsystem
  42. termios_path = ['./terminal/', './terminal/freebsd/']
  43. for item in termios_path:
  44. src += Glob(item + '*.c')
  45. CPPPATH += ['./terminal/']
  46. # Remove optional sources
  47. if not GetDepend(['LWP_USING_RUNTIME']):
  48. SrcRemove(src, 'lwp_runtime.c')
  49. group = DefineGroup('lwProcess', src, depend = ['RT_USING_SMART'], CPPPATH = CPPPATH)
  50. group = group + SConscript(os.path.join('vdso', 'SConscript'))
  51. Return('group')