SConscript 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. # Device class
  22. if GetDepend(["PKG_TINYUSB_DEVICE_CDC"]):
  23. src += ["../src/class/cdc/cdc_device.c"]
  24. if GetDepend(["PKG_TINYUSB_DEVICE_MSC"]):
  25. src += ["../src/class/msc/msc_device.c", "port/msc_device_port.c"]
  26. if GetDepend(["PKG_TINYUSB_DEVICE_HID"]):
  27. src += ["../src/class/hid/hid_device.c", "port/hid_device_port.c"]
  28. if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_CDC"]):
  29. src += ["example/cdc_example.c"]
  30. LOCAL_CCFLAGS = ''
  31. if rtconfig.PLATFORM == 'gcc': # GCC
  32. LOCAL_CCFLAGS += ' -std=c99'
  33. elif rtconfig.PLATFORM == 'armcc': # Keil AC5
  34. LOCAL_CCFLAGS += ' --c99 --gnu -g -W'
  35. elif rtconfig.PLATFORM == 'armclang': # Keil AC6
  36. LOCAL_CCFLAGS += ' -std=c99 -g -w'
  37. group = DefineGroup('tinyusb', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CCFLAGS = LOCAL_CCFLAGS)
  38. Return('group')