ESP32 crashes when listening_message_reliably
ESP32 crashes when listening_message_reliably
- Hardware description: ESP32 serially linked to a nRF5340DK (using UART1 on pins 19/18 as TX/RX)
- RTOS: FreeRTOS
- Installation type: micro_ros_espidf_component, ESP IDF v4.4
- Version or commit hash: humble
Steps to reproduce the issue
My project consist on controlling a BT Mesh provisioner via ROS, and transmitting sensors data from the Mesh network to ROS. The ESP32 serves as a message bridge between the provisioner and ROS. For that I've got 4 threads running :
- the uROS thread (priority 5, stack 16000 bytes) with 2 subs and 2 pubs
- an "uart_phy" thread (priority 6, stack 4096 bytes) which job is to read data from UART1 and sends it to uart_mac_rx with a message queue
- 2 "uart_mac_rx" and "uart_mac_tx" threads (priority 6, stack 4096 bytes). uart_mac_rx gets data from uart_phy and publishes message to ROS. uart_mac_tx receives messages from the subscribers callbacks and transmits data to UART1
The nRF5340 scans for unprovisioned ("unconnected") mesh nodes, and sends the UUIDs to the ESP32 via serial. So the ESP32 receives a 16 bytes UUID from UART, the uart_phy sends this UUID to uart_mac_rx through a message queue. uart_mac_rx wakes up because something is in the queue, sees that it is an UUID, and publish it with my "unprov_pub". The ROS message is the following : ble2ros_interfaces/msg/Beacon.msg
# Represent an unprovisioned beacon from BT Mesh
uint8[16] uuid
Expected behavior
UUIDs are sent to ROS without error
Actual behavior
Sometimes, mostly when the ESP32 receives a lot of UUID's to transmit to ROS, i got the following error :
assert failed: pbuf_free IDF/components/lwip/lwip/src/core/pbuf.c:757 (pbuf_free: p->ref > 0)
OR
assert failed: tlsf_free heap_tlsf.c:872 (!block_is_free(block) && "block already marked as free")
but mostly the pbuf_free assert failed. The most frequent stack backtrace is the following :
assert failed: pbuf_free IDF/components/lwip/lwip/src/core/pbuf.c:757 (pbuf_free: p->ref > 0)
Backtrace:0x40081ade:0x3ffd0a700x400891bd:0x3ffd0a90 0x4008fd5d:0x3ffd0ab0 0x400f3de7:0x3ffd0bd0 0x401057c1:0x3ffd0bf0 0x400f03ef:0x3ffd0c10 0x400f0ff2:0x3ffd0c50 0x400f1072:0x3ffd0cb0 0x400de19d:0x3ffd0cd0 0x400ddfad:0x3ffd0d00 0x400dd2fc:0x3ffd0d30 0x400dd488:0x3ffd0dd0 0x400e2836:0x3ffd0df0 0x400e0e4b:0x3ffd0e40 0x400da51d:0x3ffd0eb0 0x400da563:0x3ffd0ef0 0x400d6e6c:0x3ffd0f10 0x400d6e7e:0x3ffd0f30 0x4008c37d:0x3ffd0f50
0x40081ade: panic_abort at /home/samy/esp/esp-idf/components/esp_system/panic.c:402
0x400891bd: esp_system_abort at /home/samy/esp/esp-idf/components/esp_system/esp_system.c:128
0x4008fd5d: __assert_func at /home/samy/esp/esp-idf/components/newlib/assert.c:85
0x400f3de7: pbuf_free at /home/samy/esp/esp-idf/components/lwip/lwip/src/core/pbuf.c:757 (discriminator 1)
0x401057c1: netbuf_delete at /home/samy/esp/esp-idf/components/lwip/lwip/src/api/netbuf.c:85
0x400f03ef: lwip_recvfrom_udp_raw at /home/samy/esp/esp-idf/components/lwip/lwip/src/api/sockets.c:1250
0x400f0ff2: lwip_recvfrom at /home/samy/esp/esp-idf/components/lwip/lwip/src/api/sockets.c:1292 (discriminator 4)
0x400f1072: lwip_recv at /home/samy/esp/esp-idf/components/lwip/lwip/src/api/sockets.c:1337
0x400de19d: uxr_read_udp_data_platform at ??:?
0x400ddfad: recv_udp_msg at udp_transport.c:?
0x400dd2fc: listen_message_reliably at session.c:?
0x400dd488: uxr_run_session_until_data at ??:?
0x400e2836: rmw_wait at ??:?
0x400e0e4b: rcl_wait at ??:?
0x400da51d: rclc_executor_spin_some$part$5 at executor.c:?
0x400da563: rclc_executor_spin_some at ??:?
0x400d6e6c: spin_uros at /home/samy/work/ble2ros/firmware/uros_node/main/uros/uros.c:119 (discriminator 1)
0x400d6e7e: uros_task at /home/samy/work/ble2ros/firmware/uros_node/main/uros/uros.c:126
0x4008c37d: vPortTaskWrapper at /home/samy/esp/esp-idf/components/freertos/port/xtensa/port.c:131
Additional information
I also had other configuration with at most 4 pubs and 4 subs, and this problem can occur with any publisher. I went back to 2 pubs and 2 subs to get back to the basic uROS config (also resetted the max pub/sub in colcon.meta)
I looked if the heap became corrupted at some point, but it was always clean.
When disabling asserts, it stills crash with Guru meditation error: Core 0 panic'ed
I tried lowering priorities, (12 for UART, 11 for uROS), switching priorities (4 for UART, 5 for uROS), still got the same problem.
Looked over the internet for solutions, looked in this repo's issues, found nothing...
Looked if I had memory leaks, but found none
What are the differences between the uROS thread and "uart_mac_rx" and "uart_mac_tx" threads? Are you calling the micro-ROS API from two different threads? Have you enabled the multithread operation of the middleware?
In any case, a corruption like this sounds to me like a stack overflow. Have you tried to increase stack sizes of each task?
Here is a quick diagram showing how to program is composed :

