Skip to content

Commit b7fa90e

Browse files
committed
rp2040: Fixup lib and example compile for LLVM Embedded Toolchain for ARM
1 parent 34798ff commit b7fa90e

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

examples/host/msc_file_explorer/src/msc_app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ void cli_cmd_cat(EmbeddedCli *cli, char *args, void *context)
413413
{
414414
for(UINT c = 0; c < count; c++)
415415
{
416-
const char ch = buf[c];
416+
const uint8_t ch = buf[c];
417417
if (isprint(ch) || iscntrl(ch))
418418
{
419419
putchar(ch);

hw/bsp/rp2040/family.cmake

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
152152
if (NOT PICO_TINYUSB_NO_EXAMPLE_WARNINGS)
153153
family_add_default_example_warnings(${TARGET})
154154
endif()
155+
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
156+
target_compile_options(${TARGET} PRIVATE -Wno-unreachable-code)
157+
endif()
155158
suppress_tinyusb_warnings()
156159
endfunction()
157160

@@ -172,8 +175,8 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
172175

173176
# For rp2040 enable pico-pio-usb
174177
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))
178+
# code does not compile with non GCC, or GCC 11.3+
179+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3)
177180
family_add_pico_pio_usb(${PROJECT})
178181
endif()
179182
endif()
@@ -278,7 +281,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
278281
COMPILE_FLAGS "-Wno-conversion")
279282
endforeach()
280283
endif()
281-
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
284+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
282285
set_source_files_properties(
283286
${PICO_TINYUSB_PATH}/lib/fatfs/source/ff.c
284287
COMPILE_FLAGS "-Wno-stringop-overflow -Wno-array-bounds")
@@ -310,6 +313,17 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
310313
PROPERTIES
311314
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual -Wno-attributes")
312315
endif()
316+
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
317+
set_source_files_properties(
318+
${PICO_TINYUSB_PATH}/src/class/cdc/cdc_device.c
319+
COMPILE_FLAGS "-Wno-unreachable-code")
320+
set_source_files_properties(
321+
${PICO_TINYUSB_PATH}/src/class/cdc/cdc_host.c
322+
COMPILE_FLAGS "-Wno-unreachable-code-fallthrough")
323+
set_source_files_properties(
324+
${PICO_TINYUSB_PATH}/lib/fatfs/source/ff.c
325+
PROPERTIES
326+
COMPILE_FLAGS "-Wno-cast-qual")
313327
endif()
314328
endfunction()
315329
endif()

src/portable/raspberrypi/rp2040/dcd_rp2040.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static void __tusb_irq_path_func(dcd_rp2040_irq)(void)
297297
if ( status & USB_INTS_SETUP_REQ_BITS )
298298
{
299299
handled |= USB_INTS_SETUP_REQ_BITS;
300-
uint8_t const * setup = (uint8_t const*) &usb_dpram->setup_packet;
300+
uint8_t const * setup = remove_volatile_cast(uint8_t const*, &usb_dpram->setup_packet);
301301

302302
// reset pid to both 1 (data and ack)
303303
reset_ep0_pid();

0 commit comments

Comments
 (0)