A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/../tutorials/../lib_builder.html below:

Library Builder - - — Arduino ESP32 latest documentation

Arduino ESP32 Library Builder About

Espressif provides a macOS and Linux 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.

Installing

To install the Library Builder into your environment, please, follow the instructions below.

git clone https://github.com/espressif/esp32-arduino-lib-builder
cd esp32-arduino-lib-builder

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.

sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf cmake ninja-build ccache jq
sudo apt-get install python3
sudo pip install --upgrade pip
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:

Custom Build

There are some options to help you create custom libraries. You can use the following options:

Usage
build.sh [-s] [-A arduino_branch] [-I idf_branch] [-i idf_commit] [-c path] [-t <target>] [-b <build|menuconfig|idf_libs|copy_bootloader|mem_variant>] [config ...]
Skip Install/Update

Skip installing/updating of ESP-IDF and all components

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

./build.sh -A <arduino_branch>
Set ESP-IDF Branch

Set which branch of ESP-IDF is to be used for compilation

./build.sh -I <idf_branch>
Set the ESP-IDF Commit

Set which commit of ESP-IDF to be used for compilation

./build.sh -i <idf_commit>
Deploy

Deploy the build to github arduino-esp32

Set the Arduino-ESP32 Destination Folder

Set the arduino-esp32 folder to copy the result to. ex. ‘$HOME/Arduino/hardware/espressif/esp32’

This function is used to copy the compiled libraries to the Arduino folder.

Set the Target

Set the build target(chip). ex. ‘esp32s3’

This build command will build for the ESP32-S3 target. You can specify other targets.

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.

./build.sh -t esp32 -b <build|menuconfig|idf_libs|copy_bootloader|mem_variant>
Additional Configuration

Specify additional configs to be applied. ex. qio 80m to compile for QIO Flash at 80 MHz.

Note

This command requires the -b to work properly.

./build.sh -t esp32 -b idf_libs qio 80m
User Interface

Starting from arduino-esp32 version 3.0.0 (IDF v5.1), there is also a terminal user interface that can be used to configure the libraries to be compiled.

It allows the user to select the targets to compile, change the configuration options and compile the libraries. It has mouse support and can be pre-configured using command line arguments.

For more information and troubleshooting, check the documentation.

To use the terminal user interface, make sure to have python>=3.9, all the previous dependencies and install the textual library:

pip install --user textual

You can then run the UI using the following command:

./tools/config_editor/app.py
Pre-Configuring the UI

The UI can be pre-configured using command line arguments. The following arguments are available:

Please note that all these options can be changed in the UI itself and are only used for automation purposes.

Screens

There are many screens in the UI that are used to configure the libraries to be compiled. Note that in all screens you can also use the shortcut keys shown in the footer bar to navigate.

The UI consists of the following screens:

Docker Image

You can use a docker image for building the static libraries of ESP-IDF components for use in Arduino projects. This image contains a copy of the esp32-arduino-lib-builder repository and already includes or will obtain all the required tools and dependencies to build the Arduino static libraries.

The current supported architectures by the Docker image are:

Note

Building the libraries using the Docker image is much slower than building them natively on the host machine. It is recommended to use the Docker image only when the host machine does not meet the requirements for building the libraries (e.g., building on Windows).

Usage

Before using the espressif/esp32-arduino-lib-builder Docker image locally, make sure you have Docker installed and running on your machine. Follow the instructions at https://docs.docker.com/install/, if it is not installed yet.

If using the image in a CI environment, consult the documentation of your CI service on how to specify the image used for the build process.

Building the Libraries

You have two options to run the Docker image to build the libraries. Manually or using the provided run script.

To run the Docker image manually, use the following command from the root of the arduino-esp32 repository:

docker run --rm -it -v $PWD:/arduino-esp32 -e TERM=xterm-256color espressif/esp32-arduino-lib-builder:release-v5.4

This will start the Lib Builder UI for compiling the libraries. The above command explained:

Warning

The -v option is used to mount a folder from the host machine to the container. Make sure the folder already exists on the host machine before running the command. Otherwise, the folder will be created with root permissions and files generated inside the container might cause permission issues and compilation errors.

Note

When the mounted directory /arduino-esp32 contains a git repository owned by a different user (UID) than the one running the Docker container, git commands executed within /arduino-esp32 might fail, displaying an error message fatal: detected dubious ownership in repository at '/arduino-esp32'. To resolve this issue, you can designate the /arduino-esp32 directory as safe by setting the LIBBUILDER_GIT_SAFE_DIR environment variable during the Docker container startup. For instance, you can achieve this by including -e LIBBUILDER_GIT_SAFE_DIR='/arduino-esp32' as a parameter. Additionally, multiple directories can be specified by using a : separator. To entirely disable this git security check, * can be used.

After running the above command, you will be inside the container and the libraries can be built using the user interface.

By default the docker container will run the user interface script. If you want to run a specific command, you can pass it as an argument to the docker run command. For example, to run a terminal inside the container, you can run:

docker run -it espressif/esp32-arduino-lib-builder:release-v5.4 /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.4 tag:

curl -LJO https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v5.4/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:

Invoke-WebRequest -Uri "https://raw.githubusercontent.com/espressif/esp32-arduino-lib-builder/refs/heads/release/v5.4/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. To do so, run the following command in PowerShell:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Warning

It is always a good practice to understand what the script does before running it. Make sure to analyze the content of the script to ensure it is safe to run and won’t cause any harm to your system.

Building Custom Images

To build a custom Docker image, you need to clone the Lib Builder repository and use the provided Dockerfile in the Lib Builder repository. The Dockerfile is located in the tools/docker directory.

The Docker file in the Lib Builder repository provides several build arguments which can be used to customize the Docker image:

To use these arguments, pass them via the --build-arg command line option. For example, the following command builds a Docker image with a shallow clone of Lib Builder from a specific repository and branch:

docker buildx build -t lib-builder-custom:master \
    --build-arg LIBBUILDER_CLONE_BRANCH_OR_TAG=master \
    --build-arg LIBBUILDER_CLONE_SHALLOW=1 \
    --build-arg LIBBUILDER_CLONE_URL=https://github.com/espressif/esp32-arduino-lib-builder \
    tools/docker

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4