|
2 | 2 | Library Builder
|
3 | 3 | ###############
|
4 | 4 |
|
5 |
| -How to Use Library Builder |
6 |
| --------------------------- |
| 5 | +About |
| 6 | +----- |
7 | 7 |
|
8 |
| -Espressif has provided a `tool <https://github.com/espressif/esp32-arduino-lib-builder>`_ to simplify building your own compiled libraries for use in Arduino IDE (or your favorite IDE). |
9 |
| -To generate custom libraries, follow these steps: |
| 8 | +Espressif provides a `tool <https://github.com/espressif/esp32-arduino-lib-builder>`_ to simplify building your own compiled libraries for use in Arduino IDE (or your favorite IDE). |
10 | 9 |
|
| 10 | +This tool can be used to change the project or a specific configuration according to your needs. |
11 | 11 |
|
12 |
| -- Step 1 - Clone the ESP32 Arduino lib builder:: |
| 12 | +Installing |
| 13 | +---------- |
| 14 | + |
| 15 | +To install the Library Builder into your environment, please, follow the instructions below. |
| 16 | + |
| 17 | +- Clone the ESP32 Arduino lib builder: |
| 18 | + |
| 19 | +.. code-block:: bash |
13 | 20 |
|
14 | 21 | git clone https://github.com/espressif/esp32-arduino-lib-builder
|
15 | 22 |
|
16 |
| -- Step 2 - Go to the ``esp32-arduino-lib-builder`` folder:: |
| 23 | +- Go to the ``esp32-arduino-lib-builder`` folder: |
| 24 | + |
| 25 | +.. code-block:: bash |
17 | 26 |
|
18 | 27 | cd esp32-arduino-lib-builder
|
19 | 28 |
|
20 |
| -- Step 3 - Run the ``update-components`` script:: |
| 29 | +- Build: |
| 30 | + |
| 31 | +.. code-block:: bash |
| 32 | +
|
| 33 | + ./build.sh |
| 34 | +
|
| 35 | +If everything works, you may see the following message: ``Successfully created esp32 image.`` |
| 36 | + |
| 37 | +Dependencies |
| 38 | +************ |
| 39 | + |
| 40 | +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. |
| 41 | + |
| 42 | +- Install all dependencies (**Ubuntu**): |
| 43 | + |
| 44 | +.. code-block:: bash |
| 45 | +
|
| 46 | + sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf cmake ninja-build ccache jq |
| 47 | +
|
| 48 | +- Install Python and upgrade pip: |
| 49 | + |
| 50 | +.. code-block:: bash |
| 51 | +
|
| 52 | + sudo apt-get install python3 |
| 53 | + sudo pip install --upgrade pip |
| 54 | +
|
| 55 | +- Install all required packages: |
| 56 | + |
| 57 | +.. code-block:: bash |
| 58 | +
|
| 59 | + pip install --user setuptools pyserial click cryptography future pyparsing pyelftools |
| 60 | +
|
| 61 | +Building |
| 62 | +-------- |
| 63 | + |
| 64 | +If you have all the dependencies met, it is time to build the libraries. |
| 65 | + |
| 66 | +To build using the default configuration: |
| 67 | + |
| 68 | +.. code-block:: bash |
| 69 | +
|
| 70 | + ./build.sh |
| 71 | +
|
| 72 | +Custom Build |
| 73 | +************ |
| 74 | + |
| 75 | +There are some options to help you create custom libraries. You can use the following options: |
| 76 | + |
| 77 | +Usage |
| 78 | +^^^^^ |
| 79 | + |
| 80 | +.. code-block:: bash |
| 81 | +
|
| 82 | + 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 ...] |
| 83 | +
|
| 84 | +Skip Install/Update |
| 85 | +^^^^^^^^^^^^^^^^^^^ |
| 86 | + |
| 87 | +Skip installing/updating of ESP-IDF and all components |
| 88 | + |
| 89 | +.. code-block:: bash |
| 90 | +
|
| 91 | + ./build.sh -s |
| 92 | +
|
| 93 | +This option can be used if you already have the ESP-IDF and all components already in your environment. |
| 94 | + |
| 95 | +Set Arduino-ESP32 Branch |
| 96 | +^^^^^^^^^^^^^^^^^^^^^^^^ |
| 97 | + |
| 98 | +Set which branch of arduino-esp32 to be used for compilation |
| 99 | + |
| 100 | +.. code-block:: bash |
| 101 | +
|
| 102 | + ./build.sh -A <arduino_branch> |
| 103 | +
|
| 104 | +Set ESP-IDF Branch |
| 105 | +^^^^^^^^^^^^^^^^^^ |
| 106 | + |
| 107 | +Set which branch of ESP-IDF is to be used for compilation |
| 108 | + |
| 109 | +.. code-block:: bash |
| 110 | +
|
| 111 | + ./build.sh -I <idf_branch> |
| 112 | +
|
| 113 | +Set the ESP-IDF Commit |
| 114 | +^^^^^^^^^^^^^^^^^^^^^^ |
| 115 | + |
| 116 | +Set which commit of ESP-IDF to be used for compilation |
| 117 | + |
| 118 | +.. code-block:: bash |
| 119 | +
|
| 120 | + ./build.sh -i <idf_commit> |
| 121 | +
|
| 122 | +Deploy |
| 123 | +^^^^^^ |
| 124 | + |
| 125 | +Deploy the build to github arduino-esp32 |
| 126 | + |
| 127 | +.. code-block:: bash |
| 128 | +
|
| 129 | + ./build.sh -d |
| 130 | +
|
| 131 | +Set the Arduino-ESP32 Destination Folder |
| 132 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 133 | + |
| 134 | +Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32' |
| 135 | + |
| 136 | +.. code-block:: bash |
| 137 | +
|
| 138 | + ./build.sh -c <path> |
| 139 | +
|
| 140 | +This function is used to copy the compiled libraries to the Arduino folder. |
| 141 | + |
| 142 | +Set the Target |
| 143 | +^^^^^^^^^^^^^^ |
| 144 | + |
| 145 | +Set the build target(chip). ex. 'esp32s3' |
| 146 | + |
| 147 | +.. code-block:: bash |
| 148 | +
|
| 149 | + ./build.sh -t <target> |
| 150 | +
|
| 151 | +This build command will build for the ESP32-S3 target. You can specify other targets. |
| 152 | + |
| 153 | +* esp32 |
| 154 | +* esp32s2 |
| 155 | +* esp32c3 |
| 156 | +* esp32s3 |
| 157 | + |
| 158 | +Set Build Type |
| 159 | +^^^^^^^^^^^^^^ |
| 160 | + |
| 161 | +Set the build type. ex. 'build' to build the project and prepare for uploading to a board. |
| 162 | + |
| 163 | +.. note:: This command depends on the ``-t`` argument. |
21 | 164 |
|
22 |
| - ./tools/update-components.sh` |
| 165 | +.. code-block:: bash |
23 | 166 |
|
24 |
| -- 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):: |
| 167 | + ./build.sh -t esp32 -b <build|menuconfig|idf_libs|copy_bootloader|mem_variant> |
25 | 168 |
|
26 |
| - ./tools/install-esp-idf.sh |
| 169 | +Additional Configuration |
| 170 | +^^^^^^^^^^^^^^^^^^^^^^^^ |
27 | 171 |
|
28 |
| -- Step 5 - Copy the configuration (recommended) or directly edit sdkconfig using ``idf.py menuconfig``:: |
| 172 | +Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b |
29 | 173 |
|
30 |
| - cp sdkconfig.esp32s2 sdkconfig |
| 174 | +.. note:: This command requires the ``-b`` to work properly. |
31 | 175 |
|
32 |
| -- Step 6 - Build:: |
33 | 176 |
|
34 |
| - idf.py build |
| 177 | +.. code-block:: bash |
35 | 178 |
|
36 |
| -The script automates the process of building `Arduino as an ESP-IDF component <https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md>`_. |
37 |
| -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. |
38 |
| -``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. |
| 179 | + ./build.sh -t esp32 -b idf_libs qio 80m |
0 commit comments