Files
CherryUSB/SConscript

78 lines
2.8 KiB
Python
Raw Normal View History

2021-12-04 14:41:09 +08:00
from building import *
cwd = GetCurrentDir()
path = [cwd]
path += [cwd + '/common']
2021-12-04 14:41:09 +08:00
path += [cwd + '/core']
2022-03-20 09:15:10 +08:00
src = []
2022-02-07 21:24:53 +08:00
2021-12-04 14:41:09 +08:00
CPPDEFINES = []
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_HS']):
2021-12-04 14:41:09 +08:00
CPPDEFINES+=['CONFIG_USB_HS']
2022-02-07 21:24:53 +08:00
elif GetDepend(['PKG_CHERRYUSB_USING_HS_IN_FULL']):
2021-12-12 21:49:21 +08:00
CPPDEFINES += ['CONFIG_USB_HS_IN_FULL']
2022-02-07 21:24:53 +08:00
2021-12-04 14:41:09 +08:00
# USB DEVICE
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_DEVICE']):
2022-03-20 09:15:10 +08:00
src += Glob('core/usbd_core.c')
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_CDC']):
2021-12-04 14:41:09 +08:00
path += [cwd + '/class/cdc']
src += Glob('class/cdc/usbd_cdc.c')
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_HID']):
2021-12-04 14:41:09 +08:00
path += [cwd + '/class/hid']
2022-02-07 21:24:53 +08:00
src += Glob('class/cdc/usbd_hid.c')
if GetDepend(['PKG_CHERRYUSB_USING_DFU']):
2021-12-04 14:41:09 +08:00
path += [cwd + '/class/dfu']
src += Glob('class/cdc/usbd_dfu.c')
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_HUB']):
2021-12-04 14:41:09 +08:00
path += [cwd + '/class/hub']
src += Glob('class/cdc/usbd_hub.c')
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_AUDIO']):
2021-12-04 14:41:09 +08:00
path += [cwd + '/class/audio']
src += Glob('class/cdc/usbd_audio.c')
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_VIDEO']):
2021-12-04 14:41:09 +08:00
path += [cwd + '/class/video']
src += Glob('class/cdc/usbd_video.c')
2022-02-07 21:24:53 +08:00
if GetDepend(['PKG_CHERRYUSB_USING_MSC']):
2021-12-04 14:41:09 +08:00
path += [cwd + '/class/msc']
src += Glob('class/cdc/usbd_msc.c')
if GetDepend(['SOC_FAMILY_STM32']):
2021-12-12 21:49:21 +08:00
if GetDepend(['SOC_SERIES_STM32F0']) or GetDepend(['SOC_SERIES_STM32F1']) or GetDepend(['SOC_SERIES_STM32F3']) or GetDepend(['SOC_SERIES_STM32L0']):
src += Glob('port/fsdev/usb_dc_fsdev.c')
else:
src += Glob('port/synopsys/usb_dc_synopsys.c')
if GetDepend(['SOC_SERIES_STM32H7']) and GetDepend(['PKG_CHERRYUSB_USING_FS']):
2022-03-11 21:09:09 +08:00
CPPDEFINES += ['USB_BASE=0x40080000UL']
2022-03-20 09:15:10 +08:00
if GetDepend(['CHERRYUSB_USING_MUSB']):
src += Glob('port/musb/usb_dc_musb.c')
if GetDepend(['CHERRYUSB_USING_CDC_DEMO']):
src += Glob('demo/cdc_acm_template.c')
2021-12-04 14:41:09 +08:00
2022-02-07 21:24:53 +08:00
# USB HOST
if GetDepend(['PKG_CHERRYUSB_USING_HOST']):
2022-03-20 09:15:10 +08:00
src += Glob('core/usbh_core.c')
2022-02-07 21:24:53 +08:00
path += [cwd + '/osal']
src += Glob('osal/usb_osal_rtthread.c')
src += Glob('osal/usb_workq.c')
path += [cwd + '/class/cdc']
src += Glob('class/cdc/usbh_cdc_acm.c')
path += [cwd + '/class/hid']
src += Glob('class/hid/usbh_hid.c')
path += [cwd + '/class/msc']
src += Glob('class/msc/usbh_msc.c')
path += [cwd + '/class/hub']
src += Glob('class/hub/usbh_hub.c')
2022-03-20 09:15:10 +08:00
CPPDEFINES += ['CONFIG_USBHOST_HUB']
2022-02-07 21:24:53 +08:00
if GetDepend(['SOC_FAMILY_STM32']):
src += Glob('port/synopsys/usb_hc_synopsys.c')
2022-03-20 09:15:10 +08:00
if GetDepend(['CHERRYUSB_USING_MUSB']):
src += Glob('port/musb/usb_hc_musb.c')
if GetDepend(['CHERRYUSB_USING_HOST_DEMO']):
src += Glob('demo/usb_host.c')
2022-02-07 21:24:53 +08:00
group = DefineGroup('CherryUSB', src, depend = ['PKG_USING_CHERRYUSB'], CPPPATH = path, CPPDEFINES = CPPDEFINES)
2021-12-04 14:41:09 +08:00
Return('group')