Every subs run with the uros_thread executor, their callback functions sends a message to the txQueue. uart_mac_rx receives messages from the uart_phy thread and calls the rcl_publish, so yeah it uses the micro-ROS API.
I already tried increasing stacks, but maybe not enough. I'll try both propositions
Ok, please provide feedback. And enable the multithread flag because if not, all the stack layers are not thread safe!
When I turn ON the UCLIENT_PROFILE_MULTITHREAD in the CMakeLists.txt of Micro-XRCE-DDS-Client, it doesn't change the build, and when I do a clean build, it reverts back to OFF. Am I missing something ?
You need to use the colcon.meta file in order to confgure the micro-ROS stack.
I have added the line "-DUCLIENT_PROFILE_MULTITHREAD=ON" in microxrcedds_client/cmake-args in colcon.meta, but it stays off in the CMakeLists.txt
Just check that is enabled in the generated config.h inside Micro XRCE-DDS Client include folder
Just a moment, my build keeps crashing (doesn't find <rcl/rcl.h> and micro-ros doesn't want to clean)
When I set the line in colcon.meta, the build keeps crashing
Clean your environment
Already done, clean, fullclean, clean-microros, removed the microROS component and resetted it
Provide more info about this crash
build failed with doesn't find <rcl/rcl.h> rebuilding right now to provide you the log
Finished <<< ament_index_cpp [5.25s]
Summary: 60 packages finished [1min 15s]
58 packages had stderr output: ament_clang_format ament_clang_tidy ament_cmake ament_cmake_auto ament_cmake_clang_format ament_cmake_clang_tidy ament_cmake_copyright ament_cmake_core ament_cmake_cppcheck ament_cmake_cpplint ament_cmake_export_definitions ament_cmake_export_dependencies ament_cmake_export_include_directories ament_cmake_export_interfaces ament_cmake_export_libraries ament_cmake_export_link_flags ament_cmake_export_targets ament_cmake_flake8 ament_cmake_gmock ament_cmake_google_benchmark ament_cmake_gtest ament_cmake_include_directories ament_cmake_libraries ament_cmake_lint_cmake ament_cmake_mypy ament_cmake_nose ament_cmake_pclint ament_cmake_pep257 ament_cmake_pycodestyle ament_cmake_pyflakes ament_cmake_pytest ament_cmake_python ament_cmake_ros ament_cmake_target_dependencies ament_cmake_test ament_cmake_uncrustify ament_cmake_version ament_cmake_xmllint ament_copyright ament_cppcheck ament_cpplint ament_flake8 ament_index_python ament_lint ament_lint_auto ament_lint_cmake ament_lint_common ament_mypy ament_package ament_pclint ament_pep257 ament_pycodestyle ament_pyflakes ament_uncrustify ament_xmllint domain_coordinator gmock_vendor gtest_vendor
cd /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src; \
unset AMENT_PREFIX_PATH; \
PATH="/home/samy/esp/esp-idf/components/esptool_py/esptool:/home/samy/esp/esp-idf/components/espcoredump:/home/samy/esp/esp-idf/components/partition_table:/home/samy/esp/esp-idf/components/app_update:/home/samy/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin:/home/samy/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/home/samy/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/bin:/home/samy/.espressif/python_env/idf4.4_py3.10_env/bin:/home/samy/esp/esp-idf/tools::/home/samy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"; \
. ../micro_ros_dev/install/local_setup.sh; \
colcon build \
--merge-install \
--packages-ignore-regex=.*_cpp \
--metas /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/colcon.meta \
--cmake-args \
"--no-warn-unused-cli" \
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=OFF \
-DTHIRDPARTY=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/esp32_toolchain.cmake \
-DCMAKE_VERBOSE_MAKEFILE=OFF; \
Starting >>> rcutils
Starting >>> rosidl_cli
Starting >>> rosidl_typesupport_interface
Starting >>> microcdr
Finished <<< rosidl_typesupport_interface [6.60s]
Starting >>> rmw_implementation_cmake
Finished <<< microcdr [10.3s]
Starting >>> microxrcedds_client
--- stderr: rosidl_cli
/home/samy/.espressif/python_env/idf4.4_py3.10_env/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
---Finished <<< rosidl_cli [11.5s]
Starting >>> rosidl_adapter
Finished <<< rmw_implementation_cmake [7.06s]
Starting >>> tracetools
--- stderr: microxrcedds_client
In file included from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/output_best_effort_stream.h:27,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/output_best_effort_stream_internal.h:23,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/output_best_effort_stream.c:1:
/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/profile/multithread/multithread.h:33:10: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^~~~~~~~~~~~
compilation terminated.
In file included from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/input_best_effort_stream.h:27,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/input_best_effort_stream_internal.h:23,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/input_best_effort_stream.c:1:
/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/profile/multithread/multithread.h:33:10: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^~~~~~~~~~~~
compilation terminated.
gmake[3]: *** [CMakeFiles/microxrcedds_client.dir/build.make:104 : CMakeFiles/microxrcedds_client.dir/src/c/core/session/stream/output_best_effort_stream.c.obj] Erreur 1
gmake[3]: *** Attente des tâches non terminées....
gmake[3]: *** [CMakeFiles/microxrcedds_client.dir/build.make:76 : CMakeFiles/microxrcedds_client.dir/src/c/core/session/stream/input_best_effort_stream.c.obj] Erreur 1
In file included from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/output_best_effort_stream.h:27,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/stream_storage.h:23,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/session.h:29,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/session.c:1:
/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/profile/multithread/multithread.h:33:10: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^~~~~~~~~~~~
compilation terminated.
gmake[3]: *** [CMakeFiles/microxrcedds_client.dir/build.make:174 : CMakeFiles/microxrcedds_client.dir/src/c/core/session/session.c.obj] Erreur 1
In file included from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/output_best_effort_stream.h:27,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/stream_storage.h:23,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/stream_storage_internal.h:23,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/stream_storage.c:1:
/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/profile/multithread/multithread.h:33:10: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^~~~~~~~~~~~
compilation terminated.
gmake[3]: *** [CMakeFiles/microxrcedds_client.dir/build.make:132 : CMakeFiles/microxrcedds_client.dir/src/c/core/session/stream/stream_storage.c.obj] Erreur 1
In file included from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/input_reliable_stream.h:28,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/./input_reliable_stream_internal.h:23,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/input_reliable_stream.c:4:
/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/profile/multithread/multithread.h:33:10: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^~~~~~~~~~~~
compilation terminated.
gmake[3]: *** [CMakeFiles/microxrcedds_client.dir/build.make:90 : CMakeFiles/microxrcedds_client.dir/src/c/core/session/stream/input_reliable_stream.c.obj] Erreur 1
In file included from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/stream/output_reliable_stream.h:28,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/output_reliable_stream_internal.h:23,
from /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/src/c/core/session/stream/output_reliable_stream.c:1:
/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/src/Micro-XRCE-DDS-Client/include/uxr/client/profile/multithread/multithread.h:33:10: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^~~~~~~~~~~~
compilation terminated.
gmake[3]: *** [CMakeFiles/microxrcedds_client.dir/build.make:118 : CMakeFiles/microxrcedds_client.dir/src/c/core/session/stream/output_reliable_stream.c.obj] Erreur 1
gmake[2]: *** [CMakeFiles/Makefile2:83 : CMakeFiles/microxrcedds_client.dir/all] Erreur 2
gmake[1]: *** [Makefile:136 : all] Erreur 2
---
Failed <<< microxrcedds_client [4.42s, exited with code 2]
Aborted <<< rcutils [15.2s]
Aborted <<< rosidl_adapter [4.46s]
Aborted <<< tracetools [3.87s]
Summary: 4 packages finished [19.2s]
1 package failed: microxrcedds_client
3 packages aborted: rcutils rosidl_adapter tracetools
3 packages had stderr output: microxrcedds_client rcutils rosidl_cli
58 packages not processed
make: *** [libmicroros.mk:87 : /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/micro_ros_src/install] Erreur 2
-- Components: app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_ipc esp_lcd esp_local_ctrl esp_netif esp_phy esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos hal heap idf_test ieee802154 jsmn json libsodium log lwip main mbedtls mdns mqtt newlib nghttp nvs_flash openssl openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb ulp unity uros_component usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /home/samy/esp/esp-idf/components/app_trace /home/samy/esp/esp-idf/components/app_update /home/samy/esp/esp-idf/components/asio /home/samy/esp/esp-idf/components/bootloader /home/samy/esp/esp-idf/components/bootloader_support /home/samy/esp/esp-idf/components/bt /home/samy/esp/esp-idf/components/cbor /home/samy/esp/esp-idf/components/cmock /home/samy/esp/esp-idf/components/coap /home/samy/esp/esp-idf/components/console /home/samy/esp/esp-idf/components/cxx /home/samy/esp/esp-idf/components/driver /home/samy/esp/esp-idf/components/efuse /home/samy/esp/esp-idf/components/esp-tls /home/samy/esp/esp-idf/components/esp32 /home/samy/esp/esp-idf/components/esp_adc_cal /home/samy/esp/esp-idf/components/esp_common /home/samy/esp/esp-idf/components/esp_eth /home/samy/esp/esp-idf/components/esp_event /home/samy/esp/esp-idf/components/esp_gdbstub /home/samy/esp/esp-idf/components/esp_hid /home/samy/esp/esp-idf/components/esp_http_client /home/samy/esp/esp-idf/components/esp_http_server /home/samy/esp/esp-idf/components/esp_https_ota /home/samy/esp/esp-idf/components/esp_https_server /home/samy/esp/esp-idf/components/esp_hw_support /home/samy/esp/esp-idf/components/esp_ipc /home/samy/esp/esp-idf/components/esp_lcd /home/samy/esp/esp-idf/components/esp_local_ctrl /home/samy/esp/esp-idf/components/esp_netif /home/samy/esp/esp-idf/components/esp_phy /home/samy/esp/esp-idf/components/esp_pm /home/samy/esp/esp-idf/components/esp_ringbuf /home/samy/esp/esp-idf/components/esp_rom /home/samy/esp/esp-idf/components/esp_serial_slave_link /home/samy/esp/esp-idf/components/esp_system /home/samy/esp/esp-idf/components/esp_timer /home/samy/esp/esp-idf/components/esp_websocket_client /home/samy/esp/esp-idf/components/esp_wifi /home/samy/esp/esp-idf/components/espcoredump /home/samy/esp/esp-idf/components/esptool_py /home/samy/esp/esp-idf/components/expat /home/samy/esp/esp-idf/components/fatfs /home/samy/esp/esp-idf/components/freemodbus /home/samy/esp/esp-idf/components/freertos /home/samy/esp/esp-idf/components/hal /home/samy/esp/esp-idf/components/heap /home/samy/esp/esp-idf/components/idf_test /home/samy/esp/esp-idf/components/ieee802154 /home/samy/esp/esp-idf/components/jsmn /home/samy/esp/esp-idf/components/json /home/samy/esp/esp-idf/components/libsodium /home/samy/esp/esp-idf/components/log /home/samy/esp/esp-idf/components/lwip /home/samy/work/ble2ros/firmware/uros_node/main /home/samy/esp/esp-idf/components/mbedtls /home/samy/esp/esp-idf/components/mdns /home/samy/esp/esp-idf/components/mqtt /home/samy/esp/esp-idf/components/newlib /home/samy/esp/esp-idf/components/nghttp /home/samy/esp/esp-idf/components/nvs_flash /home/samy/esp/esp-idf/components/openssl /home/samy/esp/esp-idf/components/openthread /home/samy/esp/esp-idf/components/partition_table /home/samy/esp/esp-idf/components/perfmon /home/samy/esp/esp-idf/components/protobuf-c /home/samy/esp/esp-idf/components/protocomm /home/samy/esp/esp-idf/components/pthread /home/samy/esp/esp-idf/components/sdmmc /home/samy/esp/esp-idf/components/soc /home/samy/esp/esp-idf/components/spi_flash /home/samy/esp/esp-idf/components/spiffs /home/samy/esp/esp-idf/components/tcp_transport /home/samy/esp/esp-idf/components/tcpip_adapter /home/samy/esp/esp-idf/components/tinyusb /home/samy/esp/esp-idf/components/ulp /home/samy/esp/esp-idf/components/unity /home/samy/work/ble2ros/firmware/uros_node/components/uros_component /home/samy/esp/esp-idf/components/usb /home/samy/esp/esp-idf/components/vfs /home/samy/esp/esp-idf/components/wear_levelling /home/samy/esp/esp-idf/components/wifi_provisioning /home/samy/esp/esp-idf/components/wpa_supplicant /home/samy/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/samy/work/ble2ros/firmware/uros_node/build
[0/2] Re-checking globbed directories...
[10/1045] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************
[196/1045] Performing configure step for 'bootloader'
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/samy/work/ble2ros/firmware/uros_node/sdkconfig
-- Adding linker script /home/samy/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Adding linker script /home/samy/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/samy/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/samy/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/samy/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/samy/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/samy/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /home/samy/esp/esp-idf/components/bootloader /home/samy/esp/esp-idf/components/bootloader_support /home/samy/esp/esp-idf/components/efuse /home/samy/esp/esp-idf/components/esp32 /home/samy/esp/esp-idf/components/esp_common /home/samy/esp/esp-idf/components/esp_hw_support /home/samy/esp/esp-idf/components/esp_rom /home/samy/esp/esp-idf/components/esp_system /home/samy/esp/esp-idf/components/esptool_py /home/samy/esp/esp-idf/components/freertos /home/samy/esp/esp-idf/components/hal /home/samy/esp/esp-idf/components/log /home/samy/esp/esp-idf/components/bootloader/subproject/main /home/samy/esp/esp-idf/components/bootloader/subproject/components/micro-ecc /home/samy/esp/esp-idf/components/newlib /home/samy/esp/esp-idf/components/partition_table /home/samy/esp/esp-idf/components/soc /home/samy/esp/esp-idf/components/spi_flash /home/samy/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/samy/work/ble2ros/firmware/uros_node/build/bootloader
[213/1045] Performing build step for 'bootloader'
[1/3] Linking C executable bootloader.elf
[2/3] Generating binary image from built executable
esptool.py v3.3-dev
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generated /home/samy/work/ble2ros/firmware/uros_node/build/bootloader/bootloader.bin
[3/3] cd /home/samy/work/ble2ros/firmware/uros_node/build/bootloader/esp-idf/esptool_py && /home/samy/.espressif/python_env/idf4.4_py3.10_env/bin/python /home/samy/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/samy/work/ble2ros/firmware/uros_node/build/bootloader/bootloader.bin
Bootloader binary size 0x62c0 bytes. 0xd40 bytes (12%) free.
[1018/1045] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
/home/samy/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -I/home/samy/work/ble2ros/firmware/uros_node/build/config -I/home/samy/work/ble2ros/firmware/uros_node/main -I/home/samy/esp/esp-idf/components/newlib/platform_include -I/home/samy/esp/esp-idf/components/freertos/include -I/home/samy/esp/esp-idf/components/freertos/include/esp_additions/freertos -I/home/samy/esp/esp-idf/components/freertos/port/xtensa/include -I/home/samy/esp/esp-idf/components/freertos/include/esp_additions -I/home/samy/esp/esp-idf/components/esp_hw_support/include -I/home/samy/esp/esp-idf/components/esp_hw_support/include/soc -I/home/samy/esp/esp-idf/components/esp_hw_support/include/soc/esp32 -I/home/samy/esp/esp-idf/components/esp_hw_support/port/esp32/. -I/home/samy/esp/esp-idf/components/esp_hw_support/port/esp32/private_include -I/home/samy/esp/esp-idf/components/heap/include -I/home/samy/esp/esp-idf/components/log/include -I/home/samy/esp/esp-idf/components/lwip/include/apps -I/home/samy/esp/esp-idf/components/lwip/include/apps/sntp -I/home/samy/esp/esp-idf/components/lwip/lwip/src/include -I/home/samy/esp/esp-idf/components/lwip/port/esp32/include -I/home/samy/esp/esp-idf/components/lwip/port/esp32/include/arch -I/home/samy/esp/esp-idf/components/soc/include -I/home/samy/esp/esp-idf/components/soc/esp32/. -I/home/samy/esp/esp-idf/components/soc/esp32/include -I/home/samy/esp/esp-idf/components/hal/esp32/include -I/home/samy/esp/esp-idf/components/hal/include -I/home/samy/esp/esp-idf/components/hal/platform_port/include -I/home/samy/esp/esp-idf/components/esp_rom/include -I/home/samy/esp/esp-idf/components/esp_rom/include/esp32 -I/home/samy/esp/esp-idf/components/esp_rom/esp32 -I/home/samy/esp/esp-idf/components/esp_common/include -I/home/samy/esp/esp-idf/components/esp_system/include -I/home/samy/esp/esp-idf/components/esp_system/port/soc -I/home/samy/esp/esp-idf/components/esp_system/port/public_compat -I/home/samy/esp/esp-idf/components/esp32/include -I/home/samy/esp/esp-idf/components/xtensa/include -I/home/samy/esp/esp-idf/components/xtensa/esp32/include -I/home/samy/esp/esp-idf/components/driver/include -I/home/samy/esp/esp-idf/components/driver/esp32/include -I/home/samy/esp/esp-idf/components/esp_pm/include -I/home/samy/esp/esp-idf/components/esp_ringbuf/include -I/home/samy/esp/esp-idf/components/efuse/include -I/home/samy/esp/esp-idf/components/efuse/esp32/include -I/home/samy/esp/esp-idf/components/vfs/include -I/home/samy/esp/esp-idf/components/esp_wifi/include -I/home/samy/esp/esp-idf/components/esp_event/include -I/home/samy/esp/esp-idf/components/esp_netif/include -I/home/samy/esp/esp-idf/components/esp_eth/include -I/home/samy/esp/esp-idf/components/tcpip_adapter/include -I/home/samy/esp/esp-idf/components/esp_phy/include -I/home/samy/esp/esp-idf/components/esp_phy/esp32/include -I/home/samy/esp/esp-idf/components/esp_ipc/include -I/home/samy/esp/esp-idf/components/app_trace/include -I/home/samy/esp/esp-idf/components/esp_timer/include -I/home/samy/esp/esp-idf/components/mbedtls/port/include -I/home/samy/esp/esp-idf/components/mbedtls/mbedtls/include -I/home/samy/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/home/samy/esp/esp-idf/components/app_update/include -I/home/samy/esp/esp-idf/components/spi_flash/include -I/home/samy/esp/esp-idf/components/bootloader_support/include -I/home/samy/esp/esp-idf/components/nvs_flash/include -I/home/samy/esp/esp-idf/components/pthread/include -I/home/samy/esp/esp-idf/components/esp_gdbstub/include -I/home/samy/esp/esp-idf/components/esp_gdbstub/xtensa -I/home/samy/esp/esp-idf/components/esp_gdbstub/esp32 -I/home/samy/esp/esp-idf/components/espcoredump/include -I/home/samy/esp/esp-idf/components/espcoredump/include/port/xtensa -I/home/samy/esp/esp-idf/components/wpa_supplicant/include -I/home/samy/esp/esp-idf/components/wpa_supplicant/port/include -I/home/samy/esp/esp-idf/components/wpa_supplicant/esp_supplicant/include -I/home/samy/esp/esp-idf/components/ieee802154/include -I/home/samy/esp/esp-idf/components/console -I/home/samy/esp/esp-idf/components/asio/asio/asio/include -I/home/samy/esp/esp-idf/components/asio/port/include -I/home/samy/esp/esp-idf/components/cbor/port/include -I/home/samy/esp/esp-idf/components/unity/include -I/home/samy/esp/esp-idf/components/unity/unity/src -I/home/samy/esp/esp-idf/components/cmock/CMock/src -I/home/samy/esp/esp-idf/components/coap/port/include -I/home/samy/esp/esp-idf/components/coap/libcoap/include -I/home/samy/esp/esp-idf/components/nghttp/port/include -I/home/samy/esp/esp-idf/components/nghttp/nghttp2/lib/includes -I/home/samy/esp/esp-idf/components/esp-tls -I/home/samy/esp/esp-idf/components/esp-tls/esp-tls-crypto -I/home/samy/esp/esp-idf/components/esp_adc_cal/include -I/home/samy/esp/esp-idf/components/esp_hid/include -I/home/samy/esp/esp-idf/components/tcp_transport/include -I/home/samy/esp/esp-idf/components/esp_http_client/include -I/home/samy/esp/esp-idf/components/esp_http_server/include -I/home/samy/esp/esp-idf/components/esp_https_ota/include -I/home/samy/esp/esp-idf/components/esp_lcd/include -I/home/samy/esp/esp-idf/components/esp_lcd/interface -I/home/samy/esp/esp-idf/components/protobuf-c/protobuf-c -I/home/samy/esp/esp-idf/components/protocomm/include/common -I/home/samy/esp/esp-idf/components/protocomm/include/security -I/home/samy/esp/esp-idf/components/protocomm/include/transports -I/home/samy/esp/esp-idf/components/mdns/include -I/home/samy/esp/esp-idf/components/esp_local_ctrl/include -I/home/samy/esp/esp-idf/components/sdmmc/include -I/home/samy/esp/esp-idf/components/esp_serial_slave_link/include -I/home/samy/esp/esp-idf/components/esp_websocket_client/include -I/home/samy/esp/esp-idf/components/expat/expat/expat/lib -I/home/samy/esp/esp-idf/components/expat/port/include -I/home/samy/esp/esp-idf/components/wear_levelling/include -I/home/samy/esp/esp-idf/components/fatfs/diskio -I/home/samy/esp/esp-idf/components/fatfs/vfs -I/home/samy/esp/esp-idf/components/fatfs/src -I/home/samy/esp/esp-idf/components/freemodbus/common/include -I/home/samy/esp/esp-idf/components/idf_test/include -I/home/samy/esp/esp-idf/components/idf_test/include/esp32 -I/home/samy/esp/esp-idf/components/jsmn/include -I/home/samy/esp/esp-idf/components/json/cJSON -I/home/samy/esp/esp-idf/components/libsodium/libsodium/src/libsodium/include -I/home/samy/esp/esp-idf/components/libsodium/port_include -I/home/samy/esp/esp-idf/components/mqtt/esp-mqtt/include -I/home/samy/esp/esp-idf/components/openssl/include -I/home/samy/esp/esp-idf/components/perfmon/include -I/home/samy/esp/esp-idf/components/spiffs/include -I/home/samy/esp/esp-idf/components/ulp/include -I/home/samy/esp/esp-idf/components/wifi_provisioning/include -I/home/samy/work/ble2ros/firmware/uros_node/components/uros_component/network_interfaces -isystem /home/samy/work/ble2ros/firmware/uros_node/components/uros_component/include -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -fmacro-prefix-map=/home/samy/work/ble2ros/firmware/uros_node=. -fmacro-prefix-map=/home/samy/esp/esp-idf=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.4.1\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -MF esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -c /home/samy/work/ble2ros/firmware/uros_node/main/main.c
In file included from /home/samy/work/ble2ros/firmware/uros_node/main/main.c:13:
/home/samy/work/ble2ros/firmware/uros_node/main/uros/uros.h:23:10: fatal error: rcl/rcl.h: No such file or directory
#include <rcl/rcl.h>
^~~~~~~~~~~
compilation terminated.
[1023/1045] Building C object esp-idf/wifi_provisioning/CMakeFiles/__idf_wifi_provisioning.dir/src/manager.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
the stderr in the uROS build is typically :
-- stderr: ament_cmake_clang_format
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_CXX_COMPILER
CMAKE_C_COMPILER
---
It is not finding your FreeRTOS headers, let me check
Found anything ?
Can someone at least guide me? Maybe my config in the colcon.meta wasn't done properly? It would help me a lot as I've already tried on multiple computers, with multiple codebases (including ones without any thread apart from the microROS thread), and still, impossible to turn on this multithreading. Am I missing something? It's kind of a big issue if it's impossible to make use of multiple threads, and it seems weird to me that I'm the first and only one having this issue.
Hey, I'm facing the exact same error. I'll try the things mentioned here and will update the results. If anyone has already got the resolution please provide it.
Project builds successfully after adding "-DUUCLIENT_PROFILE_MULTITHREAD=ON" in colcon.meta. Still, I'm getting a similar error.
I'm using a single executor and thread for uros so I think changing the multi thread flag won't do anything. This error occurs only with a specific sequence of requests made (service clients on ESP32) which are working as usual when executed otherwise.
Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4000c291 PS : 0x00060c30 A0 : 0x800deb56 A1 : 0x3ffc9d60
A2 : 0x00000001 A3 : 0x3ffb5c8d A4 : 0x00000001 A5 : 0x00000001
A6 : 0x00000000 A7 : 0x00000001 A8 : 0x00000001 A9 : 0x00000000
A10 : 0x00000001 A11 : 0x3ffb5c88 A12 : 0x05aed580 A13 : 0x00000001
A14 : 0x3ffc9fa0 A15 : 0x00000003 SAR : 0x0000000c EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000001 LBEG : 0x4000c28c LEND : 0x4000c296 LCOUNT : 0x00000000
Backtrace: 0x4000c28e:0x3ffc9d60 0x400deb53:0x3ffc9d70 0x400da0af:0x3ffc9da0 0x400d837d:0x3ffc9dc0 0x400ddef2:0x3ffc9df0 0x400da445:0x3ffc9e40 0x400dbac0:0x3ffc9e90 0x400dc0f3:0x3ffc9ef0 0x400dc1db:0x3ffc9f20 0x400d7841:0x3ffc9f40 0x4008ca2d:0x3ffca040
0x400deb53: ucdr_deserialize_endian_array_char at ??:?
0x400da0af: ucdr_deserialize_sequence_char at ??:?
0x400d837d: _DcapsTask_Response__cdr_deserialize at dcaps_task__type_support_c.c:?
0x400ddef2: rmw_take_response at ??:?
0x400da445: rcl_take_response at ??:?
0x400dbac0: _rclc_take_new_data at executor.c:?
0x400dc0f3: rclc_executor_spin_some$part$4 at executor.c:?
0x400dc1db: rclc_executor_spin_some at ??:?
0x400d7841: micro_ros_task at /home/shic/Foodlabs_Codes/AiKi/Saute/pasta-house/pasta-house-esp32/module_/build/../components/UROS/src/uros.c:306 (discriminator 1)
0x4008ca2d: vPortTaskWrapper at /home/shic/esp/esp-idf/components/freertos/port/xtensa/port.c:131
ELF file SHA256: 45168d89d1a4c770
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6676
load:0x40078000,len:14848
ho 0 tail 12 room 4
load:0x40080400,len:3792
0x40080400: _init at ??:?
entry 0x40080694
It'll be really helpful to understand what the error is about.
@pablogs9 still nothing ?
Provide code for replicating this issue
I will try to provide a minimal code replicating this soon, as it currently requires connection with multiple other devices