From 5bf5a6ed4430c2f4f1749e22b5ed226952cfaea8 Mon Sep 17 00:00:00 2001 From: Pablo Garrido Date: Wed, 13 Nov 2024 09:37:53 +0100 Subject: [PATCH] IDF 5.3 fixes (#269) (cherry picked from commit df752687ea877151359f29f7d5d941ec082e7569) --- CMakeLists.txt | 15 ++++++++++++++- libmicroros.mk | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06119f96..c6f94e0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,17 @@ -idf_component_register(SRCS "network_interfaces/uros_ethernet_netif.c" "network_interfaces/uros_wlan_netif.c" +option(BUILD_ETHERNET_INTERFACE "Build ethernet interface support" OFF) +option(BUILD_WLAN_INTERFACE "Build wlan interface support" ON) + +set(COMPONENT_SRC "") + +if(BUILD_ETHERNET_INTERFACE) + list(APPEND COMPONENT_SRC "network_interfaces/uros_ethernet_netif.c") +endif() + +if(BUILD_WLAN_INTERFACE) + list(APPEND COMPONENT_SRC "network_interfaces/uros_wlan_netif.c") +endif() + +idf_component_register(SRCS ${COMPONENT_SRC} INCLUDE_DIRS "network_interfaces" REQUIRES nvs_flash esp_wifi esp_eth lwip) diff --git a/libmicroros.mk b/libmicroros.mk index 9921a846..7980f3d0 100644 --- a/libmicroros.mk +++ b/libmicroros.mk @@ -134,6 +134,21 @@ ifeq ($(IDF_TARGET),$(filter $(IDF_TARGET),esp32s2 esp32c3)) cd ..; \ rm -rf $(UROS_DIR)/atomic_workaround; endif +ifeq ($(IDF_TARGET),$(filter $(IDF_TARGET),esp32)) + echo $(UROS_DIR)/atomic_workaround; \ + mkdir $(UROS_DIR)/atomic_workaround; cd $(UROS_DIR)/atomic_workaround; \ + $(X_AR) x $(UROS_DIR)/install/lib/librcutils.a; \ + $(X_STRIP) atomic_64bits.c.obj --strip-symbol=__atomic_fetch_add_8; \ + if [ $(IDF_VERSION_MAJOR) -ge 5 ] && [ $(IDF_VERSION_MINOR) -ge 3 ]; then \ + $(X_STRIP) atomic_64bits.c.obj --strip-symbol=__atomic_load_8; \ + $(X_STRIP) atomic_64bits.c.obj --strip-symbol=__atomic_store_8; \ + $(X_STRIP) atomic_64bits.c.obj --strip-symbol=__atomic_exchange_8; \ + fi; \ + $(X_AR) rc -s librcutils.a *.obj; \ + cp -rf librcutils.a $(UROS_DIR)/install/lib/librcutils.a; \ + cd ..; \ + rm -rf $(UROS_DIR)/atomic_workaround; +endif $(EXTENSIONS_DIR)/libmicroros.a: $(EXTENSIONS_DIR)/micro_ros_src/install patch_atomic mkdir -p $(UROS_DIR)/libmicroros; cd $(UROS_DIR)/libmicroros; \