Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macro redefinitions for ESP32S2 and ESP32S3 #484

Open
dhebbeker opened this issue Dec 26, 2024 · 0 comments
Open

macro redefinitions for ESP32S2 and ESP32S3 #484

dhebbeker opened this issue Dec 26, 2024 · 0 comments
Labels
Bug Something isn't working

Comments

@dhebbeker
Copy link

Operating System

Linux

Arduino IDE version

PIO PlatformIO Core, version 6.1.16

Board

esp32-s3-devkitc-1

ArduinoCore version

framework-arduinoespressif32 @ 3.20017.0 (2.0.17)

TinyUSB Library version

3.4.2

Sketch as ATTACHED TXT

main.cpp.txt

Compiled Log as ATTACHED TXT

compile.txt

What happened ?

Compiler warns about redefinitions of preprocessor macros. The definitions are conflicting. For example:

Compiling .pio/build/esp32-s3-devkitc-1/lib663/Adafruit TinyUSB Library/arduino/Adafruit_TinyUSB_API.cpp.o
In file included from .pio/libdeps/esp32-s3-devkitc-1/Adafruit TinyUSB Library/src/Adafruit_TinyUSB.h:30,
                 from .pio/libdeps/esp32-s3-devkitc-1/Adafruit TinyUSB Library/src/arduino/Adafruit_TinyUSB_API.cpp:29:
.pio/libdeps/esp32-s3-devkitc-1/Adafruit TinyUSB Library/src/arduino/ports/esp32/tusb_config_esp32.h:92: warning: "CFG_TUH_ENABLED" redefined
 #define CFG_TUH_ENABLED 1
 
In file included from .pio/libdeps/esp32-s3-devkitc-1/Adafruit TinyUSB Library/src/arduino/Adafruit_TinyUSB_API.cpp:25:
.pio/libdeps/esp32-s3-devkitc-1/Adafruit TinyUSB Library/src/tusb_option.h:318: note: this is the location of the previous definition
   #define CFG_TUH_ENABLED     (TUH_RHPORT_MODE & OPT_MODE_HOST)

See compiler log for all conflicts.


I analysed the code and noted:

  1. includes
  2. #include "arduino/ports/esp32/tusb_config_esp32.h"

But

  1. includes
  2. #include "tusb_config.h"
    includes
  3. #include "../../arduino_tinyusb/include/tusb_config.h"
    on the following conditions:
    #elif defined(ARDUINO_ARCH_ESP32)
    // Note: when compiling core Arduino IDEs will include tusb_config.h in the BSP
    // sdk/include/arduino_tinyusb/include. While compiling .c file in this library this
    // file will be used instead. For consistency: include the one in BSP here as well
    #include "sdkconfig.h"
    #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
      #include "../../arduino_tinyusb/include/tusb_config.h"
    #else
      #include "arduino/ports/esp32/tusb_config_esp32.h"
    #endif

In summary:

If both would include the same header, there wouldn't be the conflicts.

How to reproduce ?

Using PlatformIO, build the above "sketch", or use this MVP: https://github.com/Task-Tracker-Systems/Task-Tracker-Device/tree/ec83e905c7b1b328fd92ee1322906067698a20e0

Debug Log

No response

Screenshots

No response

@dhebbeker dhebbeker added the Bug Something isn't working label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant