Browse Source

Merge pull request #5183 from tfx2001/tinyusb_stm32

[bsp][stm32] add TinyUSB support
guo 3 years ago
parent
commit
574e11f62a

+ 1 - 1
bsp/stm32/libraries/STM32F0xx_HAL/SConscript

@@ -42,7 +42,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_spi_ex.c'] 
     src += ['STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_spi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pcd.c']
     src += ['STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pcd_ex.c']
 

+ 1 - 1
bsp/stm32/libraries/STM32F1xx_HAL/SConscript

@@ -33,7 +33,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c']
     src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_spi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c']
     src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c'] 
     src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c']

+ 1 - 1
bsp/stm32/libraries/STM32F2xx_HAL/SConscript

@@ -28,7 +28,7 @@ if GetDepend(['RT_USING_I2C']):
 if GetDepend(['RT_USING_SPI']):
     src += ['STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_spi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_pccard.c']
     src += ['STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_pcd.c']
     src += ['STM32F2xx_HAL_Driver/Src/stm32f2xx_hal_pcd_ex.c'] 

+ 1 - 1
bsp/stm32/libraries/STM32F3xx_HAL/SConscript

@@ -37,7 +37,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_spi.c']
     src += ['STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_spi_ex.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd.c'] 
     src += ['STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd_ex.c']
     src += ['STM32F3xx_HAL_Driver/Src/stm32f3xx_ll_usb.c']

+ 1 - 1
bsp/stm32/libraries/STM32F4xx_HAL/SConscript

@@ -36,7 +36,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c']
     src += ['STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c']
     src += ['STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c'] 
     src += ['STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c']

+ 1 - 1
bsp/stm32/libraries/STM32F7xx_HAL/SConscript

@@ -41,7 +41,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_spi_ex.c']
     src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_qspi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pcd.c'] 
     src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pcd_ex.c']
     src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_hcd.c']

+ 1 - 1
bsp/stm32/libraries/STM32G4xx_HAL/SConscript

@@ -37,7 +37,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_spi.c']
     src += ['STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_qspi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pccard.c']
     src += ['STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pcd.c'] 
     src += ['STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pcd_ex.c']

+ 1 - 1
bsp/stm32/libraries/STM32H7xx_HAL/SConscript

@@ -41,7 +41,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c']
     src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
    # src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pccard.c']
     src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd.c']
     src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd_ex.c']

+ 1 - 1
bsp/stm32/libraries/STM32L0xx_HAL/SConscript

@@ -38,7 +38,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_spi_ex.c']
     src += ['STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_qspi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_hcd.c'] 
     src += ['STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pcd.c']
     src += ['STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pcd_ex.c']

+ 1 - 1
bsp/stm32/libraries/STM32L1xx_HAL/SConscript

@@ -34,7 +34,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32L1xx_HAL_Driver/Src/stm32L1xx_hal_spi.c']
     src += ['STM32L1xx_HAL_Driver/Src/stm32L1xx_ll_spi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32L1xx_HAL_Driver/Src/stm32L1xx_hal_pcd.c']
     src += ['STM32L1xx_HAL_Driver/Src/stm32L1xx_hal_pcd_ex.c'] 
     src += ['STM32L1xx_HAL_Driver/Src/stm32L1xx_ll_usb.c']

+ 1 - 1
bsp/stm32/libraries/STM32L4xx_HAL/SConscript

@@ -41,7 +41,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c']
     src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_qspi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_hcd.c'] 
     src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd.c']
     src += ['STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c']

+ 1 - 1
bsp/stm32/libraries/STM32MPxx_HAL/SConscript

@@ -35,7 +35,7 @@ if GetDepend(['RT_USING_SERIAL']):
     src += ['STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal_uart.c']
     src += ['STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal_uart_ex.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
     src += ['STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal_pccard.c']
     src += ['STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal_pcd.c']
     src += ['STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal_pcd_ex.c']

+ 1 - 1
bsp/stm32/libraries/STM32WBxx_HAL/SConscript

@@ -42,7 +42,7 @@ if GetDepend(['RT_USING_SPI']):
     src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_spi_ex.c']
     src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_qspi.c']
 
-if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
+if GetDepend(['RT_USING_USB']):
 #    src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_hcd.c'] 
     src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd.c']
     src += ['STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd_ex.c']

+ 7 - 0
components/drivers/Kconfig

@@ -623,9 +623,14 @@ menuconfig RT_USING_WIFI
     endif
 
 menu "Using USB"
+    config RT_USING_USB
+        bool
+        default n
+
     config RT_USING_USB_HOST
         bool "Using USB host"
         default n
+        select RT_USING_USB
 
         if RT_USING_USB_HOST
             config RT_USBH_MSTORAGE
@@ -648,6 +653,8 @@ menu "Using USB"
     config RT_USING_USB_DEVICE
         bool "Using USB device"
         default n
+        select RT_USING_USB
+
         if RT_USING_USB_DEVICE || RT_USING_USB_HOST
             config RT_USBD_THREAD_STACK_SZ
                 int "usb thread stack size"