8000 esp32: Update port to support IDF v5.0.2. · projectgus/micropython@e465012 · GitHub
[go: up one dir, main page]

Skip to content

Commit e465012

Browse files
committed
esp32: Update port to support IDF v5.0.2.
This commit updates the esp32 port to work exclusively with ESP-IDF v5. IDF v5 is needed for some of the newer ESP32 SoCs to work, and it also cleans up a lot of the inconsistencies between existing SoCs (eg S2, S3, and C3). Support for IDF v4 is dropped because it's a lot of effort to maintain both versions at the same time. The following components have been verified to work on the various SoCs: ESP32 ESP32-S2 ESP32-S3 ESP32-C3 build pass pass pass pass SPIRAM pass pass pass N/A REPL (UART) pass pass pass pass REPL (USB) N/A pass pass N/A filesystem pass pass pass pass GPIO pass pass pass pass SPI pass pass pass pass I2C pass pass pass pass PWM pass pass pass pass ADC pass pass pass pass WiFi STA pass pass pass pass WiFi AP pass pass pass pass BLE pass N/A pass pass ETH pass -- -- -- PPP pass pass pass -- sockets pass pass pass pass SSL pass ENOMEM pass pass RMT pass pass pass pass NeoPixel pass pass pass pass I2S pass pass pass N/A ESPNow pass pass pass pass ULP-FSM pass pass pass N/A SDCard pass N/A N/A pass WDT pass pass pass pass Signed-off-by: Damien George <damien@micropython.org> Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
1 parent 2af229c commit e465012

Some content is hidden

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

68 files changed

+485
-675
lines changed

ports/esp32/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dependencies.lock
2+
managed_components/

ports/esp32/CMakeLists.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
1515
message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}")
1616
endif()
1717

18-
# Include main IDF cmake file.
19-
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
20-
2118
# Define the output sdkconfig so it goes in the build directory.
2219
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
2320

2421
# Save the manifest file set from the cmake command line.
2522
set(MICROPY_USER_FROZEN_MANIFEST ${MICROPY_FROZEN_MANIFEST})
2623

27-
# Include board config; this is expected to set SDKCONFIG_DEFAULTS (among other options).
24+
# Include board config; this is expected to set (among other options):
25+
# - SDKCONFIG_DEFAULTS
26+
# - IDF_TARGET
2827
include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
2928

3029
# Set the frozen manifest file. Note if MICROPY_FROZEN_MANIFEST is set from the cmake
@@ -35,13 +34,6 @@ elseif (NOT MICROPY_FROZEN_MANIFEST)
3534
set(MICROPY_FROZEN_MANIFEST ${CMAKE_CURRENT_LIST_DIR}/boards/manifest.py)
3635
endif()
3736

38-
# Add sdkconfig fragments that depend on the IDF version.
39-
if(IDF_VERSION_MAJOR EQUAL 4 AND IDF_VERSION_MINOR LESS 2)
40-
set(SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core0)
41-
else()
42-
set(SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core1)
43-
endif()
44-
4537
# Concatenate all sdkconfig files into a combined one for the IDF to use.
4638
file(WRITE ${CMAKE_BINARY_DIR}/sdkconfig.combined.in "")
4739
foreach(SDKCONFIG_DEFAULT ${SDKCONFIG_DEFAULTS})
@@ -51,5 +43,11 @@ endforeach()
5143
configure_file(${CMAKE_BINARY_DIR}/sdkconfig.combined.in ${CMAKE_BINARY_DIR}/sdkconfig.combined COPYONLY)
5244
set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined)
5345

46+
# Include main IDF cmake file.
47+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
48+
49+
# Set the location of the main component for the project (one per target).
50+
set(EXTRA_COMPONENT_DIRS main_${IDF_TARGET})
51+
5452
# Define the project.
5553
project(micropython)

ports/esp32/README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ Initial development of this ESP32 port was sponsored in part by Microbric Pty Lt
2222
Setting up ESP-IDF and the build environment
2323
--------------------------------------------
2424

