h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
672 stars 138 forks source link

how to reference Nimble-Arduino in a "Arduino as an ESP-IDF component" project? #565

Closed mhaberler closed 1 year ago

mhaberler commented 1 year ago

I have a Platformio project with an ESP32 using Arduino framework, and Nimble-Arduino

This is set up as a "esp-idf mit Arduino als component" as described here: https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/esp-idf_component.html

I include Nimble-Arduino in platformio.ini

when building, I get a significant number of "symbol redefined" warnings, like so:

In file included from .pio/libdeps/m5stack_coreS3/NimBLE-Arduino/src/NimBLEAddress.cpp:14:
.pio/libdeps/m5stack_coreS3/NimBLE-Arduino/src/nimconfig.h:234: warning: "CONFIG_BT_NIMBLE_ACL_BUF_COUNT" redefined
 #define CONFIG_BT_NIMBLE_ACL_BUF_COUNT 12

In file included from .pio/libdeps/m5stack_coreS3/NimBLE-Arduino/src/nimconfig.h:4,
                 from .pio/libdeps/m5stack_coreS3/NimBLE-Arduino/src/NimBLEAddress.cpp:14:
.pio/build/m5stack_coreS3/config/sdkconfig.h:132: note: this is the location of the previous definition
 #define CONFIG_BT_NIMBLE_ACL_BUF_COUNT 20

Compiling .pio/build/m5stack_coreS3/lib905/NimBLE-Arduino/NimBLEBeacon.cpp.o
In file included from .pio/libdeps/m5stack_coreS3/NimBLE-Arduino/src/NimBLEAdvertisedDevice.cpp:15:
.pio/libdeps/m5stack_coreS3/NimBLE-Arduino/src/nimconfig.h:154: warning: "CONFIG_BT_NIMBLE_ROLE_CENTRAL" redefined
 #define CONFIG_BT_NIMBLE_ROLE_CENTRAL

obviously these come from collisions between nimconfig.h and the sdkconfig.fragment

how should I deal with this?

ignore? adjust all options in sdkconfig.m5stack_coreS3 to match the values from nimconfig.h?

the full build log is here the esp-idf version is 4.4.5.230614

thanks in advance Michael

h2zero commented 1 year ago

I suggest using this instead: https://github.com/h2zero/esp-nimble-cpp

mhaberler commented 1 year ago

thanks, will do that and report - leaving open until then

mhaberler commented 1 year ago

added esp-nimble-cpp as git submodule under lib/ adjusted platformio.ini worked right away - thanks a lot!

-Michael reference: https://github.com/mhaberler/flowsensor/tree/main