Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RP2040 build fixes #1887

Merged
merged 1 commit into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions examples/host/bare_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,3 @@ target_include_directories(${PROJECT} PUBLIC
# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})

# For rp2040 enable pico-pio-usb
if(FAMILY STREQUAL "rp2040")
family_add_pico_pio_usb(${PROJECT})

# due to warnings from Pico-PIO-USB
target_compile_options(${PROJECT} PUBLIC
-Wno-error=cast-qual
-Wno-error=sign-conversion
-Wno-error=conversion
)
endif()
12 changes: 0 additions & 12 deletions examples/host/cdc_msc_hid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,3 @@ target_include_directories(${PROJECT} PUBLIC
# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})

# For rp2040 enable pico-pio-usb
if(FAMILY STREQUAL "rp2040")
family_add_pico_pio_usb(${PROJECT})

# due to warnings from Pico-PIO-USB
target_compile_options(${PROJECT} PUBLIC
-Wno-error=cast-qual
-Wno-error=sign-conversion
-Wno-error=conversion
)
endif()
12 changes: 0 additions & 12 deletions examples/host/hid_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,3 @@ target_include_directories(${PROJECT} PUBLIC
# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})

# For rp2040 enable pico-pio-usb
if(FAMILY STREQUAL "rp2040")
family_add_pico_pio_usb(${PROJECT})

# due to warnings from Pico-PIO-USB
target_compile_options(${PROJECT} PUBLIC
-Wno-error=cast-qual
-Wno-error=sign-conversion
-Wno-error=conversion
)
endif()
11 changes: 0 additions & 11 deletions examples/host/msc_file_explorer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,3 @@ target_include_directories(${PROJECT} PUBLIC
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})

# For rp2040 enable pico-pio-usb
if(FAMILY STREQUAL "rp2040")
family_add_pico_pio_usb(${PROJECT})

# due to warnings from Pico-PIO-USB
target_compile_options(${PROJECT} PUBLIC
-Wno-error=cast-qual
-Wno-error=sign-conversion
-Wno-error=conversion
)
endif()
44 changes: 39 additions & 5 deletions hw/bsp/rp2040/family.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,22 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
rp2040_family_configure_example_warnings(${TARGET})
endfunction()

function(family_add_pico_pio_usb TARGET)
target_link_libraries(${TARGET} PUBLIC tinyusb_pico_pio_usb)
endfunction()

function(family_configure_host_example TARGET)
family_configure_target(${TARGET})
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_host)
rp2040_family_configure_example_warnings(${TARGET})
endfunction()

function(family_add_pico_pio_usb TARGET)
target_link_libraries(${TARGET} PUBLIC tinyusb_pico_pio_usb)
# For rp2040 enable pico-pio-usb
if (TARGET tinyusb_pico_pio_usb)
# code does not compile with GCC 12+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment doesn't match the line below.
Does it fail with gcc 12+ (as the comment suggests) or with 11.3+ as the line below and your explanations in this PR suggest it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it fails with 11.3 too (I updated the line but not the comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to push a fix to pico-pio-usb anyway

if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3))
family_add_pico_pio_usb(${PROJECT})
endif()
endif()
endfunction()

function(family_configure_dual_usb_example TARGET)
Expand Down Expand Up @@ -272,10 +280,36 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
endif()
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/rp2040/rp2040_usb.c
PROPERTIES
${PICO_TINYUSB_PATH}/lib/fatfs/source/ff.c
COMPILE_FLAGS "-Wno-stringop-overflow -Wno-array-bounds")
endif()
set_source_files_properties(
${PICO_TINYUSB_PATH}/lib/fatfs/source/ff.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual")

set_source_files_properties(
${PICO_TINYUSB_PATH}/lib/lwip/src/core/tcp_in.c
${PICO_TINYUSB_PATH}/lib/lwip/src/core/tcp_out.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion")

set_source_files_properties(
${PICO_TINYUSB_PATH}/lib/networking/dnserver.c
${PICO_TINYUSB_PATH}/lib/networking/dhserver.c
${PICO_TINYUSB_PATH}/lib/networking/rndis_reports.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-sign-conversion")

if (TARGET tinyusb_pico_pio_usb)
set_source_files_properties(
${PICO_TINYUSB_PATH}/hw/mcu/raspberry_pi/Pico-PIO-USB/src/pio_usb_device.c
${PICO_TINYUSB_PATH}/hw/mcu/raspberry_pi/Pico-PIO-USB/src/pio_usb.c
${PICO_TINYUSB_PATH}/hw/mcu/raspberry_pi/Pico-PIO-USB/src/pio_usb_host.c
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual -Wno-attributes")
endif()
endif()
endfunction()
endif()