SConscript 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import rtconfig
  2. from building import *
  3. cwd = GetCurrentDir()
  4. src = Split("""
  5. ../src/tusb.c
  6. ../src/common/tusb_fifo.c
  7. ../src/device/usbd.c
  8. ../src/device/usbd_control.c
  9. ./tinyusb_port.c
  10. ./usb_descriptor.c
  11. """)
  12. path = [cwd, cwd + "/../src"]
  13. # BSP
  14. if GetDepend(["SOC_FAMILY_STM32"]):
  15. src += ["bsp/stm32/drv_tinyusb.c",
  16. "../src/portable/synopsys/dwc2/dcd_dwc2.c",
  17. "../src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c"]
  18. if GetDepend(["SOC_NRF52840"]):
  19. src += ["../src/portable/nordic/nrf5x/dcd_nrf5x.c",
  20. "bsp/nrf5x/drv_tinyusb.c"]
  21. if GetDepend(["SOC_HPM6000"]):
  22. src += ["bsp/hpmicro/drv_tinyusb.c",
  23. "../src/portable/hpm/dcd_hpm.c"]
  24. # Device class
  25. if GetDepend(["PKG_TINYUSB_DEVICE_CDC"]):
  26. src += ["../src/class/cdc/cdc_device.c"]
  27. if GetDepend(["PKG_TINYUSB_DEVICE_MSC"]):
  28. src += ["../src/class/msc/msc_device.c", "port/msc_device_port.c"]
  29. if GetDepend(["PKG_TINYUSB_DEVICE_HID"]):
  30. src += ["../src/class/hid/hid_device.c", "port/hid_device_port.c"]
  31. if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_CDC"]):
  32. src += ["example/cdc_example.c"]
  33. LOCAL_CCFLAGS = ''
  34. if rtconfig.PLATFORM == 'gcc': # GCC
  35. LOCAL_CCFLAGS += ' -std=c99'
  36. elif rtconfig.PLATFORM == 'armcc': # Keil AC5
  37. LOCAL_CCFLAGS += ' --c99 --gnu -g -W'
  38. elif rtconfig.PLATFORM == 'armclang': # Keil AC6
  39. LOCAL_CCFLAGS += ' -std=c99 -g -w'
  40. group = DefineGroup('tinyusb', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
  41. Return('group')