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

This commit is contained in:
hathach
2023-09-11 11:35:51 +07:00
parent e32c1e08bd
commit ab9585401b
34 changed files with 101 additions and 50 deletions

View File

@@ -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 "")

View File

@@ -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})

View File

@@ -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})

View File

@@ -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/

View File

@@ -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})