25-
MicroPython on ESP32 requires the Espressif IDF version 4 (IoT development
25+
MicroPython on ESP32 requires the Espressif IDF version 5 (IoT development
2626
framework, aka SDK). The ESP-IDF includes the libraries and RTOS needed to
2727
manage the ESP32 microcontroller, as well as a way to manage the required
2828
build environment and toolchains needed to build the firmware.
2929

3030
The ESP-IDF changes quickly and MicroPython only supports certain versions.
31-
Currently MicroPython supports v4.0.2, v4.1.1, v4.2.2, v4.3.2 and v4.4,
31+
Currently MicroPython supports v5.0.2,
3232
although other IDF v4 versions may also work.
3333

3434
To install the ESP-IDF the full instructions can be found at the
@@ -47,10 +47,10 @@ The steps to take are summarised below.
4747
To check out a copy of the IDF use git clone:
4848

4949
```bash
50-
$ git clone -b v4.0.2 --recursive https://github.com/espressif/esp-idf.git
50+
$ git clone -b v5.0.2 --recursive https://github.com/espressif/esp-idf.git
5151
```
5252

53-
You can replace `v4.0.2` with `v4.2.2` or `v4.4` or any other supported version.
53+
You can replace `v5.0.2` with any other supported version.
5454
(You don't need a full recursive clone; see the `ci_esp32_setup` function in
5555
`tools/ci.sh` in this repository for more detailed set-up commands.)
5656

@@ -59,7 +59,7 @@ MicroPython and update the submodules using:
5959

6060
```bash
6161
$ cd esp-idf
62-
$ git checkout v4.2
62+
$ git checkout v5.0.2
6363
$ git submodule update --init --recursive
6464
```
6565

@@ -75,11 +75,6 @@ $ source export.sh # (or export.bat on Windows)
7575
The `install.sh` step only needs to be done once. You will need to source
7676
`export.sh` for every new session.
7777

78-
**Note:** If you are building MicroPython for the ESP32-S2, ESP32-C3 or ESP32-S3,
79-
please ensure you are using the following required IDF versions:
80-
- ESP32-S3 currently requires `v4.4` or later.
81-
- ESP32-S2 and ESP32-C3 require `v4.3.1` or later.
82-
8378
Building the firmware
8479
---------------------
8580

ports/esp32/boards/ESP32_S2_WROVER/sdkconfig.board

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CONFIG_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
43
CONFIG_ESPTOOLPY_AFTER_NORESET=y
54

65
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
CONFIG_ESP32C3_REV_MIN_3=y
2-
CONFIG_ESP32C3_REV_MIN=3
32
CONFIG_ESP32C3_BROWNOUT_DET=y
43
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7=
54
CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_4=y
65
CONFIG_ESP32C3_BROWNOUT_DET_LVL=4
76
CONFIG_ESP_CONSOLE_UART_DEFAULT=
8-
CONFIG_ESP_CONSOLE_USB_CDC=
97
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y

ports/esp32/boards/GENERIC_D2WD/sdkconfig.board

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Optimise using -Os to reduce size
22
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
33
CONFIG_COMPILER_OPTIMIZATION_PERF=n
4+
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
45

56
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
67
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y

ports/esp32/boards/GENERIC_S3/sdkconfig.board

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
CONFIG_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
43
CONFIG_ESPTOOLPY_AFTER_NORESET=y
54

6-
CONFIG_SPIRAM_MEMTEST=
7-
85
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
96
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
107
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=

ports/esp32/boards/GENERIC_S3_SPIRAM/sdkconfig.board

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
CONFIG_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
43
CONFIG_ESPTOOLPY_AFTER_NORESET=y
54

6-
CONFIG_SPIRAM_MEMTEST=
7-
85
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
96
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
107
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=

ports/esp32/boards/GENERIC_S3_SPIRAM_OCT/sdkconfig.board

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
CONFIG_FLASHMODE_QIO=y
22
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
3-
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
43
CONFIG_ESPTOOLPY_AFTER_NORESET=y
54

6-
CONFIG_SPIRAM_MEMTEST=
7-
85
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
96
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
107
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=

ports/esp32/boards/GENERIC_SPIRAM/mpconfigboard.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ set(SDKCONFIG_DEFAULTS
22
boards/sdkconfig.base
33
boards/sdkconfig.ble
44
boards/sdkconfig.spiram
5-
boards/GENERIC_SPIRAM/sdkconfig.board
65
)

0 commit comments

Comments
 (0)
0