Skip to content

Commit 6e33f19

Browse files
Add support for esp-idf v6.0 (#334) (#366)
(cherry picked from commit 04f3cca) Co-authored-by: Narukara <narukara@foxmail.com>
1 parent b8e1470 commit 6e33f19

6 files changed

Lines changed: 28 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
idf_target: [esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32p4]
27-
idf_version: [v5.2, v5.3, v5.4, v5.5]
27+
idf_version: [v5.2, v5.3, v5.4, v5.5, v6.0]
2828
exclude:
2929
- idf_target: esp32p4
3030
idf_version: v5.2

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# micro-ROS component for ESP-IDF
99

10-
This component has been tested in ESP-IDF v5.2, v5.3, v5.4, and v5.5 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6, and ESP32-P4.
10+
This component has been tested in ESP-IDF v5.2, v5.3, v5.4, v5.5, and v6.0 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6, and ESP32-P4.
1111

1212
## Dependencies
1313

@@ -67,7 +67,7 @@ docker run -it --rm --net=host microros/micro-ros-agent:humble udp4 --port 8888
6767
It's possible to build this example application using the official Espressif [docker images](https://hub.docker.com/r/espressif/idf), following the same steps:
6868

6969
```bash
70-
docker run --name micro-ros-espidf-component -it espressif/idf:release-v5.5 bash
70+
docker run --name micro-ros-espidf-component -it espressif/idf:release-v6.0 bash
7171

7272
git clone -b humble https://github.com/micro-ROS/micro_ros_espidf_component.git
7373
cd micro_ros_espidf_component/

esp32_toolchain.cmake.in

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ else()
2222
set(FLAGS "-mlongcalls -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
2323
endif()
2424

25+
include("@BUILD_CONFIG_DIR@/sdkconfig.cmake" OPTIONAL)
26+
if(CONFIG_LIBC_PICOLIBC)
27+
set(FLAGS "${FLAGS} --specs=picolibc.specs" CACHE STRING "" FORCE)
28+
# `__STDC_WANT_LIB_EXT1__` (C11 Annex K) is only implemented by picolibc.
29+
# Temporary workaround for ros2/rcutils#552. Remove this once micro-ROS/rcutils picks up ros2/rcutils#555
30+
add_compile_definitions(__STDC_WANT_LIB_EXT1__=1)
31+
endif()
32+
2533
set(CMAKE_CROSSCOMPILING 1)
2634
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
2735
set(PLATFORM_NAME "LwIP")
@@ -33,8 +41,11 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
3341
set(CMAKE_C_COMPILER @CMAKE_C_COMPILER@)
3442
set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@)
3543

36-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS} ${IDF_INCLUDES}")
37-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti ${FLAGS} ${IDF_INCLUDES}")
44+
if(NOT MICROROS_TOOLCHAIN_FLAGS_APPLIED)
45+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS} ${IDF_INCLUDES}" CACHE STRING "" FORCE)
46+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti ${FLAGS} ${IDF_INCLUDES}" CACHE STRING "" FORCE)
47+
set(MICROROS_TOOLCHAIN_FLAGS_APPLIED TRUE CACHE INTERNAL "micro-ROS toolchain flags were applied")
48+
endif()
3849

3950
add_compile_definitions(ESP_PLATFORM LWIP_IPV4 LWIP_IPV6 PLATFORM_NAME_FREERTOS)
4051

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
## IDF Component Manager Manifest File
22
dependencies:
33
espressif/esp_tinyusb: "^1.4.4"
4+
espressif/usb:
5+
version: "*"
6+
rules:
7+
- if: "idf_version >=6.0.0"
48
## Required IDF version
59
idf:
610
version: ">=5.0"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
## IDF Component Manager Manifest File
22
dependencies:
33
espressif/esp_tinyusb: "^1.4.4"
4+
espressif/usb:
5+
version: "*"
6+
rules:
7+
- if: "idf_version >=6.0.0"
48
## Required IDF version
59
idf:
610
version: ">=5.0"

network_interfaces/uros_wlan_netif.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ static void wifi_init_sta(void)
8585
},
8686
};
8787
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
88+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
89+
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
90+
#else
8891
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
92+
#endif
8993
ESP_ERROR_CHECK(esp_wifi_start() );
9094

9195
ESP_LOGI(TAG, "wifi_init_sta finished.");

0 commit comments

Comments
 (0)