fix build, update freertos config for cmake

This commit is contained in:
hathach 2023-06-16 14:17:25 +07:00
parent 65d6acdbfa
commit a7f330fa94
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
21 changed files with 107 additions and 100 deletions

View File

@ -4,7 +4,7 @@ mcu:MSP430x5xx
mcu:NUC121 mcu:NUC121
mcu:SAMD11 mcu:SAMD11
mcu:STM32L0 mcu:STM32L0
mcu:MKL25ZXX mcu:KINETIS_KL
family:broadcom_64bit family:broadcom_64bit
family:broadcom_32bit family:broadcom_32bit
board:curiosity_nano board:curiosity_nano

View File

@ -192,12 +192,8 @@ function(family_add_freertos TARGET)
CFG_TUSB_OS=OPT_OS_FREERTOS CFG_TUSB_OS=OPT_OS_FREERTOS
) )
# link tinyusb with freeRTOS kernel # link tinyusb with freeRTOS kernel
target_link_libraries(${TARGET}-tinyusb PUBLIC target_link_libraries(${TARGET}-tinyusb PUBLIC freertos_kernel)
freertos_kernel target_link_libraries(${TARGET} PUBLIC freertos_kernel)
)
target_link_libraries(${TARGET} PUBLIC
freertos_kernel
)
endfunction() endfunction()

View File

