Skip to content

Update to IDF 5.4.2 and add basic ESP32_P4 support #3152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
099c96e
Update to IDF 5.4.1 and add basic ESP32_P4
AdrianSoundy Dec 12, 2024
800ba69
Code style fixes
nfbot Apr 12, 2025
54788dc
Fix Coderabbit issues and add P4 to Azure build
AdrianSoundy Apr 12, 2025
df02c9a
Add back mbedtls_xxx for some STM32 targets
AdrianSoundy Apr 14, 2025
d3146c6
Update patch version and python env for dockers
AdrianSoundy Apr 18, 2025
0d90296
Add libusb to docker for openocd
AdrianSoundy Apr 22, 2025
d883b97
Work around for ESP_ROM_ELF_DIR issue
AdrianSoundy Apr 22, 2025
25ce6f4
Correcting typos
josesimoes Apr 22, 2025
250f3fd
Resolve smoketest builds, header not found
AdrianSoundy Apr 23, 2025
ef76ed0
IDF 5_4_1 patch test
AdrianSoundy Apr 26, 2025
13c0a4d
Updates from review part 1
AdrianSoundy Apr 26, 2025
735562d
Updates for review part 2
AdrianSoundy Apr 29, 2025
780dbd6
Ethernet and build rework
AdrianSoundy Apr 30, 2025
92d8787
Update Component registry versions to latest
AdrianSoundy Apr 30, 2025
a4f373c
Update Graphics_Memory.cpp code to same version for all ESP targets
AdrianSoundy May 1, 2025
d6fd18d
Add extra p4 config for latest hosted component
AdrianSoundy May 6, 2025
5688c45
Update P4 config & readme
AdrianSoundy May 10, 2025
638bd4f
Change Wifi-remote & esp_hosted component versions used
AdrianSoundy May 10, 2025
aefc820
Update sdkconfig.default.esp32p4
AdrianSoundy May 13, 2025
1ad0ce2
Add Wi-Fi Remote config for better performance on p4
AdrianSoundy May 15, 2025
fe74b8c
Initial ESP32_C5 build + Build diagnostic message
AdrianSoundy May 24, 2025
ddbf89a
Add ESP_IDF_VERSION to p4 environment as test
AdrianSoundy May 31, 2025
575aebb
Update to IDF 5.4.1 and add basic ESP32_P4
AdrianSoundy Dec 12, 2024
636fb04
Fix Coderabbit issues and add P4 to Azure build
AdrianSoundy Apr 12, 2025
01d9cf6
Add back mbedtls_xxx for some STM32 targets
AdrianSoundy Apr 14, 2025
a8c8989
Work around for ESP_ROM_ELF_DIR issue
AdrianSoundy Apr 22, 2025
e296041
Resolve smoketest builds, header not found
AdrianSoundy Apr 23, 2025
8616cdf
IDF 5_4_1 patch test
AdrianSoundy Apr 26, 2025
a1271fc
Updates from review part 1
AdrianSoundy Apr 26, 2025
4077404
Updates for review part 2
AdrianSoundy Apr 29, 2025
2d449b2
Add extra p4 config for latest hosted component
AdrianSoundy May 6, 2025
ad20f01
Update P4 config & readme
AdrianSoundy May 10, 2025
05efb83
Update to IDF 5.4.2
AdrianSoundy Jul 24, 2025
6ce22d7
Code style fixes
nfbot Jul 24, 2025
d448df2
Merge pull request #10 from nanoframework/nfbot/clang-format-fix/8d2f…
AdrianSoundy Jul 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .devcontainer/All/Dockerfile.All.SRC
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ RUN apt-get update \
ninja-build \
srecord \
nodejs \
libffi-dev
libffi-dev \
libusb-1.0

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

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

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

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

ENV PATH=/root/.espressif/python_env/idf5.2_py3.11_env/bin:$PATH:\
ENV PATH=/root/.espressif/python_env/idf5.4_py3.11_env/bin:$PATH:\
$IDF_PATH/components/esptool_py/esptool:\
$IDF_PATH/components/espcoredump:\
$IDF_PATH/components/partition_table/:\
Expand Down
9 changes: 5 additions & 4 deletions .devcontainer/ESP32/Dockerfile.ESP32.SRC
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ RUN apt-get update \
ninja-build \
srecord \
nodejs \
libffi-dev
libffi-dev \
libusb-1.0

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

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

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

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

