Skip to content

Commit 53be302

Browse files
AdrianSoundynfbotjosesimoes
authored
Update to IDF 5.4.2 and add basic ESP32_P4 support (#3152)
Co-authored-by: nfbot <[email protected]> Co-authored-by: José Simões <[email protected]>
1 parent 4c90a01 commit 53be302

File tree

137 files changed

+12015
-10969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+12015
-10969
lines changed

.devcontainer/All/Dockerfile.All.SRC

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ RUN apt-get update \
5555
ninja-build \
5656
srecord \
5757
nodejs \
58-
libffi-dev
58+
libffi-dev \
59+
libusb-1.0
5960

6061
# Create needed directories
6162
RUN mkdir -p /usr/local/bin/gcc \
@@ -92,7 +93,7 @@ RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-
9293
RUN git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip
9394

9495
# Clone ESP-IDF
95-
RUN git clone --branch v5.2.3 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf
96+
RUN git clone --branch v5.4.2 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf
9697

9798
# Clone what is needed for TI
9899
RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC32xx_SDK.git --depth 1 ./sources/SimpleLinkCC32 \
@@ -127,12 +128,12 @@ RUN ln -fs /usr/bin/python3 /usr/bin/python \
127128

128129
# Install ESP-IDF
129130
ENV IDF_PATH=/sources/esp-idf
130-
ENV ESP_PATCH_VER=esp-13.2.0_20230928
131+
ENV ESP_PATCH_VER=esp-14.2.0_20241119
131132
# This is now taking care in the following line
132133
# RUN python -m pip install -r $IDF_PATH/requirements.txt
133134
RUN $IDF_PATH/install.sh
134135

135-
ENV PATH=/root/.espressif/python_env/idf5.2_py3.11_env/bin:$PATH:\
136+
ENV PATH=/root/.espressif/python_env/idf5.4_py3.11_env/bin:$PATH:\
136137
$IDF_PATH/components/esptool_py/esptool:\
137138
$IDF_PATH/components/espcoredump:\
138139
$IDF_PATH/components/partition_table/:\

.devcontainer/ESP32/Dockerfile.ESP32.SRC

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ RUN apt-get update \
3939
ninja-build \
4040
srecord \
4141
nodejs \
42-
libffi-dev
42+
libffi-dev \
43+
libusb-1.0
4344

4445
# Create needed directories
4546
RUN mkdir -p /usr/local/bin/gcc
@@ -48,7 +49,7 @@ RUN mkdir -p /usr/local/bin/gcc
4849
RUN git clone --branch R0.15a https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs
4950

5051
# Clone ESP-IDF
51-
RUN git clone --branch v5.2.3 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf
52+
RUN git clone --branch v5.4.2 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf
5253

5354
# Creating static link python for pyhton3
5455
RUN ln -fs /usr/bin/python3 /usr/bin/python \
@@ -61,12 +62,12 @@ ENV PATH=/usr/bin/cmake/bin:${PATH}
6162

6263
# Install ESP-IDF
6364
ENV IDF_PATH=/sources/esp-idf
64-
ENV ESP_PATCH_VER=esp-13.2.0_20230928
65+
ENV ESP_PATCH_VER=esp-14.2.0_20241119
6566
# This is now taking care in the following line
6667
# RUN python -m pip install -r $IDF_PATH/requirements.txt
6768
RUN $IDF_PATH/install.sh
6869

69-
ENV PATH=/root/.espressif/python_env/idf5.2_py3.11_env/bin:$PATH:\
70+
ENV PATH=/root/.espressif/python_env/idf5.4_py3.11_env/bin:$PATH:\
7071
$IDF_PATH/components/esptool_py/esptool:\
7172
$IDF_PATH/components/espcoredump:\
7273
$IDF_PATH/components/partition_table/:\

.vscode/tasks.TEMPLATE.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@
2828
{
2929
"label": "Flash nanoCLR to ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S3",
3030
"type": "shell",
31-
"command": "python ${env:IDF_PATH}/components/esptool_py/esptool/esptool.py --chip auto --port \"${input:comPort}\" --baud 1500000 --before \"default_reset\" --after \"hard_reset\" write_flash -z --flash_size detect 0x0 ${workspaceFolder}/build/bootloader/bootloader.bin 0x10000 ${workspaceFolder}/build/nanoCLR.bin 0x8000 ${workspaceFolder}/build/partitions_${input:esp32Partitions}.bin",
31+
"command": "python ${env:IDF_PATH}/components/esptool_py/esptool/esptool.py --chip auto --port \"${input:comPort}\" --baud 1500000 --before \"default_reset\" --after \"hard_reset\" write_flash -z --flash_size detect 0x0 ${workspaceFolder}/build/bootloader/bootloader.bin 0x10000 ${workspaceFolder}/build/nanoCLR.bin 0x8000 ${workspaceFolder}/build/partitions_${input:esp32Partitions}.bin --force",
32+
"presentation": {
33+
"reveal": "always",
34+
"panel": "shared"
35+
},
36+
"problemMatcher": []
37+
},
38+
{
39+
"label": "Flash nanoCLR to ESP32-P4",
40+
"type": "shell",
41+
"command": "python ${env:IDF_PATH}/components/esptool_py/esptool/esptool.py --chip auto --port \"${input:comPort}\" --baud 1500000 --before \"default_reset\" --after \"hard_reset\" write_flash -z --flash_size detect 0x2000 ${workspaceFolder}/build/bootloader/bootloader.bin 0x10000 ${workspaceFolder}/build/nanoCLR.bin 0x8000 ${workspaceFolder}/build/partitions_${input:esp32Partitions}.bin",
3242
"presentation": {
3343
"reveal": "always",
3444
"panel": "shared"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# Copyright (c) .NET Foundation and Contributors
3+
# See LICENSE file in the project root for full license information.
4+
#
5+
6+
# need to specify linker flags here
7+
set(CMAKE_EXE_LINKER_FLAGS " -Wl,--print-memory-usage " CACHE INTERNAL "executable linker flags")
8+
9+
# TARGET parameter to set the target that's setting them for
10+
# optional EXTRA_COMPILE_OPTIONS with compile options to be added
11+
macro(nf_set_compile_options)
12+
13+
# parse arguments
14+
cmake_parse_arguments(NFSCO "" "TARGET" "EXTRA_COMPILE_OPTIONS" ${ARGN})
15+
16+
if(NOT NFSCO_TARGET OR "${NFSCO_TARGET}" STREQUAL "")
17+
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_compile_options()")
18+
endif()
19+
20+
# include any extra options coming from any extra args?
21+
target_compile_options(${NFSCO_TARGET} PUBLIC ${NFSCO_EXTRA_COMPILE_OPTIONS} -Wall -Wextra -Werror -Wno-sign-compare -Wno-unused-parameter -Wshadow -Wimplicit-fallthrough -fshort-wchar -fno-builtin -fno-common -fno-exceptions -fcheck-new )
22+
23+
# this series has FPU
24+
target_compile_definitions(${NFSCO_TARGET} PUBLIC -DTARGET=esp32c5 -DUSE_FPU=TRUE -DPLATFORM_ESP32 -DESP_PLATFORM)
25+
26+
endmacro()
27+
28+
# TARGET parameter to set the target that's setting them for
29+
# optional EXTRA_LINK_FLAGS with link flags to be added
30+
macro(nf_set_link_options)
31+
32+
# parse arguments
33+
cmake_parse_arguments(NFSLO "" "TARGET;EXTRA_LINK_FLAGS" "" ${ARGN})
34+
35+
if(NOT NFSLO_TARGET OR "${NFSLO_TARGET}" STREQUAL "")
36+
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_link_options()")
37+
endif()
38+
39+
# set optimization linker flags for RELEASE and MinSizeRel
40+
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
41+
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os ")
42+
endif()
43+
44+
# include libraries in build
45+
nf_include_libraries_in_build(${NFSLO_TARGET})
46+
47+
# set extra linker flags
48+
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " ${NFSLO_EXTRA_LINK_FLAGS} ")
49+
50+
# set optimization flags
51+
nf_set_optimization_options(${NFSLO_TARGET})
52+
53+
endmacro()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#
2+
# Copyright (c) .NET Foundation and Contributors
3+
# See LICENSE file in the project root for full license information.
4+
#
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# Copyright (c) .NET Foundation and Contributors
3+
# See LICENSE file in the project root for full license information.
4+
#
5+
6+
# need to specify linker flags here
7+
set(CMAKE_EXE_LINKER_FLAGS " -Wl,--print-memory-usage " CACHE INTERNAL "executable linker flags")
8+
9+
# TARGET parameter to set the target that's setting them for
10+
# optional EXTRA_COMPILE_OPTIONS with compile options to be added
11+
macro(nf_set_compile_options)
12+
13+
# parse arguments
14+
cmake_parse_arguments(NFSCO "" "TARGET" "EXTRA_COMPILE_OPTIONS" ${ARGN})
15+
16+
if(NOT NFSCO_TARGET OR "${NFSCO_TARGET}" STREQUAL "")
17+
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_compile_options()")
18+
endif()
19+
20+
# include any extra options coming from any extra args?
21+
target_compile_options(${NFSCO_TARGET} PUBLIC ${NFSCO_EXTRA_COMPILE_OPTIONS} -Wall -Wextra -Werror -Wno-sign-compare -Wno-unused-parameter -Wshadow -Wimplicit-fallthrough -fshort-wchar -fno-builtin -fno-common -fno-exceptions -fcheck-new )
22+
23+
# this series has FPU
24+
target_compile_definitions(${NFSCO_TARGET} PUBLIC -DTARGET=esp32p4 -DUSE_FPU=TRUE -DPLATFORM_ESP32 -DESP_PLATFORM)
25+
26+
endmacro()
27+
28+
# TARGET parameter to set the target that's setting them for
29+
# optional EXTRA_LINK_FLAGS with link flags to be added
30+
macro(nf_set_link_options)
31+
32+
# parse arguments
33+
cmake_parse_arguments(NFSLO "" "TARGET;EXTRA_LINK_FLAGS" "" ${ARGN})
34+
35+
if(NOT NFSLO_TARGET OR "${NFSLO_TARGET}" STREQUAL "")
36+
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_link_options()")
37+
endif()
38+
39+
# set optimization linker flags for RELEASE and MinSizeRel
40+
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
41+
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os ")
42+
endif()
43+
44+
# include libraries in build
45+
nf_include_libraries_in_build(${NFSLO_TARGET})
46+
47+
# set extra linker flags
48+
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " ${NFSLO_EXTRA_LINK_FLAGS} ")
49+
50+
# set optimization flags
51+
nf_set_optimization_options(${NFSLO_TARGET})
52+
53+
endmacro()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#
2+
# Copyright (c) .NET Foundation and Contributors
3+
# See LICENSE file in the project root for full license information.
4+
#

CMake/Modules/FindESP32_IDF.cmake

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ FetchContent_GetProperties(esp32_idf)
99
include(binutils.ESP32)
1010

1111
list(APPEND ESP32_IDF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/config)
12-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/${TARGET_SERIES_SHORT})
13-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/${TARGET_SERIES_SHORT}/include)
1412
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/${TARGET_SERIES_SHORT}/esp_rom/include)
1513
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/${ESP32_CPU_TYPE}/include)
1614
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/${ESP32_CPU_TYPE}/${TARGET_SERIES_SHORT}/include)
@@ -21,21 +19,22 @@ list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/hal/includ
2119
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/hal/${TARGET_SERIES_SHORT}/include)
2220
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/soc/${TARGET_SERIES_SHORT}/include)
2321
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/soc/${TARGET_SERIES_SHORT}/include/soc)
22+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/soc/${TARGET_SERIES_SHORT}/register)
2423
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_hw_support/include)
24+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_hw_support/dma/include)
2525
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_hw_support/include/soc)
2626

