mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 01:20:19 +00:00
Merge pull request #2127 from hathach/rp2040-cmake-cleanup
Rp2040 cmake cleanup
This commit is contained in:
commit
bc0d6c7e92
2
.idea/cmake.xml
generated
2
.idea/cmake.xml
generated
@ -25,7 +25,7 @@
|
|||||||
</envs>
|
</envs>
|
||||||
</ADDITIONAL_GENERATION_ENVIRONMENT>
|
</ADDITIONAL_GENERATION_ENVIRONMENT>
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration PROFILE_NAME="rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico" />
|
<configuration PROFILE_NAME="rp2040" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=2 -DLOGGER=RTT" />
|
||||||
<configuration PROFILE_NAME="rt1010 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1010_evk" />
|
<configuration PROFILE_NAME="rt1010 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1010_evk" />
|
||||||
<configuration PROFILE_NAME="rt1060 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1060_evk" />
|
<configuration PROFILE_NAME="rt1060 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1060_evk" />
|
||||||
<configuration PROFILE_NAME="rt1064 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1064_evk" />
|
<configuration PROFILE_NAME="rt1064 evk" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=mimxrt1064_evk" />
|
||||||
|
@ -93,12 +93,12 @@ bool __no_inline_not_in_flash_func(get_bootsel_button)(void) {
|
|||||||
|
|
||||||
static void stdio_rtt_write (const char *buf, int length)
|
static void stdio_rtt_write (const char *buf, int length)
|
||||||
{
|
{
|
||||||
SEGGER_RTT_Write(0, buf, length);
|
SEGGER_RTT_Write(0, buf, (unsigned) length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stdio_rtt_read (char *buf, int len)
|
static int stdio_rtt_read (char *buf, int len)
|
||||||
{
|
{
|
||||||
return SEGGER_RTT_Read(0, buf, len);
|
return (int) SEGGER_RTT_Read(0, buf, (unsigned) len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static stdio_driver_t stdio_rtt =
|
static stdio_driver_t stdio_rtt =
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
if (NOT TARGET _rp2040_family_inclusion_marker)
|
include_guard()
|
||||||
add_library(_rp2040_family_inclusion_marker INTERFACE)
|
|
||||||
|
|
||||||
if (NOT BOARD)
|
if (NOT BOARD)
|
||||||
message("BOARD not specified, defaulting to pico_sdk")
|
message("BOARD not specified, defaulting to pico_sdk")
|
||||||
@ -15,10 +14,6 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
|
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||||
|
|
||||||
# TOP is absolute path to root directory of TinyUSB git repo
|
|
||||||
#set(TOP "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
|
||||||
#get_filename_component(TOP "${TOP}" REALPATH)
|
|
||||||
|
|
||||||
if (NOT PICO_TINYUSB_PATH)
|
if (NOT PICO_TINYUSB_PATH)
|
||||||
set(PICO_TINYUSB_PATH ${TOP})
|
set(PICO_TINYUSB_PATH ${TOP})
|
||||||
endif()
|
endif()
|
||||||
@ -39,8 +34,21 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
|
|
||||||
target_include_directories(tinyusb_common_base INTERFACE
|
target_include_directories(tinyusb_common_base INTERFACE
|
||||||
${TOP}/src
|
${TOP}/src
|
||||||
${TOP}/src/common
|
)
|
||||||
${TOP}/hw
|
|
||||||
|
if(DEFINED LOG)
|
||||||
|
set(TINYUSB_DEBUG_LEVEL ${LOG})
|
||||||
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
message("Compiling TinyUSB with CFG_TUSB_DEBUG=1")
|
||||||
|
set(TINYUSB_DEBUG_LEVEL 1)
|
||||||
|
else ()
|
||||||
|
set(TINYUSB_DEBUG_LEVEL 0)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(tinyusb_common_base INTERFACE
|
||||||
|
CFG_TUSB_MCU=OPT_MCU_RP2040
|
||||||
|
CFG_TUSB_OS=${TINYUSB_OPT_OS}
|
||||||
|
CFG_TUSB_DEBUG=${TINYUSB_DEBUG_LEVEL}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(tinyusb_common_base INTERFACE
|
target_link_libraries(tinyusb_common_base INTERFACE
|
||||||
@ -50,18 +58,6 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
pico_sync
|
pico_sync
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TINYUSB_DEBUG_LEVEL 0)
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
message("Compiling TinyUSB with CFG_TUSB_DEBUG=1")
|
|
||||||
set(TINYUSB_DEBUG_LEVEL 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(tinyusb_common_base INTERFACE
|
|
||||||
CFG_TUSB_MCU=OPT_MCU_RP2040
|
|
||||||
CFG_TUSB_OS=${TINYUSB_OPT_OS}
|
|
||||||
#CFG_TUSB_DEBUG=${TINYUSB_DEBUG_LEVEL}
|
|
||||||
)
|
|
||||||
|
|
||||||
#------------------------------------
|
#------------------------------------
|
||||||
# Base config for device mode; wrapped by SDK's tinyusb_device
|
# Base config for device mode; wrapped by SDK's tinyusb_device
|
||||||
#------------------------------------
|
#------------------------------------
|
||||||
@ -112,8 +108,9 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
target_sources(tinyusb_bsp INTERFACE
|
target_sources(tinyusb_bsp INTERFACE
|
||||||
${TOP}/hw/bsp/rp2040/family.c
|
${TOP}/hw/bsp/rp2040/family.c
|
||||||
)
|
)
|
||||||
# target_include_directories(tinyusb_bsp INTERFACE
|
target_include_directories(tinyusb_bsp INTERFACE
|
||||||
# ${TOP}/hw/bsp/rp2040)
|
${TOP}/hw
|
||||||
|
)
|
||||||
|
|
||||||
# tinyusb_additions will hold our extra settings for examples
|
# tinyusb_additions will hold our extra settings for examples
|
||||||
add_library(tinyusb_additions INTERFACE)
|
add_library(tinyusb_additions INTERFACE)
|
||||||
@ -123,11 +120,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
PICO_RP2040_USB_DEVICE_UFRAME_FIX=1
|
PICO_RP2040_USB_DEVICE_UFRAME_FIX=1
|
||||||
)
|
)
|
||||||
|
|
||||||
if(DEFINED LOG)
|
if(LOGGER STREQUAL "RTT" OR LOGGER STREQUAL "rtt")
|
||||||
target_compile_definitions(tinyusb_additions INTERFACE CFG_TUSB_DEBUG=${LOG})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(LOGGER STREQUAL "rtt")
|
|
||||||
target_compile_definitions(tinyusb_additions INTERFACE
|
target_compile_definitions(tinyusb_additions INTERFACE
|
||||||
LOGGER_RTT
|
LOGGER_RTT
|
||||||
SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||||
@ -137,6 +130,10 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c
|
${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_source_files_properties(${TOP}/lib/SEGGER_RTT/RTT/SEGGER_RTT.c
|
||||||
|
PROPERTIES
|
||||||
|
COMPILE_FLAGS "-Wno-cast-qual -Wno-cast-align -Wno-sign-conversion")
|
||||||
|
|
||||||
target_include_directories(tinyusb_additions INTERFACE
|
target_include_directories(tinyusb_additions INTERFACE
|
||||||
${TOP}/lib/SEGGER_RTT/RTT
|
${TOP}/lib/SEGGER_RTT/RTT
|
||||||
)
|
)
|
||||||
@ -334,4 +331,3 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
# rp2040 does not support freeRTOS example yet
|
# rp2040 does not support freeRTOS example yet
|
||||||
function(family_add_freertos TARGET)
|
function(family_add_freertos TARGET)
|
||||||
endfunction()
|
endfunction()
|
||||||
endif()
|
|
||||||
|
@ -75,8 +75,11 @@ endfunction()
|
|||||||
#------------------------------------
|
#------------------------------------
|
||||||
# TinyUSB as library target
|
# TinyUSB as library target
|
||||||
#------------------------------------
|
#------------------------------------
|
||||||
|
if (NOT DEFINED TINYUSB_TARGET)
|
||||||
set(TINYUSB_TARGET "tinyusb")
|
set(TINYUSB_TARGET "tinyusb")
|
||||||
set(TINYUSB_CONFIG_TARGET "tinyusb_config")
|
endif ()
|
||||||
|
|
||||||
|
set(TINYUSB_CONFIG_TARGET "${TINYUSB_TARGET}_config")
|
||||||
|
|
||||||
if (DEFINED TINYUSB_TARGET_PREFIX)
|
if (DEFINED TINYUSB_TARGET_PREFIX)
|
||||||
set(TINYUSB_TARGET "${TINYUSB_TARGET_PREFIX}${TINYUSB_TARGET}")
|
set(TINYUSB_TARGET "${TINYUSB_TARGET_PREFIX}${TINYUSB_TARGET}")
|
||||||
|
@ -189,7 +189,7 @@ static void hw_endpoint_xfer(uint8_t ep_addr, uint8_t *buffer, uint16_t total_by
|
|||||||
static void __tusb_irq_path_func(hw_handle_buff_status)(void)
|
static void __tusb_irq_path_func(hw_handle_buff_status)(void)
|
||||||
{
|
{
|
||||||
uint32_t remaining_buffers = usb_hw->buf_status;
|
uint32_t remaining_buffers = usb_hw->buf_status;
|
||||||
pico_trace("buf_status = 0x%08x\n", remaining_buffers);
|
pico_trace("buf_status = 0x%08lx\n", remaining_buffers);
|
||||||
uint bit = 1u;
|
uint bit = 1u;
|
||||||
for (uint8_t i = 0; remaining_buffers && i < USB_MAX_ENDPOINTS * 2; i++)
|
for (uint8_t i = 0; remaining_buffers && i < USB_MAX_ENDPOINTS * 2; i++)
|
||||||
{
|
{
|
||||||
|
@ -419,7 +419,7 @@ static bool __tusb_irq_path_func(e15_is_critical_frame_period) (struct hw_endpoi
|
|||||||
if (delta < 800 || delta > 998) {
|
if (delta < 800 || delta > 998) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TU_LOG(3, "Avoiding sof %u now %lu last %lu\n", (usb_hw->sof_rd + 1) & USB_SOF_RD_BITS, time_us_32(), e15_last_sof);
|
TU_LOG(3, "Avoiding sof %lu now %lu last %lu\n", (usb_hw->sof_rd + 1) & USB_SOF_RD_BITS, time_us_32(), e15_last_sof);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user