SConscript 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. if GetDepend(["SOC_RP2040"]):
  25. src += ["bsp/rp2040/drv_tinyusb.c",
  26. "../src/portable/raspberrypi/rp2040/rp2040_usb.c",
  27. "../src/portable/raspberrypi/rp2040/dcd_rp2040.c"]
  28. # Device class
  29. if GetDepend(["PKG_TINYUSB_DEVICE_CDC"]):
  30. src += ["../src/class/cdc/cdc_device.c"]
  31. if GetDepend(["PKG_TINYUSB_DEVICE_MSC"]):
  32. src += ["../src/class/msc/msc_device.c", "port/msc_device_port.c"]
  33. if GetDepend(["PKG_TINYUSB_DEVICE_HID"]):
  34. src += ["../src/class/hid/hid_device.c", "port/hid_device_port.c"]
  35. if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_CDC"]):
  36. src += ["example/cdc_example.c"]
  37. if GetDepend(["PKG_TINYUSB_DEVICE_EXAMPLE_HID"]):
  38. src += ["example/hid_example.c"]
  39. LOCAL_CFLAGS = ''
  40. if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6
  41. LOCAL_CFLAGS += ' -std=c99'
  42. elif rtconfig.PLATFORM == 'armcc': # Keil AC5
  43. LOCAL_CFLAGS += ' --c99 --gnu'
  44. group = DefineGroup('tinyusb', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CFLAGS = LOCAL_CFLAGS)
  45. Return('group')