1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #18787 from gschorcht/cpu/stm32/usbdev_synopsys_dwc_dependency

cpu/stm32: improvement of USB device driver selection
This commit is contained in:
Kevin "Tristate Tom" Weiss 2022-11-04 07:57:28 +01:00 committed by GitHub
commit 19943d2aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 35 deletions

View File

@ -4,12 +4,19 @@
USEMODULE += periph stm32_clk stm32_vectors
ifneq (,$(filter periph_usbdev,$(FEATURES_USED)))
# All STM32 families except for STM32F1, STM32F3 and STM32WG use synopsys_dwc2
ifeq (,$(filter f1 f3 wb,$(CPU_FAM)))
ifneq (,$(filter f2 f4 f7 h7 u5,$(CPU_FAM)))
# Whole STM32 families F2, F4, F7, H7 and U5 use the Synopsys DWC2 USB OTG core
USEMODULE += usbdev_synopsys_dwc2
endif
# In STM32F1 family STM32F105xx and STM32F107xx also use synopsys_dwc2
ifneq (,$(filter stm32f105% stm32f107%,$(CPU_MODEL)))
else ifneq (,$(filter stm32f105% stm32f107%,$(CPU_MODEL)))
# STM32F105xx and STM32F107xx also use the Synopsys DWC2 USB OTG core
USEMODULE += usbdev_synopsys_dwc2
else ifneq (,$(filter stm32l47% stm32l48% stm32l49%,$(CPU_MODEL)))
# STM32L475xx, STM32L476xx, STM32L485xx, STM32L486xx and STM32L496xx
# also use the Synopsys DWC2 USB OTG core
USEMODULE += usbdev_synopsys_dwc2
else ifneq (,$(filter stm32l4a% stm32l4p% stm32l4q% stm32l4r% stm32l4s%,$(CPU_MODEL)))
# STM32L4Axxx, STM32L4Pxxx, STM32L4Qxxx, STM32L4Rxxx and STM32L4Sxxx
# also use the Synopsys DWC2 USB OTG core
USEMODULE += usbdev_synopsys_dwc2
endif
USEMODULE += ztimer

View File

@ -10,21 +10,30 @@ config MODULE_PERIPH
default y
select MODULE_ZTIMER if MODULE_PERIPH_USBDEV
select MODULE_ZTIMER_MSEC if MODULE_PERIPH_USBDEV
# All STM32 families except for STM32F1, STM32F3 and STM32WG use
# MODULE_USBDEV_SYNOPSYS_DWC2
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && !HAS_CPU_STM32WB && !HAS_CPU_STM32F3 && !HAS_CPU_STM32F1
# In STM32F1 family STM32F105xx also uses MODULE_USBDEV_SYNOPSYS_DWC2.
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F105R8
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F105RB
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F105RC
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F105V8
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F105VB
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F105VC
# In STM32F1 family STM32F107xx also uses MODULE_USBDEV_SYNOPSYS_DWC2.
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F107RB
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F107RC
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F107VB
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_MODEL_STM32F107VC
# Whole STM32 families F2, F4, F7, H7 and U5 use the Synopsys DWC2 USB OTG core
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && HAS_CPU_STM32F2
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && HAS_CPU_STM32F4
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && HAS_CPU_STM32F7
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && HAS_CPU_STM32H7
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && HAS_CPU_STM32U5
# STM32F105xx and STM32F107xx lines also use the Synopsys DWC2 USB OTG core
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32F105XC
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32F107XC
# Several lines of STM32L4 family also use the Synopsys DWC2 USB OTG core
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L475XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L476XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L485XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L486XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L496XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4A6XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4P5XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4Q5XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4R5XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4R7XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4R9XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4S5XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4S7XX
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV && CPU_LINE_STM32L4S9XX
help
stm32 common peripheral code.

View File

