1import os
2from building import *
3
4cwd = GetCurrentDir()
5
6# add general drivers
7src = Split('''
8board.c
9CubeMX_Config/CM4/Src/stm32mp1xx_hal_msp.c
10''')
11
12path =  [cwd]
13path += [cwd + '/CubeMX_Config/CM4/Inc']
14
15if GetDepend(['BSP_USING_OPENAMP']):
16    src +=  Glob('CubeMX_Config/CM4/Src/ipcc.c')
17    src +=  Glob('CubeMX_Config/CM4/Src/openamp.c')
18    src +=  Glob('CubeMX_Config/CM4/Src/openamp_log.c')
19    src +=  Glob('CubeMX_Config/CM4/Src/mbox_ipcc.c')
20    src +=  Glob('CubeMX_Config/CM4/Src/rsc_table.c')
21    src +=  Glob('ports/OpenAMP/libmetal/lib/*.c')
22    src +=  Glob('ports/OpenAMP/libmetal/lib/system/generic/*.c')
23    src +=  Glob('ports/OpenAMP/libmetal/lib/system/generic/cortexm/*.c')
24    src +=  Glob('ports/OpenAMP/open-amp/lib/rpmsg/*.c')
25    src +=  Glob('ports/OpenAMP/open-amp/lib/remoteproc/*.c')
26    src +=  Glob('ports/OpenAMP/open-amp/lib/virtio/*.c')
27    src +=  Glob('ports/OpenAMP/virtual_driver/*.c')
28    src +=  Glob('ports/OpenAMP/drv_openamp.c')
29
30if GetDepend(['BSP_USING_OPENAMP']):
31    path += [cwd + '/ports/OpenAMP']
32    path += [cwd + '/ports/OpenAMP/open-amp/lib/include']
33    path += [cwd + '/ports/OpenAMP/libmetal/lib/include']
34    path += [cwd + '/ports/OpenAMP/virtual_driver']
35    path += [cwd + '/CubeMX_Config/CM4/Inc']
36
37CPPDEFINES = ['CORE_CM4','NO_ATOMIC_64_SUPPORT','METAL_INTERNAL','METAL_MAX_DEVICE_REGIONS=2','VIRTIO_SLAVE_ONLY','STM32MP157Axx','__LOG_TRACE_IO_']
38group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
39
40# if os.path.isfile(os.path.join(cwd, "ports", 'SConscript')):
41#     group = group + SConscript(os.path.join("ports", 'SConscript'))
42
43list = os.listdir(cwd)
44for item in list:
45    if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
46        group = group + SConscript(os.path.join(item, 'SConscript'))
47
48Return('group')
49