diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b93d7e8..f053ac71 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,12 +12,18 @@ jobs: strategy: fail-fast: false matrix: - idf_target: [ esp32, esp32s2, esp32s3, esp32c3, esp32c6] - idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2" ] + idf_target: [ esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32p4] + idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2", "espressif/idf:release-v5.5" ] exclude: # Skip IDF v4 + ESP32C6 combination - idf_target: esp32c6 idf_version: espressif/idf:release-v4.4 + # Skip IDF v4 + ESP32-P4 combination + - idf_target: esp32p4 + idf_version: espressif/idf:release-v4.4 + # Skip IDF v5.2 + ESP32-P4 combination + - idf_target: esp32p4 + idf_version: espressif/idf:release-v5.2 container: image: ${{ matrix.idf_version }} @@ -38,7 +44,12 @@ jobs: # This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/ pip3 install importlib-resources # this installs the modules also for global python interpreter, needed for IDF v5 - /usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions empy==3.3.4 importlib-resources + # IDF 5.5 uses Python 3.12 which has externally-managed-environment protection + if [ "${{ matrix.idf_version }}" == "espressif/idf:release-v5.5" ]; then \ + /usr/bin/pip3 install --break-system-packages catkin_pkg lark-parser colcon-common-extensions empy==3.3.4 importlib-resources; \ + else \ + /usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions empy==3.3.4 importlib-resources; \ + fi # This line can be removed when https://github.com/colcon/colcon-python-setup-py/issues/56 is solved - name: Patch setuptools @@ -58,7 +69,7 @@ jobs: - name: Build sample - low_consumption shell: bash - if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6' + if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6' && matrix.idf_target != 'esp32p4' run: | . $IDF_PATH/export.sh cd micro_ros_espidf_component/examples/low_consumption diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 419795fb..4df283d9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,12 +15,18 @@ jobs: fail-fast: false matrix: branch: [rolling, jazzy, humble] - idf_target: [ esp32, esp32s2, esp32c3, esp32s3, esp32c6] - idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2" ] + idf_target: [ esp32, esp32s2, esp32c3, esp32s3, esp32c6, esp32p4] + idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2", "espressif/idf:release-v5.5" ] exclude: # Skip IDF v4 + ESP32C6 combination - idf_target: esp32c6 idf_version: espressif/idf:release-v4.4 + # Skip IDF v4 + ESP32-P4 combination + - idf_target: esp32p4 + idf_version: espressif/idf:release-v4.4 + # Skip IDF v5.2 + ESP32-P4 combination + - idf_target: esp32p4 + idf_version: espressif/idf:release-v5.2 container: @@ -43,7 +49,12 @@ jobs: # This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/ pip3 install importlib-resources # this installs the modules also for global python interpreter, needed for IDF v5 - /usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions importlib-resources + # IDF 5.5 uses Python 3.12 which has externally-managed-environment protection + if [ "${{ matrix.idf_version }}" == "espressif/idf:release-v5.5" ]; then \ + /usr/bin/pip3 install --break-system-packages catkin_pkg lark-parser colcon-common-extensions importlib-resources; \ + else \ + /usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions importlib-resources; \ + fi # This line can be removed when https://github.com/colcon/colcon-python-setup-py/issues/56 is solved - name: Patch setuptools @@ -63,7 +74,7 @@ jobs: - name: Build sample - low_consumption shell: bash - if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6' + if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6' && matrix.idf_target != 'esp32p4' run: | . $IDF_PATH/export.sh cd micro_ros_espidf_component/examples/low_consumption diff --git a/README.md b/README.md index d737e4de..3e93f58d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # micro-ROS component for ESP-IDF -This component has been tested in ESP-IDF v4.4, and v5.2 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3 and ESP32-C6. +This component has been tested in ESP-IDF v4.4, v5.2, and v5.5 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-P4. ## Dependencies @@ -34,7 +34,7 @@ In order to test a int32_publisher example: ```bash . $IDF_PATH/export.sh cd examples/int32_publisher -# Set target board [esp32|esp32s2|esp32s3|esp32c3] +# Set target board [esp32|esp32s2|esp32s3|esp32c3|esp32c6|esp32p4] idf.py set-target esp32 idf.py menuconfig # Set your micro-ROS configuration and WiFi credentials under micro-ROS Settings diff --git a/esp32_toolchain.cmake.in b/esp32_toolchain.cmake.in index 5bc33a7c..a71a9a63 100644 --- a/esp32_toolchain.cmake.in +++ b/esp32_toolchain.cmake.in @@ -5,11 +5,18 @@ set(CMAKE_SYSTEM_NAME Generic) set(idf_target "@IDF_TARGET@") set(idf_path "@IDF_PATH@") -set(RISCV_TARGETS "esp32c3" "esp32c6") +set(RISCV_TARGETS "esp32c3" "esp32c6" "esp32p4") +set(RISCV_HARD_FLOAT_TARGETS "esp32p4") if("${idf_target}" IN_LIST RISCV_TARGETS) set(CMAKE_SYSTEM_PROCESSOR riscv) - set(FLAGS "-ffunction-sections -fdata-sections" CACHE STRING "" FORCE) + if("${idf_target}" IN_LIST RISCV_HARD_FLOAT_TARGETS) + # ESP32-P4 uses hardware floating point + set(FLAGS "-march=rv32imafc -mabi=ilp32f -ffunction-sections -fdata-sections" CACHE STRING "" FORCE) + else() + # ESP32-C3/C6 use soft-float + set(FLAGS "-ffunction-sections -fdata-sections" CACHE STRING "" FORCE) + endif() else() set(CMAKE_SYSTEM_PROCESSOR xtensa) set(FLAGS "-mlongcalls -ffunction-sections -fdata-sections" CACHE STRING "" FORCE) @@ -35,3 +42,9 @@ include_directories( "@BUILD_CONFIG_DIR@" ${idf_path}/components/soc/${idf_target}/include ) + +if("${idf_target}" IN_LIST RISCV_TARGETS) + include_directories( + ${idf_path}/components/riscv/include + ) +endif() diff --git a/examples/addtwoints_server/.gitignore b/examples/addtwoints_server/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/addtwoints_server/.gitignore +++ b/examples/addtwoints_server/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/handle_static_types/.gitignore b/examples/handle_static_types/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/handle_static_types/.gitignore +++ b/examples/handle_static_types/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/int32_publisher/.gitignore b/examples/int32_publisher/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/int32_publisher/.gitignore +++ b/examples/int32_publisher/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/int32_publisher_custom_transport/.gitignore b/examples/int32_publisher_custom_transport/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/int32_publisher_custom_transport/.gitignore +++ b/examples/int32_publisher_custom_transport/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/int32_publisher_embeddedrtps/.gitignore b/examples/int32_publisher_embeddedrtps/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/int32_publisher_embeddedrtps/.gitignore +++ b/examples/int32_publisher_embeddedrtps/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/int32_sub_pub/.gitignore b/examples/int32_sub_pub/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/int32_sub_pub/.gitignore +++ b/examples/int32_sub_pub/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/low_consumption/.gitignore b/examples/low_consumption/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/low_consumption/.gitignore +++ b/examples/low_consumption/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/multithread_publisher/.gitignore b/examples/multithread_publisher/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/multithread_publisher/.gitignore +++ b/examples/multithread_publisher/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/parameters/.gitignore b/examples/parameters/.gitignore index 9b375231..72cca8bc 100644 --- a/examples/parameters/.gitignore +++ b/examples/parameters/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old \ No newline at end of file diff --git a/examples/ping_pong/.gitignore b/examples/ping_pong/.gitignore index d054d843..16038b4d 100644 --- a/examples/ping_pong/.gitignore +++ b/examples/ping_pong/.gitignore @@ -1,3 +1,5 @@ build +managed_components +dependencies.lock sdkconfig sdkconfig.old diff --git a/idf_component.yml b/idf_component.yml new file mode 100644 index 00000000..6087dc7b --- /dev/null +++ b/idf_component.yml @@ -0,0 +1,10 @@ +dependencies: + espressif/esp_wifi_remote: + version: ">=0.10,<2.0" + rules: + - if: "target in [esp32p4]" + espressif/esp_hosted: + version: "~2" + rules: + - if: "target in [esp32p4]" + diff --git a/libmicroros.mk b/libmicroros.mk index e5d22e29..010b519b 100644 --- a/libmicroros.mk +++ b/libmicroros.mk @@ -131,20 +131,21 @@ ifeq ($(IDF_TARGET),$(filter $(IDF_TARGET),esp32s2 esp32c3 esp32c6)) cd ..; \ rm -rf $(UROS_DIR)/atomic_workaround; endif -ifeq ($(IDF_TARGET),$(filter $(IDF_TARGET),esp32)) +# ESP32-S3, ESP32-P4, ESP32: only need workaround in IDF 5.5 +ifeq ($(IDF_TARGET),$(filter $(IDF_TARGET),esp32s3 esp32p4 esp32)) + @if [ $(IDF_VERSION_MAJOR) -eq 5 ] && [ $(IDF_VERSION_MINOR) -eq 5 ]; then \ 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_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; \ $(X_AR) rc -s librcutils.a *.obj; \ cp -rf librcutils.a $(UROS_DIR)/install/lib/librcutils.a; \ cd ..; \ - rm -rf $(UROS_DIR)/atomic_workaround; + rm -rf $(UROS_DIR)/atomic_workaround; \ + fi endif $(EXTENSIONS_DIR)/libmicroros.a: $(EXTENSIONS_DIR)/micro_ros_src/install patch_atomic