Update to TinyUSB 0.12.0 (#622)

Update kitchent_sink compilation test to include TinyUSB to catch warnings
Fix warnings in stdio_usb and stdio_semihosting caught by above
This commit is contained in:
Graham Sanderson 2021-10-25 08:33:42 -05:00 committed by GitHub
parent 22b0d5d2ed
commit 0ccd0db163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 13 deletions

@ -1 +1 @@
Subproject commit d49938d0f5052bce70e55c652b657c0a6a7e84fe Subproject commit 4bfab30c02279a0530e1a56f4a7c539f2d35a293

View File

@ -49,10 +49,10 @@
#define EP_CTRL_INTERRUPT_PER_DOUBLE_BUFFER (1u << 28) #define EP_CTRL_INTERRUPT_PER_DOUBLE_BUFFER (1u << 28)
#define EP_CTRL_INTERRUPT_ON_NAK (1u << 16) #define EP_CTRL_INTERRUPT_ON_NAK (1u << 16)
#define EP_CTRL_INTERRUPT_ON_STALL (1u << 17) #define EP_CTRL_INTERRUPT_ON_STALL (1u << 17)
#define EP_CTRL_BUFFER_TYPE_LSB 26 #define EP_CTRL_BUFFER_TYPE_LSB 26u
#define EP_CTRL_HOST_INTERRUPT_INTERVAL_LSB 16 #define EP_CTRL_HOST_INTERRUPT_INTERVAL_LSB 16u
#define USB_DPRAM_SIZE 4096 #define USB_DPRAM_SIZE 4096u
// PICO_CONFIG: USB_DPRAM_MAX, Set amount of USB RAM used by USB system, min=0, max=4096, default=4096, group=hardware_usb // PICO_CONFIG: USB_DPRAM_MAX, Set amount of USB RAM used by USB system, min=0, max=4096, default=4096, group=hardware_usb
// Allow user to claim some of the USB RAM for themselves // Allow user to claim some of the USB RAM for themselves

View File

@ -18,7 +18,7 @@
// ); // );
//} //}
static void __attribute__((naked)) semihosting_putc(const char *c) { static void __attribute__((naked)) semihosting_putc(__unused const char *c) {
__asm ( __asm (
"mov r1, r0\n" "mov r1, r0\n"
@ -30,7 +30,7 @@ static void __attribute__((naked)) semihosting_putc(const char *c) {
static void stdio_semihosting_out_chars(const char *buf, int length) { static void stdio_semihosting_out_chars(const char *buf, int length) {
for (uint i = 0; i <length; i++) { for (int i = 0; i < length; i++) {
semihosting_putc(&buf[i]); semihosting_putc(&buf[i]);
} }
} }

View File

@ -38,7 +38,7 @@ static uint16_t resetd_open(uint8_t __unused rhport, tusb_desc_interface_t const
} }
// Support for parameterized reset via vendor interface control request // Support for parameterized reset via vendor interface control request
static bool resetd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request) { static bool resetd_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request) {
// nothing to do with DATA & ACK stage // nothing to do with DATA & ACK stage
if (stage != CONTROL_STAGE_SETUP) return true; if (stage != CONTROL_STAGE_SETUP) return true;

View File

@ -41,10 +41,10 @@ static void stdio_usb_out_chars(const char *buf, int length) {
if (tud_cdc_connected()) { if (tud_cdc_connected()) {
for (int i = 0; i < length;) { for (int i = 0; i < length;) {
int n = length - i; int n = length - i;
int avail = tud_cdc_write_available(); int avail = (int) tud_cdc_write_available();
if (n > avail) n = avail; if (n > avail) n = avail;
if (n) { if (n) {
int n2 = tud_cdc_write(buf + i, n); int n2 = (int) tud_cdc_write(buf + i, (uint32_t)n);
tud_task(); tud_task();
tud_cdc_write_flush(); tud_cdc_write_flush();
i += n2; i += n2;
@ -73,7 +73,7 @@ int stdio_usb_in_chars(char *buf, int length) {
} }
int rc = PICO_ERROR_NO_DATA; int rc = PICO_ERROR_NO_DATA;
if (tud_cdc_connected() && tud_cdc_available()) { if (tud_cdc_connected() && tud_cdc_available()) {
int count = tud_cdc_read(buf, length); int count = (int) tud_cdc_read(buf, (uint32_t) length);
rc = count ? count : PICO_ERROR_NO_DATA; rc = count ? count : PICO_ERROR_NO_DATA;
} }
mutex_exit(&stdio_usb_mutex); mutex_exit(&stdio_usb_mutex);

View File

@ -143,7 +143,7 @@ const uint16_t *tud_descriptor_string_cb(uint8_t index, __unused uint16_t langid
} }
// first byte is length (including header), second byte is string type // first byte is length (including header), second byte is string type
desc_str[0] = (TUSB_DESC_STRING << 8) | (2 * len + 2); desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8) | (2 * len + 2));
return desc_str; return desc_str;
} }

View File

@ -20,7 +20,8 @@ if (EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH})
pico_register_common_scope_var(PICO_TINYUSB_PATH) pico_register_common_scope_var(PICO_TINYUSB_PATH)
set(BOARD pico_sdk) set(BOARD pico_sdk)
include(${PICO_TINYUSB_PATH}/hw/bsp/rp2040/family.cmake) set(FAMILY rp2040)
include(${PICO_TINYUSB_PATH}/hw/bsp/family_support.cmake)
add_library(tinyusb_common INTERFACE) add_library(tinyusb_common INTERFACE)
target_link_libraries(tinyusb_common INTERFACE tinyusb_common_base) target_link_libraries(tinyusb_common INTERFACE tinyusb_common_base)

View File

@ -97,7 +97,8 @@ pico_set_program_name(kitchen_sink "Wombat tentacles")
pico_add_extra_outputs(kitchen_sink) pico_add_extra_outputs(kitchen_sink)
add_executable(kitchen_sink_extra_stdio) add_executable(kitchen_sink_extra_stdio)
target_link_libraries(kitchen_sink_extra_stdio kitchen_sink_libs) # no kitchen_sink_options as TinyUSB has warnings suppress_tinyusb_warnings() # suppress warnings explicitly in TinyUSB files which have them
target_link_libraries(kitchen_sink_extra_stdio kitchen_sink_libs kitchen_sink_options)
pico_add_extra_outputs(kitchen_sink_extra_stdio) pico_add_extra_outputs(kitchen_sink_extra_stdio)
pico_enable_stdio_usb(kitchen_sink_extra_stdio 1) pico_enable_stdio_usb(kitchen_sink_extra_stdio 1)
pico_enable_stdio_semihosting(kitchen_sink_extra_stdio 1) pico_enable_stdio_semihosting(kitchen_sink_extra_stdio 1)
@ -111,3 +112,4 @@ add_executable(kitchen_sink_no_flash)
pico_set_binary_type(kitchen_sink_no_flash no_flash) pico_set_binary_type(kitchen_sink_no_flash no_flash)
target_link_libraries(kitchen_sink_no_flash kitchen_sink_libs kitchen_sink_options) target_link_libraries(kitchen_sink_no_flash kitchen_sink_libs kitchen_sink_options)
pico_add_extra_outputs(kitchen_sink_no_flash) pico_add_extra_outputs(kitchen_sink_no_flash)