From 5ee008c9974621cd4930d2975040717e71c16b84 Mon Sep 17 00:00:00 2001 From: Rbb666 Date: Tue, 16 Apr 2024 13:22:53 +0800 Subject: [add]Add rtthread script support to better integrate into rtthread projects. --- lib/rt-thread/SConscript | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/rt-thread/SConscript (limited to 'lib/rt-thread/SConscript') diff --git a/lib/rt-thread/SConscript b/lib/rt-thread/SConscript new file mode 100644 index 000000000..14fbf5549 --- /dev/null +++ b/lib/rt-thread/SConscript @@ -0,0 +1,42 @@ +import rtconfig +from building import * + +cwd = GetCurrentDir() +src = Split(""" +../../src/tusb.c +../../src/common/tusb_fifo.c +../../src/device/usbd.c +../../src/device/usbd_control.c +./tusb_rt_thread_port.c +""") +path = [cwd, cwd + "/../../src"] + +# BSP +if GetDepend(["SOC_FAMILY_STM32"]): + src += ["../../src/portable/synopsys/dwc2/dcd_dwc2.c", + "../../src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c"] + +if GetDepend(["SOC_NRF52840"]): + src += ["../../src/portable/nordic/nrf5x/dcd_nrf5x.c"] + +if GetDepend(["SOC_FAMILY_RENESAS"]): + src += ["../../src/portable/renesas/rusb2/dcd_rusb2.c", + "../../src/portable/renesas/rusb2/rusb2_common.c"] + +# Device class +if GetDepend(["PKG_TINYUSB_DEVICE_CDC"]): + src += ["../../src/class/cdc/cdc_device.c"] + +if GetDepend(["PKG_TINYUSB_DEVICE_MSC"]): + src += ["../../src/class/msc/msc_device.c", "port/msc_device_port.c"] + +LOCAL_CFLAGS = '' + +if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil AC6 + LOCAL_CFLAGS += ' -std=c99' +elif rtconfig.PLATFORM == 'armcc': # Keil AC5 + LOCAL_CFLAGS += ' --c99 --gnu' + +group = DefineGroup('TinyUSB', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CFLAGS = LOCAL_CFLAGS) + +Return('group') -- cgit v1.3.1 From d664cbfcdd1ab34dd82079a7b0a5bec339c37b81 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 25 Apr 2024 11:28:18 +0700 Subject: fix pre-commit --- lib/rt-thread/SConscript | 2 +- lib/rt-thread/port/msc_device_port.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/rt-thread/SConscript') diff --git a/lib/rt-thread/SConscript b/lib/rt-thread/SConscript index 14fbf5549..205e12958 100644 --- a/lib/rt-thread/SConscript +++ b/lib/rt-thread/SConscript @@ -36,7 +36,7 @@ if rtconfig.PLATFORM == 'gcc' or rtconfig.PLATFORM == 'armclang': # GCC or Keil LOCAL_CFLAGS += ' -std=c99' elif rtconfig.PLATFORM == 'armcc': # Keil AC5 LOCAL_CFLAGS += ' --c99 --gnu' - + group = DefineGroup('TinyUSB', src, depend = ['PKG_USING_TINYUSB'], CPPPATH = path, LOCAL_CFLAGS = LOCAL_CFLAGS) Return('group') diff --git a/lib/rt-thread/port/msc_device_port.c b/lib/rt-thread/port/msc_device_port.c index 6af3c4f61..c7e8c508e 100644 --- a/lib/rt-thread/port/msc_device_port.c +++ b/lib/rt-thread/port/msc_device_port.c @@ -106,7 +106,7 @@ bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, boo // unload disk storage ejected = true; } - } + } return true; } -- cgit v1.3.1