27-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/include)
28-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/gptimer/include)
29-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/uart/include)
30-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/gpio/include)
31-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/spi/include)
27+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_gptimer/include)
28+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_uart/include)
29+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_gpio/include)
30+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_spi/include)
3231
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/i2c/include)
33-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/i2s/include)
34-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/dac/include)
35-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/ledc/include)
36-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/pcnt/include)
37-
#list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/rmt/include)
38-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/sdmmc/include)
32+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_i2s/include)
33+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_dac/include)
34+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_ledc/include)
35+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_pcnt/include)
36+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_sdmmc/include)
37+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_sdspi/include)
3938

4039
# Use depecated drivers for RMT, I2S etc
4140
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/deprecated)
@@ -58,6 +57,7 @@ list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_ringbu
5857
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_timer/include)
5958
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_system/include)
6059
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_wifi/include)
60+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_wifi/include/local)
6161
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_partition/include)
6262
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_pm/include)
6363
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/fatfs/diskio)
@@ -86,11 +86,12 @@ list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/sdmmc/incl
8686
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/soc/include)
8787
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/vfs/include)
8888
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/wear_levelling/include)
89-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/driver/usb_serial_jtag/include)
89+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_driver_usb_serial_jtag/include)
9090

91-
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_rom/include/${TARGET_SERIES_SHORT}/rom)
9291
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_rom/include)
9392
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_rom/${TARGET_SERIES_SHORT})
93+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_rom/${TARGET_SERIES_SHORT}/include)
94+
list(APPEND ESP32_IDF_INCLUDE_DIRS ${esp32_idf_SOURCE_DIR}/components/esp_rom/${TARGET_SERIES_SHORT}/include/${TARGET_SERIES_SHORT}/rom)
9495

