summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraham sanderson <[email protected]>2023-03-02 14:32:22 -0600
committergraham sanderson <[email protected]>2023-03-02 14:32:22 -0600
commitb7fa90e7066fff8a529d02c2a51a3319f25c77f8 (patch)
tree797381e716eb1a450e60a9093811cdcb8c19c8bf
parent34798ff85ec819bafc09da57f7853a1d116a7fff (diff)
rp2040: Fixup lib and example compile for LLVM Embedded Toolchain for ARM
-rw-r--r--examples/host/msc_file_explorer/src/msc_app.c2
-rw-r--r--hw/bsp/rp2040/family.cmake20
-rw-r--r--src/portable/raspberrypi/rp2040/dcd_rp2040.c2
3 files changed, 19 insertions, 5 deletions
diff --git a/examples/host/msc_file_explorer/src/msc_app.c b/examples/host/msc_file_explorer/src/msc_app.c
index 5a1635015..eef28fe12 100644
--- a/examples/host/msc_file_explorer/src/msc_app.c
+++ b/examples/host/msc_file_explorer/src/msc_app.c
@@ -413,7 +413,7 @@ void cli_cmd_cat(EmbeddedCli *cli, char *args, void *context)
{
for(UINT c = 0; c < count; c++)
{
- const char ch = buf[c];
+ const uint8_t ch = buf[c];
if (isprint(ch) || iscntrl(ch))
{
putchar(ch);
diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake
index 1eab95304..82010efef 100644
--- a/hw/bsp/rp2040/family.cmake
+++ b/hw/bsp/rp2040/family.cmake
@@ -152,6 +152,9 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
if (NOT PICO_TINYUSB_NO_EXAMPLE_WARNINGS)
family_add_default_example_warnings(${TARGET})
endif()
+ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ target_compile_options(${TARGET} PRIVATE -Wno-unreachable-code)
+ endif()
suppress_tinyusb_warnings()
endfunction()
@@ -172,8 +175,8 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
# For rp2040 enable pico-pio-usb
if (TARGET tinyusb_pico_pio_usb)
- # code does not compile with GCC 12+
- if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3))
+ # code does not compile with non GCC, or GCC 11.3+
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3)
family_add_pico_pio_usb(${PROJECT})
endif()
endif()
@@ -278,7 +281,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
COMPILE_FLAGS "-Wno-conversion")
endforeach()
endif()
- if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
set_source_files_properties(
${PICO_TINYUSB_PATH}/lib/fatfs/source/ff.c
COMPILE_FLAGS "-Wno-stringop-overflow -Wno-array-bounds")
@@ -310,6 +313,17 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual -Wno-attributes")
endif()
+ elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ set_source_files_properties(
+ ${PICO_TINYUSB_PATH}/src/class/cdc/cdc_device.c
+ COMPILE_FLAGS "-Wno-unreachable-code")
+ set_source_files_properties(
+ ${PICO_TINYUSB_PATH}/src/class/cdc/cdc_host.c
+ COMPILE_FLAGS "-Wno-unreachable-code-fallthrough")
+ set_source_files_properties(
+ ${PICO_TINYUSB_PATH}/lib/fatfs/source/ff.c
+ PROPERTIES
+ COMPILE_FLAGS "-Wno-cast-qual")
endif()
endfunction()
endif()
diff --git a/src/portable/raspberrypi/rp2040/dcd_rp2040.c b/src/portable/raspberrypi/rp2040/dcd_rp2040.c
index b5fa90c92..8df7bef2b 100644
--- a/src/portable/raspberrypi/rp2040/dcd_rp2040.c
+++ b/src/portable/raspberrypi/rp2040/dcd_rp2040.c
@@ -297,7 +297,7 @@ static void __tusb_irq_path_func(dcd_rp2040_irq)(void)
if ( status & USB_INTS_SETUP_REQ_BITS )
{
handled |= USB_INTS_SETUP_REQ_BITS;
- uint8_t const * setup = (uint8_t const*) &usb_dpram->setup_packet;
+ uint8_t const * setup = remove_volatile_cast(uint8_t const*, &usb_dpram->setup_packet);
// reset pid to both 1 (data and ack)
reset_ep0_pid();