Skip to content

Commit f8bb400

Browse files
committed
Add ESP32-P4 support for Micro-ROS
1 parent 7d5efa5 commit f8bb400

File tree

16 files changed

+85
-19
lines changed

16 files changed

+85
-19
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
idf_target: [ esp32, esp32s2, esp32s3, esp32c3, esp32c6]
16-
idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2" ]
15+
idf_target: [ esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32p4]
16+
idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2", "espressif/idf:release-v5.5" ]
1717
exclude:
1818
# Skip IDF v4 + ESP32C6 combination
1919
- idf_target: esp32c6
2020
idf_version: espressif/idf:release-v4.4
21+
# Skip IDF v4 + ESP32-P4 combination
22+
- idf_target: esp32p4
23+
idf_version: espressif/idf:release-v4.4
24+
# Skip IDF v5.2 + ESP32-P4 combination
25+
- idf_target: esp32p4
26+
idf_version: espressif/idf:release-v5.2
2127

2228
container:
2329
image: ${{ matrix.idf_version }}
@@ -38,7 +44,12 @@ jobs:
3844
# This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/
3945
pip3 install importlib-resources
4046
# this installs the modules also for global python interpreter, needed for IDF v5
41-
/usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions empy==3.3.4 importlib-resources
47+
# IDF 5.5 uses Python 3.12 which has externally-managed-environment protection
48+
if [ "${{ matrix.idf_version }}" == "espressif/idf:release-v5.5" ]; then \
49+
/usr/bin/pip3 install --break-system-packages catkin_pkg lark-parser colcon-common-extensions empy==3.3.4 importlib-resources; \
50+
else \
51+
/usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions empy==3.3.4 importlib-resources; \
52+
fi
4253
4354
# This line can be removed when https://github.com/colcon/colcon-python-setup-py/issues/56 is solved
4455
- name: Patch setuptools
@@ -58,7 +69,7 @@ jobs:
5869
5970
- name: Build sample - low_consumption
6071
shell: bash
61-
if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6'
72+
if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6' && matrix.idf_target != 'esp32p4'
6273
run: |
6374
. $IDF_PATH/export.sh
6475
cd micro_ros_espidf_component/examples/low_consumption

.github/workflows/nightly.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
branch: [rolling, jazzy, humble]
18-
idf_target: [ esp32, esp32s2, esp32c3, esp32s3, esp32c6]
19-
idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2" ]
18+
idf_target: [ esp32, esp32s2, esp32c3, esp32s3, esp32c6, esp32p4]
19+
idf_version: [ "espressif/idf:release-v4.4", "espressif/idf:release-v5.2", "espressif/idf:release-v5.5" ]
2020
exclude:
2121
# Skip IDF v4 + ESP32C6 combination
2222
- idf_target: esp32c6
2323
idf_version: espressif/idf:release-v4.4
24+
# Skip IDF v4 + ESP32-P4 combination
25+
- idf_target: esp32p4
26+
idf_version: espressif/idf:release-v4.4
27+
# Skip IDF v5.2 + ESP32-P4 combination
28+
- idf_target: esp32p4
29+
idf_version: espressif/idf:release-v5.2
2430

2531

2632
container:
@@ -43,7 +49,12 @@ jobs:
4349
# This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/
4450
pip3 install importlib-resources
4551
# this installs the modules also for global python interpreter, needed for IDF v5
46-
/usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions importlib-resources
52+
# IDF 5.5 uses Python 3.12 which has externally-managed-environment protection
53+
if [ "${{ matrix.idf_version }}" == "espressif/idf:release-v5.5" ]; then \
54+
/usr/bin/pip3 install --break-system-packages catkin_pkg lark-parser colcon-common-extensions importlib-resources; \
55+
else \
56+
/usr/bin/pip3 install catkin_pkg lark-parser colcon-common-extensions importlib-resources; \
57+
fi
4758
4859
# This line can be removed when https://github.com/colcon/colcon-python-setup-py/issues/56 is solved
4960
- name: Patch setuptools
@@ -63,7 +74,7 @@ jobs:
6374
6475
- name: Build sample - low_consumption
6576
shell: bash
66-
if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6'
77+
if: matrix.idf_target != 'esp32c3' && matrix.idf_target != 'esp32s3' && matrix.idf_target != 'esp32c6' && matrix.idf_target != 'esp32p4'
6778
run: |
6879
. $IDF_PATH/export.sh
6980
cd micro_ros_espidf_component/examples/low_consumption

README.md

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

44
# micro-ROS component for ESP-IDF
55

6-
This component has been tested in ESP-IDF v4.4, and v5.2 with ESP32, ESP32-S2, ESP32-S3, ESP32-C3 and ESP32-C6.
6+
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.
77

88
## Dependencies
99

@@ -34,7 +34,7 @@ In order to test a int32_publisher example:
3434
```bash
3535
. $IDF_PATH/export.sh
3636
cd examples/int32_publisher
37-
# Set target board [esp32|esp32s2|esp32s3|esp32c3]
37+
# Set target board [esp32|esp32s2|esp32s3|esp32c3|esp32c6|esp32p4]
3838
idf.py set-target esp32
3939
idf.py menuconfig
4040
# Set your micro-ROS configuration and WiFi credentials under micro-ROS Settings

esp32_toolchain.cmake.in

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ set(CMAKE_SYSTEM_NAME Generic)
55
set(idf_target "@IDF_TARGET@")
66
set(idf_path "@IDF_PATH@")
77

8-
set(RISCV_TARGETS "esp32c3" "esp32c6")
8+
set(RISCV_TARGETS "esp32c3" "esp32c6" "esp32p4")
9+
set(RISCV_HARD_FLOAT_TARGETS "esp32p4")
910

1011
if("${idf_target}" IN_LIST RISCV_TARGETS)
1112
set(CMAKE_SYSTEM_PROCESSOR riscv)
12-
set(FLAGS "-ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
13+
if("${idf_target}" IN_LIST RISCV_HARD_FLOAT_TARGETS)
14+
# ESP32-P4 uses hardware floating point
15+
set(FLAGS "-march=rv32imafc -mabi=ilp32f -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
16+
else()
17+
# ESP32-C3/C6 use soft-float
18+
set(FLAGS "-ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
19+
endif()
1320
else()
1421
set(CMAKE_SYSTEM_PROCESSOR xtensa)
1522
set(FLAGS "-mlongcalls -ffunction-sections -fdata-sections" CACHE STRING "" FORCE)
@@ -35,3 +42,9 @@ include_directories(
3542
"@BUILD_CONFIG_DIR@"
3643
${idf_path}/components/soc/${idf_target}/include
3744
)
45+
46+
if("${idf_target}" IN_LIST RISCV_TARGETS)
47+
include_directories(
48+
${idf_path}/components/riscv/include
49+
)
50+
endif()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
2+
managed_components
3+
dependencies.lock
24
sdkconfig
35
sdkconfig.old
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
2+
managed_components
3+
dependencies.lock
24
sdkconfig
35
sdkconfig.old
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
2+
managed_components
3+
dependencies.lock
24
sdkconfig
35
sdkconfig.old
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
2+
managed_components
3+
dependencies.lock
24
sdkconfig
35
sdkconfig.old
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
2+
managed_components
3+
dependencies.lock
24
sdkconfig
35
sdkconfig.old

examples/int32_sub_pub/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
build
2+
managed_components
3+
dependencies.lock
24
sdkconfig
35
sdkconfig.old

0 commit comments

Comments
 (0)