9596
# includes specific to ESP32S2 and ESP32S3
9697
if(${TARGET_SERIES_SHORT} STREQUAL "esp32s2" OR ${TARGET_SERIES_SHORT} STREQUAL "esp32s3")

CMake/binutils.ESP32.cmake

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ macro(nf_fix_esp32c3_rom_file)
151151

152152
endmacro()
153153

154+
154155
# setting compile definitions for a target based on general build options
155156
# TARGET parameter to set the target that's setting them for
156157
# optional EXTRA_COMPILE_DEFINITIONS with compiler definitions to be added to the library
@@ -184,7 +185,7 @@ function(nf_set_esp32_target_series)
184185
set(TARGET_SERIES_SHORT ${TARGET_SERIES_2} CACHE INTERNAL "ESP32 target series lower case, short version")
185186

186187
# set the CPU type
187-
if(${TARGET_SERIES_SHORT} STREQUAL "esp32c3" OR ${TARGET_SERIES_SHORT} STREQUAL "esp32c6" OR ${TARGET_SERIES_SHORT} STREQUAL "esp32h2" )
188+
if(${TARGET_SERIES_SHORT} STREQUAL "esp32c3" OR ${TARGET_SERIES_SHORT} STREQUAL "esp32c5" OR ${TARGET_SERIES_SHORT} STREQUAL "esp32c6" OR ${TARGET_SERIES_SHORT} STREQUAL "esp32h2" OR ${TARGET_SERIES_SHORT} STREQUAL "esp32p4")
188189
set(ESP32_CPU_TYPE "riscv" CACHE INTERNAL "Setting CPU type")
189190
else()
190191
set(ESP32_CPU_TYPE "xtensa" CACHE INTERNAL "Setting CPU type")
@@ -466,8 +467,10 @@ macro(nf_setup_partition_tables_generator)
466467

