rt-thread/bsp/samd21/sam_d2x_asflib/SConscript

98 lines
3.7 KiB
Python

Import('RTT_ROOT')
Import('rtconfig')
from building import *
# get current directory
cwd = GetCurrentDir()
#var defined
CPPDEFINES = []
src = []
path = []
#common lib define
CPPDEFINES += [rtconfig.DEVICE_TYPE, 'DEBUG']
#CMSIS/Include/ common/ common2/service/delay
path += [cwd + '/CMSIS/Include/']
path += [cwd + '/common/utils/', cwd + '/common/utils/interrupt/']
path += [cwd + '/common/boards/']
path += [cwd + '/common2/services/delay/', cwd + '/common2/services/delay/sam0/']
src += Glob('./common/utils/interrupt/interrupt_sam_nvic.c')
#sam0/ sam0/utils/
path += [cwd + '/sam0/', cwd + '/sam0/utils/']
path += [cwd + '/sam0/utils/preprocessor']
path += [cwd + '/sam0/utils/header_files']
#sam0/utils/cmsis/
if rtconfig.DEVICE_SERIES == 'SAMD20':
#D20
path += [cwd + '/sam0/', cwd + '/sam0/utils/cmsis/samd20/include/']
path += [cwd + '/sam0/utils/cmsis/samd20/source/']
src += Glob('./sam0/utils/cmsis/samd20/source/*.c')
if rtconfig.PLATFORM == 'gcc':
src += Glob('./sam0/utils/cmsis/samd20/source/gcc/*.s')
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
src += Glob('./sam0/utils/cmsis/samd20/source/arm/*.s')
elif rtconfig.DEVICE_SERIES == 'SAMD21':
#D21
path += [cwd + '/sam0/utils/cmsis/samd21/include/']
path += [cwd + '/sam0/utils/cmsis/samd21/source/']
src += Glob('./sam0/utils/cmsis/samd21/source/*.c')
if rtconfig.PLATFORM == 'gcc':
src += Glob('./sam0/utils/cmsis/samd21/source/gcc/*.s')
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
src += Glob('./sam0/utils/cmsis/samd21/source/arm/*.s')
#sam0/drivers/system
path += [cwd + '/sam0/drivers/system/']
src += Glob('./sam0/drivers/system/system.c')
path += [cwd + '/sam0/drivers/system/pinmux']
src += Glob('./sam0/drivers/system/pinmux/*.c')
path += [cwd + '/sam0/drivers/system/power/power_sam_d_r_h']
path += [cwd + '/sam0/drivers/system/reset/reset_sam_d_r_h']
path += [cwd + '/sam0/drivers/system/clock']
path += [cwd + '/sam0/drivers/system/interrupt/']
src += Glob('./sam0/drivers/system/interrupt/*.c')
if rtconfig.DEVICE_SERIES == 'SAMD20':
path += [cwd + '/sam0/drivers/system/interrupt/system_interrupt_samd20/']
elif rtconfig.DEVICE_SERIES == 'SAMD21':
path += [cwd + '/sam0/drivers/system/interrupt/system_interrupt_samd21/']
#sam0/drivers/system/clock
if rtconfig.DEVICE_SERIES == 'SAMD20':
path += [cwd + '/sam0/drivers/system/clock/clock_samd20']
#path += [cwd + '/sam0/drivers/system/clock/clock_samd20/module_config']
src += Glob('./sam0/drivers/system/clock/clock_samd20/*.c')
elif rtconfig.DEVICE_SERIES == 'SAMD21':
#path += [cwd + '/sam0/drivers/system/clock/clock_samd21_r21_da_ha1/module_config']
path += [cwd + '/sam0/drivers/system/clock/clock_samd21_r21_da_ha1']
src += Glob('./sam0/drivers/system/clock/clock_samd21_r21_da_ha1/*.c')
#sam0/drivers/sercom
path += [cwd + '/sam0/drivers/sercom', cwd + '/sam0/drivers/sercom/usart']
src += Glob('./sam0/drivers/sercom/*.c')
src += Glob('./sam0/drivers/sercom/usart/*.c')
SrcRemove(src, './sam0/drivers/sercom/sercom_interrupt.c')
SrcRemove(src, './sam0/drivers/sercom/usart/usart_interrupt.c')
CPPDEFINES += ['USART_CALLBACK_MODE=false']
#sam0/drivers/port
path += [cwd + '/sam0/drivers/port']
src += Glob('./sam0/drivers/port/port.c')
#sam0/drivers/rtc
path += [cwd + '/sam0/drivers/rtc']
src += Glob('./sam0/drivers/rtc/rtc_sam_d_r_h/rtc_count*.c')
CPPDEFINES += ['RTC_COUNT_ASYNC=true']
#sam0/drivers/extint
path += [cwd + '/sam0/drivers/extint', cwd + '/sam0/drivers/extint/extint_sam_d_r_h']
src += Glob('./sam0/drivers/extint/extint_callback.c')
src += Glob('./sam0/drivers/extint/extint_sam_d_r_h/extint.c')
CPPDEFINES += ['EXTINT_CALLBACK_MODE=true']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
Return('group')