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
8 changed files with 16 additions and 13 deletions

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 (
"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) {
for (uint i = 0; i <length; i++) {
for (int i = 0; i < length; 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
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
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()) {
for (int i = 0; i < length;) {
int n = length - i;
int avail = tud_cdc_write_available();
int avail = (int) tud_cdc_write_available();
if (n > avail) n = avail;
if (n) {
int n2 = tud_cdc_write(buf + i, n);
int n2 = (int) tud_cdc_write(buf + i, (uint32_t)n);
tud_task();
tud_cdc_write_flush();
i += n2;
@ -73,7 +73,7 @@ int stdio_usb_in_chars(char *buf, int length) {
}
int rc = PICO_ERROR_NO_DATA;
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;
}
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
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;
}

View File

@ -20,7 +20,8 @@ if (EXISTS ${PICO_TINYUSB_PATH}/${TINYUSB_TEST_PATH})
pico_register_common_scope_var(PICO_TINYUSB_PATH)
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)
target_link_libraries(tinyusb_common INTERFACE tinyusb_common_base)