ENV PATH=/root/.espressif/python_env/idf5.2_py3.11_env/bin:$PATH:\
ENV PATH=/root/.espressif/python_env/idf5.4_py3.11_env/bin:$PATH:\
$IDF_PATH/components/esptool_py/esptool:\
$IDF_PATH/components/espcoredump:\
$IDF_PATH/components/partition_table/:\
Expand Down
12 changes: 11 additions & 1 deletion .vscode/tasks.TEMPLATE.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@
{
"label": "Flash nanoCLR to ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S3",
"type": "shell",
"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",
"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",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"problemMatcher": []
},
{
"label": "Flash nanoCLR to ESP32-P4",
"type": "shell",
"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",
"presentation": {
"reveal": "always",
"panel": "shared"
Expand Down
184 changes: 184 additions & 0 deletions .vscode/tasks.TEMPLATE.json.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Install nanoFramework tools",
"type": "shell",
"group": "none",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"command": "install-scripts\\install-nf-tools.ps1 -TargetSeries ${input:targetSeries} -Path '${input:toolsPath}' "
},
{
"label": "Flash nanoCLR to ESP32 | ESP32-S2",
"type": "shell",
"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 0x1000 ${workspaceFolder}/build/bootloader/bootloader.bin 0x10000 ${workspaceFolder}/build/nanoCLR.bin 0x8000 ${workspaceFolder}/build/partitions_${input:esp32Partitions}.bin",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"problemMatcher": []
},
{
"label": "Flash nanoCLR to ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S3",
"type": "shell",
"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",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"problemMatcher": []
},
{
"label": "Erase ESP32 flash",
"type": "shell",
"command": "python ${env:IDF_PATH}/components/esptool_py/esptool/esptool.py --chip auto --port \"${input:comPort}\" --baud 1500000 --before \"default_reset\" --after \"hard_reset\" erase_flash",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"problemMatcher": []
},
{
"label": "Decode ESP32 backtrace",
"type": "shell",
"command": "xtensa-${input:esp32series}-elf-addr2line -apsfCire \"${input:espBacktraceElfFile}\" \"${input:espBacktrace}\"",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"problemMatcher": []
},
{
"label": "Decode ESP32 (riscv32 series) backtrace",
"type": "shell",
"command": "riscv32-esp-elf-addr2line -apsfCire \"${input:espBacktraceElfFile}\" \"${input:espBacktrace}\"",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"problemMatcher": []
},
{
"label": "Flash MIMXRT1060",
"type": "shell",
"command": "C:/nxp/MCUXpressoIDE_10.2.1_795/ide/bin/crt_emu_cm_redlink.exe",
"options": {
"cwd": "${workspaceFolder}/Build"
},
"args": [
"-pMIMXRT1062xxxxA",
"--vendor=NXP",
"--flash-dir=C:/nxp/MCUXpressoIDE_10.2.1_795/ide/bin/Flash",
"--flash-driver=MIMXRT1060_SFDP_QSPI.cfx",
"--flash-load=nanoBooter.elf",
"--rst"
],
"presentation": {
"reveal": "always",
"panel": "dedicated"
},
"problemMatcher": []
},
{
"label": "Erase flash Silabs GG11",
"type": "shell",
"command": "${env:JLINK_PATH}/Jlink.exe -device default -si swd -CommandFile ${workspaceRoot}/.jlink/erase_gg11.jlink",
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/c"
]
}
}
},
"problemMatcher": []
},
{
"label": "Flash Silabs GG11",
"type": "shell",
"command": "${env:JLINK_PATH}/Jlink.exe -device default -si swd -CommandFile ${workspaceRoot}/.jlink/flash_gg11.jlink",
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/c"
]
},
"cwd": "${workspaceFolder}/Build"
}
},
"problemMatcher": []
}
],
"inputs": [
{
"id": "toolsPath",
"type": "promptString",
"default": "C:\nftools",
"description": "Path where to install the tools."
},
{
"id": "targetSeries",
"type": "pickString",
"description": "Series of the target to install the tools for.",
"options": [
"ESP32",
"STM32",
"NXP",
"TI"
]
},
{
"id": "comPort",
"type": "promptString",
"default": "COM1",
"description": "COM port of the ESP32 device."
},
{
"id": "esp32Partitions",
"type": "pickString",
"description": "Partition to flash to ESP32.",
"default": "4mb",
"options": [
"2mb",
"4mb",
"8mb",
"16mb",
"32mb"
]
},
{
"id": "esp32series",
"type": "pickString",
"description": "ESP32 series",
"default": "esp32",
"options": [
"esp32",
"esp32s2",
"esp32s3"
]
},
{
"id": "espBacktrace",
"type": "promptString",
"default": "",
"description": "Backtrace information from 'Guru Meditation Error' output. *** JUST THE BACKTRACE line, NOT the whole output! ***"
},
{
"id": "espBacktraceElfFile",
"type": "promptString",
"default": "${workspaceFolder}/build/nanoCLR.elf",
"description": "Path to ELF file. Default is the current build executable."
}
]
}
53 changes: 53 additions & 0 deletions CMake/Modules/ESP32_C5_GCC_options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#

