From 95ae8cf9c63e3045034cdbc7b642d9bd0c5148b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Andr=C3=BDsek?= Date: Mon, 23 Jun 2025 14:02:47 +0200 Subject: [PATCH 1/8] feat(test): Enhance NVS test (#11481) * feat(test): Enhance NVS test * fix(nvs): Remove unused Unity header and improve Serial wait loop * refactor(nvs): Extract string increment logic into a separate function * refactor(test): Format long strings in expect_exact calls for better readability --- tests/validation/nvs/nvs.ino | 132 +++++++++++++++++++++++++++---- tests/validation/nvs/test_nvs.py | 24 ++++-- 2 files changed, 136 insertions(+), 20 deletions(-) diff --git a/tests/validation/nvs/nvs.ino b/tests/validation/nvs/nvs.ino index 20b5b4600..12c640c65 100644 --- a/tests/validation/nvs/nvs.ino +++ b/tests/validation/nvs/nvs.ino @@ -1,35 +1,139 @@ +#include #include +struct TestData { + uint8_t id; + uint16_t value; +}; + Preferences preferences; +void validate_types() { + assert(preferences.getType("char") == PT_I8); + assert(preferences.getType("uchar") == PT_U8); + assert(preferences.getType("short") == PT_I16); + assert(preferences.getType("ushort") == PT_U16); + assert(preferences.getType("int") == PT_I32); + assert(preferences.getType("uint") == PT_U32); + assert(preferences.getType("long") == PT_I32); + assert(preferences.getType("ulong") == PT_U32); + assert(preferences.getType("long64") == PT_I64); + assert(preferences.getType("ulong64") == PT_U64); + assert(preferences.getType("float") == PT_BLOB); + assert(preferences.getType("double") == PT_BLOB); + assert(preferences.getType("bool") == PT_U8); + assert(preferences.getType("str") == PT_STR); + assert(preferences.getType("strLen") == PT_STR); + assert(preferences.getType("struct") == PT_BLOB); +} + +// Function to increment string values +void incrementStringValues(String &val_string, char *val_string_buf, size_t buf_size) { + // Extract the number from string and increment it + val_string = "str" + String(val_string.substring(3).toInt() + 1); + + // Extract the number from strLen and increment it + String strLen_str = String(val_string_buf); + int strLen_num = strLen_str.substring(6).toInt(); + snprintf(val_string_buf, buf_size, "strLen%d", strLen_num + 1); +} + void setup() { Serial.begin(115200); - while (!Serial) { ; } preferences.begin("my-app", false); - // Get the counter value, if the key does not exist, return a default value of 0 - unsigned int counter = preferences.getUInt("counter", 0); + // Get the preferences value and if not exists, use default parameter + char val_char = preferences.getChar("char", 'A'); + unsigned char val_uchar = preferences.getUChar("uchar", 0); + int16_t val_short = preferences.getShort("short", 0); + uint16_t val_ushort = preferences.getUShort("ushort", 0); + int32_t val_int = preferences.getInt("int", 0); + uint32_t val_uint = preferences.getUInt("uint", 0); + int64_t val_long = preferences.getLong("long", 0); + uint32_t val_ulong = preferences.getULong("ulong", 0); + int64_t val_long64 = preferences.getLong64("long64", 0); + uint64_t val_ulong64 = preferences.getULong64("ulong64", 0); + float val_float = preferences.getFloat("float", 0.0f); + double val_double = preferences.getDouble("double", 0.0); + bool val_bool = preferences.getBool("bool", false); - // Print the counter to Serial Monitor - Serial.printf("Current counter value: %u\n", counter); + // Strings + String val_string = preferences.getString("str", "str0"); + char val_string_buf[20] = "strLen0"; + preferences.getString("strLen", val_string_buf, sizeof(val_string_buf)); - // Increase counter by 1 - counter++; + // Structure data + TestData test_data = {0, 0}; - // Store the counter to the Preferences - preferences.putUInt("counter", counter); + size_t struct_size = preferences.getBytes("struct", &test_data, sizeof(test_data)); + if (struct_size == 0) { + // First time - set initial values using parameter names + test_data.id = 1; + test_data.value = 100; + } - // Close the Preferences + Serial.printf("Values from Preferences: "); + Serial.printf("char: %c | uchar: %u | short: %d | ushort: %u | int: %ld | uint: %lu | ", val_char, val_uchar, val_short, val_ushort, val_int, val_uint); + Serial.printf("long: %lld | ulong: %lu | long64: %lld | ulong64: %llu | ", val_long, val_ulong, val_long64, val_ulong64); + Serial.printf( + "float: %.2f | double: %.2f | bool: %s | str: %s | strLen: %s | struct: {id:%u,val:%u}\n", val_float, val_double, val_bool ? "true" : "false", + val_string.c_str(), val_string_buf, test_data.id, test_data.value + ); + + // Increment the values + val_char += 1; // Increment char A -> B + val_uchar += 1; + val_short += 1; + val_ushort += 1; + val_int += 1; + val_uint += 1; + val_long += 1; + val_ulong += 1; + val_long64 += 1; + val_ulong64 += 1; + val_float += 1.1f; + val_double += 1.1; + val_bool = !val_bool; // Toggle boolean value + + // Increment string values using function + incrementStringValues(val_string, val_string_buf, sizeof(val_string_buf)); + + test_data.id += 1; + test_data.value += 10; + + // Store the updated values back to Preferences + preferences.putChar("char", val_char); + preferences.putUChar("uchar", val_uchar); + preferences.putShort("short", val_short); + preferences.putUShort("ushort", val_ushort); + preferences.putInt("int", val_int); + preferences.putUInt("uint", val_uint); + preferences.putLong("long", val_long); + preferences.putULong("ulong", val_ulong); + preferences.putLong64("long64", val_long64); + preferences.putULong64("ulong64", val_ulong64); + preferences.putFloat("float", val_float); + preferences.putDouble("double", val_double); + preferences.putBool("bool", val_bool); + preferences.putString("str", val_string); + preferences.putString("strLen", val_string_buf); + preferences.putBytes("struct", &test_data, sizeof(test_data)); + + // Check if the keys exist + assert(preferences.isKey("char")); + assert(preferences.isKey("struct")); + + // Validate the types of the keys + validate_types(); + + // Close the Preferences, wait and restart preferences.end(); - - // Wait 1 second + Serial.flush(); delay(1000); - - // Restart ESP ESP.restart(); } diff --git a/tests/validation/nvs/test_nvs.py b/tests/validation/nvs/test_nvs.py index 424095a49..7f595b8e9 100644 --- a/tests/validation/nvs/test_nvs.py +++ b/tests/validation/nvs/test_nvs.py @@ -4,11 +4,23 @@ import logging def test_nvs(dut): LOGGER = logging.getLogger(__name__) - LOGGER.info("Expecting counter value 0") - dut.expect_exact("Current counter value: 0") + LOGGER.info("Expecting default values from Preferences") + dut.expect_exact( + "Values from Preferences: char: A | uchar: 0 | short: 0 | ushort: 0 | int: 0 | uint: 0 | long: 0 | ulong: 0 | " + "long64: 0 | ulong64: 0 | float: 0.00 | double: 0.00 | bool: false | str: str0 | strLen: strLen0 | " + "struct: {id:1,val:100}" + ) - LOGGER.info("Expecting counter value 1") - dut.expect_exact("Current counter value: 1") + LOGGER.info("Expecting updated preferences for the first time") + dut.expect_exact( + "Values from Preferences: char: B | uchar: 1 | short: 1 | ushort: 1 | int: 1 | uint: 1 | long: 1 | ulong: 1 | " + "long64: 1 | ulong64: 1 | float: 1.10 | double: 1.10 | bool: true | str: str1 | strLen: strLen1 | " + "struct: {id:2,val:110}" + ) - LOGGER.info("Expecting counter value 2") - dut.expect_exact("Current counter value: 2") + LOGGER.info("Expecting updated preferences for the second time") + dut.expect_exact( + "Values from Preferences: char: C | uchar: 2 | short: 2 | ushort: 2 | int: 2 | uint: 2 | long: 2 | ulong: 2 | " + "long64: 2 | ulong64: 2 | float: 2.20 | double: 2.20 | bool: false | str: str2 | strLen: strLen2 | " + "struct: {id:3,val:120}" + ) From bad975daa5910b42b48f9f1eda6154c45eb18e6f Mon Sep 17 00:00:00 2001 From: Sugar Glider Date: Tue, 24 Jun 2025 03:37:07 -0300 Subject: [PATCH 2/8] fix(uart): removes assert() to avoid reset (#11508) --- cores/esp32/esp32-hal-uart.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 2163e9b5f..21fe88b57 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -305,7 +305,10 @@ static bool _uartTrySetIomuxPin(uart_port_t uart_num, int io_num, uint32_t idx) } // Assign the correct function to the GPIO. - assert(upin->iomux_func != -1); + if (upin->iomux_func == -1) { + log_e("IO#%d has bad IOMUX internal information. Switching to GPIO Matrix UART function.", io_num); + return false; + } if (uart_num < SOC_UART_HP_NUM) { gpio_iomux_out(io_num, upin->iomux_func, false); // If the pin is input, we also have to redirect the signal, in order to bypass the GPIO matrix. From 882ef25a36399e3c32fc16986f00edddd3324d5a Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 23 Jun 2025 12:11:32 +0300 Subject: [PATCH 3/8] fix(p4): Update hosted and wifi_remote components --- idf_component.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idf_component.yml b/idf_component.yml index 7f090cb26..450929a40 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -105,11 +105,11 @@ dependencies: rules: - if: "target in [esp32s3]" espressif/esp_hosted: - version: "^0.0.25" + version: "^2.0.12" rules: - if: "target == esp32p4" espressif/esp_wifi_remote: - version: "^0.4.1" + version: "^0.13.0" rules: - if: "target == esp32p4" espressif/libsodium: From b7e5169ea17eabedb82171457f08f43c72bd2c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 24 Jun 2025 13:43:05 +0200 Subject: [PATCH 4/8] fix(spi): Update spi bus for esp32s2 (#11510) --- cores/esp32/esp32-hal-spi.c | 32 ++++++++++++-------------------- cores/esp32/esp32-hal-spi.h | 12 +++--------- libraries/SD/src/SD.cpp | 4 +++- libraries/SPI/src/SPI.cpp | 1 + 4 files changed, 19 insertions(+), 30 deletions(-) diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 6b8e3f8c0..d39aceb5f 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -79,16 +79,15 @@ struct spi_struct_t { #if CONFIG_IDF_TARGET_ESP32S2 // ESP32S2 -#define SPI_COUNT (3) +#define SPI_COUNT (2) -#define SPI_CLK_IDX(p) ((p == 0) ? SPICLK_OUT_MUX_IDX : ((p == 1) ? FSPICLK_OUT_MUX_IDX : ((p == 2) ? SPI3_CLK_OUT_MUX_IDX : 0))) -#define SPI_MISO_IDX(p) ((p == 0) ? SPIQ_OUT_IDX : ((p == 1) ? FSPIQ_OUT_IDX : ((p == 2) ? SPI3_Q_OUT_IDX : 0))) -#define SPI_MOSI_IDX(p) ((p == 0) ? SPID_IN_IDX : ((p == 1) ? FSPID_IN_IDX : ((p == 2) ? SPI3_D_IN_IDX : 0))) +#define SPI_CLK_IDX(p) ((p == 0) ? FSPICLK_OUT_MUX_IDX : ((p == 1) ? SPI3_CLK_OUT_MUX_IDX : 0)) +#define SPI_MISO_IDX(p) ((p == 0) ? FSPIQ_OUT_IDX : ((p == 1) ? SPI3_Q_OUT_IDX : 0)) +#define SPI_MOSI_IDX(p) ((p == 0) ? FSPID_IN_IDX : ((p == 1) ? SPI3_D_IN_IDX : 0)) -#define SPI_SPI_SS_IDX(n) ((n == 0) ? SPICS0_OUT_IDX : ((n == 1) ? SPICS1_OUT_IDX : 0)) -#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : ((n == 2) ? SPI3_CS2_OUT_IDX : SPI3_CS0_OUT_IDX))) -#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : ((n == 2) ? FSPICS2_OUT_IDX : FSPICS0_OUT_IDX))) -#define SPI_SS_IDX(p, n) ((p == 0) ? SPI_SPI_SS_IDX(n) : ((p == 1) ? SPI_SPI_SS_IDX(n) : ((p == 2) ? SPI_HSPI_SS_IDX(n) : 0))) +#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : ((n == 2) ? SPI3_CS2_OUT_IDX : 0))) +#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : ((n == 2) ? FSPICS2_OUT_IDX : 0))) +#define SPI_SS_IDX(p, n) ((p == 0) ? SPI_FSPI_SS_IDX(n) : ((p == 1) ? SPI_HSPI_SS_IDX(n) : 0)) #elif CONFIG_IDF_TARGET_ESP32S3 // ESP32S3 @@ -98,8 +97,8 @@ struct spi_struct_t { #define SPI_MISO_IDX(p) ((p == 0) ? FSPIQ_OUT_IDX : ((p == 1) ? SPI3_Q_OUT_IDX : 0)) #define SPI_MOSI_IDX(p) ((p == 0) ? FSPID_IN_IDX : ((p == 1) ? SPI3_D_IN_IDX : 0)) -#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : 0)) -#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : 0)) +#define SPI_HSPI_SS_IDX(n) ((n == 0) ? SPI3_CS0_OUT_IDX : ((n == 1) ? SPI3_CS1_OUT_IDX : ((n == 2) ? SPI3_CS2_OUT_IDX : 0))) +#define SPI_FSPI_SS_IDX(n) ((n == 0) ? FSPICS0_OUT_IDX : ((n == 1) ? FSPICS1_OUT_IDX : ((n == 2) ? FSPICS2_OUT_IDX : 0))) #define SPI_SS_IDX(p, n) ((p == 0) ? SPI_FSPI_SS_IDX(n) : ((p == 1) ? SPI_HSPI_SS_IDX(n) : 0)) #elif CONFIG_IDF_TARGET_ESP32P4 @@ -151,11 +150,7 @@ struct spi_struct_t { #define SPI_MUTEX_UNLOCK() // clang-format off static spi_t _spi_bus_array[] = { -#if CONFIG_IDF_TARGET_ESP32S2 - {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), 0, -1, -1, -1, -1, false}, - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 1, -1, -1, -1, -1, false}, - {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 2, -1, -1, -1, -1, false} -#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32S2 ||CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1, false}, {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 1, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32C2 @@ -179,11 +174,7 @@ static spi_t _spi_bus_array[] = { #define SPI_MUTEX_UNLOCK() xSemaphoreGive(spi->lock) static spi_t _spi_bus_array[] = { -#if CONFIG_IDF_TARGET_ESP32S2 - {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), NULL, 0, -1, -1, -1, -1, false}, - {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 1, -1, -1, -1, -1, false}, - {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 2, -1, -1, -1, -1, false} -#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false}, {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 1, -1, -1, -1, -1, false} #elif CONFIG_IDF_TARGET_ESP32C2 {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1, false} @@ -621,6 +612,7 @@ void spiStopBus(spi_t *spi) { spi_t *spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_t bitOrder) { if (spi_num >= SPI_COUNT) { + log_e("SPI bus index %d is out of range", spi_num); return NULL; } diff --git a/cores/esp32/esp32-hal-spi.h b/cores/esp32/esp32-hal-spi.h index 565ca43f6..0284fea88 100644 --- a/cores/esp32/esp32-hal-spi.h +++ b/cores/esp32/esp32-hal-spi.h @@ -27,19 +27,13 @@ extern "C" { #include #define SPI_HAS_TRANSACTION - -#ifdef CONFIG_IDF_TARGET_ESP32S2 -#define FSPI 1 //SPI 1 bus. ESP32S2: for external memory only (can use the same data lines but different SS) -#define HSPI 2 //SPI 2 bus. ESP32S2: external memory or device - it can be matrixed to any pins -#define SPI2 2 // Another name for ESP32S2 SPI 2 -#define SPI3 3 //SPI 3 bus. ESP32S2: device only - it can be matrixed to any pins -#elif CONFIG_IDF_TARGET_ESP32 +#ifdef CONFIG_IDF_TARGET_ESP32 #define FSPI 1 //SPI 1 bus attached to the flash (can use the same data lines but different SS) #define HSPI 2 //SPI 2 bus normally mapped to pins 12 - 15, but can be matrixed to any pins #define VSPI 3 //SPI 3 bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins #else -#define FSPI 0 // ESP32C2, C3, C6, H2, S3, P4 - SPI 2 bus -#define HSPI 1 // ESP32S3, P4 - SPI 3 bus +#define FSPI 0 // ESP32C2, C3, C6, H2, S2, S3, P4 - SPI 2 bus +#define HSPI 1 // ESP32S2, S3, P4 - SPI 3 bus #endif // This defines are not representing the real Divider of the ESP32 diff --git a/libraries/SD/src/SD.cpp b/libraries/SD/src/SD.cpp index eaec24830..2d646276d 100644 --- a/libraries/SD/src/SD.cpp +++ b/libraries/SD/src/SD.cpp @@ -27,7 +27,9 @@ bool SDFS::begin(uint8_t ssPin, SPIClass &spi, uint32_t frequency, const char *m return true; } - spi.begin(); + if (!spi.begin()) { + return false; + } _pdrv = sdcard_init(ssPin, &spi, frequency); if (_pdrv == 0xFF) { diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index c0d7665df..7d8d44320 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -74,6 +74,7 @@ bool SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) { _spi = spiStartBus(_spi_num, _div, SPI_MODE0, SPI_MSBFIRST); if (!_spi) { + log_e("SPI bus %d start failed.", _spi_num); return false; } From 30fb3cbb4f2eb749863f39a040601df3decd87a5 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Tue, 24 Jun 2025 08:43:27 -0300 Subject: [PATCH 5/8] fix(docs): Fix links and versions (#11505) * fix(docs): Fix links and versions * fix(docs): Apply suggestions and leftover substitutions --- docs/conf_common.py | 7 +++++++ docs/en/contributing.rst | 4 ++-- docs/en/esp-idf_component.rst | 10 ++++++---- docs/en/guides/docs_contributing.rst | 13 +++++-------- docs/en/index.rst | 1 + docs/en/lib_builder.rst | 16 ++++++++++------ docs/requirements.txt | 2 ++ 7 files changed, 33 insertions(+), 20 deletions(-) diff --git a/docs/conf_common.py b/docs/conf_common.py index 676cca899..6945c0d19 100644 --- a/docs/conf_common.py +++ b/docs/conf_common.py @@ -2,6 +2,12 @@ from esp_docs.conf_docs import * # noqa: F403,F401 +# Used for substituting variables in the documentation +rst_prolog = """ +.. |version| replace:: 3.2.0 +.. |idf_version| replace:: 5.4 +""" + languages = ["en"] # idf_targets = [ @@ -27,6 +33,7 @@ html_static_path = ["../_static"] extensions += [ # noqa: F405 "sphinx_copybutton", "sphinx_tabs.tabs", + "sphinx_substitution_extensions", # For allowing substitutions inside code blocks "esp_docs.esp_extensions.dummy_build_system", ] diff --git a/docs/en/contributing.rst b/docs/en/contributing.rst index 4ebe01cbf..7a7b99894 100644 --- a/docs/en/contributing.rst +++ b/docs/en/contributing.rst @@ -222,7 +222,7 @@ Documentation ------------- If you are contributing to the documentation, please follow the instructions described in the -`documentation guidelines `_ to properly format and test your changes. +`documentation guidelines `_ to properly format and test your changes. Testing and CI -------------- @@ -435,7 +435,7 @@ Documentation Checks ^^^^^^^^^^^^^^^^^^^^ The CI also checks the documentation for any compilation errors. This is important to ensure that the documentation layout is not broken. -To build the documentation locally, please refer to the `documentation guidelines `_. +To build the documentation locally, please refer to the `documentation guidelines `_. Code Style Checks ^^^^^^^^^^^^^^^^^ diff --git a/docs/en/esp-idf_component.rst b/docs/en/esp-idf_component.rst index f38dc44ec..13542cc3c 100644 --- a/docs/en/esp-idf_component.rst +++ b/docs/en/esp-idf_component.rst @@ -14,9 +14,9 @@ For a simplified method, see `Installing using Boards Manager `_. -.. note:: Latest Arduino Core ESP32 version (3.0.X) is now compatible with `ESP-IDF v5.1 `_. Please consider this compatibility when using Arduino as a component in ESP-IDF. +.. note:: Latest Arduino Core ESP32 version (|version|) is now compatible with ESP-IDF v\ |idf_version|\ . Please consider this compatibility when using Arduino as a component in ESP-IDF. -For easiest use of Arduino framework as a ESP-IDF component, you can use the `IDF Component Manager `_ to add the Arduino component to your project. +For easiest use of Arduino framework as a ESP-IDF component, you can use the `IDF Component Manager `_ to add the Arduino component to your project. This will automatically clone the repository and its submodules. You can find the Arduino component in the `ESP Registry `_ together with dependencies list and examples. Installation @@ -32,14 +32,16 @@ Installing using IDF Component Manager To add the Arduino component to your project using the IDF Component Manager, run the following command in your project directory: .. code-block:: bash + :substitutions: - idf.py add-dependency "espressif/arduino-esp32^3.0.2" + idf.py add-dependency "espressif/arduino-esp32^|version|" Or you can start a new project from a template with the Arduino component: .. code-block:: bash + :substitutions: - idf.py create-project-from-example "espressif/arduino-esp32^3.0.2:hello_world" + idf.py create-project-from-example "espressif/arduino-esp32^|version|:hello_world" Manual installation of Arduino framework **************************************** diff --git a/docs/en/guides/docs_contributing.rst b/docs/en/guides/docs_contributing.rst index 20dc4c84c..13f08c476 100644 --- a/docs/en/guides/docs_contributing.rst +++ b/docs/en/guides/docs_contributing.rst @@ -49,11 +49,11 @@ Before starting your collaboration, you need to get the documentation source cod Requirements ************ -To properly work with the documentation, you need to install some packages in your system. +To build the documentation properly, you need to install some packages in your system. Note that depending on +your system, you may need to use a virtual environment to install the packages. .. code-block:: - pip install -U Sphinx pip install -r requirements.txt The requirements file is under the ``docs`` folder. @@ -62,17 +62,14 @@ Using Visual Studio Code ************************ If you are using the Visual Studio Code, you can install some extensions to help you while writing documentation. +For reStructuredText, you can install the `reStructuredText Pack `_ extension. -`reStructuredText Pack `_ - -We also recommend you install to grammar check extension to help you to review English grammar. - -`Grammarly `_ +We also recommend you to install some grammar check extension to help you to review English grammar. Building ******** -To build the documentation and generate the HTML files, you can use the following command inside the ``docs`` folder. After a successful build, you can check the files inside the `_build/en/generic/html` folder. +To build the documentation and generate the HTML files, you can use the following command inside the ``docs`` folder. After a successful build, you can check the files inside the ``_build/en/generic/html`` folder. .. code-block:: diff --git a/docs/en/index.rst b/docs/en/index.rst index 1314a8fc7..89fc7e3bd 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -3,6 +3,7 @@ Welcome to ESP32 Arduino Core's documentation ############################################# Here you will find all the relevant information about the project. +This documentation is valid for the Arduino Core for ESP32 version |version| based on ESP-IDF |idf_version|. .. note:: This is a work in progress documentation and we will appreciate your help! We are looking for contributors! diff --git a/docs/en/lib_builder.rst b/docs/en/lib_builder.rst index e7edb331f..a8126c18e 100644 --- a/docs/en/lib_builder.rst +++ b/docs/en/lib_builder.rst @@ -293,8 +293,9 @@ You have two options to run the Docker image to build the libraries. Manually or To run the Docker image manually, use the following command from the root of the ``arduino-esp32`` repository: .. code-block:: bash + :substitutions: - docker run --rm -it -v $PWD:/arduino-esp32 -e TERM=xterm-256color espressif/esp32-arduino-lib-builder:release-v5.1 + docker run --rm -it -v $PWD:/arduino-esp32 -e TERM=xterm-256color espressif/esp32-arduino-lib-builder:release-v|idf_version| This will start the Lib Builder UI for compiling the libraries. The above command explained: @@ -304,7 +305,7 @@ This will start the Lib Builder UI for compiling the libraries. The above comman - ``-t`` Allocate a pseudo-TTY; - ``-e TERM=xterm-256color``: Optional. Sets the terminal type to ``xterm-256color`` to display colors correctly; - ``-v $PWD:/arduino-esp32``: Optional. Mounts the current folder at ``/arduino-esp32`` inside the container. If not provided, the container will not copy the compiled libraries to the host machine; -- ``espressif/esp32-arduino-lib-builder:release-v5.1``: uses Docker image ``espressif/esp32-arduino-lib-builder`` with tag ``release-v5.1``. +- :substitution-code:`espressif/esp32-arduino-lib-builder:release-v|idf_version|`: uses Docker image ``espressif/esp32-arduino-lib-builder`` with tag :substitution-code:`release-v|idf_version|`. The ``latest`` tag is implicitly added by Docker when no tag is specified. It is recommended to use a specific version tag to ensure reproducibility of the build process. .. warning:: @@ -324,24 +325,27 @@ By default the docker container will run the user interface script. If you want For example, to run a terminal inside the container, you can run: .. code-block:: bash + :substitutions: - docker run -it espressif/esp32-arduino-lib-builder:release-v5.1 /bin/bash + docker run -it espressif/esp32-arduino-lib-builder:release-v|idf_version| /bin/bash Running the Docker image using the provided run script will depend on the host OS. Use the following command from the root of the ``arduino-esp32`` repository to execute the image in a Linux or macOS environment for -the ``release-v5.1`` tag: +the :substitution-code:`release-v|idf_version|` tag: .. code-block:: bash + :substitutions: - curl -LJO https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v5.1/tools/docker/run.sh + curl -LJO https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v|idf_version|/tools/docker/run.sh chmod +x run.sh ./run.sh $PWD For Windows, use the following command in PowerShell from the root of the ``arduino-esp32`` repository: .. code-block:: powershell + :substitutions: - Invoke-WebRequest -Uri "https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v5.1/tools/docker/run.ps1" -OutFile "run.ps1" + Invoke-WebRequest -Uri "https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v|idf_version|/tools/docker/run.ps1" -OutFile "run.ps1" .\run.ps1 $pwd As the script is unsigned, you may need to change the execution policy of the current session before running the script. diff --git a/docs/requirements.txt b/docs/requirements.txt index d3017fb5a..ef2ab88cb 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,7 @@ +sphinx==4.5.0 esp-docs>=1.4.0 sphinx-copybutton==0.5.0 sphinx-tabs==3.2.0 numpydoc==1.5.0 standard-imghdr==3.13.0 +Sphinx-Substitution-Extensions==2022.2.16 From e9b0930f9dd1fb2e1df28c7156fa7892e4306b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:34:17 +0200 Subject: [PATCH 6/8] ci(sizes): Update sizes workflow action --- .github/workflows/publishsizes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publishsizes.yml b/.github/workflows/publishsizes.yml index 8ff591e05..f3c401d63 100644 --- a/.github/workflows/publishsizes.yml +++ b/.github/workflows/publishsizes.yml @@ -66,7 +66,7 @@ jobs: path: ./artifacts/sizes-report/pr_num.txt - name: Report results - uses: P-R-O-C-H-Y/report-size-deltas@2043188c68f483a7b50527c4eacf609d05bb67a5 # sizes_v2 + uses: P-R-O-C-H-Y/report-size-deltas@sizes_v2 #2043188c68f483a7b50527c4eacf609d05bb67a5 # sizes_v2 with: sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} github-token: ${{ env.GITHUB_TOKEN }} From 0213200b3d66cae7849623dc6551503346228de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:40:53 +0200 Subject: [PATCH 7/8] ci(sizes): Use commit id in report-size-delta action --- .github/workflows/publishsizes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publishsizes.yml b/.github/workflows/publishsizes.yml index f3c401d63..fad241866 100644 --- a/.github/workflows/publishsizes.yml +++ b/.github/workflows/publishsizes.yml @@ -66,7 +66,7 @@ jobs: path: ./artifacts/sizes-report/pr_num.txt - name: Report results - uses: P-R-O-C-H-Y/report-size-deltas@sizes_v2 #2043188c68f483a7b50527c4eacf609d05bb67a5 # sizes_v2 + uses: P-R-O-C-H-Y/report-size-deltas@bea91d2c99ca80c88a883b39b1c4012f00ec3d09 # sizes_v2 with: sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} github-token: ${{ env.GITHUB_TOKEN }} From 9e61fa7e4bce59c05cb17c15b11b53b9bafca077 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Tue, 24 Jun 2025 17:23:50 +0300 Subject: [PATCH 8/8] IDF release/v5.4 (#11512) * IDF release/v5.4 f0f2980d * fix(p4): Allow custom pins on P4 for ESP-Hosted --- libraries/WiFi/src/WiFiGeneric.cpp | 12 +++- package/package_esp32_index.template.json | 68 +++++++++++------------ 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 3faf34fef..bddcb5fd4 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -252,13 +252,23 @@ static bool wifiHostedInit() { if (!hosted_initialized) { hosted_initialized = true; struct esp_hosted_sdio_config conf = INIT_DEFAULT_HOST_SDIO_CONFIG(); +#ifdef BOARD_HAS_SDIO_ESP_HOSTED + conf.pin_clk.pin = BOARD_SDIO_ESP_HOSTED_CLK; + conf.pin_cmd.pin = BOARD_SDIO_ESP_HOSTED_CMD; + conf.pin_d0.pin = BOARD_SDIO_ESP_HOSTED_D0; + conf.pin_d1.pin = BOARD_SDIO_ESP_HOSTED_D1; + conf.pin_d2.pin = BOARD_SDIO_ESP_HOSTED_D2; + conf.pin_d3.pin = BOARD_SDIO_ESP_HOSTED_D3; + conf.pin_reset.pin = BOARD_SDIO_ESP_HOSTED_RESET; +#else conf.pin_clk.pin = CONFIG_ESP_SDIO_PIN_CLK; conf.pin_cmd.pin = CONFIG_ESP_SDIO_PIN_CMD; conf.pin_d0.pin = CONFIG_ESP_SDIO_PIN_D0; conf.pin_d1.pin = CONFIG_ESP_SDIO_PIN_D1; conf.pin_d2.pin = CONFIG_ESP_SDIO_PIN_D2; conf.pin_d3.pin = CONFIG_ESP_SDIO_PIN_D3; - //conf.pin_rst.pin = CONFIG_ESP_SDIO_GPIO_RESET_SLAVE; + conf.pin_reset.pin = CONFIG_ESP_SDIO_GPIO_RESET_SLAVE; +#endif // esp_hosted_sdio_set_config() will fail on second attempt but here temporarily to not cause exception on reinit if (esp_hosted_sdio_set_config(&conf) != ESP_OK || esp_hosted_init() != ESP_OK) { log_e("esp_hosted_init failed!"); diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 22d3cc054..9c1516dba 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -51,7 +51,7 @@ { "packager": "esp32", "name": "esp32-arduino-libs", - "version": "idf-release_v5.4-aed8bdc8-v1" + "version": "idf-release_v5.4-f0f2980d-v1" }, { "packager": "esp32", @@ -104,63 +104,63 @@ "tools": [ { "name": "esp32-arduino-libs", - "version": "idf-release_v5.4-aed8bdc8-v1", + "version": "idf-release_v5.4-f0f2980d-v1", "systems": [ { "host": "i686-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" }, { "host": "x86_64-mingw32", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" }, { "host": "arm64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-aed8bdc8-v1.zip", - "checksum": "SHA-256:448691c3171f79b2136e4ab8006e9c78bd1627156dab1365fff8f8867a6a7e5b", - "size": "353758763" + "url": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.4/esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "archiveFileName": "esp32-arduino-libs-idf-release_v5.4-f0f2980d-v1.zip", + "checksum": "SHA-256:b1a77c83634111d78a356f1d1756dc815eeeb91605c5d8714a0db7cccbd0bede", + "size": "353978504" } ] },