Skip to content

Commit 0d29e14

Browse files
Gao Weiespressif-bot
authored andcommitted
tools: Add install and export scripts
1 parent dd204c4 commit 0d29e14

14 files changed

+222
-102
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The ESP-IDF master branch is marked as not supported because the major feature c
3030
End of Life IDF branches are removed. See [IDF Supported Periods](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html#support-periods) for details.
3131

3232

33-
| | ESP-IDF <br> Release/v4.3| ESP-IDF <br> Release/v4.4 | ESP-IDF <br> Release/v5.0 | ESP-IDF <br> Release/v5.1 |ESP-IDF <br> Master |
33+
| | ESP-IDF <br> [Release/v4.3](https://docs.espressif.com/projects/esp-idf/zh_CN/release-v4.3/esp32/versions.html)| ESP-IDF <br> [Release/v4.4](https://docs.espressif.com/projects/esp-idf/zh_CN/release-v4.4/esp32/versions.html) | ESP-IDF <br> [Release/v5.0](https://docs.espressif.com/projects/esp-idf/zh_CN/release-v5.0/esp32/versions.html) | ESP-IDF <br> [Release/v5.1](https://docs.espressif.com/projects/esp-idf/zh_CN/release-v5.1/esp32/versions.html) |ESP-IDF <br> [Master](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/versions.html) |
3434
|:----------- |:---------------------: | :---------------------:| :---------------------:|:---------------------: | :---------------------:|
3535
| ESP-ADF <br> Master | ![alt text](docs/_static/yes-checkm.png "supported") | ![alt text](docs/_static/yes-checkm.png "supported") | ![alt text](docs/_static/yes-checkm.png "supported") | ![alt text](docs/_static/yes-checkm.png "supported") |![alt text](docs/_static/no-icon.png "not supported") |
3636
| ESP-ADF <br> Release/v2.6 | ![alt text](docs/_static/yes-checkm.png "supported") | ![alt text](docs/_static/yes-checkm.png "supported") <sup> **1** </sup>| ![alt text](docs/_static/yes-checkm.png "supported")| ![alt text](docs/_static/yes-checkm.png "supported") |![alt text](docs/_static/no-icon.png "not supported") |

docs/en/design-guide/dev-boards/get-started-esp32-korvo-du1906.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Once the board is initially set up and checked, you can start preparing the deve
154154

155155
* **Set up ESP-IDF** to get a common development framework for the ESP32 (and ESP32-S2) chips in C language;
156156
* **Get ESP-ADF** to install the API specific to audio applications;
157-
* **Setup Path to ESP-ADF** to make the framework aware of the audio specific API;
157+
* **Set up env** to make the framework aware of the audio specific API;
158158
* **Start a Project** that will provide a sample audio application for the board;
159159
* **Connect Your Device** to prepare the application for loading;
160160
* **Build the Project** to finally run the application and play some music.

docs/en/design-guide/dev-boards/get-started-esp32-lyrat-mini.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Once the board is initially set up and checked, you can start preparing the deve
116116

117117
* **Set up ESP-IDF** to get a common development framework for the ESP32 (and ESP32-S2) chips in C language;
118118
* **Get ESP-ADF** to install the API specific to audio applications;
119-
* **Setup Path to ESP-ADF** to make the framework aware of the audio specific API;
119+
* **Set up env** to make the framework aware of the audio specific API;
120120
* **Start a Project** that will provide a sample audio application for the board;
121121
* **Connect Your Device** to prepare the application for loading;
122122
* **Build the Project** to finally run the application and play some music.

docs/en/design-guide/dev-boards/get-started-esp32-lyrat-v4.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ Once the board is initially set up and checked, you can start preparing the deve
436436

437437
* **Set up ESP-IDF** to get a common development framework for the ESP32 (and ESP32-S2) chips in C language;
438438
* **Get ESP-ADF** to install the API specific to audio applications;
439-
* **Setup Path to ESP-ADF** to make the framework aware of the audio specific API;
439+
* **Set up env** to make the framework aware of the audio specific API;
440440
* **Start a Project** that will provide a sample audio application for the board;
441441
* **Connect Your Device** to prepare the application for loading;
442442
* **Build the Project** to finally run the application and play some music.

docs/en/design-guide/dev-boards/get-started-esp32-lyrat-v4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ Once the board is initially set up and checked, you can start preparing the deve
410410

411411
* **Set up ESP-IDF** to get a common development framework for the ESP32 (and ESP32-S2) chips in C language;
412412
* **Get ESP-ADF** to install the API specific to audio applications;
413-
* **Setup Path to ESP-ADF** to make the framework aware of the audio specific API;
413+
* **Set up env** to make the framework aware of the audio specific API;
414414
* **Start a Project** that will provide a sample audio application for the board;
415415
* **Connect Your Device** to prepare the application for loading;
416416
* **Build the Project** to finally run the application and play some music.

docs/en/design-guide/dev-boards/get-started-esp32-lyrat.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Once the board is initially set up and checked, you can start preparing the deve
117117

118118
* **Set up ESP-IDF** to get a common development framework for the ESP32 (and ESP32-S2) chips in C language;
119119
* **Get ESP-ADF** to install the API specific to audio applications;
120-
* **Setup Path to ESP-ADF** to make the framework aware of the audio specific API;
120+
* **Set up env** to make the framework aware of the audio specific API;
121121
* **Start a Project** that will provide a sample audio application for the board;
122122
* **Connect Your Device** to prepare the application for loading;
123123
* **Build the Project** to finally run the application and play some music.

docs/en/design-guide/dev-boards/get-started-esp32-lyratd-msc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Once the board is initially set up and checked, you can start preparing the deve
134134

135135
* **Set up ESP-IDF** to get a common development framework for the ESP32 (and ESP32-S2) chips in C language;
136136
* **Get ESP-ADF** to install the API specific to audio applications;
137-
* **Setup Path to ESP-ADF** to make the framework aware of the audio specific API;
137+
* **Set up env** to make the framework aware of the audio specific API;
138138
* **Start a Project** that will provide a sample audio application for the board;
139139
* **Connect Your Device** to prepare the application for loading;
140140
* **Build the Project** to finally run the application and play some music.

docs/en/get-started/index.rst

Lines changed: 25 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ To use ESP-ADF you need set up the ESP-IDF first, and this is described in the n
3030

3131
.. note::
3232

33-
ESP-ADF provides support for specific `ESP-IDF versions (v3.3, v4.0, v4.1, v4.2, v4.3 and v4.4) <https://docs.espressif.com/projects/esp-idf/en/release-v3.3/versions.html>`_. If your have already set up another version, please switch to a supported ESP-IDF version, or you may not be able to compile ESP-ADF applications.
33+
ESP-ADF provides support for specific `ESP-IDF versions <https://github.com/espressif/esp-adf/blob/master/README.md#idf-version>`_. If your have already set up another version, please switch to a supported ESP-IDF version, or you may not be able to compile ESP-ADF applications. In addition, the python version needs to be between 3.7 and 3.11.
3434

3535
.. _get-started-quick-start:
3636

@@ -56,18 +56,13 @@ The operating environment below is on Linux Ubuntu 18.04 and above.
5656

5757
git clone --recursive https://gitee.com/EspressifSystems/esp-adf.git
5858

59-
2. Set the ``$ESP-ADF`` path by running::
59+
2. Configure the ``$ESP-IDF`` and ``$ESP-ADF`` compilation environment by running::
6060

6161
cd esp-adf
62-
export ADF_PATH=$PWD
63-
64-
3. Configure the ``$ESP-IDF`` compilation environment by running::
65-
66-
cd $ADF_PATH/esp-idf
6762
./install.sh
6863
. ./export.sh
6964

70-
4. After completing the above environment variable configuration, you can compile the ADF sample project ``$ADF_PATH/examples/get-started/play_mp3_control``. Switch to the project's directory, compile, and flash it onto your ESP device by running the following command. Then, you will see the serial port of the routine is printed.
65+
3. After completing the above environment variable configuration, you can compile the ADF sample project ``$ADF_PATH/examples/get-started/play_mp3_control``. Switch to the project's directory, compile, and flash it onto your ESP device by running the following command. Then, you will see the serial port of the routine is printed.
7166

7267
::
7368

@@ -87,19 +82,21 @@ Windows
8782
git clone --recursive https://gitee.com/EspressifSystems/esp-adf.git
8883

8984

90-
2. Download the full ESP-IDF Windows Installer from `ESP-IDF Windows Installer <https://dl.espressif.com/dl/esp-idf/?idf=4.4>`_.
85+
2. Install the ``$ESP-IDF`` compilation environment in the command prompt window::
9186

87+
cd esp-adf
88+
.\install.bat
9289

93-
3. Turn off the antivirus software (because it may prevent the installation as the software writes the Windows system regedit) and install the downloaded file. After the installation is complete, open the ESP-IDF-V4.4 CMD shortcut icon on the desktop, the script will automatically help you download submodules, and set environment variables such as ``IDF_PATH``.
90+
Or first download the full ESP-IDF Windows Installer from `ESP-IDF Windows Installer <https://dl.espressif.com/dl/esp-idf>`_ (Please download the `ESP-IDF versions <https://github.com/espressif/esp-adf/blob/master/README.md#idf-version>`_ supported by ESP-ADF). And then turn off the antivirus software (Because it may prevent the installation as the software writes the Windows system regedit) and install the downloaded file. After the installation is complete, open the ESP-IDF CMD shortcut icon on the desktop, the script will automatically help you download submodules, and set environment variables such as ``IDF_PATH``.
9491

9592

96-
4. Set the ``$ESP-ADF`` path by running the following commands. Note that ``%userprofile%\esp`` is used as an installation folder for ESP-ADF. You can use any directory, but you will need to adjust paths for the commands accordingly.
93+
3. Set the ``ADF_PATH`` by running the following commands::
9794

98-
set ADF_PATH=%userprofile%\esp\esp-adf
95+
.\export.bat
9996
echo %ADF_PATH%
10097

10198

102-
5. If your ``ADF_PATH`` variable prints correctly, it's time to compile the ADF routines::
99+
4. If your ``ADF_PATH`` variable prints correctly, it's time to compile the ADF routines::
103100

104101
cd %ADF_PATH%\examples\get-started\play_mp3_control
105102
idf.py build flash monitor
@@ -117,7 +114,6 @@ Setting up Development Environment
117114

118115
* :ref:`get-started-setup-esp-idf` for Windows, Linux or Mac OS
119116
* :ref:`get-started-get-esp-adf`
120-
* :ref:`get-started-setup-path`
121117
* :ref:`get-started-set-up-env`
122118

123119
Creating Your First Project
@@ -177,48 +173,12 @@ Open Terminal, and run the following commands::
177173
git clone --recursive https://github.com/espressif/esp-adf.git
178174

179175

180-
.. _get-started-setup-path:
181-
182-
Step 3. Set up Path to ESP-ADF
183-
==============================
184-
185-
The toolchain programs access ESP-ADF using ``ADF_PATH`` environment variable. This variable should be set up on your PC, otherwise the projects will not build.
186-
187-
Windows
188-
~~~~~~~
189-
190-
Open Command Prompt and run the following command::
191-
192-
set ADF_PATH=%userprofile%\esp\esp-adf
193-
194-
You need to enter this command each time you start your PC. To avoid retyping you can add it to "ESP-IDF Command Prompt", batch or Power Shell scripts described in Step 4 below.
195-
196-
To make sure that ADF_PATH has been set up properly, run::
197-
198-
echo %ADF_PATH%
199-
200-
It should return the path to your ESP-ADF directory.
201-
202-
Linux and macOS
203-
~~~~~~~~~~~~~~~
204-
205-
Open Terminal, and run the following commands::
206-
207-
export ADF_PATH=~/esp/esp-adf
208-
209-
You need to enter this command each time you open a Terminal. To make this setting permanent follow similar `instructions <https://docs.espressif.com/projects/esp-idf/en/v3.3.1/get-started/add-idf_path-to-profile.html#linux-and-macos>`__ for configuration of ``IDF_PATH`` in ESP-IDF Programming Guide.
210-
211-
Check if ``ADF_PATH`` has been set up to point to directory with ESP-ADF::
212-
213-
printenv ADF_PATH
214-
215-
216176
.. _get-started-set-up-env:
217177

218-
Step 4. Set up the environment variables
178+
Step 3. Set up the environment
219179
========================================
220180

221-
Before being able to compile ESP-ADF projects, on each new session, ESP-IDF tools should be added to the PATH environment variable. To make the tools usable from the command line, some environment variables must be set. ESP-IDF provides a script which does that.
181+
Before being able to compile ESP-ADF projects, on each new session, ESP-IDF tools should be added to the PATH environment variable. To make the tools usable from the command line, some environment variables must be set. ESP-ADF provides a script which does that.
222182

223183
Windows
224184
~~~~~~~
@@ -229,13 +189,7 @@ Alternatively, if you want to use ESP-IDF in an existing Command Prompt window,
229189

230190
.. code-block:: batch
231191
232-
%userprofile%\esp\esp-idf\export.bat
233-
234-
or with Windows PowerShell
235-
236-
.. code-block:: powershell
237-
238-
.$HOME/esp/esp-idf/export.ps1
192+
%userprofile%\esp\esp-adf\export.bat
239193
240194
Linux and macOS
241195
~~~~~~~~~~~~~~~
@@ -244,22 +198,22 @@ In the terminal where you have installed ESP-IDF, run:
244198

245199
.. code-block:: bash
246200
247-
. $HOME/esp/esp-idf/export.sh
201+
. $HOME/esp/esp-adf/export.sh
248202
249203
Note the space between the leading dot and the path!
250204

251205
You can also create an alias for the export script to your ``.profile`` or ``.bash_profile`` script. This way you can set up the environment in a new terminal window by typing ``get_idf``:
252206

253207
.. code-block:: bash
254208
255-
alias get_idf='. $HOME/esp/esp-idf/export.sh'
209+
alias get_idf='. $HOME/esp/esp-adf/export.sh'
256210
257211
Note that it is not recommended to source ``export.sh`` from the profile script directly. Doing so activates IDF virtual environment in every terminal session (even in those where IDF is not needed), defeating the purpose of the virtual environment and likely affecting other software.
258212

259213

260214
.. _get-started-start-project:
261215

262-
Step 5. Start a Project
216+
Step 4. Start a Project
263217
=======================
264218

265219
After initial preparation you are ready to build the first audio application. The process has already been described in ESP-IDF documentation. Now we would like to discuss remaining key steps and show how the toolchain is able to access the ESP-ADF :adf:`components` by using the ``ADF_PATH`` variable.
@@ -294,7 +248,7 @@ It is also possible to build examples in-place, without copying them first.
294248

295249
.. _get-started-connect:
296250

297-
Step 6. Connect Your Device
251+
Step 5. Connect Your Device
298252
===========================
299253

300254
Connect the audio board to the PC, check under what serial port the board is visible and verify, if serial communication works as described in `ESP-IDF documentation <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/establish-serial-connection.html>`_.
@@ -306,36 +260,13 @@ Connect the audio board to the PC, check under what serial port the board is vis
306260

307261
.. _get-started-configure:
308262

309-
Step 7. Configure
263+
Step 6. Configure
310264
=================
311265

312266
Navigate to your ``play_mp3_control`` directory from :ref:`get-started-start-project` and configure the project:
313267

314-
ESP-IDF v3.3.2 and v4.0 releases
315-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316-
317-
Windows
318-
^^^^^^^
319-
320-
.. code-block:: batch
321-
322-
cd %userprofile%\esp\play_mp3_control
323-
idf.py menuconfig
324-
325-
Linux and macOS
326-
^^^^^^^^^^^^^^^
327-
328-
.. code-block:: bash
329-
330-
cd ~/esp/play_mp3_control
331-
idf.py menuconfig
332-
333-
334-
ESP-IDF v4.1 and master releases
335-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336-
337268
Windows
338-
^^^^^^^
269+
~~~~~~~
339270

340271
.. code-block:: batch
341272
@@ -344,7 +275,7 @@ Windows
344275
idf.py menuconfig
345276
346277
Linux and macOS
347-
^^^^^^^^^^^^^^^
278+
~~~~~~~~~~~~~~~
348279

349280
.. code-block:: bash
350281
@@ -354,7 +285,7 @@ Linux and macOS
354285
355286
.. note::
356287

357-
If you are using an ESP32-S2 based board, then the second command above should be ``idf.py set-target esp32s2`` for ESP-IDF master release or ``idf.py set-target esp32s2beta`` for ESP-IDF v4.1 release.
288+
If you are using an ESP32-S2 based board, then the second command above should be ``idf.py set-target esp32s2``.
358289

359290
Setting the target with ``idf.py set-target <target>`` should be done once, after opening a new project. If the project contains some existing builds and configuration, they will be cleared and initialized. The target may be saved in environment variable to skip this step at all. See `Selecting the Target <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#step-7-configure>`__ in ESP-IDF Programming Guide for additional information.
360291

@@ -385,7 +316,7 @@ Select your board from the menu, press ``S`` to save configuration and then ``Q`
385316

386317
.. _get-started-build:
387318

388-
Step 8. Build the Project
319+
Step 7. Build the Project
389320
=========================
390321

391322
Build the project by running:
@@ -419,7 +350,7 @@ If there are no errors, the build will finish by generating the firmware binary
419350

420351
.. _get-started-flash:
421352

422-
Step 9. Flash onto the Device
353+
Step 8. Flash onto the Device
423354
=============================
424355

425356
Flash the binaries that you just built onto your board by running:
@@ -467,7 +398,7 @@ If there are no issues by the end of the flash process, the board will reboot an
467398

468399
.. _get-started-build-monitor:
469400

470-
Step 10. Monitor
401+
Step 9. Monitor
471402
================
472403

473404
At this point press the **Reset** button to start the application. Following several lines of start up log, the ``play_mp3_control`` application specific messages should be displayed::
@@ -538,7 +469,7 @@ Install and Set up Environment Variables
538469

539470
2. To install ESP-ADF, follow section :ref:`get-started-get-esp-adf`.
540471

541-
3. 3. To set ``ADF_PATH`` environment variable, open ``Window`` > ``Preferences`` > ``C/C++`` > ``Build`` > ``Environment`` panel, click **Add** button and fill in ``ADF_PATH``. After you complete the above steps, select ``ADF_PATH`` in ``Environment variables`` table and click **Edit** and **OK** button without changing any value (There is a bug in Eclipse CDT that is appending a null value before the path hence we need to click on edit and save it.).
472+
3. To set ``ADF_PATH`` environment variable, open ``Window`` > ``Preferences`` > ``C/C++`` > ``Build`` > ``Environment`` panel, click **Add** button and fill in ``ADF_PATH``. After you complete the above steps, select ``ADF_PATH`` in ``Environment variables`` table and click **Edit** and **OK** button without changing any value (There is a bug in Eclipse CDT that is appending a null value before the path hence we need to click on edit and save it.).
542473

543474
If this step does not work, you can delete ``ADF_PATH`` set in Eclipse and set ``ADF_PATH`` as system environment variable. For Windows, set environment variable in ``Advanced System Setting`` panel. For Linux and macOS, add ``export ADF_PATH=your adf path`` in file ``/etc/profile``. However, it is not recommended. Doing so activates ADF virtual environment in every terminal session (including those where ADF is not needed), defeating the purpose of the virtual environment and likely affecting other software.
544475

docs/zh_CN/design-guide/dev-boards/get-started-esp32-lyrat-mini.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ESP32-LyraT-Mini 上电之前,请首先确认开发板完好无损。
114114

115115
* :ref:`get-started-setup-esp-idf` 提供了一套 ESP32 的 C 语言 PC 开发编译环境;
116116
* :ref:`get-started-get-esp-adf` 获取开发音频应用程序的 API;
117-
* :ref:`get-started-setup-path` 使编译器找到音频应用 API;
117+
* :ref:`get-started-set-up-env` 使编译器找到音频应用 API;
118118
* :ref:`get-started-start-project` 提供 ESP32-LyraT-Mini 开发板的音频应用程序示例;
119119
* :ref:`get-started-connect` 准备加载应用程序;
120120
* :ref:`get-started-build` 最后运行应用程序并播放音乐。

export.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@echo off
2+
3+
set "ORIG_PATH=%cd%"
4+
set ADF_PATH=%~dp0
5+
set ADF_PATH=%ADF_PATH:~0,-1%
6+
7+
:: Check IDF_PATH
8+
if not defined IDF_PATH (
9+
set IDF_PATH=%ADF_PATH%\esp-idf
10+
)
11+
12+
echo ADF_PATH: %ADF_PATH%
13+
echo IDF_PATH: %IDF_PATH%
14+
15+
call %IDF_PATH%\export.bat
16+
if %errorlevel% neq 0 (goto :ErrorHandling)
17+
python.exe "%ADF_PATH%\tools\adf_install_patches.py" apply-patch
18+
if %errorlevel% neq 0 (goto :ErrorHandling)
19+
20+
echo.
21+
echo The following command can be executed now to view detailed usage:
22+
echo.
23+
echo idf.py --help
24+
echo.
25+
echo Compilation example (The commands highlighted in yellow below are optional: Configure the chip and project settings separately)
26+
echo.
27+
echo cd %ADF_PATH%\examples\cli
28+
echo idf.py set-target esp32
29+
echo idf.py menuconfig
30+
echo idf.py build
31+
echo.
32+
33+
:ErrorHandling
34+
echo The script encountered an error.
35+
goto :eof

0 commit comments

Comments
 (0)