Skip to content

Commit c0e4c02

Browse files
committed
allow imxrt build with dual exmaples
1 parent bc579c0 commit c0e4c02

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

examples/cmake/toolchain/set_flags.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ foreach(LANG IN ITEMS C CXX ASM)
88
#cmake_print_variables(CMAKE_${LANG}_FLAGS_INIT)
99

1010
# optimization flags
11-
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-Og")
11+
set(CMAKE_${LANG}_FLAGS_RELEASE_INIT "-Os")
12+
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
1213
endforeach()
1314

1415
# Linker

examples/dual/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../hw/bsp/family_support.cmake)
44

55
project(tinyusb_dual_examples C CXX ASM)
66
family_initialize_project(tinyusb_dual_examples ${CMAKE_CURRENT_LIST_DIR})
7+
78
if (FAMILY STREQUAL "rp2040" AND NOT TARGET tinyusb_pico_pio_usb)
8-
message("Skipping dual host/device mode examples as Pico-PIO-USB is not available")
9-
else()
10-
# family_add_subdirectory will filter what to actually add based on selected FAMILY
11-
family_add_subdirectory(host_hid_to_device_cdc)
12-
endif()
9+
message("Skipping dual host/device mode examples as Pico-PIO-USB is not available")
10+
else ()
11+
# family_add_subdirectory will filter what to actually add based on selected FAMILY
12+
family_add_subdirectory(host_hid_to_device_cdc)
13+
endif ()

examples/dual/host_hid_to_device_cdc/CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ add_executable(${PROJECT})
1414

1515
# Example source
1616
target_sources(${PROJECT} PUBLIC
17-
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
18-
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
19-
)
17+
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
18+
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
19+
)
2020

2121
# Example include
2222
target_include_directories(${PROJECT} PUBLIC
23-
${CMAKE_CURRENT_SOURCE_DIR}/src
24-
)
23+
${CMAKE_CURRENT_SOURCE_DIR}/src
24+
)
2525

2626
# Configure compilation flags and libraries for the example... see the corresponding function
2727
# in hw/bsp/FAMILY/family.cmake for details.
2828
family_configure_dual_usb_example(${PROJECT})
2929

3030
# due to warnings from Pico-PIO-USB
3131
target_compile_options(${PROJECT} PUBLIC
32-
-Wno-error=shadow
33-
-Wno-error=cast-align
34-
-Wno-error=cast-qual
35-
-Wno-error=redundant-decls
36-
-Wno-error=sign-conversion
37-
-Wno-error=conversion
38-
-Wno-error=sign-compare
39-
-Wno-error=unused-function
40-
)
32+
-Wno-error=shadow
33+
-Wno-error=cast-align
34+
-Wno-error=cast-qual
35+
-Wno-error=redundant-decls
36+
-Wno-error=sign-conversion
37+
-Wno-error=conversion
38+
-Wno-error=sign-compare
39+
-Wno-error=unused-function
40+
)

hw/bsp/family_support.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ if (NOT TARGET _family_support_marker)
2727
foreach(MCU IN LISTS FAMILY_MCUS)
2828
# For each line in only.txt
2929
foreach(_line ${ONLYS_LINES})
30-
# If mcu:xxx exists for this mcu then include
31-
if (${_line} STREQUAL "mcu:${MCU}")
30+
# If mcu:xxx exists for this mcu or board:xxx then include
31+
if (${_line} STREQUAL "mcu:${MCU}" OR ${_line} STREQUAL "board:${BOARD}")
3232
set(${RESULT} 1 PARENT_SCOPE)
3333
return()
3434
endif()

hw/bsp/imxrt/family.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,7 @@ endfunction()
173173
function(family_configure_host_example TARGET)
174174
family_configure_target(${TARGET})
175175
endfunction()
176+
177+
function(family_configure_dual_usb_example TARGET)
178+
family_configure_target(${TARGET})
179+
endfunction()

src/portable/chipidea/ci_hs/hcd_ci_hs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ bool hcd_init(uint8_t rhport)
7676
#endif
7777

7878
// FIXME force full speed, still have issue with Highspeed enumeration
79+
// 1. Have issue when plug/unplug devices, maybe the port is not reset properly
80+
// 2. Also does not seems to detect disconnection
7981
hcd_reg->PORTSC1 |= PORTSC1_FORCE_FULL_SPEED;
8082

8183
return ehci_init(rhport, (uint32_t) &hcd_reg->CAPLENGTH, (uint32_t) &hcd_reg->USBCMD);

0 commit comments

Comments
 (0)