Skip to content

Commit 6c7c9f2

Browse files
authored
Merge pull request hathach#2152 from kilograham/is_pico_pio_usb_supported
add is_compiler_supported_by_pico_pio_usb() for rp2040
2 parents e3d4385 + 08a1892 commit 6c7c9f2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

hw/bsp/rp2040/family.cmake

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ function(family_add_pico_pio_usb TARGET)
183183
target_link_libraries(${TARGET} PUBLIC tinyusb_pico_pio_usb)
184184
endfunction()
185185

186+
# since Pico-PIO_USB compiler support may lag, and change from version to version, add a function that pico-sdk/pico-examples
187+
# can check (if present) in case the user has updated their TinyUSB
188+
function(is_compiler_supported_by_pico_pio_usb OUTVAR)
189+
if ((NOT CMAKE_C_COMPILER_ID STREQUAL "GNU"))
190+
SET(${OUTVAR} 0 PARENT_SCOPE)
191+
else()
192+
set(${OUTVAR} 1 PARENT_SCOPE)
193+
endif()
194+
endfunction()
186195

187196
function(family_configure_host_example TARGET RTOS)
188197
family_configure_target(${TARGET} ${RTOS})
@@ -191,8 +200,9 @@ function(family_configure_host_example TARGET RTOS)
191200

192201
# For rp2040 enable pico-pio-usb
193202
if (TARGET tinyusb_pico_pio_usb)
194-
# code does not compile with non GCC, or GCC 11.3+
195-
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3)
203+
# Pico-PIO-USB does not compile with all pico-sdk supported compilers, so check before enabling it
204+
is_compiler_supported_by_pico_pio_usb(PICO_PIO_USB_COMPILER_SUPPORTED)
205+
if (PICO_PIO_USB_COMPILER_SUPPORTED)
196206
family_add_pico_pio_usb(${PROJECT})
197207
endif()
198208
endif()

0 commit comments

Comments
 (0)