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 3449996d..8d59e3d7 100644 --- a/libmicroros.mk +++ b/libmicroros.mk @@ -135,6 +135,21 @@ ifeq ($(IDF_TARGET),$(filter $(IDF_TARGET),esp32s2 esp32c3)) rm -rf $(UROS_DIR)/atomic_workaround; \ cd ..; 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; \