467468
if(${TARGET_SERIES_SHORT} STREQUAL "esp32" OR
468469
${TARGET_SERIES_SHORT} STREQUAL "esp32c3" OR
470+
${TARGET_SERIES_SHORT} STREQUAL "esp32c5" OR
469471
${TARGET_SERIES_SHORT} STREQUAL "esp32c6" OR
470472
${TARGET_SERIES_SHORT} STREQUAL "esp32h2" OR
473+
${TARGET_SERIES_SHORT} STREQUAL "esp32p4" OR
471474
${TARGET_SERIES_SHORT} STREQUAL "esp32s2" OR
472475
${TARGET_SERIES_SHORT} STREQUAL "esp32s3")
473476

@@ -481,7 +484,9 @@ macro(nf_setup_partition_tables_generator)
481484
endif()
482485

483486
if(${TARGET_SERIES_SHORT} STREQUAL "esp32" OR
487+
${TARGET_SERIES_SHORT} STREQUAL "esp32c5" OR
484488
${TARGET_SERIES_SHORT} STREQUAL "esp32c6" OR
489+
${TARGET_SERIES_SHORT} STREQUAL "esp32p4" OR
485490
${TARGET_SERIES_SHORT} STREQUAL "esp32s2" OR
486491
${TARGET_SERIES_SHORT} STREQUAL "esp32s3")
487492

@@ -501,7 +506,8 @@ macro(nf_setup_partition_tables_generator)
501506

502507
endif()
503508

504-
if(${TARGET_SERIES_SHORT} STREQUAL "esp32s3")
509+
if(${TARGET_SERIES_SHORT} STREQUAL "esp32s3" OR
510+
${TARGET_SERIES_SHORT} STREQUAL "esp32p4")
505511

