From f2d081fbe780156ebdd3ca9785e45f555c88c1a8 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Thu, 10 Mar 2022 20:17:55 +0200 Subject: [PATCH 1/2] Add helper script for updating the core version --- .github/scripts/update-version.sh | 35 +++++++++++++++++++++++++++++++ cores/esp32/esp_arduino_version.h | 2 +- package.json | 2 +- platform.txt | 2 +- 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100755 .github/scripts/update-version.sh diff --git a/.github/scripts/update-version.sh b/.github/scripts/update-version.sh new file mode 100755 index 00000000000..7e13b398b25 --- /dev/null +++ b/.github/scripts/update-version.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +if [ ! $# -eq 3 ]; then + echo "Bad number of arguments: $#" >&2 + echo "usage: $0 " >&2 + exit 1 +fi + +re='^[0-9]+$' +if [[ ! $1 =~ $re ]] || [[ ! $2 =~ $re ]] || [[ ! $3 =~ $re ]] ; then + echo "error: Not a valid version: $1.$2.$3" >&2 + echo "usage: $0 " >&2 + exit 1 +fi + +ESP_ARDUINO_VERSION_MAJOR="$1" +ESP_ARDUINO_VERSION_MINOR="$2" +ESP_ARDUINO_VERSION_PATCH="$3" +ESP_ARDUINO_VERSION="$ESP_ARDUINO_VERSION_MAJOR.$ESP_ARDUINO_VERSION_MINOR.$ESP_ARDUINO_VERSION_PATCH" + +echo "New Arduino Version: $ESP_ARDUINO_VERSION" + +echo "Updating platform.txt..." +cat platform.txt | sed "s/version=.*/version=$ESP_ARDUINO_VERSION/g" > __platform.txt && mv __platform.txt platform.txt + +echo "Updating package.json..." +cat package.json | sed "s/.*\"version\":.*/ \"version\": \"$ESP_ARDUINO_VERSION\",/g" > __package.json && mv __package.json package.json + +echo "Updating cores/esp32/esp_arduino_version.h..." +cat cores/esp32/esp_arduino_version.h | \ +sed "s/#define ESP_ARDUINO_VERSION_MAJOR.*/#define ESP_ARDUINO_VERSION_MAJOR $ESP_ARDUINO_VERSION_MAJOR/g" | \ +sed "s/#define ESP_ARDUINO_VERSION_MINOR.*/#define ESP_ARDUINO_VERSION_MINOR $ESP_ARDUINO_VERSION_MINOR/g" | \ +sed "s/#define ESP_ARDUINO_VERSION_PATCH.*/#define ESP_ARDUINO_VERSION_PATCH $ESP_ARDUINO_VERSION_PATCH/g" > __esp_arduino_version.h && mv __esp_arduino_version.h cores/esp32/esp_arduino_version.h + +exit 0 diff --git a/cores/esp32/esp_arduino_version.h b/cores/esp32/esp_arduino_version.h index 03fbeea2396..9b053df2640 100644 --- a/cores/esp32/esp_arduino_version.h +++ b/cores/esp32/esp_arduino_version.h @@ -23,7 +23,7 @@ extern "C" { /** Minor version number (x.X.x) */ #define ESP_ARDUINO_VERSION_MINOR 0 /** Patch version number (x.x.X) */ -#define ESP_ARDUINO_VERSION_PATCH 0 +#define ESP_ARDUINO_VERSION_PATCH 3 /** * Macro to convert ARDUINO version number into an integer diff --git a/package.json b/package.json index 8b4729f1fa5..8204d5e4511 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "framework-arduinoespressif32", - "version": "0.0.0", + "version": "2.0.3", "description": "Arduino Wiring-based Framework for the Espressif ESP32, ESP32-S and ESP32-C series of SoCs", "keywords": [ "framework", diff --git a/platform.txt b/platform.txt index 2e1e311e415..4af32d02601 100644 --- a/platform.txt +++ b/platform.txt @@ -1,5 +1,5 @@ name=ESP32 Arduino -version=2.0.0 +version=2.0.3 runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf From 701fcad2d486343e042e8e33fd25ca498536955e Mon Sep 17 00:00:00 2001 From: Pedro Minatel Date: Thu, 10 Mar 2022 18:20:47 +0000 Subject: [PATCH 2/2] [Docs] Added/Updated Lib builder docs (#6401) * [Docs] Added/Updated Lib builder docs * [Docs] Fixes according to the PR review * [Docs] Fixes according to the PR review --- docs/source/lib_builder.rst | 175 ++++++++++++++++++++++++++++++++---- 1 file changed, 158 insertions(+), 17 deletions(-) diff --git a/docs/source/lib_builder.rst b/docs/source/lib_builder.rst index e9a270362d2..5c62aafe55d 100644 --- a/docs/source/lib_builder.rst +++ b/docs/source/lib_builder.rst @@ -2,37 +2,178 @@ Library Builder ############### -How to Use Library Builder --------------------------- +About +----- -Espressif has provided a `tool `_ to simplify building your own compiled libraries for use in Arduino IDE (or your favorite IDE). -To generate custom libraries, follow these steps: +Espressif provides a `tool `_ to simplify building your own compiled libraries for use in Arduino IDE (or your favorite IDE). +This tool can be used to change the project or a specific configuration according to your needs. -- Step 1 - Clone the ESP32 Arduino lib builder:: +Installing +---------- + +To install the Library Builder into your environment, please, follow the instructions below. + +- Clone the ESP32 Arduino lib builder: + +.. code-block:: bash git clone https://github.com/espressif/esp32-arduino-lib-builder -- Step 2 - Go to the ``esp32-arduino-lib-builder`` folder:: +- Go to the ``esp32-arduino-lib-builder`` folder: + +.. code-block:: bash cd esp32-arduino-lib-builder -- Step 3 - Run the ``update-components`` script:: +- Build: + +.. code-block:: bash + + ./build.sh + +If everything works, you may see the following message: ``Successfully created esp32 image.`` + +Dependencies +************ + +To build the library you will need to install some dependencies. Maybe you already have installed it, but it is a good idea to check before building. + +- Install all dependencies (**Ubuntu**): + +.. code-block:: bash + + sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf cmake ninja-build ccache jq + +- Install Python and upgrade pip: + +.. code-block:: bash + + sudo apt-get install python3 + sudo pip install --upgrade pip + +- Install all required packages: + +.. code-block:: bash + + pip install --user setuptools pyserial click cryptography future pyparsing pyelftools + +Building +-------- + +If you have all the dependencies met, it is time to build the libraries. + +To build using the default configuration: + +.. code-block:: bash + + ./build.sh + +Custom Build +************ + +There are some options to help you create custom libraries. You can use the following options: + +Usage +^^^^^ + +.. code-block:: bash + + build.sh [-s] [-A arduino_branch] [-I idf_branch] [-i idf_commit] [-c path] [-t ] [-b ] [config ...] + +Skip Install/Update +^^^^^^^^^^^^^^^^^^^ + +Skip installing/updating of ESP-IDF and all components + +.. code-block:: bash + + ./build.sh -s + +This option can be used if you already have the ESP-IDF and all components already in your environment. + +Set Arduino-ESP32 Branch +^^^^^^^^^^^^^^^^^^^^^^^^ + +Set which branch of arduino-esp32 to be used for compilation + +.. code-block:: bash + + ./build.sh -A + +Set ESP-IDF Branch +^^^^^^^^^^^^^^^^^^ + +Set which branch of ESP-IDF is to be used for compilation + +.. code-block:: bash + + ./build.sh -I + +Set the ESP-IDF Commit +^^^^^^^^^^^^^^^^^^^^^^ + +Set which commit of ESP-IDF to be used for compilation + +.. code-block:: bash + + ./build.sh -i + +Deploy +^^^^^^ + +Deploy the build to github arduino-esp32 + +.. code-block:: bash + + ./build.sh -d + +Set the Arduino-ESP32 Destination Folder +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32' + +.. code-block:: bash + + ./build.sh -c + +This function is used to copy the compiled libraries to the Arduino folder. + +Set the Target +^^^^^^^^^^^^^^ + +Set the build target(chip). ex. 'esp32s3' + +.. code-block:: bash + + ./build.sh -t + +This build command will build for the ESP32-S3 target. You can specify other targets. + +* esp32 +* esp32s2 +* esp32c3 +* esp32s3 + +Set Build Type +^^^^^^^^^^^^^^ + +Set the build type. ex. 'build' to build the project and prepare for uploading to a board. + +.. note:: This command depends on the ``-t`` argument. - ./tools/update-components.sh` +.. code-block:: bash -- Step 4 - Run ``install-esp-idf`` installation script (if you already have an ``$IDF_PATH`` defined, it will use your local copy of the repository):: + ./build.sh -t esp32 -b - ./tools/install-esp-idf.sh +Additional Configuration +^^^^^^^^^^^^^^^^^^^^^^^^ -- Step 5 - Copy the configuration (recommended) or directly edit sdkconfig using ``idf.py menuconfig``:: +Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b - cp sdkconfig.esp32s2 sdkconfig +.. note:: This command requires the ``-b`` to work properly. -- Step 6 - Build:: - idf.py build +.. code-block:: bash -The script automates the process of building `Arduino as an ESP-IDF component `_. -Once it is complete, you can cherry pick the needed libraries from ``out/tools/sdk/lib``, or run ``tools/copy-to-arduino.sh`` to copy the entire built system. -``tools/config.sh`` contains a number of variables that control the process, particularly the ``$IDF_BRANCH`` variable. You can adjust this to try building against newer versions, but there are absolutely no guarantees that any components will work or even successfully compile against a newer IDF. + ./build.sh -t esp32 -b idf_libs qio 80m