@ -114,10 +114,8 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_MIMXRT1XXX) family_add_tinyusb(${TARGET} OPT_MCU_MIMXRT1XXX)
# Add TinyUSB Port source
target_sources(${TARGET}-tinyusb PUBLIC target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c ${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c ${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c

View File

@ -44,15 +44,14 @@
// skip if included from IAR assembler // skip if included from IAR assembler
#ifndef __IASMARM__ #ifndef __IASMARM__
// FIXME cause redundant-decls warnings #include "fsl_device_registers.h"
extern uint32_t SystemCoreClock;
#endif #endif
/* Cortex M23/M33 port configuration. */ /* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0 #define configENABLE_MPU 0
#define configENABLE_FPU 1 #define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0 #define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024) #define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -83,7 +83,7 @@ board: FRDM-KL25Z
* Variables * Variables
******************************************************************************/ ******************************************************************************/
/* System clock frequency. */ /* System clock frequency. */
extern uint32_t SystemCoreClock; //extern uint32_t SystemCoreClock;
/******************************************************************************* /*******************************************************************************
* Code * Code

View File

@ -87,9 +87,6 @@ function(family_configure_example TARGET)
#---------- Port Specific ---------- #---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h # These files are built for each example since it depends on example's tusb_config.h
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PUBLIC
# TinyUSB Port
${TOP}/src/portable/chipidea/ci_fs/dcd_ci_fs.c
${TOP}/src/portable/nxp/khci/hcd_khci.c
# BSP # BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
@ -101,8 +98,13 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_KL) family_add_tinyusb(${TARGET} OPT_MCU_KINETIS_KL)
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/chipidea/ci_fs/dcd_ci_fs.c
${TOP}/src/portable/nxp/khci/hcd_khci.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
# Link dependencies # Link dependencies
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb) target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)

View File

@ -42,17 +42,16 @@
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
// IAR assembler have limited preprocessor support and it only need following macros: // skip if included from IAR assembler
#ifndef __IASMARM__ #ifndef __IASMARM__
// FIXME cause redundant-decls warnings #include "chip.h"
extern uint32_t SystemCoreClock;
#endif #endif
/* Cortex M23/M33 port configuration. */ /* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0 #define configENABLE_MPU 0
#define configENABLE_FPU 0 #define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0 #define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024) #define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -79,10 +79,6 @@ function(family_configure_example TARGET)
#---------- Port Specific ---------- #---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h # These files are built for each example since it depends on example's tusb_config.h
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PUBLIC
# TinyUSB Port
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
${TOP}/src/portable/ehci/ehci.c
# BSP # BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
@ -94,8 +90,14 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_LPC18XX) family_add_tinyusb(${TARGET} OPT_MCU_LPC18XX)
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/chipidea/ci_hs/dcd_ci_hs.c
${TOP}/src/portable/chipidea/ci_hs/hcd_ci_hs.c
${TOP}/src/portable/ehci/ehci.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
# Link dependencies # Link dependencies
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb) target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)

View File

@ -42,17 +42,16 @@
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
// IAR assembler have limited preprocessor support and it only need following macros: // skip if included from IAR assembler
#ifndef __IASMARM__ #ifndef __IASMARM__
// FIXME cause redundant-decls warnings #include "fsl_device_registers.h"
extern uint32_t SystemCoreClock;
#endif #endif
/* Cortex M23/M33 port configuration. */ /* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0 #define configENABLE_MPU 0
#define configENABLE_FPU 1 #define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0 #define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024) #define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -16,16 +16,6 @@ set(FAMILY_MCUS LPC55XX CACHE INTERNAL "")
# include board specific # include board specific
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake) include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
#------------------------------------
# freertos
#------------------------------------
if (NOT TARGET freertos_config)
add_library(freertos_config INTERFACE)
target_include_directories(freertos_config SYSTEM INTERFACE
${CMAKE_CURRENT_LIST_DIR}/FreeRTOSConfig
)
endif()
#------------------------------------ #------------------------------------
# BOARD_TARGET # BOARD_TARGET
@ -106,8 +96,6 @@ function(family_configure_example TARGET)
#---------- Port Specific ---------- #---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h # These files are built for each example since it depends on example's tusb_config.h
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PUBLIC
# TinyUSB Port
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
# BSP # BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
@ -121,15 +109,19 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_LPC55XX) family_add_tinyusb(${TARGET} OPT_MCU_LPC55XX)
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
# Link dependencies # Link dependencies
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb) target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
# Flashing # Flashing
family_flash_jlink(${TARGET}) family_flash_jlink(${TARGET})
family_flash_nxplink(${TARGET}) #family_flash_nxplink(${TARGET})
#family_flash_pyocd(${TARGET}) #family_flash_pyocd(${TARGET})
endfunction() endfunction()

View File

@ -42,17 +42,16 @@
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
// IAR assembler have limited preprocessor support and it only need following macros: // skip if included from IAR assembler
#ifndef __IASMARM__ #ifndef __IASMARM__
// FIXME cause redundant-decls warnings #include "fsl_device_registers.h"
extern uint32_t SystemCoreClock;
#endif #endif
/* Cortex M23/M33 port configuration. */ /* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0 #define configENABLE_MPU 0
#define configENABLE_FPU 1 #define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0 #define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024) #define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -88,8 +88,6 @@ function(family_configure_example TARGET)
#---------- Port Specific ---------- #---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h # These files are built for each example since it depends on example's tusb_config.h
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PUBLIC
# TinyUSB: Port0 is chipidea FS, Port1 is chipidea HS
${TOP}/src/portable/chipidea/$<IF:${PORT},ci_hs/dcd_ci_hs.c,ci_fs/dcd_ci_fs.c>
# BSP # BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
@ -101,8 +99,13 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_MCXN9) family_add_tinyusb(${TARGET} OPT_MCU_MCXN9)
target_sources(${TARGET}-tinyusb PUBLIC
# TinyUSB: Port0 is chipidea FS, Port1 is chipidea HS
${TOP}/src/portable/chipidea/$<IF:${PORT},ci_hs/dcd_ci_hs.c,ci_fs/dcd_ci_fs.c>
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
# Link dependencies # Link dependencies
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb) target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)

View File

@ -42,17 +42,16 @@
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
// IAR assembler have limited preprocessor support and it only need following macros: // skip if included from IAR assembler
#ifndef __IASMARM__ #ifndef __IASMARM__
// FIXME cause redundant-decls warnings #include "nrf.h"
extern uint32_t SystemCoreClock;
#endif #endif
/* Cortex M23/M33 port configuration. */ /* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0 #define configENABLE_MPU 0
#define configENABLE_FPU 1 #define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0 #define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024) #define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -6,7 +6,7 @@ function(update_board TARGET)
NRF5340_XXAA NRF5340_XXAA
NRF5340_XXAA_APPLICATION NRF5340_XXAA_APPLICATION
) )
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PRIVATE
${NRFX_DIR}/drivers/src/nrfx_usbreg.c ${NRFX_DIR}/drivers/src/nrfx_usbreg.c
) )
endfunction() endfunction()

View File

@ -100,8 +100,6 @@ function(family_configure_example TARGET)
#---------- Port Specific ---------- #---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h # These files are built for each example since it depends on example's tusb_config.h
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PUBLIC
# TinyUSB Port
${TOP}/src/portable/nordic/nrf5x/dcd_nrf5x.c
# BSP # BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
@ -113,8 +111,14 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_NRF5X) family_add_tinyusb(${TARGET} OPT_MCU_NRF5X)
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/nordic/nrf5x/dcd_nrf5x.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
# Link dependencies # Link dependencies
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb) target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)

View File

@ -42,17 +42,16 @@
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
// IAR assembler have limited preprocessor support and it only need following macros: // skip if included from IAR assembler
#ifndef __IASMARM__ #ifndef __IASMARM__
// FIXME cause redundant-decls warnings #include "stm32g0xx.h"
extern uint32_t SystemCoreClock;
#endif #endif
/* Cortex M23/M33 port configuration. */ /* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0 #define configENABLE_MPU 0
#define configENABLE_FPU 0 #define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0 #define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024) #define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -59,8 +59,6 @@ function(add_board_target BOARD_TARGET)
update_board(${BOARD_TARGET}) update_board(${BOARD_TARGET})
cmake_print_variables(CMAKE_C_COMPILER_ID)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU") if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_link_options(${BOARD_TARGET} PUBLIC target_link_options(${BOARD_TARGET} PUBLIC
"LINKER:--script=${LD_FILE_GNU}" "LINKER:--script=${LD_FILE_GNU}"
@ -90,8 +88,6 @@ function(family_configure_example TARGET)
#---------- Port Specific ---------- #---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h # These files are built for each example since it depends on example's tusb_config.h
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PUBLIC
# TinyUSB Port
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
# BSP # BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
@ -103,8 +99,13 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_STM32G0) family_add_tinyusb(${TARGET} OPT_MCU_STM32G0)
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
${TOP}/src/portable/st/typec/typec_stm32.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
# Link dependencies # Link dependencies
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb) target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)

View File

@ -42,17 +42,16 @@
* See http://www.freertos.org/a00110.html. * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
// IAR assembler have limited preprocessor support and it only need following macros: // skip if included from IAR assembler
#ifndef __IASMARM__ #ifndef __IASMARM__
// FIXME cause redundant-decls warnings #include "stm32g4xx.h"
extern uint32_t SystemCoreClock;
#endif #endif
/* Cortex M23/M33 port configuration. */ /* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0 #define configENABLE_MPU 0
#define configENABLE_FPU 0 #define configENABLE_FPU 1
#define configENABLE_TRUSTZONE 0 #define configENABLE_TRUSTZONE 0
#define configMINIMAL_SECURE_STACK_SIZE (1024) #define configMINIMAL_SECURE_STACK_SIZE (1024)
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0

View File

@ -88,9 +88,6 @@ function(family_configure_example TARGET)
#---------- Port Specific ---------- #---------- Port Specific ----------
# These files are built for each example since it depends on example's tusb_config.h # These files are built for each example since it depends on example's tusb_config.h
target_sources(${TARGET} PUBLIC target_sources(${TARGET} PUBLIC
# TinyUSB Port
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
${TOP}/src/portable/st/typec/typec_stm32.c
# BSP # BSP
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
@ -102,8 +99,13 @@ function(family_configure_example TARGET)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
) )
# Add TinyUSB # Add TinyUSB target and port source
family_add_tinyusb(${TARGET} OPT_MCU_STM32G4) family_add_tinyusb(${TARGET} OPT_MCU_STM32G4)
target_sources(${TARGET}-tinyusb PUBLIC
${TOP}/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
${TOP}/src/portable/st/typec/typec_stm32.c
)
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
# Link dependencies # Link dependencies
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb) target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)

View File

@ -29,10 +29,24 @@
#if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_NRF5X #if CFG_TUD_ENABLED && CFG_TUSB_MCU == OPT_MCU_NRF5X
#include <stdatomic.h> #include <stdatomic.h>
// Suppress warning caused by nrfx driver
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#include "nrf.h" #include "nrf.h"
#include "nrf_clock.h" #include "nrf_clock.h"
#include "nrf_power.h" #include "nrf_power.h"
#include "nrfx_usbd_errata.h" #include "nrfx_usbd_errata.h"
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "device/dcd.h" #include "device/dcd.h"
// TODO remove later // TODO remove later

View File

@ -186,7 +186,7 @@ bool tcd_init(uint8_t rhport, uint32_t port_type) {
v_cc[0] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC1_Pos) & 0x03; v_cc[0] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC1_Pos) & 0x03;
v_cc[1] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC2_Pos) & 0x03; v_cc[1] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC2_Pos) & 0x03;
TU_LOG1("Initial VState CC1 = %u, CC2 = %u\r\n", v_cc[0], v_cc[1]); TU_LOG1("Initial VState CC1 = %lu, CC2 = %lu\r\n", v_cc[0], v_cc[1]);
// Enable CC1 & CC2 Interrupt // Enable CC1 & CC2 Interrupt
UCPD1->IMR = UCPD_IMR_TYPECEVT1IE | UCPD_IMR_TYPECEVT2IE; UCPD1->IMR = UCPD_IMR_TYPECEVT1IE | UCPD_IMR_TYPECEVT2IE;
@ -246,7 +246,7 @@ void tcd_int_handler(uint8_t rhport) {
v_cc[0] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC1_Pos) & 0x03; v_cc[0] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC1_Pos) & 0x03;
v_cc[1] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC2_Pos) & 0x03; v_cc[1] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC2_Pos) & 0x03;
TU_LOG3("VState CC1 = %u, CC2 = %u\n", v_cc[0], v_cc[1]); TU_LOG3("VState CC1 = %lu, CC2 = %lu\n", v_cc[0], v_cc[1]);
uint32_t cr = UCPD1->CR; uint32_t cr = UCPD1->CR;