506512
# 32MB partition table for ESP32_S3
507513
add_custom_command( TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD
@@ -594,11 +600,16 @@ macro(nf_add_idf_as_library)
594600
# Load any required Components from Component registry
595601
# Must be done before "tools/cmake/idf.cmake"
596602
if(ESP32_USB_CDC)
597-
nf_install_idf_component_from_registry(tinyusb 55142eec-a3a4-47a5-ad01-4ba3ef44444b)
598-
nf_install_idf_component_from_registry(esp_tinyusb 8115ffc9-366a-4340-94ab-e327aed20831)
603+
nf_install_idf_component_from_registry(tinyusb c384401d-144d-453d-a821-20f1ba0a7be1)
604+
nf_install_idf_component_from_registry(esp_tinyusb 47b2b1fc-fb7e-4acf-943b-a14125e0f1e7)
599605
endif()
600606

601-
nf_install_idf_component_from_registry(littlefs 4831aa41-8b72-48ac-a534-910a985a5519)
607+
nf_install_idf_component_from_registry(littlefs 288ff2e7-dfd9-4833-9be5-6e9d37d29880)
608+
609+
if(${TARGET_SERIES_SHORT} STREQUAL "esp32p4")
610+
nf_install_idf_component_from_registry(esp_wifi_remote 3355c7e4-03ac-44a2-b100-1cbb29a05d03)
611+
nf_install_idf_component_from_registry(esp_hosted 9fb39051-7a32-4fbf-83e9-a4b54ab6fae5)
612+
endif()
602613

603614
include(${IDF_PATH_CMAKED}/tools/cmake/idf.cmake)
604615

@@ -611,6 +622,7 @@ macro(nf_add_idf_as_library)
611622
message(FATAL_ERROR "Couldn't get IDF version from target __idf_build_target")
612623
endif()
613624

625+
message(STATUS "ESP_IDF_VERSION: $ENV{ESP_IDF_VERSION}")
614626
message(STATUS "Current IDF version is: ${MY_IDF_VER}")
615627

616628
string(FIND ${MY_IDF_VER} "-dirty" MY_IDF_VER_DIRTY)
@@ -670,7 +682,6 @@ macro(nf_add_idf_as_library)
670682
freertos
671683
esptool_py
672684
fatfs
673-
esp_wifi
674685
esp_event
675686
vfs
676687
esp_netif
@@ -686,7 +697,6 @@ macro(nf_add_idf_as_library)
686697
idf::freertos
687698
idf::esptool_py
688699
idf::fatfs
689-
idf::esp_wifi
690700
idf::esp_event
691701
idf::vfs
692702
idf::esp_netif
@@ -695,6 +705,17 @@ macro(nf_add_idf_as_library)
695705
idf::littlefs
696706
)
697707

708+
# Needed for remote Wifi module on P4 boards
709+
if(${TARGET_SERIES_SHORT} STREQUAL "esp32p4")
710+
list(APPEND IDF_COMPONENTS_TO_ADD esp_wifi_remote)
711+
list(APPEND IDF_COMPONENTS_TO_ADD esp_hosted)
712+
list(APPEND IDF_LIBRARIES_TO_ADD idf::esp_hosted)
713+
list(APPEND IDF_LIBRARIES_TO_ADD idf::esp_wifi_remote)
714+
else()
715+
list(APPEND IDF_COMPONENTS_TO_ADD esp_wifi)
716+
list(APPEND IDF_LIBRARIES_TO_ADD idf::esp_wifi)
717+
endif()
718+
698719
if(HAL_USE_BLE_OPTION)
699720
list(APPEND IDF_COMPONENTS_TO_ADD bt)
700721
list(APPEND IDF_LIBRARIES_TO_ADD idf::bt)
@@ -1035,8 +1056,8 @@ macro(nf_add_idf_as_library)
10351056
add_custom_command(
10361057
TARGET ${NANOCLR_PROJECT_NAME}.elf POST_BUILD
10371058
COMMAND ${output_idf_size}
1038-
--archives --target ${TARGET_SERIES_SHORT} ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map
1039-
COMMENT "Ouptut IDF size summary")
1059+
--archives ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map
1060+
COMMENT "Output IDF size summary")
10401061

10411062
endmacro()
10421063

0 commit comments

Comments
 (0)