diff --git a/.github/workflows/build_sdk_auto.yml b/.github/workflows/build_sdk_auto.yml new file mode 100644 index 000000000..dd441fe79 --- /dev/null +++ b/.github/workflows/build_sdk_auto.yml @@ -0,0 +1,31 @@ +name: Auto Build SDK For All Targets + +on: + push: + branches: + - '*' + - '!master' + +jobs: + run: + name: Build ${{ github.ref_name }} SDK For all + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: bash ./tools/prepare-ci.sh + + - name: Build + shell: bash + run: | + echo "Building for all" + bash ./build.sh -e -t all + + - name: Upload archive + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: dist \ No newline at end of file diff --git a/.github/workflows/build_sdk_manual_v2.yml b/.github/workflows/build_sdk_manual_v2.yml new file mode 100644 index 000000000..634551727 --- /dev/null +++ b/.github/workflows/build_sdk_manual_v2.yml @@ -0,0 +1,40 @@ +name: Manual Build SDK (v2) For the Specific Target + +on: + workflow_dispatch: + inputs: + target: + type: choice + description: Choose Target + default: 'all' + options: + - 'all' + - 'esp32' + - 'esp32s2' + - 'esp32s3' + - 'esp32c3' + +jobs: + run: + name: Build ${{ github.ref_name }} SDK (v2) For ${{ github.event.inputs.target }} + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: bash ./tools/prepare-ci.sh + + - name: Build + shell: bash + run: | + export TARGET_TYPE=${{ github.event.inputs.target }} + echo "Building for $TARGET_TYPE" + bash ./build.sh -e -t $TARGET_TYPE + + - name: Upload archive + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: dist \ No newline at end of file diff --git a/.github/workflows/build_sdk_manual_v3.yml b/.github/workflows/build_sdk_manual_v3.yml new file mode 100644 index 000000000..04049e992 --- /dev/null +++ b/.github/workflows/build_sdk_manual_v3.yml @@ -0,0 +1,55 @@ +name: Manual Build SDK (v3) For the Specific Target + +on: + workflow_dispatch: + inputs: + target: + type: choice + description: Choose Target + default: 'all' + options: + - 'all' + - 'esp32' + - 'esp32s2' + - 'esp32s3' + - 'esp32c3' + - 'esp32c6' + - 'esp32h6' + log_level: + type: choice + description: Choose Log Level + default: 'default' + options: + - 'default' + - 'none' + - 'verbose' + - 'debug' + - 'info' + - 'warning' + - 'error' + +jobs: + run: + name: Build ${{ github.ref_name }} SDK (v3) For ${{ github.event.inputs.target }} + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: bash ./tools/prepare-ci.sh + + - name: Build + shell: bash + run: | + export TARGET_TYPE=${{ github.event.inputs.target }} + export LOG_LEVEL=${{ github.event.inputs.log_level }} + echo "Building for $TARGET_TYPE (log_level: $LOG_LEVEL)" + bash ./build.sh -e -t $TARGET_TYPE -D $LOG_LEVEL + + - name: Upload archive + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: dist \ No newline at end of file diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml deleted file mode 100644 index dafe2a22b..000000000 --- a/.github/workflows/cron.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Cron Build - -on: - schedule: -# ┌───────────── minute (0 - 59) -# │ ┌───────────── hour (0 - 23) -# │ │ ┌───────────── day of the month (1 - 31) -# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) -# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) -# │ │ │ │ │ -# │ │ │ │ │ -# │ │ │ │ │ -# * * * * * - - cron: '0 */6 * * *' - -defaults: - run: - shell: bash - -jobs: - run: - name: Build with IDF ${{ matrix.idf_branch }} - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - idf_branch: [release/v5.1, release/v4.4] #, release/v3.3] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install dependencies - run: bash ./tools/prepare-ci.sh - - name: Build - env: - GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} - GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} - GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} - IDF_BRANCH: ${{ matrix.idf_branch }} - run: | - git checkout ${{ matrix.idf_branch }} || echo "Using master branch" - bash ./tools/cron.sh - - name: Upload archive - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: dist - - - # check: - # name: Check if result should be deployed - # runs-on: ubuntu-latest - # strategy: - # matrix: - # branch: [release/v5.1, release/v4.4] #, release/v3.3] - # outputs: - # idf_branch: ${{ steps.check.outputs.idf_branch }} - # idf_commit: ${{ steps.check.outputs.idf_commit }} - # ar_branch: ${{ steps.check.outputs.ar_branch }} - # ar_new_commit_message: ${{ steps.check.outputs.ar_new_commit_message }} - # ar_new_branch_name: ${{ steps.check.outputs.ar_new_branch_name }} - # ar_new_pr_title: ${{ steps.check.outputs.ar_new_pr_title }} - # ar_has_commit: ${{ steps.check.outputs.ar_has_commit }} - # ar_has_branch: ${{ steps.check.outputs.ar_has_branch }} - # ar_has_pr: ${{ steps.check.outputs.ar_has_pr }} - # libs_version: ${{ steps.check.outputs.libs_version }} - # libs_has_commit: ${{ steps.check.outputs.libs_has_commit }} - # libs_has_branch: ${{ steps.check.outputs.libs_has_branch }} - # steps: - # - uses: actions/checkout@v3 - # - id: check - # env: - # GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} - # GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} - # GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} - # IDF_BRANCH: ${{ matrix.idf_branch }} - # run: bash ./tools/check-deploy-needed.sh - - # build: - # name: Build Libs for ${{ matrix.target }} - # runs-on: ubuntu-latest - # needs: check - # if: needs.check.outputs.libs_has_commit == '0' || needs.check.outputs.ar_has_commit == '0' - # strategy: - # matrix: - # target: [esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2] - # fail-fast: false - # steps: - # - uses: actions/checkout@v3 - # # - name: Install dependencies - # # run: bash ./tools/prepare-ci.sh - # - shell: bash - # name: Build Libs for ${{ matrix.target }} - # run: echo ${{ matrix.target }} - # # run: bash ./build.sh -t ${{ matrix.target }} - # # - name: Upload archive - # # uses: actions/upload-artifact@v3 - # # with: - # # name: artifacts - # # path: dist - - # deploy: - # name: Deploy build - # runs-on: ubuntu-latest - # needs: [check, build] - # steps: - # - uses: actions/checkout@v3 - # - shell: bash - # env: - # GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} - # GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} - # GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} - # IDF_BRANCH: ${{ needs.check.outputs.idf_branch }} - # IDF_COMMIT: ${{ needs.check.outputs.idf_commit }} - # AR_BRANCH: ${{ needs.check.outputs.ar_branch }} - # AR_NEW_COMMIT_MESSAGE: ${{ needs.check.outputs.ar_new_commit_message }} - # AR_NEW_BRANCH_NAME: ${{ needs.check.outputs.ar_new_branch_name }} - # AR_NEW_PR_TITLE: ${{ needs.check.outputs.ar_new_pr_title }} - # AR_HAS_COMMIT: ${{ needs.check.outputs.ar_has_commit }} - # AR_HAS_BRANCH: ${{ needs.check.outputs.ar_has_branch }} - # AR_HAS_PR: ${{ needs.check.outputs.ar_has_pr }} - # LIBS_VERSION: ${{ needs.check.outputs.libs_version }} - # LIBS_HAS_COMMIT: ${{ needs.check.outputs.libs_has_commit }} - # LIBS_HAS_BRANCH: ${{ needs.check.outputs.libs_has_branch }} - # run: | - # echo "IDF_COMMIT: $IDF_COMMIT" - # echo "AR_BRANCH: $AR_BRANCH" - # echo "AR_NEW_COMMIT_MESSAGE: $AR_NEW_COMMIT_MESSAGE" - # echo "AR_NEW_BRANCH_NAME: $AR_NEW_BRANCH_NAME" - # echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE" - # echo "AR_HAS_COMMIT: $AR_HAS_COMMIT" - # echo "AR_HAS_BRANCH: $AR_HAS_BRANCH" - # echo "AR_HAS_PR: $AR_HAS_PR" - # echo "LIBS_VERSION: $LIBS_VERSION" - # echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT" - # echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH" - diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 8525bdeec..000000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: ESP32 Arduino Libs CI - -on: - push: - branches: - - master - pull_request: - -concurrency: - group: esp-idf-libs-${{github.event.pull_request.number || github.ref}} - cancel-in-progress: true - -jobs: - - build-libs: - name: Build Libs for ${{ matrix.target }} - runs-on: ubuntu-latest - strategy: - matrix: - target: [esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2] - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: Install dependencies - run: bash ./tools/prepare-ci.sh - - name: Build Libs for ${{ matrix.target }} - run: bash ./build.sh -e -t ${{ matrix.target }} - - name: Upload archive - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: dist - - combine-artifacts: - name: Combine artifacts - needs: build-libs - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: artifacts - path: dist - - shell: bash - run: | - mkdir -p out - find dist -name 'arduino-esp32-libs-esp*.tar.gz' -exec tar zxvf {} -C out \; - cd out/tools/esp32-arduino-libs && tar zcf ../../../dist/esp32-arduino-libs.tar.gz * && cd ../../.. - cp out/package_esp32_index.template.json dist/package_esp32_index.template.json - - name: Upload full esp32-arduino-libs archive - uses: actions/upload-artifact@v3 - with: - name: esp32-arduino-libs - path: dist/esp32-arduino-libs.tar.gz - - name: Upload package_esp32_index.template.json - uses: actions/upload-artifact@v3 - with: - name: package-esp32-index-json - path: dist/package_esp32_index.template.json - diff --git a/.github/workflows/repository_dispatch.yml b/.github/workflows/repository_dispatch.yml deleted file mode 100644 index 678deb4e8..000000000 --- a/.github/workflows/repository_dispatch.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Remote Trigger - -on: repository_dispatch - -jobs: - run: - name: Dispatch Event - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Install dependencies - run: bash ./tools/prepare-ci.sh - - name: Handle Event - env: - GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} - GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }} - GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }} - run: bash ./tools/repository_dispatch.sh - - name: Upload archive - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: dist diff --git a/README.md b/README.md index 8133c0d7a..284a2e32a 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,117 @@ -# ESP32 Arduino Lib Builder [![ESP32 Arduino Libs CI](https://github.com/espressif/esp32-arduino-lib-builder/actions/workflows/push.yml/badge.svg)](https://github.com/espressif/esp32-arduino-lib-builder/actions/workflows/push.yml) +# ESP32 Arduino Lib Builder -This repository contains the scripts that produce the libraries included with esp32-arduino. +This repository contains the scripts that produce the SDK included with esp32-arduino. It not only supports local compilation but also provides an automated compilation and SDK download process through GitHub Actions. -Tested on Ubuntu (32 and 64 bit), Raspberry Pi and MacOS. +If you want to directly use the precompiled SDK based on the branches below, please check the [arduino-esp32-SDK](https://github.com/esp-arduino-libs/arduino-esp32-sdk) repository. -### Build on Ubuntu and Raspberry Pi -```bash -sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache jq -sudo pip install --upgrade pip -git clone https://github.com/espressif/esp32-arduino-lib-builder -cd esp32-arduino-lib-builder -./build.sh -``` -### Documentation +## Contents -For more information about how to use the Library builder, please refer to this [Documentation page](https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html?highlight=lib%20builder) +- [ESP32 Arduino Lib Builder](#esp32-arduino-lib-builder) + - [Contents](#contents) + - [Feature](#feature) + - [Branches](#branches) + - [Release Versions](#release-versions) + - [Debug Versions](#debug-versions) + - [High Performance Versions](#high-performance-versions) + - [How to Use](#how-to-use) + - [Compilation in Github](#compilation-in-github) + - [Compilation in Local](#compilation-in-local) + +## Feature + +In comparison to the original [esp32-arduino-lib-builder](https://github.com/espressif/esp32-arduino-lib-builder), this repository is used for recompiling specific versions of the SDK in `arduino-esp32` and has the following branches: + +* `release/*` is used to recompile the original SDK for a specified version. +* `debug/*` is used to recompile debug versions based on a specified SDK version. +* `high_perf/*` is used to recompile high performance versions based on a specified SDK version. It changes some configurations (as below) and can achieve higher performance in some cases, especially for avoiding [screen drifting](https://docs.espressif.com/projects/esp-faq/en/latest/software-framework/peripherals/lcd.html#why-do-i-get-drift-overall-drift-of-the-display-when-esp32-s3-is-driving-an-rgb-lcd-screen) when using RGB LCDs. (Only available for v3.x and above versions) + + * For ESP32-S3 SoCs: + * It changes the optimization level from `-Os` to `-O2` by enabling `CONFIG_COMPILER_OPTIMIZATION_PERF=y`. + * It increases the size of the data cache line from `32` to `64` by enabling `CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y`. + * For ESP32-S3R8 SoC: + * It enables the function **XIP on PSRAM** by enabling `CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y` and `CONFIG_SPIRAM_RODATA=y`. + +## Branches + +### Release Versions + +* [release/v2.0.13](https://github.com/esp-arduino-libs/esp32-arduino-lib-builder/tree/release/v2.0.13) +* [release/v3.0.0-alpha3](https://github.com/esp-arduino-libs/esp32-arduino-lib-builder/tree/release/v3.0.0-alpha3) + +### Debug Versions + +Due to the support of specifying the LOG level when compiling v3.x and above versions in esp32-arduino-lib-builder, the branches here are only used to compile debug versions of v2.x. + +* [debug/v2.0.13](https://github.com/esp-arduino-libs/esp32-arduino-lib-builder/tree/release/v2.0.13) + +### High Performance Versions + +As only v3.x and above versions support the required high-performance configurations, the branches here are only used for compiling the high_perf version of v3.x. + +* [high_perf/v3.0.0-alpha3](https://github.com/esp-arduino-libs/esp32-arduino-lib-builder/tree/high_perf/v3.0.0-alpha3) + +## How to Use + +### Compilation in Github + +1. Click `Fork` to fork this repository into your account. + + + +2. Uncheck the `Copy the master branch only` option and click `Create fork`. + + + +3. If you want to change the default configurations, follow the below steps: + + * Choose a branch based on the version you want to recompile. Here take `release/v3.0.0-alpha3` as an example. + + + + * To change the default configurations, mofify the files in the `configs` folder based on your application requirements. + + + + * Commit the changes. + + + + * Select `Create a new branch for this commit and start a pull request`, change the branch name if needed and click `Propose changes`. + + + + * Do not create a pull request, just click `Action`. Here you can see the compilation process. (Default to compile all targets) + + + + + +4. If you don't need to change the default configurations or just want to compile a specific target, follow the below steps: + + * Click `Actions`, here are two workflows, `Manual Build SDK For (v2) the Specific Target` is used to compile the v2.x version, and `Manual Build SDK For (v3) the Specific Target` is used to compile the v3.x version. + + + + * If you want to compile the **v2.x version**, click `Manual Build SDK For (v2) the Specific Target`, then click `Run workflow`. Here you can select the branch (only available for the `xx/v2.x.x` branches) and the target. + + + + * If you want to compile the **v3.x version**, click `Manual Build SDK For (v3) the Specific Target`, then click `Run workflow`. Here you can select the branch (only available for the `xx/v3.x.x` branches), the target and log level. So there are no `debug/v3.x.x` branches, you can specify the log level when compiling. + + + + * Then the compilation process will start. After it is complete, download the zip file from the `Artifacts`. + + + + + +6. To replace the original SDK, please refer to the [steps](https://github.com/esp-arduino-libs/arduino-esp32-sdk#how-to-use) for more details. + +### Compilation in Local + +1. Choose a branch version based on your application requirements and download it to the local. +2. Modify the files in the `configs` folder based on your application requirements. +3. Consult its README for compilation instructions. Note that the process involves downloading `ESP-IDF`, `arduino-esp32`, and several large components, which may take a considerable amount of time. Please be patient. +6. After the compilation is complete, the SDK will be located in the `out` folder. +7. To replace the original SDK, please refer to the [steps](https://github.com/esp-arduino-libs/arduino-esp32-sdk#how-to-use) for more details. diff --git a/docs/_static/auto_step_0-1.png b/docs/_static/auto_step_0-1.png new file mode 100644 index 000000000..e6c61e207 Binary files /dev/null and b/docs/_static/auto_step_0-1.png differ diff --git a/docs/_static/auto_step_0-2.png b/docs/_static/auto_step_0-2.png new file mode 100644 index 000000000..3acfe314f Binary files /dev/null and b/docs/_static/auto_step_0-2.png differ diff --git a/docs/_static/auto_step_1.png b/docs/_static/auto_step_1.png new file mode 100644 index 000000000..15ae08f45 Binary files /dev/null and b/docs/_static/auto_step_1.png differ diff --git a/docs/_static/auto_step_2.png b/docs/_static/auto_step_2.png new file mode 100644 index 000000000..78032d693 Binary files /dev/null and b/docs/_static/auto_step_2.png differ diff --git a/docs/_static/auto_step_3.png b/docs/_static/auto_step_3.png new file mode 100644 index 000000000..f35e04a4d Binary files /dev/null and b/docs/_static/auto_step_3.png differ diff --git a/docs/_static/auto_step_4.png b/docs/_static/auto_step_4.png new file mode 100644 index 000000000..f2182ebe3 Binary files /dev/null and b/docs/_static/auto_step_4.png differ diff --git a/docs/_static/auto_step_5.png b/docs/_static/auto_step_5.png new file mode 100644 index 000000000..96584833a Binary files /dev/null and b/docs/_static/auto_step_5.png differ diff --git a/docs/_static/auto_step_6.png b/docs/_static/auto_step_6.png new file mode 100644 index 000000000..5dd048168 Binary files /dev/null and b/docs/_static/auto_step_6.png differ diff --git a/docs/_static/auto_step_7.png b/docs/_static/auto_step_7.png new file mode 100644 index 000000000..7882ff377 Binary files /dev/null and b/docs/_static/auto_step_7.png differ diff --git a/docs/_static/manual_step_0_0.png b/docs/_static/manual_step_0_0.png new file mode 100644 index 000000000..4e8d9ca9d Binary files /dev/null and b/docs/_static/manual_step_0_0.png differ diff --git a/docs/_static/manual_step_0_1.png b/docs/_static/manual_step_0_1.png new file mode 100644 index 000000000..1a75c69bc Binary files /dev/null and b/docs/_static/manual_step_0_1.png differ diff --git a/docs/_static/manual_step_0_2.png b/docs/_static/manual_step_0_2.png new file mode 100644 index 000000000..8a3fae5c3 Binary files /dev/null and b/docs/_static/manual_step_0_2.png differ diff --git a/docs/_static/manual_step_1.png b/docs/_static/manual_step_1.png new file mode 100644 index 000000000..a049f935a Binary files /dev/null and b/docs/_static/manual_step_1.png differ diff --git a/docs/_static/manual_step_2.png b/docs/_static/manual_step_2.png new file mode 100644 index 000000000..ed1f7aded Binary files /dev/null and b/docs/_static/manual_step_2.png differ diff --git a/docs/_static/manual_step_3.png b/docs/_static/manual_step_3.png new file mode 100644 index 000000000..19e14e320 Binary files /dev/null and b/docs/_static/manual_step_3.png differ