@ -25,22 +25,61 @@ menuconfig PACKAGE_TINYUSB
select MODULE_TINYUSB_CONTRIB
select MODULE_TINYUSB_HW
select MODULE_TINYUSB_PORTABLE_ESPRESSIF if CPU_FAM_ESP32S2 || CPU_FAM_ESP32S3
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_STM32 && CPU_FAM_F2
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_STM32 && CPU_FAM_F4
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_STM32 && CPU_FAM_F7
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_STM32 && CPU_FAM_H7
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_STM32 && CPU_FAM_L4
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_STM32 && CPU_FAM_F0
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_STM32 && CPU_FAM_F1
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_STM32 && CPU_FAM_G4
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_STM32 && CPU_FAM_L0
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_STM32 && CPU_FAM_WB
# Whole STM32 families F2, F4, F7 and U5 use the Synopsys DWC2 USB OTG core
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if HAS_CPU_STM32F2
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if HAS_CPU_STM32F4
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if HAS_CPU_STM32F7
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if HAS_CPU_STM32U5
# STM32F105xx and STM32F107xx lines also use the Synopsys DWC2 USB OTG core
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32F105XC
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32F107XC
# Several lines of STM32L4 family also use the Synopsys DWC2 USB OTG core
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L475XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L476XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L485XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L486XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L496XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4A6XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4P5XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4Q5XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4R5XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4R7XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4R9XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4S5XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4S7XX
select MODULE_TINYUSB_PORTABLE_SYNOPSYS_DWC2 if CPU_LINE_STM32L4S9XX
# Whole STM32 families F0, F3, G0, G4, L0, L1, L5 and WB use the Synopsys DWC2 USB OTG core
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32F0
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32F3
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32G0
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32G4
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32L0
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32L1
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32L5
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if HAS_CPU_STM32WB
# STM32F102xx and STM32F103xx lines also use USB FS Device core
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32F102X6
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32F102XB
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32F103X6
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32F103XB
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32F103XE
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32F103XG
# Following STM32L4 lines also use USB FS Device core
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L412XX
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L422XX
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L432XX
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L433XX
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L442XX
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L443XX
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L452XX
select MODULE_TINYUSB_PORTABLE_STM32_FSDEV if CPU_LINE_STM32L462XX
#
select MODULE_TINYUSB_PORTABLE_MICROCHIP if CPU_FAM_SAMD21 || CPU_FAM_SAMR21 \
|| CPU_COMMON_SAMD5X || CPU_FAM_SAML21 || CPU_FAM_SAMR34 \
|| CPU_FAM_SAMR30
select MODULE_TINYUSB_PORTABLE_NRF5X if CPU_FAM_NRF52
select PACKAGE_NRFX if CPU_FAM_NRF52
select MODULE_ZTIMER_MSEC
select PACKAGE_NRFX if CPU_FAM_NRF52
help
tinyUSB is an open-source cross-platform USB Host/Device stack for
embedded systems.

View File

@ -60,14 +60,22 @@ else ifeq (nrf52,$(CPU))
else ifneq (,$(filter saml21 samd5x samd21,$(CPU)))
USEMODULE += tinyusb_portable_microchip
else ifeq (stm32,$(CPU))
ifneq (,$(filter f2 f4 f7 h7 l4,$(CPU_FAM)))
# STM32 families F2, F4, F7, H7 and L4 use the Synopsys DWC2 USB OTG IP core
ifneq (,$(filter f2 f4 f7 h7 u5,$(CPU_FAM)))
# Whole STM32 families F2, F4, F7, H7 and U5 use the Synopsys DWC2 USB OTG core
USEMODULE += tinyusb_portable_synopsys_dwc2
else ifneq (,$(filter stm32f105% stm32f107%,$(CPU_MODEL)))
# STM32F105xx and STM32F107xx also use the Synopsys DWC2 USB OTG IP core
# STM32F105xx and STM32F107xx also use the Synopsys DWC2 USB OTG core
USEMODULE += tinyusb_portable_synopsys_dwc2
else ifneq (,$(filter stm32l47% stm32l48% stm32l49%,$(CPU_MODEL)))
# STM32L475xx, STM32L476xx, STM32L485xx, STM32L486xx and STM32L496xx
# also use the Synopsys DWC2 USB OTG core
USEMODULE += tinyusb_portable_synopsys_dwc2
else ifneq (,$(filter stm32l4a% stm32l4p% stm32l4q% stm32l4r% stm32l4s%,$(CPU_MODEL)))
# STM32L4Axxx, STM32L4Pxxx, STM32L4Qxxx, STM32L4Rxxx and STM32L4Sxxx
# also use the Synopsys DWC2 USB OTG core
USEMODULE += tinyusb_portable_synopsys_dwc2
else
# All other STM32 MCUs use the USB Device FS IP core.
# all other STM32 with USB interface use USB FS Device core
USEMODULE += tinyusb_portable_stm32_fsdev
endif
endif