@@ -150,11 +150,13 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
150
150
function (family_configure_device_example TARGET )
151
151
family_configure_target (${TARGET} )
152
152
target_link_libraries (${TARGET} PUBLIC pico_stdlib tinyusb_device )
153
+ suppress_tinyusb_warnings ()
153
154
endfunction ()
154
155
155
156
function (family_configure_host_example TARGET )
156
157
family_configure_target (${TARGET} )
157
158
target_link_libraries (${TARGET} PUBLIC pico_stdlib tinyusb_host )
159
+ suppress_tinyusb_warnings ()
158
160
endfunction ()
159
161
160
162
function (family_add_pico_pio_usb TARGET )
@@ -165,6 +167,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
165
167
family_configure_target (${TARGET} )
166
168
# require tinyusb_pico_pio_usb
167
169
target_link_libraries (${TARGET} PUBLIC pico_stdlib tinyusb_device tinyusb_host tinyusb_pico_pio_usb )
170
+ suppress_tinyusb_warnings ()
168
171
endfunction ()
169
172
170
173
function (check_and_add_pico_pio_usb_support )
@@ -232,6 +235,31 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
232
235
233
236
# This method must be called from the project scope to suppress known warnings in TinyUSB source files
234
237
function (suppress_tinyusb_warnings )
235
- # there are currently no warnings to suppress, however this function must still exist
238
+ # some of these are pretty silly warnings only occurring in some older GCC versions 9 or prior
239
+ if (CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0 )
240
+ set (CONVERSION_WARNING_FILES
241
+ ${PICO_TINYUSB_PATH} /src/tusb.c
242
+ ${PICO_TINYUSB_PATH} /src/common/tusb_fifo.c
243
+ ${PICO_TINYUSB_PATH} /src/device/usbd.c
244
+ ${PICO_TINYUSB_PATH} /src/device/usbd_control.c
245
+ ${PICO_TINYUSB_PATH} /src/host/usbh.c
246
+ ${PICO_TINYUSB_PATH} /src/class/cdc/cdc_device.c
247
+ ${PICO_TINYUSB_PATH} /src/class/cdc/cdc_host.c
248
+ ${PICO_TINYUSB_PATH} /src/class/hid/hid_device.c
249
+ ${PICO_TINYUSB_PATH} /src/class/hid/hid_host.c
250
+ ${PICO_TINYUSB_PATH} /src/class/audio/audio_device.c
251
+ ${PICO_TINYUSB_PATH} /src/class/dfu/dfu_device.c
252
+ ${PICO_TINYUSB_PATH} /src/class/dfu/dfu_rt_device.c
253
+ ${PICO_TINYUSB_PATH} /src/class/midi/midi_device.c
254
+ ${PICO_TINYUSB_PATH} /src/class/usbtmc/usbtmc_device.c
255
+ ${PICO_TINYUSB_PATH} /src/portable/raspberrypi/rp2040/hcd_rp2040.c
256
+ )
257
+ foreach (SOURCE_FILE IN LISTS CONVERSION_WARNING_FILES )
258
+ set_source_files_properties (
259
+ ${SOURCE_FILE}
260
+ PROPERTIES
261
+ COMPILE_FLAGS "-Wno-conversion" )
262
+ endforeach ()
263
+ endif ()
236
264
endfunction ()
237
265
endif ()
0 commit comments