Skip to content

Commit f74b83b

Browse files
committed
Merge branch 'feature/idf_tools_doc' into 'master'
docs: add API guide page about IDF Tools See merge request espressif/esp-idf!7378
2 parents 600d542 + 1cd6f67 commit f74b83b

File tree

9 files changed

+369
-12
lines changed

9 files changed

+369
-12
lines changed

docs/_static/theme_overrides.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ a.internal + code.descname::before {
5050
a.internal + em::before {
5151
content: ' ';
5252
}
53+
54+
.tool-sha256 {
55+
word-break: break-all;
56+
}

docs/conf_common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ def generate_version_specific_includes(app):
151151
call_with_python('../gen-toolchain-links.py ../../tools/toolchain_versions.mk {} {}'.format(base_url, toolchain_tmpdir))
152152
copy_if_modified(toolchain_tmpdir, '{}/inc'.format(builddir))
153153

154+
print("Generating IDF Tools list")
155+
os.environ["IDF_MAINTAINER"] = "1"
156+
tools_rst = os.path.join(builddir, 'idf-tools-inc.rst')
157+
tools_rst_tmp = os.path.join(builddir, 'inc', 'idf-tools-inc.rst')
158+
call_with_python("{}/tools/idf_tools.py gen-doc --output {}".format(idf_path, tools_rst_tmp))
159+
copy_if_modified(tools_rst_tmp, tools_rst)
160+
154161
# http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format
155162
#
156163
suppress_warnings = ['image.nonlocal_uri']
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. This file gets included from auto-generated part of idf-tools.rst.
2+
.. Comments "tool-NAME-notes" act as delimiters.
3+
4+
5+
.. tool-xtensa-esp32-elf-notes
6+
7+
8+
---
9+
10+
.. tool-xtensa-esp32s2-elf-notes
11+
12+
13+
---
14+
15+
.. tool-esp32ulp-elf-notes
16+
17+
18+
---
19+
20+
.. tool-esp32s2ulp-elf-notes
21+
22+
23+
---
24+
25+
.. tool-openocd-esp32-notes
26+
27+
28+
---
29+
30+
.. tool-cmake-notes
31+
32+
On Linux and macOS, it is recommended to install CMake using the OS-specific package manager (like apt, yum, brew, etc.). However, for convenience it is possible to install CMake using idf_tools.py along with the other tools.
33+
34+
---
35+
36+
.. tool-ninja-notes
37+
38+
On Linux and macOS, it is recommended to install ninja using the OS-specific package manager (like apt, yum, brew, etc.). However, for convenience it is possible to install ninja using idf_tools.py along with the other tools.
39+
40+
---
41+
42+
.. tool-idf-exe-notes
43+
44+
45+
---
46+
47+
.. tool-ccache-notes
48+
49+
50+
---
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
Downloadable Tools
2+
==================
3+
4+
ESP-IDF build process relies on a number of tools: cross-compiler toolchains, CMake build system, and others.
5+
6+
Installing the tools using an OS-specific package manager (like apt, yum, brew, etc.) is the preferred method when the required version of the tool is available. This recommendation is reflected in the Getting Started guide. For example, on Linux and macOS it is recommended to install CMake using an OS package manager.
7+
8+
However, some of the tools are IDF-specific and are not available in OS package repositories. Furthermore, different versions of ESP-IDF require different versions of the tools to operate correctly. To solve these two problems, ESP-IDF provides a set of scripts for downloading and installing the correct versions of tools, and exposing them in the environment.
9+
10+
The rest of the document refers to these downloadable tools simply as "tools". Other kinds of tools used in ESP-IDF are:
11+
12+
* Python scripts bundled with ESP-IDF (such as ``idf.py``)
13+
* Python packages installed from PyPI.
14+
15+
The following sections explain the installation method, and provide the list of tools installed on each platform.
16+
17+
.. note::
18+
19+
This document is provided for advanced users who need to customize their installation, users who wish to understand the installation process, and ESP-IDF developers.
20+
21+
If you are looking for instructions on how to install the tools, see the :doc:`Getting Started Guide <../../get-started/index>`.
22+
23+
24+
Tools metadata file
25+
-------------------
26+
27+
The list of tools and tool versions required for each platform is located in :idf_file:`tools/tools.json`. The schema of this file is defined by :idf_file:`tools/tools_schema.json`.
28+
29+
This file is used by :idf_file:`tools/idf_tools.py` script when installing the tools or setting up the environment variables.
30+
31+
.. _idf-tools-path:
32+
33+
Tools installation directory
34+
----------------------------
35+
36+
``IDF_TOOLS_PATH`` environment variable specifies the location where the tools are to be downloaded and installed. If not set, ``IDF_TOOLS_PATH`` defaults to ``HOME/.espressif`` on Linux and macOS, and ``%USER_PROFILE%\.espressif`` on Windows.
37+
38+
Inside ``IDF_TOOLS_PATH``, the scripts performing tools installation create the following directories:
39+
40+
- ``dist`` — where the archives of the tools are downloaded.
41+
- ``tools`` — where the tools are extracted. The tools are extracted into subdirectories: ``tools/TOOL_NAME/VERSION/``. This arrangement allows different versions of tools to be installed side by side.
42+
43+
``idf_tools.py`` script
44+
-----------------------
45+
46+
:idf_file:`tools/idf_tools.py` script bundled with ESP-IDF performs several functions:
47+
48+
* ``install``: Download the tool into ``${IDF_TOOLS_PATH}/dist`` directory, extract it into ``${IDF_TOOLS_PATH}/tools/TOOL_NAME/VERSION``.
49+
50+
``install`` command accepts the list of tools to install, in ``TOOL_NAME`` or ``TOOL_NAME@VERSION`` format. If ``all`` is given, all the tools (required and optional ones) are installed. If no argument or ``required`` is given, only the required tools are installed.
51+
52+
* ``download``: Similar to ``install`` but doesn't extract the tools. An optional ``--platform`` argument may be used to download the tools for the specific platform.
53+
54+
* ``export``: Lists the environment variables which need to be set to use the installed tools. For most of the tools, setting ``PATH`` environment variable is sufficient, but some tools require extra environment variables.
55+
56+
The environment variables can be listed in either of ``shell`` or ``key-value`` formats, set by ``--format`` parameter:
57+
58+
- ``shell`` produces output suitable for evaluation in the shell. For example,
59+
60+
::
61+
62+
export PATH="/home/user/.espressif/tools/tool/v1.0.0/bin:$PATH"
63+
64+
on Linux and macOS, and
65+
66+
::
67+
68+
set "PATH=C:\Users\user\.espressif\tools\v1.0.0\bin;%PATH%"
69+
70+
on Windows.
71+
72+
.. note::
73+
74+
Exporting environment variables in Powershell format is not supported at the moment. ``key-value`` format may be used instead.
75+
76+
The output of this command may be used to update the environment variables, if the shell supports this. For example::
77+
78+
eval $($IDF_PATH/tools/idf_tools.py export)
79+
80+
- ``key-value`` produces output in `VARIABLE=VALUE` format, suitable for parsing by other scripts::
81+
82+
PATH=/home/user/.espressif/tools/tool/v1.0.0:$PATH
83+
84+
Note that the script consuming this output has to perform expansion of ``$VAR`` or ``%VAR%`` patterns found in the output.
85+
86+
* ``list``: Lists the known versions of the tools, and indicates which ones are installed.
87+
88+
* ``check``: For each tool, checks whether the tool is available in the system path and in ``IDF_TOOLS_PATH``.
89+
90+
.. _idf-tools-install:
91+
92+
Install scripts
93+
---------------
94+
95+
Shell-specific user-facing scripts are provided in the root of ESP-IDF repository to facilitate tools installation. These are:
96+
97+
* ``install.bat`` for Windows Command Prompt
98+
* ``install.ps1`` for Powershell
99+
* ``install.sh`` for Bash
100+
101+
Aside from downloading and installing the tools into ``IDF_TOOLS_PATH``, these scripts prepare a Python virtual environment, and install the required packages into that environment.
102+
103+
.. _idf-tools-export:
104+
105+
Export scripts
106+
--------------
107+
108+
Since the installed tools are not permanently added into the user or system ``PATH`` environment variable, an extra step is required to use them in the command line. The following scripts modify the environment variables in the current shell to make the correct versions of the tools available:
109+
110+
* ``export.bat`` for Windows Command Prompt
111+
* ``export.ps1`` for Powershell
112+
* ``export.sh`` for Bash
113+
114+
.. note::
115+
116+
To modify the shell environment in Bash, ``export.sh`` must be "sourced": ``. ./export.sh`` (note the leading dot and space).
117+
118+
``export.sh`` may be used with shells other than Bash (such as zsh). However in this case the ``IDF_PATH`` environment variable must be set before running the script. When used in Bash, the script will guess the ``IDF_PATH`` value from its own location.
119+
120+
In addition to calling ``idf_tools.py``, these scripts list the directories which have been added to the ``PATH``.
121+
122+
Other installation methods
123+
--------------------------
124+
125+
Depending on the environment, more user-friendly wrappers for ``idf_tools.py`` are provided:
126+
127+
* :ref:`IDF Tools installer for Windows <get-started-windows-tools-installer>` can download and install the tools. Internally the installer uses ``idf_tools.py``.
128+
* :doc:`Eclipse plugin for ESP-IDF <../../get-started/eclipse-setup>` includes a menu item to set up the tools. Internally the plugin calls ``idf_tools.py``.
129+
* Visual Studio Code extension for ESP-IDF includes an onboarding flow. This flow helps setting up the tools. Although the extension does not rely on ``idf_tools.py``, the same installation method is used.
130+
131+
Custom installation
132+
-------------------
133+
134+
Although the methods above are recommended for ESP-IDF users, they are not a must for building ESP-IDF applications. ESP-IDF build system expects that all the necessary tools are installed somewhere, and made available in the ``PATH``.
135+
136+
.. _idf-tools-list:
137+
138+
List of IDF Tools
139+
-----------------
140+
141+
.. include:: /_build/inc/idf-tools-inc.rst

docs/en/api-guides/tools/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ Tools
44
.. toctree::
55
:maxdepth: 1
66

7+
IDF Tools <idf-tools>
78
IDF Monitor <idf-monitor>
89
IDF Docker image <idf-docker-image>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.. This file gets included from auto-generated part of idf-tools.rst.
2+
.. Comments "tool-NAME-notes" act as delimiters.
3+
.. This zh_CN version is a duplicate of en version, since includes are not expanded recursively
4+
.. before processing :start-after: and :end-before: options.
5+
6+
7+
.. tool-xtensa-esp32-elf-notes
8+
9+
10+
---
11+
12+
.. tool-xtensa-esp32s2-elf-notes
13+
14+
15+
---
16+
17+
.. tool-esp32ulp-elf-notes
18+
19+
20+
---
21+
22+
.. tool-esp32s2ulp-elf-notes
23+
24+
25+
---
26+
27+
.. tool-openocd-esp32-notes
28+
29+
30+
---
31+
32+
.. tool-cmake-notes
33+
34+
On Linux and macOS, it is recommended to install CMake using the OS package manager. However, for convenience it is possible to install CMake using idf_tools.py along with the other tools.
35+
36+
---
37+
38+
.. tool-ninja-notes
39+
40+
On Linux and macOS, it is recommended to install ninja using the OS package manager. However, for convenience it is possible to install ninja using idf_tools.py along with the other tools.
41+
42+
---
43+
44+
.. tool-idf-exe-notes
45+
46+
47+
---
48+
49+
.. tool-ccache-notes
50+
51+
52+
---
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../../en/api-guides/tools/idf-tools.rst

docs/zh_CN/api-guides/tools/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
.. toctree::
55
:maxdepth: 1
66

7+
IDF Tools <idf-tools>
78
IDF 监视器 <idf-monitor>
89
IDF Docker image <idf-docker-image>

0 commit comments

Comments
 (0)