ShellAddicted / BNO055ESP32

C++ Interface for the Bosch-Sensortec's BNO055 compatible with Espressif's ESP32 SoC running esp-idf.
MIT License
24 stars 9 forks source link

Is this working with ESP-IDF v5.1 #11

Closed dj-fiorex closed 1 year ago

dj-fiorex commented 1 year ago

Hello, first of all thanks for this repo, i want to ask you if you tried to build an example with the latest version of ESP-IDF (v5.1) because i have some weird errors: 1) First of all i needed to add REQUIRES driver to CMakeLists.txt of the library, because ESP-IDF doesn't include driver by default anymore 2) This is the error log during build:

[862/879] Building C object esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.objFAILED: esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.obj
ccache C:\Users\carme\.espressif\tools\xtensa-esp32-elf\esp-2022r1-11.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-3196-g732df630cd\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/build/config -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/model/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/open62541lib/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/newlib/platform_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include/freertos -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/. -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/private_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/heap/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/log/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/platform_port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_common/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/include/private -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps/sntp -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/lwip/src/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/freertos/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include/arch -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/deprecated -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_pm/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_ringbuf/include -mlongcalls -Wno-frame-address  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno=. -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -Wno-error=format= -Wno-format -MD -MT esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.obj -MF esp-idf\model\CMakeFiles\__idf_model.dir\BNO055.c.obj.d -o esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.obj -c C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/model/BNO055.c
In file included from C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/model/BNO055.c:2
:
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include/BNO055ESP32.h:33:10: fatal error: cstring: No such file or directory
   33 | #include <cstring>  //memset, memcpy
      |          ^~~~~~~~~
compilation terminated.
[865/879] Building CXX object esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.objFAILED: esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.obj
ccache C:\Users\carme\.espressif\tools\xtensa-esp32-elf\esp-2022r1-11.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-3196-g732df630cd\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/build/config -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/newlib/platform_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include/freertos -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/. -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/private_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/heap/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/log/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/platform_port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_common/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/include/private -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps/sntp -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/lwip/src/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/freertos/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include/arch -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/deprecated -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_pm/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_ringbuf/include -mlongcalls -Wno-frame-address  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno=. -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu++20 -fno-exceptions -fno-rtti -MD -MT esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.obj -MF esp-idf\BNO055ESP32\CMakeFiles\__idf_BNO055ESP32.dir\BNO055ESP32.cpp.obj.d -o esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.obj -c C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp
In file included from C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:29:
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include/BNO055ESP32.h:666:61: error: 'const uart_config_t' has no non-static data member named 'use_ref_tick'
  666 |                                        .use_ref_tick = false};
      |                                                             ^
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::i2c_readLen(uint8_t, uint8_t*, uint8_t, uint32_t)':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:101:45: error: exception handling disabled, use '-fexceptions' to enable
  101 |     if (err != ESP_OK) throw BNO055I2CError();
      |                                             ^
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::uart_readLen(bno055_reg_t, uint8_t*, uint8_t, uint32_t)':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:173:79: error: 'portTICK_RATE_MS' was not declared in this scope; did you mean 'portTICK_PERIOD_MS'?
  173 |             rxBytes = uart_read_bytes(_uartPort, data, (len + 2), timeoutMS / portTICK_RATE_MS);
      |                                                                               ^~~~~~~~~~~~~~~~
      |                                                                               portTICK_PERIOD_MS
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::uart_writeLen(bno055_reg_t, uint8_t*, uint8_t, uint32_t)':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:234:71: error: 'portTICK_RATE_MS' was not declared in this scope; did you mean 'portTICK_PERIOD_MS'?
  234 |             rxBytes = uart_read_bytes(_uartPort, data, 2, timeoutMS / portTICK_RATE_MS);
      |                                                                       ^~~~~~~~~~~~~~~~
      |                                                                       portTICK_PERIOD_MS
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::reset()':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:409:9: error: 'gpio_pad_select_gpio' was not declared in this scope; did you mean 'esp_rom_gpio_pad_select_gpio'?
  409 |         gpio_pad_select_gpio(_rstPin);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         esp_rom_gpio_pad_select_gpio
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::begin()':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:793:9: error: 'gpio_pad_select_gpio' was not declared in this scope; did you mean 'esp_rom_gpio_pad_select_gpio'?
  793 |         gpio_pad_select_gpio(_intPin);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         esp_rom_gpio_pad_select_gpio
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::stop()':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:814:7: error: '...' handler must be the last handler for its try block [-fpermissive]
  814 |     } catch (BNO055BaseException &exc) {
      |       ^~~~~

Did you have some ideas? Thanks a lot!

ShellAddicted commented 1 year ago

Hello, I will wait for v5.1 to be actually released before making any adjustment.

Meanwhile you can try to:

Right now I don't have a BNO055 on hand to run the code, but with this changes the examples/example.cpp does compile against latest docker esp-idf image

GLHF