summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-09-11 11:35:51 +0700
committerhathach <[email protected]>2023-09-11 11:35:51 +0700
commitab9585401b9964407cbf2bc7bffdf762353817f9 (patch)
treecf1c6a73a24ac2a6142a0ea4503633eaa150a67a /hw
parente32c1e08bd701b5dda7d081b10ba3262e2061326 (diff)
wrap up build cmake & make support for max3421, to enable the Host driver, 'MAX3421_HOST=1' must be added as part of make/cmake command
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/family_support.cmake14
-rw-r--r--hw/bsp/nrf/family.cmake1
-rw-r--r--hw/bsp/samd21/family.cmake1
-rw-r--r--hw/bsp/samd21/family.mk32
-rw-r--r--hw/bsp/samd51/family.cmake1
5 files changed, 30 insertions, 19 deletions
diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake
index 1cbcfb2a7..642282b0e 100644
--- a/hw/bsp/family_support.cmake
+++ b/hw/bsp/family_support.cmake
@@ -253,6 +253,15 @@ function(family_add_tinyusb TARGET OPT_MCU RTOS)
# link tinyusb with freeRTOS kernel
target_link_libraries(${TARGET}-tinyusb PUBLIC freertos_kernel)
endif ()
+
+ # use max3421 as host controller
+ if (MAX3421_HOST STREQUAL "1")
+ target_compile_definitions(${TARGET}-tinyusb_config INTERFACE CFG_TUH_MAX3421=1)
+ target_sources(${TARGET}-tinyusb PUBLIC
+ ${TOP}/src/portable/analog/max3421/hcd_max3421.c
+ )
+ endif ()
+
endfunction()
@@ -438,5 +447,10 @@ if (NOT FAMILY_MCUS)
set(FAMILY_MCUS ${FAMILY})
endif()
+# if use max3421 as host controller, expand FAMILY_MCUS to include max3421
+if (MAX3421_HOST STREQUAL "1")
+ set(FAMILY_MCUS ${FAMILY_MCUS} MAX3421)
+endif ()
+
# save it in case of re-inclusion
set(FAMILY_MCUS ${FAMILY_MCUS} CACHE INTERNAL "")
diff --git a/hw/bsp/nrf/family.cmake b/hw/bsp/nrf/family.cmake
index ff6b882ce..99d9ac6dd 100644
--- a/hw/bsp/nrf/family.cmake
+++ b/hw/bsp/nrf/family.cmake
@@ -124,7 +124,6 @@ function(family_configure_example TARGET RTOS)
family_add_tinyusb(${TARGET} OPT_MCU_NRF5X ${RTOS})
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/nordic/nrf5x/dcd_nrf5x.c
- ${TOP}/src/portable/analog/max3421/hcd_max3421.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
diff --git a/hw/bsp/samd21/family.cmake b/hw/bsp/samd21/family.cmake
index ffbf687a1..07186934a 100644
--- a/hw/bsp/samd21/family.cmake
+++ b/hw/bsp/samd21/family.cmake
@@ -94,7 +94,6 @@ function(family_configure_example TARGET RTOS)
family_add_tinyusb(${TARGET} OPT_MCU_SAMD21 ${RTOS})
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/microchip/samd/dcd_samd.c
- ${TOP}/src/portable/analog/max3421/hcd_max3421.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
diff --git a/hw/bsp/samd21/family.mk b/hw/bsp/samd21/family.mk
index 49a1a781a..79c63812d 100644
--- a/hw/bsp/samd21/family.mk
+++ b/hw/bsp/samd21/family.mk
@@ -1,5 +1,5 @@
UF2_FAMILY_ID = 0x68ed2b88
-DEPS_SUBMODULES += hw/mcu/microchip
+SDK_DIR = hw/mcu/microchip/samd21
include $(TOP)/$(BOARD_PATH)/board.mk
CPU_CORE ?= cortex-m0plus
@@ -18,24 +18,24 @@ CFLAGS_SKIP += -Wcast-qual
SRC_C += \
src/portable/microchip/samd/dcd_samd.c \
- hw/mcu/microchip/samd21/gcc/gcc/startup_samd21.c \
- hw/mcu/microchip/samd21/gcc/system_samd21.c \
- hw/mcu/microchip/samd21/hpl/gclk/hpl_gclk.c \
- hw/mcu/microchip/samd21/hpl/pm/hpl_pm.c \
- hw/mcu/microchip/samd21/hpl/sysctrl/hpl_sysctrl.c \
- hw/mcu/microchip/samd21/hal/src/hal_atomic.c
+ ${SDK_DIR}/gcc/gcc/startup_samd21.c \
+ ${SDK_DIR}/gcc/system_samd21.c \
+ ${SDK_DIR}/hpl/gclk/hpl_gclk.c \
+ ${SDK_DIR}/hpl/pm/hpl_pm.c \
+ ${SDK_DIR}/hpl/sysctrl/hpl_sysctrl.c \
+ ${SDK_DIR}/hal/src/hal_atomic.c
INC += \
$(TOP)/$(BOARD_PATH) \
- $(TOP)/hw/mcu/microchip/samd21/ \
- $(TOP)/hw/mcu/microchip/samd21/config \
- $(TOP)/hw/mcu/microchip/samd21/include \
- $(TOP)/hw/mcu/microchip/samd21/hal/include \
- $(TOP)/hw/mcu/microchip/samd21/hal/utils/include \
- $(TOP)/hw/mcu/microchip/samd21/hpl/pm/ \
- $(TOP)/hw/mcu/microchip/samd21/hpl/port \
- $(TOP)/hw/mcu/microchip/samd21/hri \
- $(TOP)/hw/mcu/microchip/samd21/CMSIS/Include
+ $(TOP)/${SDK_DIR}/ \
+ $(TOP)/${SDK_DIR}/config \
+ $(TOP)/${SDK_DIR}/include \
+ $(TOP)/${SDK_DIR}/hal/include \
+ $(TOP)/${SDK_DIR}/hal/utils/include \
+ $(TOP)/${SDK_DIR}/hpl/pm/ \
+ $(TOP)/${SDK_DIR}/hpl/port \
+ $(TOP)/${SDK_DIR}/hri \
+ $(TOP)/${SDK_DIR}/CMSIS/Include
# flash using bossac at least version 1.8
# can be found in arduino15/packages/arduino/tools/bossac/
diff --git a/hw/bsp/samd51/family.cmake b/hw/bsp/samd51/family.cmake
index 1dce483fd..fa9586066 100644
--- a/hw/bsp/samd51/family.cmake
+++ b/hw/bsp/samd51/family.cmake
@@ -93,7 +93,6 @@ function(family_configure_example TARGET RTOS)
family_add_tinyusb(${TARGET} OPT_MCU_SAMD51 ${RTOS})
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/microchip/samd/dcd_samd.c
- ${TOP}/src/portable/analog/max3421/hcd_max3421.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})