@@ -161,14 +161,22 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
161161 rp2040_family_configure_example_warnings(${TARGET} )
162162 endfunction ()
163163
164+ function (family_add_pico_pio_usb TARGET )
165+ target_link_libraries (${TARGET} PUBLIC tinyusb_pico_pio_usb)
166+ endfunction ()
167+
164168 function (family_configure_host_example TARGET )
165169 family_configure_target(${TARGET} )
166170 target_link_libraries (${TARGET} PUBLIC pico_stdlib tinyusb_host)
167171 rp2040_family_configure_example_warnings(${TARGET} )
168- endfunction ()
169172
170- function (family_add_pico_pio_usb TARGET )
171- target_link_libraries (${TARGET} PUBLIC tinyusb_pico_pio_usb)
173+ # For rp2040 enable pico-pio-usb
174+ if (TARGET tinyusb_pico_pio_usb)
175+ # code does not compile with GCC 12+
176+ if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3))
177+ family_add_pico_pio_usb(${PROJECT} )
178+ endif ()
179+ endif ()
172180 endfunction ()
173181
174182 function (family_configure_dual_usb_example TARGET )
@@ -272,10 +280,36 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
272280 endif ()
273281 if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
274282 set_source_files_properties (
275- ${PICO_TINYUSB_PATH} /src/portable/raspberrypi/rp2040/rp2040_usb.c
276- PROPERTIES
283+ ${PICO_TINYUSB_PATH} /lib/fatfs/source /ff.c
277284 COMPILE_FLAGS "-Wno-stringop-overflow -Wno-array-bounds" )
278285 endif ()
286+ set_source_files_properties (
287+ ${PICO_TINYUSB_PATH} /lib/fatfs/source /ff.c
288+ PROPERTIES
289+ COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual" )
290+
291+ set_source_files_properties (
292+ ${PICO_TINYUSB_PATH} /lib/lwip/src/core/tcp_in.c
293+ ${PICO_TINYUSB_PATH} /lib/lwip/src/core/tcp_out.c
294+ PROPERTIES
295+ COMPILE_FLAGS "-Wno-conversion" )
296+
297+ set_source_files_properties (
298+ ${PICO_TINYUSB_PATH} /lib/networking/dnserver.c
299+ ${PICO_TINYUSB_PATH} /lib/networking/dhserver.c
300+ ${PICO_TINYUSB_PATH} /lib/networking/rndis_reports.c
301+ PROPERTIES
302+ COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion" )
303+
304+ if (TARGET tinyusb_pico_pio_usb)
305+ set_source_files_properties (
306+ ${PICO_TINYUSB_PATH} /hw/mcu/raspberry_pi/Pico-PIO-USB/src/pio_usb_device.c
307+ ${PICO_TINYUSB_PATH} /hw/mcu/raspberry_pi/Pico-PIO-USB/src/pio_usb.c
308+ ${PICO_TINYUSB_PATH} /hw/mcu/raspberry_pi/Pico-PIO-USB/src/pio_usb_host.c
309+ ${PICO_TINYUSB_PATH} /src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
310+ PROPERTIES
311+ COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual -Wno-attributes" )
312+ endif ()
279313 endif ()
280314 endfunction ()
281315endif ()
0 commit comments