adafruit / Adafruit_TinyUSB_Arduino

Arduino library for TinyUSB
MIT License
486 stars 129 forks source link

ESP32-S2: Compilation error in Arduino core 2.0.5 #232

Closed FedericoBusero closed 1 year ago

FedericoBusero commented 1 year ago

Operating System

Windows 10

Arduino IDE version

1.18.19

Board

Lolin S2 Mini (ESP32-S2)

ArduinoCore version

2.0.5

TinyUSB Library version

1.17.0

Sketch (attached txt file)

examples/msc_external_flash

What happened ?

The example file msc_external_flash no longer compiles in TinyUSB version 1.17.0 and the github version. It did compile and run perfectly in TinyUSB version 1.16.0.

When compiling using ESP32 Arduino core version 2.0.6, the example file compiles correctly using tinyusb version 1.17.0 and tinyusb version 1.16.0.

Is it possible to make the TinyUSB library compatible again with Arduino core version 2.0.5 (possibly using some ifdef's checking the IDF version), for backward compatibility?

How to reproduce ?

  1. Compile the example file msc_external_flash

Debug Log

....\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:65:3: error: expected specifier-qualifier-list before 'OSAL_MUTEX_DEF' OSAL_MUTEX_DEF(rx_ff_mutex); ^~~~~~ In file included from ....\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_common.h:72, from ....\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h:30, from ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:31: ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c: In function '_prep_out_transaction': ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:90:38: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epout_buf' TU_VERIFY(available >= sizeof(p_cdc->epout_buf)); ^~ ....\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_verify.h:111:10: note: in definition of macro 'TU_VERIFY_DEFINE' if ( !(_cond) ) { _handler; return _ret; } \ ^~~~~ ....\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_verify.h:105:52: note: in expansion of macro 'TU_VERIFY_1ARGS'

define _GET_3RD_ARG(arg1, arg2, arg3, ...) arg3

                                                ^~~~

....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:90:3: note: in expansion of macro 'TU_VERIFY' TU_VERIFY(available >= sizeof(p_cdc->epout_buf)); ^~~~~ ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:98:33: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epout_buf' if ( available >= sizeof(p_cdc->epout_buf) ) ^~ ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:100:55: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epout_buf' return usbd_edpt_xfer(rhport, p_cdc->ep_out, p_cdc->epout_buf, sizeof(p_cdc->epout_buf)); ^~ ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:100:80: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epout_buf' return usbd_edpt_xfer(rhport, p_cdc->ep_out, p_cdc->epout_buf, sizeof(p_cdc->epout_buf)); ^~ ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c: In function 'tud_cdc_n_write_flush': ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:197:63: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epin_buf'; did you mean 'ep_notif'? uint16_t const count = tu_fifo_read_n(&p_cdc->tx_ff, p_cdc->epin_buf, sizeof(p_cdc->epin_buf)); ^~~~ ep_notif C:\Data\PortableApps\arduino-1.8.19\portable\sketchbook\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:197:87: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epin_buf'; did you mean 'ep_notif'? uint16_t const count = tu_fifo_read_n(&p_cdc->tx_ff, p_cdc->epin_buf, sizeof(p_cdc->epin_buf)); ^~~~ ep_notif In file included from ....\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_common.h:72, from ....\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/device/usbd.h:30, from ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:31: ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:201:60: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epin_buf'; did you mean 'ep_notif'? TU_ASSERT( usbd_edpt_xfer(rhport, p_cdc->ep_in, p_cdc->epin_buf, count), 0 ); ^~~~ ....\packages\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_verify.h:111:10: note: in definition of macro 'TU_VERIFY_DEFINE' if ( !(_cond) ) { _handler; return _ret; } \ ^~~~~ ....\esp32\hardware\esp32\2.0.5/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_verify.h:105:52: note: in expansion of macro 'ASSERT_2ARGS'

define _GET_3RD_ARG(arg1, arg2, arg3, ...) arg3

                                                ^~~~

....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:201:5: note: in expansion of macro 'TU_ASSERT' TU_ASSERT( usbd_edpt_xfer(rhport, p_cdc->ep_in, p_cdc->epin_buf, count), 0 ); ^~~~~ ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c: In function 'cdcd_init': ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:249:73: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'rx_ff_mutex'; did you mean 'rx_ff_buf'? tu_fifo_config_mutex(&p_cdc->rx_ff, NULL, osal_mutex_create(&p_cdc->rx_ff_mutex)); ^~~ rx_ff_buf ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:250:67: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'tx_ff_mutex'; did you mean 'tx_ff_buf'? tu_fifo_config_mutex(&p_cdc->tx_ff, osal_mutex_create(&p_cdc->tx_ff_mutex), NULL); ^~~ tx_ff_buf ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c: In function 'cdcd_xfer_cb': ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:435:41: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epout_buf' tu_fifo_write_n(&p_cdc->rx_ff, p_cdc->epout_buf, (uint16_t) xferred_bytes); ^~ ....\libraries\Adafruit_TinyUSB_Arduino-master\src\class\cdc\cdc_device.c:442:42: error: 'cdcd_interface_t' {aka 'struct '} has no member named 'epout_buf' if ( (p_cdc->wanted_char == p_cdc->epout_buf[i]) && !tu_fifo_empty(&p_cdc->rx_ff) ) ^~ exit status 1 Fout bij het compileren voor board LOLIN S2 Mini

Screenshots

No response

hathach commented 1 year ago

Short answer is no, please use older version of this lib with older core. However if you have a convincing reason, we may consider it