SConscript 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. if not GetDepend('RT_USING_VDSO'):
  25. vdso_files = ['vdso_data.c', 'vdso.c']
  26. src += [f for f in Glob(arch_common) if os.path.basename(str(f)) not in vdso_files]
  27. src += [f for f in Glob(common) if os.path.basename(str(f)) not in vdso_files]
  28. else:
  29. src += Glob(arch_common)
  30. src += Glob(common)
  31. if not GetDepend('ARCH_MM_MMU'):
  32. excluded_files = ['ioremap.c', 'lwp_futex.c', 'lwp_mm_area.c', 'lwp_pmutex.c', 'lwp_shm.c', 'lwp_user_mm.c']
  33. src += [f for f in Glob('*.c') if os.path.basename(str(f)) not in excluded_files] + Glob(asm_path)
  34. else:
  35. src += Glob('*.c') + Glob(asm_path)
  36. src += Glob('arch/' + arch + '/' + cpu + '/*.c')
  37. CPPPATH = [cwd]
  38. CPPPATH += [cwd + '/arch/' + arch + '/' + cpu]
  39. # Terminal I/O Subsystem
  40. termios_path = ['./terminal/', './terminal/freebsd/']
  41. for item in termios_path:
  42. src += Glob(item + '*.c')
  43. CPPPATH += ['./terminal/']
  44. # Remove optional sources
  45. if not GetDepend(['LWP_USING_RUNTIME']):
  46. SrcRemove(src, 'lwp_runtime.c')
  47. group = DefineGroup('lwP', src, depend = ['RT_USING_SMART'], CPPPATH = CPPPATH)
  48. group = group + SConscript(os.path.join('vdso', 'SConscript'))
  49. Return('group')