# need to specify linker flags here
set(CMAKE_EXE_LINKER_FLAGS " -Wl,--print-memory-usage " CACHE INTERNAL "executable linker flags")

# TARGET parameter to set the target that's setting them for
# optional EXTRA_COMPILE_OPTIONS with compile options to be added
macro(nf_set_compile_options)

# parse arguments
cmake_parse_arguments(NFSCO "" "TARGET" "EXTRA_COMPILE_OPTIONS" ${ARGN})

if(NOT NFSCO_TARGET OR "${NFSCO_TARGET}" STREQUAL "")
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_compile_options()")
endif()

# include any extra options coming from any extra args?
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 )

# this series has FPU
target_compile_definitions(${NFSCO_TARGET} PUBLIC -DTARGET=esp32c6 -DUSE_FPU=TRUE -DPLATFORM_ESP32 -DESP_PLATFORM)

endmacro()

# TARGET parameter to set the target that's setting them for
# optional EXTRA_LINK_FLAGS with link flags to be added
macro(nf_set_link_options)

# parse arguments
cmake_parse_arguments(NFSLO "" "TARGET;EXTRA_LINK_FLAGS" "" ${ARGN})

if(NOT NFSLO_TARGET OR "${NFSLO_TARGET}" STREQUAL "")
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_link_options()")
endif()

# set optimization linker flags for RELEASE and MinSizeRel
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os ")
endif()

# include libraries in build
nf_include_libraries_in_build(${NFSLO_TARGET})

# set extra linker flags
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " ${NFSLO_EXTRA_LINK_FLAGS} ")

# set optimization flags
nf_set_optimization_options(${NFSLO_TARGET})

endmacro()
4 changes: 4 additions & 0 deletions CMake/Modules/ESP32_C5_sources.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#
53 changes: 53 additions & 0 deletions CMake/Modules/ESP32_P4_GCC_options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#

# need to specify linker flags here
set(CMAKE_EXE_LINKER_FLAGS " -Wl,--print-memory-usage " CACHE INTERNAL "executable linker flags")

# TARGET parameter to set the target that's setting them for
# optional EXTRA_COMPILE_OPTIONS with compile options to be added
macro(nf_set_compile_options)

# parse arguments
cmake_parse_arguments(NFSCO "" "TARGET" "EXTRA_COMPILE_OPTIONS" ${ARGN})

if(NOT NFSCO_TARGET OR "${NFSCO_TARGET}" STREQUAL "")
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_compile_options()")
endif()

# include any extra options coming from any extra args?
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 )

# this series has FPU
target_compile_definitions(${NFSCO_TARGET} PUBLIC -DTARGET=esp32p4 -DUSE_FPU=TRUE -DPLATFORM_ESP32 -DESP_PLATFORM)

endmacro()

# TARGET parameter to set the target that's setting them for
# optional EXTRA_LINK_FLAGS with link flags to be added
macro(nf_set_link_options)

# parse arguments
cmake_parse_arguments(NFSLO "" "TARGET;EXTRA_LINK_FLAGS" "" ${ARGN})

if(NOT NFSLO_TARGET OR "${NFSLO_TARGET}" STREQUAL "")
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_link_options()")
endif()

# set optimization linker flags for RELEASE and MinSizeRel
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os ")
endif()

# include libraries in build
nf_include_libraries_in_build(${NFSLO_TARGET})

# set extra linker flags
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " ${NFSLO_EXTRA_LINK_FLAGS} ")

# set optimization flags
nf_set_optimization_options(${NFSLO_TARGET})

endmacro()
4 changes: 4 additions & 0 deletions CMake/Modules/ESP32_P4_sources.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#
Loading