SConscript 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import rtconfig
  2. from building import *
  3. cwd = GetCurrentDir()
  4. src = ["../src/tusb.c",
  5. "../src/common/tusb_fifo.c",
  6. "./tinyusb_port.c"]
  7. path = [cwd, cwd + "/../src"]
  8. # Device
  9. if GetDepend(["PKG_TINYUSB_DEVICE_ENABLE"]):
  10. src += ["../src/device/usbd.c",
  11. "../src/device/usbd_control.c",
  12. "./usb_descriptor.c"]
  13. if GetDepend(["PKG_TINYUSB_DEVICE_CDC"]):
  14. src += ["../src/class/cdc/cdc_device.c"]
  15. if GetDepend(["PKG_TINYUSB_DEVICE_MSC"]):
  16. src += ["../src/class/msc/msc_device.c", "port/msc_device_port.c"]
  17. if GetDepend(["PKG_TINYUSB_DEVICE_HID"]):
  18. src += ["../src/class/hid/hid_device.c", "port/hid_device_port.c"]
  19. if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_CDC"]):
  20. src += ["example/cdc_example.c"]
  21. if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_HID"]):
  22. src += ["example/hid_example.c"]
  23. # Host
  24. if GetDepend(["PKG_TINYUSB_HOST_ENABLE"]):
  25. src += ["../src/host/usbh.c"]
  26. if GetDepend(["PKG_TINYUSB_HOST_MSC"]):
  27. src += ["../src/class/msc/msc_host.c", "port/msc_host_app.c"]
  28. # BSP
  29. if GetDepend(["SOC_FAMILY_STM32"]):
  30. src += ["bsp/stm32/drv_tinyusb.c",
  31. "../src/portable/synopsys/dwc2/dcd_dwc2.c",
  32. "../src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c"]
  33. if GetDepend(["SOC_NRF52840"]):
  34. src += ["../src/portable/nordic/nrf5x/dcd_nrf5x.c",
  35. "bsp/nrf5x/drv_tinyusb.c"]
  36. if GetDepend(["SOC_HPM6000"]):
  37. src += ["bsp/hpmicro/drv_tinyusb.c"]
  38. if GetDepend(["PKG_TINYUSB_DEVICE_ENABLE"]):
  39. src += ["../src/portable/hpm/dcd_hpm.c"]
  40. if GetDepend(["PKG_TINYUSB_HOST_ENABLE"]):
  41. src += ["../src/portable/hpm/hcd_hpm.c"]
  42. if GetDepend(["SOC_RP2040"]):
  43. src += ["bsp/rp2040/drv_tinyusb.c",
  44. "../src/portable/raspberrypi/rp2040/rp2040_usb.c",
  45. "../src/portable/raspberrypi/rp2040/dcd_rp2040.c"]
  46. LOCAL_CFLAGS = ''
  47. if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6
  48. LOCAL_CFLAGS += ' -std=c99'
  49. elif rtconfig.PLATFORM == 'armcc': # Keil AC5
  50. LOCAL_CFLAGS += ' --c99 --gnu'
  51. group = DefineGroup('TinyUSB', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CFLAGS = LOCAL_CFLAGS)
  52. Return('group')