Переглянути джерело

allow all host examples to use pico-pio-usb for rp2040

hathach 3 роки тому
батько
коміт
21d552bbdf

+ 15 - 2
examples/host/bare_api/CMakeLists.txt

@@ -26,5 +26,18 @@ target_include_directories(${PROJECT} PUBLIC
 # 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})
 
 
-# For rp2040, un-comment to enable pico-pio-usb
-# family_add_pico_pio_usb(${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=shadow
+          -Wno-error=cast-align
+          -Wno-error=cast-qual
+          -Wno-error=redundant-decls
+          -Wno-error=sign-conversion
+          -Wno-error=conversion
+          -Wno-error=unused-function
+          )
+endif()

+ 6 - 0
examples/host/bare_api/src/tusb_config.h

@@ -34,6 +34,12 @@
 // Board Specific Configuration
 // Board Specific Configuration
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 
 
+#if CFG_TUSB_MCU == OPT_MCU_RP2040
+// change to 1 if using pico-pio-usb as host controller for raspberry rp2040
+#define CFG_TUH_RPI_PIO_USB   0
+#define BOARD_TUH_RHPORT      CFG_TUH_RPI_PIO_USB
+#endif
+
 // RHPort number used for host can be defined by board.mk, default to port 0
 // RHPort number used for host can be defined by board.mk, default to port 0
 #ifndef BOARD_TUH_RHPORT
 #ifndef BOARD_TUH_RHPORT
 #define BOARD_TUH_RHPORT      0
 #define BOARD_TUH_RHPORT      0

+ 15 - 14
examples/host/cdc_msc_hid/CMakeLists.txt

@@ -28,17 +28,18 @@ target_include_directories(${PROJECT} PUBLIC
 # 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})
 
 
-# For rp2040, un-comment to enable pico-pio-usb
-family_add_pico_pio_usb(${PROJECT})
-
-# due to warnings from Pico-PIO-USB
-target_compile_options(${PROJECT} PUBLIC
-        -Wno-error=shadow
-        -Wno-error=cast-align
-        -Wno-error=cast-qual
-        -Wno-error=redundant-decls
-        -Wno-error=sign-conversion
-        -Wno-error=conversion
-        -Wno-error=sign-compare
-        -Wno-error=unused-function
-        )
+# 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=shadow
+          -Wno-error=cast-align
+          -Wno-error=cast-qual
+          -Wno-error=redundant-decls
+          -Wno-error=sign-conversion
+          -Wno-error=conversion
+          -Wno-error=unused-function
+          )
+endif()

+ 15 - 2
examples/host/hid_controller/CMakeLists.txt

@@ -27,5 +27,18 @@ target_include_directories(${PROJECT} PUBLIC
 # 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})
 
 
-# For rp2040, un-comment to enable pico-pio-usb
-# family_add_pico_pio_usb(${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=shadow
+          -Wno-error=cast-align
+          -Wno-error=cast-qual
+          -Wno-error=redundant-decls
+          -Wno-error=sign-conversion
+          -Wno-error=conversion
+          -Wno-error=unused-function
+          )
+endif()

+ 6 - 0
examples/host/hid_controller/src/tusb_config.h

@@ -34,6 +34,12 @@
 // Board Specific Configuration
 // Board Specific Configuration
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 
 
+ #if CFG_TUSB_MCU == OPT_MCU_RP2040
+// change to 1 if using pico-pio-usb as host controller for raspberry rp2040
+#define CFG_TUH_RPI_PIO_USB   0
+#define BOARD_TUH_RHPORT      CFG_TUH_RPI_PIO_USB
+#endif
+
 // RHPort number used for host can be defined by board.mk, default to port 0
 // RHPort number used for host can be defined by board.mk, default to port 0
 #ifndef BOARD_TUH_RHPORT
 #ifndef BOARD_TUH_RHPORT
 #define BOARD_TUH_RHPORT      0
 #define BOARD_TUH_RHPORT      0

+ 15 - 14
examples/host/msc_file_explorer/CMakeLists.txt

@@ -32,17 +32,18 @@ target_include_directories(${PROJECT} PUBLIC
 # 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})
 
 
-# For rp2040, un-comment to enable pico-pio-usb
-family_add_pico_pio_usb(${PROJECT})
-
-# due to warnings from Pico-PIO-USB and fatfs
-target_compile_options(${PROJECT} PUBLIC
-        -Wno-error=shadow
-        -Wno-error=cast-align
-        -Wno-error=cast-qual
-        -Wno-error=redundant-decls
-        -Wno-error=sign-conversion
-        -Wno-error=conversion
-        -Wno-error=sign-compare
-        -Wno-error=unused-function
-        )
+# 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=shadow
+          -Wno-error=cast-align
+          -Wno-error=cast-qual
+          -Wno-error=redundant-decls
+          -Wno-error=sign-conversion
+          -Wno-error=conversion
+          -Wno-error=unused-function
+          )
+endif()