diff --git a/.github/scripts/check-cmakelists.sh b/.github/scripts/check-cmakelists.sh index 8495667ba3c..89141ac6e3f 100755 --- a/.github/scripts/check-cmakelists.sh +++ b/.github/scripts/check-cmakelists.sh @@ -15,7 +15,7 @@ git submodule update --init --recursive REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort` # find all source files named in CMakeLists.txt COMPONENT_SRCS -CMAKE_SRCS=`cmake --trace-expand -C CMakeLists.txt 2>&1 | grep set\(srcs | cut -d'(' -f3 | sed 's/ )//' | sed 's/srcs //' | tr ' ;' '\n' | sort` +CMAKE_SRCS=`cmake --trace-expand -P CMakeLists.txt 2>&1 | grep set\(srcs | cut -d'(' -f3 | sed 's/ )//' | sed 's/srcs //' | tr ' ;' '\n' | sort` if ! diff -u0 --label "Repo Files" --label "srcs" <(echo "$REPO_SRCS") <(echo "$CMAKE_SRCS"); then echo "Source files in repo (-) and source files in CMakeLists.txt (+) don't match" diff --git a/CMakeLists.txt b/CMakeLists.txt index 895ac421315..59d1ded8e80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,27 @@ +# Check ESP-IDF version and error out if it is not in the supported range. +# +# Note for arduino-esp32 developers: to bypass the version check locally, +# set ARDUINO_SKIP_IDF_VERSION_CHECK environment variable to 1. For example: +# export ARDUINO_SKIP_IDF_VERSION_CHECK=1 +# idf.py build + +set(min_supported_idf_version "4.4.0") +set(max_supported_idf_version "4.4.99") +set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}") + +if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}") + if (idf_version VERSION_LESS min_supported_idf_version) + message(FATAL_ERROR "Arduino-esp32 can be used with ESP-IDF versions " + "between ${min_supported_idf_version} and ${max_supported_idf_version}, " + "but an older version is detected: ${idf_version}.") + endif() + if (idf_version VERSION_GREATER max_supported_idf_version) + message(FATAL_ERROR "Arduino-esp32 can be used with ESP-IDF versions " + "between ${min_supported_idf_version} and ${max_supported_idf_version}, " + "but a newer version is detected: ${idf_version}.") + endif() +endif() + set(CORE_SRCS cores/esp32/base64.cpp cores/esp32/cbuf.cpp diff --git a/README.md b/README.md index 80d8f712627..757c9c80697 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,15 @@ -# Arduino core for the ESP32 +# Arduino core for the ESP32, ESP32-S2 and ESP32-C3 -[![Build Status](https://travis-ci.org/espressif/arduino-esp32.svg?branch=master)](https://travis-ci.org/espressif/arduino-esp32) ![](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![Documentation Status](https://readthedocs.com/projects/espressif-arduino-esp32/badge/?version=latest)](https://docs.espressif.com/projects/arduino-esp32/en/latest/?badge=latest) +![Build Status](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![Documentation Status](https://readthedocs.com/projects/espressif-arduino-esp32/badge/?version=latest)](https://docs.espressif.com/projects/arduino-esp32/en/latest/?badge=latest) ### Need help or have a question? Join the chat at [![https://gitter.im/espressif/arduino-esp32](https://badges.gitter.im/espressif/arduino-esp32.svg)](https://gitter.im/espressif/arduino-esp32?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ## Contents -- [ESP32-S2 and ESP32-C3 Support](#esp32-s2-and-esp32-c3-support) - [Development Status](#development-status) - [Decoding Exceptions](#decoding-exceptions) - [Issue/Bug report template](#issuebug-report-template) -### ESP32-S2 and ESP32-C3 Support - -If you want to test ESP32-S2 and/or ESP32-C3 through the board manager, please use the development release link: - -``` -https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json -``` - -Now you can install the latest 2.0.0 version from the boards manager. - ### Development Status Latest Stable Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index 102e5bbb0e2..4e20e7b8bd4 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -17,6 +17,7 @@ #include "freertos/task.h" #include "freertos/semphr.h" #include "esp32-hal-matrix.h" +#include "soc/soc_caps.h" #include "soc/ledc_reg.h" #include "soc/ledc_struct.h" #include "driver/periph_ctrl.h" @@ -331,3 +332,21 @@ double ledcChangeFrequency(uint8_t chan, double freq, uint8_t bit_num) double res_freq = _ledcSetupTimerFreq(chan, freq, bit_num); return res_freq; } + +static int8_t pin_to_channel[SOC_GPIO_PIN_COUNT] = { 0 }; +static int cnt_channel = SOC_LEDC_CHANNEL_NUM; +void analogWrite(uint8_t pin, int value) { + // Use ledc hardware for internal pins + if (pin < SOC_GPIO_PIN_COUNT) { + if (pin_to_channel[pin] == 0) { + if (!cnt_channel) { + log_e("No more analogWrite channels available! You can have maximum %u", SOC_LEDC_CHANNEL_NUM); + return; + } + pin_to_channel[pin] = cnt_channel--; + ledcAttachPin(pin, cnt_channel); + ledcSetup(cnt_channel, 1000, 8); + } + ledcWrite(pin_to_channel[pin] - 1, value); + } +} diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 3efead522dd..115a050b172 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -90,6 +90,8 @@ void yield(void); #include "esp32-hal-psram.h" #include "esp32-hal-cpu.h" +void analogWrite(uint8_t pin, int value); + //returns chip temperature in Celsius float temperatureRead(); diff --git a/docs/source/esp-idf_component.rst b/docs/source/esp-idf_component.rst index ba2ff67604d..d6f387375d5 100644 --- a/docs/source/esp-idf_component.rst +++ b/docs/source/esp-idf_component.rst @@ -10,8 +10,7 @@ For a simplified method, see `lib-builder `_. Installation ------------ -.. note:: -Latest Arduino Core ESP32 version is now compatible with [ESP-IDF v4.4](https://github.com/espressif/esp-idf/tree/release/v4.4). Please consider this compability when using Arduino as component in ESP-IDF. +.. note:: Latest Arduino Core ESP32 version is now compatible with [ESP-IDF v4.4](https://github.com/espressif/esp-idf/tree/release/v4.4). Please consider this compability when using Arduino as component in ESP-IDF. - Download and install `ESP-IDF `_. - Create blank idf project (from one of the examples). diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 52b419c394c..6275e603f2a 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -7,49 +7,69 @@ Here is where the Libraries API's descriptions are located: Supported Peripherals --------------------- -Currently, the Arduino ESP32 supports the following peripherals with Arduino style. Some other peripherals are not supported yet, but it's supported using ESP-IDF style. +Currently, the Arduino ESP32 supports the following peripherals with Arduino APIs. -+-------------+-------------+---------+--------------------+ -| Peripheral | Arduino API | ESP-IDF | Comment | -+=============+=============+=========+====================+ -| ADC | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| DAC | No | No | | -+-------------+-------------+---------+--------------------+ -| GPIO | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| SDIO/SPI | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| I2C | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| I2S | No | Yes | In Development | -+-------------+-------------+---------+--------------------+ -| Wi-Fi | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| Bluetooth | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| RMT | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| Touch | Yes | Yes | ESP32 & ESP32-S2 | -+-------------+-------------+---------+--------------------+ -| Timer | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| UART | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| Hall Sensor | Yes | Yes | Only for ESP32 | -+-------------+-------------+---------+--------------------+ -| LEDC | Yes | Yes | | -+-------------+-------------+---------+--------------------+ -| Motor PWM | No | No | | -+-------------+-------------+---------+--------------------+ -| TWAI | No | No | | -+-------------+-------------+---------+--------------------+ -| Ethernet | Yes | Yes | Only for ESP32 | -+-------------+-------------+---------+--------------------+ -| USB | Yes | Yes | Only for ESP32-S2 | -+-------------+-------------+---------+--------------------+ ++---------------+---------------+---------------+---------------+-------------------------------+ +| Peripheral | ESP32 | ESP32-S2 | ESP32-C3 | Comments | ++===============+===============+===============+===============+===============================+ +| ADC | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Bluetooth | Yes | Not Supported | Not Supported | Bluetooth Classic | ++---------------+---------------+---------------+---------------+-------------------------------+ +| BLE | Yes | Not Supported | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| DAC | Yes | Yes | Not Supported | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Ethernet | Yes | Not Supported | Not Supported | (*) | ++---------------+---------------+---------------+---------------+-------------------------------+ +| GPIO | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Hall Sensor | Yes | Not Supported | Not Supported | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| I2C | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| I2S | No | No | No | WIP | ++---------------+---------------+---------------+---------------+-------------------------------+ +| LEDC | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Motor PWM | No | Not Supported | Not Supported | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Pulse Counter | No | No | No | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| RMT | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| SDIO | No | No | No | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| SPI | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Timer | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Temp. Sensor | Not Supported | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Touch | Yes | Yes | Not Supported | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| TWAI | No | No | No | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| UART | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ +| USB | Not Supported | Yes | Yes | ESP32-C3 only CDC/JTAG | ++---------------+---------------+---------------+---------------+-------------------------------+ +| Wi-Fi | Yes | Yes | Yes | | ++---------------+---------------+---------------+---------------+-------------------------------+ -Some peripherals are not available for all ESP32 families. To see more details about it, see the corresponding datasheet. +Notes +^^^^^ + +(*) SPI Ethernet is supported by all ESP32 families and RMII only for ESP32. + +.. note:: Some peripherals are not available for all ESP32 families. To see more details about it, see the corresponding SoC at `Product Selector `_ page. + +Datasheet +^^^^^^^^^ + +* `ESP32 `_ +* `ESP32-S2 `_ +* `ESP32-C3 `_ APIs ---- diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index f6a9174c1c1..33e86691b1d 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -368,6 +368,10 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ log_e("esp_eth_init error: %d", err); } #endif + // holds a few microseconds to let DHCP start and enter into a good state + // FIX ME -- adresses issue https://github.com/espressif/arduino-esp32/issues/5733 + delay(50); + return true; } @@ -396,7 +400,8 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I if(err != ERR_OK){ log_e("STA IP could not be configured! Error: %d", err); return false; -} + } + if(info.ip.addr){ staticIP = true; } else { diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index 1c8775f0871..68d82833be4 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -447,32 +447,40 @@ void TwoWire::flush(void) uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) { - return requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop)); + return requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop)); } uint8_t TwoWire::requestFrom(uint16_t address, uint8_t quantity, uint8_t sendStop) { - return requestFrom(address, static_cast(quantity), static_cast(sendStop)); + return requestFrom(address, static_cast(quantity), static_cast(sendStop)); +} + +/* Added to match the Arduino function definition: https://github.com/arduino/ArduinoCore-API/blob/173e8eadced2ad32eeb93bcbd5c49f8d6a055ea6/api/HardwareI2C.h#L39 + * See: https://github.com/arduino-libraries/ArduinoECCX08/issues/25 +*/ +size_t TwoWire::requestFrom(uint8_t address, size_t len, bool stopBit) +{ + return requestFrom((uint16_t)address, (uint8_t)len, stopBit); } uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity) { - return requestFrom(static_cast(address), static_cast(quantity), true); + return requestFrom(static_cast(address), static_cast(quantity), true); } uint8_t TwoWire::requestFrom(uint16_t address, uint8_t quantity) { - return requestFrom(address, static_cast(quantity), true); + return requestFrom(address, static_cast(quantity), true); } uint8_t TwoWire::requestFrom(int address, int quantity) { - return requestFrom(static_cast(address), static_cast(quantity), true); + return requestFrom(static_cast(address), static_cast(quantity), true); } uint8_t TwoWire::requestFrom(int address, int quantity, int sendStop) { - return static_cast(requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop))); + return static_cast(requestFrom(static_cast(address), static_cast(quantity), static_cast(sendStop))); } void TwoWire::beginTransmission(int address) diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index 892846b3df9..da527b58ba0 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -95,6 +95,7 @@ class TwoWire: public Stream uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop); uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop); + size_t requestFrom(uint8_t address, size_t len, bool stopBit); uint8_t requestFrom(uint16_t address, uint8_t size); uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop); uint8_t requestFrom(uint8_t address, uint8_t size); diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index 7667386d971..565baf483bc 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -23,13 +23,13 @@ }, "boards": [ { - "name": "ESP32 Dev Module" + "name": "ESP32 Dev Board" }, { - "name": "WEMOS LoLin32" + "name": "ESP32-S2 Dev Board" }, { - "name": "WEMOS D1 MINI ESP32" + "name": "ESP32-C3 Dev Board" } ], "toolsDependencies": [ diff --git a/platform.txt b/platform.txt index 2536aaddd0a..d741cf6d62a 100644 --- a/platform.txt +++ b/platform.txt @@ -136,19 +136,19 @@ recipe.hooks.prebuild.5.pattern.windows=cmd /c if exist "{build.source.path}\bui recipe.hooks.prebuild.6.pattern.windows=cmd /c if not exist "{build.path}\build_opt.h" type nul > "{build.path}\build_opt.h" ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" {compiler.c.extra_flags} {build.extra_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" -DARDUINO_PARTITION_{build.partitions} {compiler.c.extra_flags} {build.extra_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" {compiler.cpp.extra_flags} {build.extra_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" -DARDUINO_PARTITION_{build.partitions} {compiler.cpp.extra_flags} {build.extra_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}" ## Compile S files -recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" {compiler.S.extra_flags} {build.extra_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}" +recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" -DARDUINO_PARTITION_{build.partitions} {compiler.S.extra_flags} {build.extra_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}" ## Create archives recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-Wl,--Map={build.path}/{build.project_name}.map" "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf" +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-Wl,--Map={build.path}/{build.project_name}.map" "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} {compiler.libraries.ldflags} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf" ## Create partitions.bin recipe.objcopy.partitions.bin.pattern={tools.gen_esp32part.cmd} -q "{build.path}/partitions.csv" "{build.path}/{build.project_name}.partitions.bin" diff --git a/tools/platformio-build-esp32.py b/tools/platformio-build-esp32.py index d12a950d079..1d5a5241ce9 100644 --- a/tools/platformio-build-esp32.py +++ b/tools/platformio-build-esp32.py @@ -310,7 +310,8 @@ ("F_CPU", "$BOARD_F_CPU"), ("ARDUINO", 10812), ("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")), - ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")) + ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")), + "ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "") ], LIBSOURCE_DIRS=[ diff --git a/tools/platformio-build-esp32c3.py b/tools/platformio-build-esp32c3.py index 9526bd4eafa..58dd07faf03 100644 --- a/tools/platformio-build-esp32c3.py +++ b/tools/platformio-build-esp32c3.py @@ -300,7 +300,8 @@ ("F_CPU", "$BOARD_F_CPU"), ("ARDUINO", 10812), ("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")), - ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")) + ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")), + "ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "") ], LIBSOURCE_DIRS=[ diff --git a/tools/platformio-build-esp32s2.py b/tools/platformio-build-esp32s2.py index 44d45b336d5..78aed0892b2 100644 --- a/tools/platformio-build-esp32s2.py +++ b/tools/platformio-build-esp32s2.py @@ -296,7 +296,8 @@ ("F_CPU", "$BOARD_F_CPU"), ("ARDUINO", 10812), ("ARDUINO_VARIANT", '\\"%s\\"' % env.BoardConfig().get("build.variant").replace('"', "")), - ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")) + ("ARDUINO_BOARD", '\\"%s\\"' % env.BoardConfig().get("name").replace('"', "")), + "ARDUINO_PARTITION_%s" % env.BoardConfig().get("build.partitions", "default.csv").replace(".csv", "") ], LIBSOURCE_DIRS=[