mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
Merge pull request #1554 from kilograham/rp2040_warning2
Rework CMake example warnings some more
This commit is contained in:
commit
868f2bcda0
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
||||||
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -36,9 +36,6 @@ else()
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
||||||
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
||||||
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -69,9 +69,6 @@ if (EXISTS ${TOP}/lib/lwip/src)
|
|||||||
${TOP}/lib/networking/rndis_reports.c
|
${TOP}/lib/networking/rndis_reports.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# due to warnings from other net source, we need to prevent error from some of the warnings options
|
# due to warnings from other net source, we need to prevent error from some of the warnings options
|
||||||
target_compile_options(${PROJECT} PUBLIC
|
target_compile_options(${PROJECT} PUBLIC
|
||||||
-Wno-error=null-dereference
|
-Wno-error=null-dereference
|
||||||
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_device_example(${PROJECT})
|
family_configure_device_example(${PROJECT})
|
@ -23,8 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
|
family_configure_dual_usb_example(${PROJECT})
|
||||||
|
|
||||||
# due to warnings from other net source, we need to prevent error from some of the warnings options
|
# due to warnings from other net source, we need to prevent error from some of the warnings options
|
||||||
target_compile_options(${PROJECT} PUBLIC
|
target_compile_options(${PROJECT} PUBLIC
|
||||||
@ -37,7 +38,3 @@ target_compile_options(${PROJECT} PUBLIC
|
|||||||
-Wno-error=sign-compare
|
-Wno-error=sign-compare
|
||||||
-Wno-error=unused-function
|
-Wno-error=unused-function
|
||||||
)
|
)
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
|
||||||
family_configure_dual_usb_example(${PROJECT})
|
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
target_compile_options(${PROJECT} PUBLIC
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Werror
|
|
||||||
-Wfatal-errors
|
|
||||||
-Wdouble-promotion
|
|
||||||
-Wfloat-equal
|
|
||||||
-Wshadow
|
|
||||||
-Wwrite-strings
|
|
||||||
-Wsign-compare
|
|
||||||
-Wmissing-format-attribute
|
|
||||||
-Wunreachable-code
|
|
||||||
-Wcast-align
|
|
||||||
-Wcast-qual
|
|
||||||
-Wnull-dereference
|
|
||||||
-Wuninitialized
|
|
||||||
-Wunused
|
|
||||||
-Wredundant-decls
|
|
||||||
#-Wstrict-prototypes
|
|
||||||
#-Werror-implicit-function-declaration
|
|
||||||
#-Wundef
|
|
||||||
)
|
|
||||||
|
|
||||||
# GCC 10
|
|
||||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
|
|
||||||
target_compile_options(${PROJECT} PUBLIC -Wconversion)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# GCC 8
|
|
||||||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
|
||||||
target_compile_options(${PROJECT} PUBLIC -Wcast-function-type -Wstrict-overflow)
|
|
||||||
endif()
|
|
@ -22,9 +22,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_host_example(${PROJECT})
|
family_configure_host_example(${PROJECT})
|
||||||
|
@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_host_example(${PROJECT})
|
family_configure_host_example(${PROJECT})
|
||||||
|
@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
# Example common such as compiler warnings
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
|
|
||||||
|
|
||||||
# Configure compilation flags and libraries for the example... see the corresponding function
|
# Configure compilation flags and libraries for the example... see the corresponding function
|
||||||
# in hw/bsp/FAMILY/family.cmake for details.
|
# in hw/bsp/FAMILY/family.cmake for details.
|
||||||
family_configure_host_example(${PROJECT})
|
family_configure_host_example(${PROJECT})
|
||||||
|
@ -79,6 +79,48 @@ if (NOT TARGET _family_support_marker)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(family_add_default_example_warnings TARGET)
|
||||||
|
target_compile_options(${TARGET} PUBLIC
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Werror
|
||||||
|
-Wfatal-errors
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Wfloat-equal
|
||||||
|
-Wshadow
|
||||||
|
-Wwrite-strings
|
||||||
|
-Wsign-compare
|
||||||
|
-Wmissing-format-attribute
|
||||||
|
-Wunreachable-code
|
||||||
|
-Wcast-align
|
||||||
|
-Wcast-qual
|
||||||
|
-Wnull-dereference
|
||||||
|
-Wuninitialized
|
||||||
|
-Wunused
|
||||||
|
-Wredundant-decls
|
||||||
|
#-Wstrict-prototypes
|
||||||
|
#-Werror-implicit-function-declaration
|
||||||
|
#-Wundef
|
||||||
|
)
|
||||||
|
|
||||||
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
|
# GCC 10
|
||||||
|
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
|
||||||
|
target_compile_options(${TARGET} PUBLIC -Wconversion)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# GCC 8
|
||||||
|
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||||
|
target_compile_options(${TARGET} PUBLIC -Wcast-function-type -Wstrict-overflow)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# GCC 6
|
||||||
|
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
|
||||||
|
target_compile_options(${TARGET} PUBLIC -Wno-strict-aliasing)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
# configure an executable target to link to tinyusb in device mode, and add the board implementation
|
# configure an executable target to link to tinyusb in device mode, and add the board implementation
|
||||||
function(family_configure_device_example TARGET)
|
function(family_configure_device_example TARGET)
|
||||||
# default implentation is empty, the function should be redefined in the FAMILY/family.cmake
|
# default implentation is empty, the function should be redefined in the FAMILY/family.cmake
|
||||||
|
@ -147,16 +147,23 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib pico_bootsel_via_double_reset tinyusb_board tinyusb_additions)
|
target_link_libraries(${TARGET} PUBLIC pico_stdlib pico_bootsel_via_double_reset tinyusb_board tinyusb_additions)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(rp2040_family_configure_example_warnings TARGET)
|
||||||
|
if (NOT PICO_TINYUSB_NO_EXAMPLE_WARNINGS)
|
||||||
|
family_add_default_example_warnings(${TARGET})
|
||||||
|
endif()
|
||||||
|
suppress_tinyusb_warnings()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(family_configure_device_example TARGET)
|
function(family_configure_device_example TARGET)
|
||||||
family_configure_target(${TARGET})
|
family_configure_target(${TARGET})
|
||||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_device)
|
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_device)
|
||||||
suppress_tinyusb_warnings()
|
rp2040_family_configure_example_warnings(${TARGET})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(family_configure_host_example TARGET)
|
function(family_configure_host_example TARGET)
|
||||||
family_configure_target(${TARGET})
|
family_configure_target(${TARGET})
|
||||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_host)
|
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_host)
|
||||||
suppress_tinyusb_warnings()
|
rp2040_family_configure_example_warnings(${TARGET})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(family_add_pico_pio_usb TARGET)
|
function(family_add_pico_pio_usb TARGET)
|
||||||
@ -167,7 +174,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
family_configure_target(${TARGET})
|
family_configure_target(${TARGET})
|
||||||
# require tinyusb_pico_pio_usb
|
# require tinyusb_pico_pio_usb
|
||||||
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_device tinyusb_host tinyusb_pico_pio_usb )
|
target_link_libraries(${TARGET} PUBLIC pico_stdlib tinyusb_device tinyusb_host tinyusb_pico_pio_usb )
|
||||||
suppress_tinyusb_warnings()
|
rp2040_family_configure_example_warnings(${TARGET})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(check_and_add_pico_pio_usb_support)
|
function(check_and_add_pico_pio_usb_support)
|
||||||
@ -236,6 +243,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
# This method must be called from the project scope to suppress known warnings in TinyUSB source files
|
# This method must be called from the project scope to suppress known warnings in TinyUSB source files
|
||||||
function(suppress_tinyusb_warnings)
|
function(suppress_tinyusb_warnings)
|
||||||
# some of these are pretty silly warnings only occurring in some older GCC versions 9 or prior
|
# some of these are pretty silly warnings only occurring in some older GCC versions 9 or prior
|
||||||
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
|
if (CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
|
||||||
set(CONVERSION_WARNING_FILES
|
set(CONVERSION_WARNING_FILES
|
||||||
${PICO_TINYUSB_PATH}/src/tusb.c
|
${PICO_TINYUSB_PATH}/src/tusb.c
|
||||||
@ -261,5 +269,12 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
|
|||||||
COMPILE_FLAGS "-Wno-conversion")
|
COMPILE_FLAGS "-Wno-conversion")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
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
|
||||||
|
COMPILE_FLAGS "-Wno-stringop-overflow -Wno-array-bounds")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
endif()
|
endif()
|
||||||
|
@ -131,6 +131,12 @@
|
|||||||
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||||
#define TU_ATTR_BIT_FIELD_ORDER_END
|
#define TU_ATTR_BIT_FIELD_ORDER_END
|
||||||
|
|
||||||
|
#if __has_attribute(__fallthrough__)
|
||||||
|
#define TU_ATTR_FALLTHROUGH __attribute__((fallthrough))
|
||||||
|
#else
|
||||||
|
#define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||||
|
#endif
|
||||||
|
|
||||||
// Endian conversion use well-known host to network (big endian) naming
|
// Endian conversion use well-known host to network (big endian) naming
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
|
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
|
||||||
@ -156,6 +162,7 @@
|
|||||||
#define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used
|
#define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used
|
||||||
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
||||||
#define TU_ATTR_USED __attribute__ ((used))
|
#define TU_ATTR_USED __attribute__ ((used))
|
||||||
|
#define TU_ATTR_FALLTHROUGH __attribute__((fallthrough))
|
||||||
|
|
||||||
#define TU_ATTR_PACKED_BEGIN
|
#define TU_ATTR_PACKED_BEGIN
|
||||||
#define TU_ATTR_PACKED_END
|
#define TU_ATTR_PACKED_END
|
||||||
@ -182,6 +189,7 @@
|
|||||||
#define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used
|
#define TU_ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used
|
||||||
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
|
||||||
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
|
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
|
||||||
|
#define TU_ATTR_FALLTHROUGH __attribute__((fallthrough))
|
||||||
|
|
||||||
#define TU_ATTR_PACKED_BEGIN
|
#define TU_ATTR_PACKED_BEGIN
|
||||||
#define TU_ATTR_PACKED_END
|
#define TU_ATTR_PACKED_END
|
||||||
@ -207,6 +215,7 @@
|
|||||||
#define TU_ATTR_DEPRECATED(mess)
|
#define TU_ATTR_DEPRECATED(mess)
|
||||||
#define TU_ATTR_UNUSED
|
#define TU_ATTR_UNUSED
|
||||||
#define TU_ATTR_USED
|
#define TU_ATTR_USED
|
||||||
|
#define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||||
|
|
||||||
#define TU_ATTR_PACKED_BEGIN _Pragma("pack")
|
#define TU_ATTR_PACKED_BEGIN _Pragma("pack")
|
||||||
#define TU_ATTR_PACKED_END _Pragma("packoption")
|
#define TU_ATTR_PACKED_END _Pragma("packoption")
|
||||||
@ -227,6 +236,7 @@
|
|||||||
#error "Compiler attribute porting is required"
|
#error "Compiler attribute porting is required"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (TU_BYTE_ORDER == TU_LITTLE_ENDIAN)
|
#if (TU_BYTE_ORDER == TU_LITTLE_ENDIAN)
|
||||||
|
|
||||||
#define tu_htons(u16) (TU_BSWAP16(u16))
|
#define tu_htons(u16) (TU_BSWAP16(u16))
|
||||||
|
@ -655,7 +655,7 @@ static bool usbh_control_xfer_cb (uint8_t dev_addr, uint8_t ep_addr, xfer_result
|
|||||||
TU_ASSERT( hcd_edpt_xfer(rhport, dev_addr, tu_edpt_addr(0, request->bmRequestType_bit.direction), _ctrl_xfer.buffer, request->wLength) );
|
TU_ASSERT( hcd_edpt_xfer(rhport, dev_addr, tu_edpt_addr(0, request->bmRequestType_bit.direction), _ctrl_xfer.buffer, request->wLength) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
__attribute__((fallthrough));
|
TU_ATTR_FALLTHROUGH;
|
||||||
|
|
||||||
case CONTROL_STAGE_DATA:
|
case CONTROL_STAGE_DATA:
|
||||||
if (request->wLength)
|
if (request->wLength)
|
||||||
|
@ -60,7 +60,9 @@ void rp2040_usb_init(void)
|
|||||||
// Clear any previous state just in case
|
// Clear any previous state just in case
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
|
#if __GNUC__ > 6
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||||
|
#endif
|
||||||
memset(usb_hw, 0, sizeof(*usb_hw));
|
memset(usb_hw, 0, sizeof(*usb_hw));
|
||||||
memset(usb_dpram, 0, sizeof(*usb_dpram));
|
memset(usb_dpram, 0, sizeof(*usb_dpram));
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user