mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
[Docs] Rebase conlicts fixed
[Docs] New getting started based on the ide and os selection Missing file on zh_CN folder added Added hidden toctree for missing files in CN version docs: Added steps summary to the macOS procedures [Docs] Changes on the titles and heading levels [Docs] Review according to MR 15432 [Docs] Fixed the start a new project secction
This commit is contained in:
parent
3da0b2249b
commit
e4a766051c
BIN
docs/_static/logo_windows_install.png
vendored
Normal file
BIN
docs/_static/logo_windows_install.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@ -80,7 +80,9 @@ For commands that are not known to ``idf.py`` an attempt to execute them as a bu
|
||||
|
||||
The command ``idf.py`` supports `shell autocompletion <https://click.palletsprojects.com/shell-completion/>`_ for bash, zsh and fish shells.
|
||||
|
||||
To enable autocompletion for ``idf.py`` use the ``export`` command (:ref:`see this <get-started-export>`). Autocompletion is initiated by pressing the TAB key. Type "idf.py -" and press the TAB key to autocomplete options.
|
||||
In order to make `shell autocompletion <https://click.palletsprojects.com/shell-completion/>`_ supported, please make sure you have at least Python 3.5 and `click <https://click.palletsprojects.com/>`_ 7.1 or newer (:ref:`see also <get-started-get-prerequisites>`).
|
||||
|
||||
To enable autocompletion for ``idf.py`` use the ``export`` command (:ref:`see this <get-started-set-up-env>`). Autocompletion is initiated by pressing the TAB key. Type "idf.py -" and press the TAB key to autocomplete options.
|
||||
|
||||
The autocomplete support for PowerShell is planned in the future.
|
||||
|
||||
|
@ -135,7 +135,7 @@ Once these steps are completed, call the standard C library function ``localtime
|
||||
|
||||
ESP-IDF uses 32-bit ``time_t`` type by default. To address Y2K38 issue, you may need to use 64-bit ``time_t`` type when building the application.
|
||||
|
||||
Currently this requires building the cross-compiler toolchain from scratch. See the instructions for building the toolchain in :doc:`/get-started/linux-setup-scratch`. To enable 64-bit ``time_t`` support in the toolchain, you need to remove the ``--enable-newlib-long-time_t`` option from the ``crosstool-NG/samples/xtensa-esp32-elf/crosstool.config`` file before building the toolchain.
|
||||
Currently this requires building the cross-compiler toolchain from scratch. See the instructions for building the toolchain in :doc:`/get-started/linux-macos-setup`. To enable 64-bit ``time_t`` support in the toolchain, you need to remove the ``--enable-newlib-long-time_t`` option from the ``crosstool-NG/samples/xtensa-esp32-elf/crosstool.config`` file before building the toolchain.
|
||||
|
||||
If you need to make the program compatible with both 32-bit and 64-bit ``time_t``, you may use the following methods:
|
||||
|
||||
|
@ -2,13 +2,6 @@
|
||||
Get Started
|
||||
***********
|
||||
|
||||
{IDF_TARGET_CORE_NUM:default="2", esp32s2="1", esp32c3="1"}
|
||||
|
||||
{IDF_TARGET_FEATURES:default="WiFi/BT/BLE, silicon revision 1, 2MB external flash", esp32="WiFi/BT/BLE, silicon revision 1, 2MB external flash", esp32s2="WiFi, silicon revision 0, 2MB external flash", esp32s3="This is esp32s3 chip with 2 CPU core(s), WiFi/BLE, silicon revision 0, 2MB external flash", esp32c3="WiFi/BLE, silicon revision 0, 2MB external flash"}
|
||||
|
||||
{IDF_TARGET_HEAP_SIZE:default="298968", esp32="298968", esp32s2="253900", esp32s3="390684", esp32c3="337332"}
|
||||
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
.. Please keep README.md in sync with these instructions.
|
||||
@ -62,41 +55,19 @@ Powered by 40 nm technology, {IDF_TARGET_NAME} provides a robust, highly integra
|
||||
|
||||
Espressif provides basic hardware and software resources to help application developers realize their ideas using the {IDF_TARGET_NAME} series hardware. The software development framework by Espressif is intended for development of Internet-of-Things (IoT) applications with Wi-Fi, Bluetooth, power management and several other system features.
|
||||
|
||||
|
||||
What You Need
|
||||
=============
|
||||
|
||||
Hardware:
|
||||
Hardware
|
||||
~~~~~~~~
|
||||
|
||||
* An **{IDF_TARGET_NAME}** board
|
||||
* **USB cable** - USB A / micro USB B
|
||||
* **Computer** running Windows, Linux, or macOS
|
||||
* An **{IDF_TARGET_NAME}** board.
|
||||
* **USB cable** - USB A / micro USB B.
|
||||
* **Computer** running Windows, Linux, or macOS.
|
||||
|
||||
Software:
|
||||
.. note:: Currently, some of the development boards are using USB Type C connectors. Be sure you have the correct cable to connect your board!
|
||||
|
||||
You have a choice to either download and install the following software manually
|
||||
|
||||
* **Toolchain** to compile code for {IDF_TARGET_NAME}
|
||||
* **Build tools** - CMake and Ninja to build a full **Application** for {IDF_TARGET_NAME}
|
||||
* **ESP-IDF** that essentially contains API (software libraries and source code) for {IDF_TARGET_NAME} and scripts to operate the **Toolchain**
|
||||
|
||||
**or** get through the onboarding process using the following official plugins for integrated development environments (IDE) described in separate documents
|
||||
|
||||
* `Eclipse Plugin <https://github.com/espressif/idf-eclipse-plugin>`_ (`installation link <https://github.com/espressif/idf-eclipse-plugin#installing-idf-plugin-using-update-site-url>`_)
|
||||
* `VS Code Extension <https://github.com/espressif/vscode-esp-idf-extension>`_ (`setup <https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md>`_)
|
||||
|
||||
.. figure:: ../../_static/what-you-need.png
|
||||
:align: center
|
||||
:alt: Development of applications for {IDF_TARGET_NAME}
|
||||
:figclass: align-center
|
||||
|
||||
Development of applications for {IDF_TARGET_NAME}
|
||||
|
||||
|
||||
Development Board Overviews
|
||||
===========================
|
||||
|
||||
If you have one of {IDF_TARGET_NAME} development boards listed below, you can click on the link to learn more about its hardware.
|
||||
If you have one of {IDF_TARGET_NAME} official development boards listed below, you can click on the link to learn more about the hardware.
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
@ -139,686 +110,59 @@ If you have one of {IDF_TARGET_NAME} development boards listed below, you can cl
|
||||
ESP32-S3-DevKitC-1 <../hw-reference/esp32s3/user-guide-devkitc-1>
|
||||
ESP32-S3-DevKitM-1 <../hw-reference/esp32s3/user-guide-devkitm-1>
|
||||
|
||||
|
||||
.. _get-started-step-by-step:
|
||||
|
||||
Installation Step by Step
|
||||
=========================
|
||||
|
||||
This is a detailed roadmap to walk you through the installation process.
|
||||
|
||||
Setting up Development Environment
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* :ref:`get-started-get-prerequisites` for :doc:`Windows <windows-setup>`, :doc:`Linux <linux-setup>`, or :doc:`macOS <macos-setup>`
|
||||
* :ref:`get-started-get-esp-idf`
|
||||
* :ref:`get-started-set-up-tools`
|
||||
* :ref:`get-started-set-up-env`
|
||||
|
||||
Creating Your First Project
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* :ref:`get-started-start-project`
|
||||
* :ref:`get-started-connect`
|
||||
* :ref:`get-started-configure`
|
||||
* :ref:`get-started-build`
|
||||
* :ref:`get-started-flash`
|
||||
* :ref:`get-started-build-monitor`
|
||||
|
||||
|
||||
.. _get-started-get-prerequisites:
|
||||
|
||||
Step 1. Install prerequisites
|
||||
=============================
|
||||
Software
|
||||
~~~~~~~~
|
||||
|
||||
Some tools need to be installed on the computer before proceeding to the next steps. Follow the links below for the instructions for your OS:
|
||||
To start using ESP-IDF on **{IDF_TARGET_NAME}** you'll need the following software installed:
|
||||
|
||||
* **Toolchain** to compile code for {IDF_TARGET_NAME}
|
||||
* **Build tools** - CMake and Ninja to build a full **Application** for {IDF_TARGET_NAME}
|
||||
* **ESP-IDF** that essentially contains API (software libraries and source code) for {IDF_TARGET_NAME} and scripts to operate the **Toolchain**
|
||||
|
||||
.. figure:: ../../_static/what-you-need.png
|
||||
:align: center
|
||||
:alt: Development of applications for {IDF_TARGET_NAME}
|
||||
:figclass: align-center
|
||||
|
||||
.. _get-started-step-by-step:
|
||||
.. _get-started-how-to-get-esp-idf:
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To install all the required software, we offer some different ways to facilitate this task. Choose from one of the available options.
|
||||
|
||||
IDE
|
||||
~~~
|
||||
|
||||
.. note:: We highly recommend installing the ESP-IDF through your favorite IDE.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
Eclipse Plugin <../get-started/eclipse-setup>
|
||||
VSCode Extension <../get-started/vscode-setup>
|
||||
|
||||
Manual Installation
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For the manual procedure, please select according to your operating system.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
Windows Installer <../get-started/windows-setup>
|
||||
Linux and macOS <../get-started/linux-macos-setup>
|
||||
|
||||
Build Your First Project
|
||||
========================
|
||||
|
||||
If you already have the ESP-IDF installed and not using IDE, you can build your first project from the command line following :ref:`get-started-first-steps`.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
Windows <windows-setup>
|
||||
Linux <linux-setup>
|
||||
macOS <macos-setup>
|
||||
|
||||
+-------------------+-------------------+-------------------+
|
||||
| |windows-logo| | |linux-logo| | |macos-logo| |
|
||||
+-------------------+-------------------+-------------------+
|
||||
| `Windows`_ | `Linux`_ | `Mac OS`_ |
|
||||
+-------------------+-------------------+-------------------+
|
||||
|
||||
.. |windows-logo| image:: ../../_static/windows-logo.png
|
||||
:target: ../get-started/windows-setup.html
|
||||
|
||||
.. |linux-logo| image:: ../../_static/linux-logo.png
|
||||
:target: ../get-started/linux-setup.html
|
||||
|
||||
.. |macos-logo| image:: ../../_static/macos-logo.png
|
||||
:target: ../get-started/macos-setup.html
|
||||
|
||||
.. _Windows: ../get-started/windows-setup.html
|
||||
.. _Linux: ../get-started/linux-setup.html
|
||||
.. _Mac OS: ../get-started/macos-setup.html
|
||||
|
||||
.. note::
|
||||
|
||||
This guide uses the directory ``~/esp`` on Linux and macOS or ``%userprofile%\esp`` on Windows as an installation folder for ESP-IDF. You can use any directory, but you will need to adjust paths for the commands respectively. Keep in mind that ESP-IDF does not support spaces in paths.
|
||||
|
||||
.. _get-started-get-esp-idf:
|
||||
|
||||
Step 2. Get ESP-IDF
|
||||
===================
|
||||
|
||||
To build applications for the {IDF_TARGET_NAME}, you need the software libraries provided by Espressif in `ESP-IDF repository <https://github.com/espressif/esp-idf>`_.
|
||||
|
||||
To get ESP-IDF, navigate to your installation directory and clone the repository with ``git clone``, following instructions below specific to your operating system.
|
||||
|
||||
Linux and macOS
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Open Terminal, and run the following commands:
|
||||
|
||||
.. include-build-file:: inc/git-clone-bash.inc
|
||||
|
||||
ESP-IDF will be downloaded into ``~/esp/esp-idf``.
|
||||
|
||||
Consult :doc:`/versions` for information about which ESP-IDF version to use in a given situation.
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
In addition to installing the tools, :ref:`get-started-windows-tools-installer` for Windows introduced in Step 1 can also download a copy of ESP-IDF.
|
||||
|
||||
Consult :doc:`/versions` for information about which ESP-IDF version to use in a given situation.
|
||||
|
||||
If you wish to download ESP-IDF without the help of ESP-IDF Tools Installer, refer to these :ref:`instructions <get-esp-idf-windows-command-line>`.
|
||||
|
||||
.. _get-started-set-up-tools:
|
||||
|
||||
Step 3. Set up the tools
|
||||
========================
|
||||
|
||||
Aside from the ESP-IDF, you also need to install the tools used by ESP-IDF, such as the compiler, debugger, Python packages, etc.
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
:ref:`get-started-windows-tools-installer` for Windows introduced in Step 1 installs all the required tools.
|
||||
|
||||
If you want to install the tools without the help of ESP-IDF Tools Installer, open the Command Prompt and follow these steps:
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
cd %userprofile%\esp\esp-idf
|
||||
install.bat {IDF_TARGET_PATH_NAME}
|
||||
|
||||
or with Windows PowerShell
|
||||
|
||||
.. code-block:: powershell
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
./install.ps1 {IDF_TARGET_PATH_NAME}
|
||||
|
||||
Linux and macOS
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
./install.sh {IDF_TARGET_PATH_NAME}
|
||||
|
||||
or with Fish shell
|
||||
|
||||
.. code-block:: fish
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
./install.fish {IDF_TARGET_PATH_NAME}
|
||||
|
||||
.. note::
|
||||
To install tools for multiple targets you can specify those targets at once. For example: ``./install.sh esp32,esp32c3,esp32s3``.
|
||||
To install tools for all supported targets, run the script without specifying targets ``./install.sh`` or use ``./install.sh all``.
|
||||
|
||||
Alternative File Downloads
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The tools installer downloads a number of files attached to GitHub Releases. If accessing GitHub is slow then it is possible to set an environment variable to prefer Espressif's download server for GitHub asset downloads.
|
||||
|
||||
.. note:: This setting only controls individual tools downloaded from GitHub releases, it doesn't change the URLs used to access any Git repositories.
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
To prefer the Espressif download server when running the ESP-IDF Tools Installer, mark the **Use Espressif download mirror instead of GitHub** in the screen **Select Components** section **Optimization**.
|
||||
|
||||
Linux and macOS
|
||||
---------------
|
||||
|
||||
To prefer the Espressif download server when installing tools, use the following sequence of commands when running ``install.sh``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
export IDF_GITHUB_ASSETS="dl.espressif.com/github_assets"
|
||||
./install.sh
|
||||
|
||||
Customizing the tools installation path
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The scripts introduced in this step install compilation tools required by ESP-IDF inside the user home directory: ``$HOME/.espressif`` on Linux and macOS, ``%USERPROFILE%\.espressif`` on Windows. If you wish to install the tools into a different directory, set the environment variable ``IDF_TOOLS_PATH`` before running the installation scripts. Make sure that your user account has sufficient permissions to read and write this path.
|
||||
|
||||
If changing the ``IDF_TOOLS_PATH``, make sure it is set to the same value every time the Install script (``install.bat``, ``install.ps1`` or ``install.sh``) and an Export script (``export.bat``, ``export.ps1`` or ``export.sh``) are executed.
|
||||
|
||||
.. _get-started-set-up-env:
|
||||
|
||||
|
||||
Step 4. Set up the environment variables
|
||||
========================================
|
||||
|
||||
The installed tools are not yet added to the PATH environment variable. To make the tools usable from the command line, some environment variables must be set. ESP-IDF provides another script which does that.
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
:ref:`get-started-windows-tools-installer` for Windows creates an "ESP-IDF Command Prompt" shortcut in the Start Menu. This shortcut opens the Command Prompt and sets up all the required environment variables. You can open this shortcut and proceed to the next step.
|
||||
|
||||
Alternatively, if you want to use ESP-IDF in an existing Command Prompt window, you can run:
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
%userprofile%\esp\esp-idf\export.bat
|
||||
|
||||
or with Windows PowerShell
|
||||
|
||||
.. code-block:: powershell
|
||||
|
||||
.$HOME/esp/esp-idf/export.ps1
|
||||
|
||||
.. _get-started-export:
|
||||
|
||||
Linux and macOS
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
In the terminal where you are going to use ESP-IDF, run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
. $HOME/esp/esp-idf/export.sh
|
||||
|
||||
or for fish (supported only since fish version 3.0.0):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
. $HOME/esp/esp-idf/export.fish
|
||||
|
||||
Note the space between the leading dot and the path!
|
||||
|
||||
If you plan to use esp-idf frequently, you can create an alias for executing ``export.sh``:
|
||||
|
||||
1. Copy and paste the following command to your shell's profile (``.profile``, ``.bashrc``, ``.zprofile``, etc.)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
alias get_idf='. $HOME/esp/esp-idf/export.sh'
|
||||
|
||||
2. Refresh the configuration by restarting the terminal session or by running ``source [path to profile]``, for example, ``source ~/.bashrc``.
|
||||
|
||||
Now you can run ``get_idf`` to set up or refresh the esp-idf environment in any terminal session.
|
||||
|
||||
Technically, you can add ``export.sh`` to your shell's profile directly; however, it is not recommended. Doing so activates IDF virtual environment in every terminal session (including those where IDF is not needed), defeating the purpose of the virtual environment and likely affecting other software.
|
||||
|
||||
.. _get-started-start-project:
|
||||
|
||||
Step 5. Start a Project
|
||||
=======================
|
||||
|
||||
Now you are ready to prepare your application for {IDF_TARGET_NAME}. You can start with :example:`get-started/hello_world` project from :idf:`examples` directory in IDF.
|
||||
|
||||
Copy the project :example:`get-started/hello_world` to ``~/esp`` directory:
|
||||
|
||||
Linux and macOS
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp
|
||||
cp -r $IDF_PATH/examples/get-started/hello_world .
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
cd %userprofile%\esp
|
||||
xcopy /e /i %IDF_PATH%\examples\get-started\hello_world hello_world
|
||||
|
||||
There is a range of example projects in the :idf:`examples` directory in ESP-IDF. You can copy any project in the same way as presented above and run it. It is also possible to build examples in-place, without copying them first.
|
||||
|
||||
.. important::
|
||||
|
||||
The ESP-IDF build system does not support spaces in the paths to either ESP-IDF or to projects.
|
||||
|
||||
.. _get-started-connect:
|
||||
|
||||
Step 6. Connect Your Device
|
||||
===========================
|
||||
|
||||
Now connect your {IDF_TARGET_NAME} board to the computer and check under what serial port the board is visible.
|
||||
|
||||
Serial ports have the following patterns in their names:
|
||||
|
||||
- **Windows**: names like ``COM1``
|
||||
- **Linux**: starting with ``/dev/tty``
|
||||
- **macOS**: starting with ``/dev/cu.``
|
||||
|
||||
If you are not sure how to check the serial port name, please refer to :doc:`establish-serial-connection` for full details.
|
||||
|
||||
.. note::
|
||||
|
||||
Keep the port name handy as you will need it in the next steps.
|
||||
|
||||
|
||||
.. _get-started-configure:
|
||||
|
||||
Step 7. Configure
|
||||
=================
|
||||
|
||||
Navigate to your ``hello_world`` directory from :ref:`get-started-start-project`, set {IDF_TARGET_NAME} chip as the target and run the project configuration utility ``menuconfig``.
|
||||
|
||||
Linux and macOS
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/hello_world
|
||||
idf.py set-target {IDF_TARGET_PATH_NAME}
|
||||
idf.py menuconfig
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
cd %userprofile%\esp\hello_world
|
||||
idf.py set-target {IDF_TARGET_PATH_NAME}
|
||||
idf.py menuconfig
|
||||
|
||||
Setting the target with ``idf.py set-target {IDF_TARGET_PATH_NAME}`` 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 :ref:`selecting-idf-target` for additional information.
|
||||
|
||||
If the previous steps have been done correctly, the following menu appears:
|
||||
|
||||
.. figure:: ../../_static/project-configuration.png
|
||||
:align: center
|
||||
:alt: Project configuration - Home window
|
||||
:figclass: align-center
|
||||
|
||||
Project configuration - Home window
|
||||
|
||||
You are using this menu to set up project specific variables, e.g. Wi-Fi network name and password, the processor speed, etc. Setting up the project with menuconfig may be skipped for "hello_word". This example will run with default configuration.
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. attention::
|
||||
|
||||
If you use ESP32-DevKitC board with the **ESP32-SOLO-1** module, or ESP32-DevKitM-1 board with the **ESP32-MIN1-1(1U)** module, enable single core mode (:ref:`CONFIG_FREERTOS_UNICORE`) in menuconfig before flashing examples.
|
||||
|
||||
.. note::
|
||||
|
||||
The colors of the menu could be different in your terminal. You can change the appearance with the option ``--style``. Please run ``idf.py menuconfig --help`` for further information.
|
||||
|
||||
.. _get-started-build:
|
||||
|
||||
Step 8. Build the Project
|
||||
=========================
|
||||
|
||||
Build the project by running:
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
idf.py build
|
||||
|
||||
This command will compile the application and all ESP-IDF components, then it will generate the bootloader, partition table, and application binaries.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
$ idf.py build
|
||||
Running cmake in directory /path/to/hello_world/build
|
||||
Executing "cmake -G Ninja --warn-uninitialized /path/to/hello_world"...
|
||||
Warn about uninitialized values.
|
||||
-- Found Git: /usr/bin/git (found version "2.17.0")
|
||||
-- Building empty aws_iot component due to configuration
|
||||
-- Component names: ...
|
||||
-- Component paths: ...
|
||||
|
||||
... (more lines of build system output)
|
||||
|
||||
[527/527] Generating hello_world.bin
|
||||
esptool.py v2.3.1
|
||||
|
||||
Project build complete. To flash, run this command:
|
||||
../../../components/esptool_py/esptool/esptool.py -p (PORT) -b 921600 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x10000 build/hello_world.bin build 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin
|
||||
or run 'idf.py -p PORT flash'
|
||||
|
||||
If there are no errors, the build will finish by generating the firmware binary .bin files.
|
||||
|
||||
|
||||
.. _get-started-flash:
|
||||
|
||||
Step 9. Flash onto the Device
|
||||
=============================
|
||||
|
||||
Flash the binaries that you just built (bootloader.bin, partition-table.bin and hello_world.bin) onto your {IDF_TARGET_NAME} board by running:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
idf.py -p PORT [-b BAUD] flash
|
||||
|
||||
Replace PORT with your {IDF_TARGET_NAME} board's serial port name from :ref:`get-started-connect`.
|
||||
|
||||
You can also change the flasher baud rate by replacing BAUD with the baud rate you need. The default baud rate is ``460800``.
|
||||
|
||||
For more information on idf.py arguments, see :ref:`idf.py`.
|
||||
|
||||
.. note::
|
||||
|
||||
The option ``flash`` automatically builds and flashes the project, so running ``idf.py build`` is not necessary.
|
||||
|
||||
|
||||
Encountered Issues While Flashing?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{IDF_TARGET_STRAP_GPIO:default="GPIO0", esp32="GPIO0", esp32s2="GPIO0", esp32s3="GPIO0", esp32c3="GPIO9"}
|
||||
|
||||
If you run the given command and see errors such as "Failed to connect", there might be several reasons for this. One of the reasons might be issues encountered by ``esptool.py``, the utility that is called by the build system to reset the chip, interact with the ROM bootloader, and flash firmware. One simple solution to try is manual reset described below, and if it does not help you can find more details about possible issues in `Troubleshooting <https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html#bootloader-won-t-respond>`_.
|
||||
|
||||
``esptool.py`` resets {IDF_TARGET_NAME} automatically by asserting DTR and RTS control lines of the USB to serial converter chip, i.e., FTDI or CP210x (for more information, see :doc:`establish-serial-connection`). The DTR and RTS control lines are in turn connected to ``{IDF_TARGET_STRAP_GPIO}`` and ``CHIP_PU`` (EN) pins of {IDF_TARGET_NAME}, thus changes in the voltage levels of DTR and RTS will boot {IDF_TARGET_NAME} into Firmware Download mode. As an example, check the `schematic <https://dl.espressif.com/dl/schematics/esp32_devkitc_v4-sch-20180607a.pdf>`_ for the ESP32 DevKitC development board.
|
||||
|
||||
In general, you should have no problems with the official esp-idf development boards. However, ``esptool.py`` is not able to reset your hardware automatically in the following cases:
|
||||
|
||||
- Your hardware does not have the DTR and RTS lines connected to ``{IDF_TARGET_STRAP_GPIO}`` and ``CHIP_PU``
|
||||
- The DTR and RTS lines are configured differently
|
||||
- There are no such serial control lines at all
|
||||
|
||||
Depending on the kind of hardware you have, it may also be possible to manually put your {IDF_TARGET_NAME} board into Firmware Download mode (reset).
|
||||
|
||||
- For development boards produced by Espressif, this information can be found in the respective getting started guides or user guides. For example, to manually reset an esp-idf development board, hold down the **Boot** button (``{IDF_TARGET_STRAP_GPIO}``) and press the **EN** button (``CHIP_PU``).
|
||||
- For other types of hardware, try pulling ``{IDF_TARGET_STRAP_GPIO}`` down.
|
||||
|
||||
|
||||
Normal Operation
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
When flashing, you will see the output log similar to the following:
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py --chip esp32 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello_world.bin
|
||||
esptool.py v3.0-dev
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting........_
|
||||
Chip is ESP32D0WDQ6 (revision 0)
|
||||
Features: WiFi, BT, Dual Core, Coding Scheme None
|
||||
Crystal is 40MHz
|
||||
MAC: 24:0a:c4:05:b9:14
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 5962.8 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 26096 bytes to 15408...
|
||||
Writing at 0x00001000... (100 %)
|
||||
Wrote 26096 bytes (15408 compressed) at 0x00001000 in 0.4 seconds (effective 546.7 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 147104 bytes to 77364...
|
||||
Writing at 0x00010000... (20 %)
|
||||
Writing at 0x00014000... (40 %)
|
||||
Writing at 0x00018000... (60 %)
|
||||
Writing at 0x0001c000... (80 %)
|
||||
Writing at 0x00020000... (100 %)
|
||||
Wrote 147104 bytes (77364 compressed) at 0x00010000 in 1.9 seconds (effective 615.5 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
.. only:: esp32s2
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py --chip esp32s2 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello_world.bin
|
||||
esptool.py v3.0-dev
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting....
|
||||
Chip is ESP32-S2
|
||||
Features: WiFi
|
||||
Crystal is 40MHz
|
||||
MAC: 18:fe:34:72:50:e3
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 3851.6 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 22592 bytes to 13483...
|
||||
Writing at 0x00001000... (100 %)
|
||||
Wrote 22592 bytes (13483 compressed) at 0x00001000 in 0.3 seconds (effective 595.1 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 140048 bytes to 70298...
|
||||
Writing at 0x00010000... (20 %)
|
||||
Writing at 0x00014000... (40 %)
|
||||
Writing at 0x00018000... (60 %)
|
||||
Writing at 0x0001c000... (80 %)
|
||||
Writing at 0x00020000... (100 %)
|
||||
Wrote 140048 bytes (70298 compressed) at 0x00010000 in 1.7 seconds (effective 662.5 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
.. only:: esp32s3
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py esp32s3 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 2MB 0x0 bootloader/bootloader.bin 0x10000 hello_world.bin 0x8000 partition_table/partition-table.bin
|
||||
esptool.py v3.2-dev
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting....
|
||||
Chip is ESP32-S3
|
||||
Features: WiFi, BLE
|
||||
Crystal is 40MHz
|
||||
MAC: 7c:df:a1:e0:00:64
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Flash will be erased from 0x00000000 to 0x00004fff...
|
||||
Flash will be erased from 0x00010000 to 0x00039fff...
|
||||
Flash will be erased from 0x00008000 to 0x00008fff...
|
||||
Compressed 18896 bytes to 11758...
|
||||
Writing at 0x00000000... (100 %)
|
||||
Wrote 18896 bytes (11758 compressed) at 0x00000000 in 0.5 seconds (effective 279.9 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 168208 bytes to 88178...
|
||||
Writing at 0x00010000... (16 %)
|
||||
Writing at 0x0001a80f... (33 %)
|
||||
Writing at 0x000201f1... (50 %)
|
||||
Writing at 0x00025dcf... (66 %)
|
||||
Writing at 0x0002d0be... (83 %)
|
||||
Writing at 0x00036c07... (100 %)
|
||||
Wrote 168208 bytes (88178 compressed) at 0x00010000 in 2.4 seconds (effective 569.2 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 478.9 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
|
||||
.. only:: esp32c3
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py --chip esp32c3 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x0 bootloader/bootloader.bin 0x10000 hello_world.bin
|
||||
esptool.py v3.0
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting....
|
||||
Chip is ESP32-C3
|
||||
Features: Wi-Fi
|
||||
Crystal is 40MHz
|
||||
MAC: 7c:df:a1:40:02:a4
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 4238.1 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 18960 bytes to 11311...
|
||||
Writing at 0x00000000... (100 %)
|
||||
Wrote 18960 bytes (11311 compressed) at 0x00000000 in 0.3 seconds (effective 584.9 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 145520 bytes to 71984...
|
||||
Writing at 0x00010000... (20 %)
|
||||
Writing at 0x00014000... (40 %)
|
||||
Writing at 0x00018000... (60 %)
|
||||
Writing at 0x0001c000... (80 %)
|
||||
Writing at 0x00020000... (100 %)
|
||||
Wrote 145520 bytes (71984 compressed) at 0x00010000 in 2.3 seconds (effective 504.4 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
|
||||
If there are no issues by the end of the flash process, the board will reboot and start up the “hello_world” application.
|
||||
|
||||
If you'd like to use the Eclipse or VS Code IDE instead of running ``idf.py``, check out the :doc:`Eclipse guide <eclipse-setup>`, :doc:`VS Code guide <vscode-setup>`.
|
||||
|
||||
|
||||
.. _get-started-build-monitor:
|
||||
|
||||
Step 10. Monitor
|
||||
================
|
||||
|
||||
To check if "hello_world" is indeed running, type ``idf.py -p PORT monitor`` (Do not forget to replace PORT with your serial port name).
|
||||
|
||||
This command launches the :doc:`IDF Monitor <../api-guides/tools/idf-monitor>` application::
|
||||
|
||||
$ idf.py -p /dev/ttyUSB0 monitor
|
||||
Running idf_monitor in directory [...]/esp/hello_world/build
|
||||
Executing "python [...]/esp-idf/tools/idf_monitor.py -b 115200 [...]/esp/hello_world/build/hello_world.elf"...
|
||||
--- idf_monitor on /dev/ttyUSB0 115200 ---
|
||||
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
|
||||
ets Jun 8 2016 00:22:57
|
||||
|
||||
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
|
||||
ets Jun 8 2016 00:22:57
|
||||
...
|
||||
|
||||
After startup and diagnostic logs scroll up, you should see "Hello world!" printed out by the application.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
Hello world!
|
||||
Restarting in 10 seconds...
|
||||
This is {IDF_TARGET_PATH_NAME} chip with {IDF_TARGET_CORE_NUM} CPU core(s), {IDF_TARGET_FEATURES}
|
||||
Minimum free heap size: {IDF_TARGET_HEAP_SIZE} bytes
|
||||
Restarting in 9 seconds...
|
||||
Restarting in 8 seconds...
|
||||
Restarting in 7 seconds...
|
||||
|
||||
To exit IDF monitor use the shortcut ``Ctrl+]``.
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
If IDF monitor fails shortly after the upload, or, if instead of the messages above, you see random garbage similar to what is given below, your board is likely using a 26 MHz crystal. Most development board designs use 40 MHz, so ESP-IDF uses this frequency as a default value.
|
||||
|
||||
.. figure:: ../../_static/get-started-garbled-output.png
|
||||
:align: center
|
||||
:alt: Garbled output
|
||||
:figclass: align-center
|
||||
|
||||
If you have such a problem, do the following:
|
||||
|
||||
1. Exit the monitor.
|
||||
2. Go back to :ref:`menuconfig <get-started-configure>`.
|
||||
3. Go to Component config --> ESP32-specific --> Main XTAL frequency, then change :ref:`CONFIG_ESP32_XTAL_FREQ_SEL` to 26 MHz.
|
||||
4. After that, :ref:`build and flash <get-started-flash>` the application again.
|
||||
|
||||
.. note::
|
||||
|
||||
You can combine building, flashing and monitoring into one step by running::
|
||||
|
||||
idf.py -p PORT flash monitor
|
||||
|
||||
.. only:: esp32s3
|
||||
|
||||
.. note::
|
||||
|
||||
If a board with Octal Flash resets before the second-stage bootloader, please refer to :ref:`Octal Flash Error Handling <flash-psram-error>`
|
||||
|
||||
See also:
|
||||
|
||||
- :doc:`IDF Monitor <../api-guides/tools/idf-monitor>` for handy shortcuts and more details on using IDF monitor.
|
||||
- :ref:`idf.py` for a full reference of ``idf.py`` commands and options.
|
||||
|
||||
**That's all that you need to get started with {IDF_TARGET_NAME}!**
|
||||
|
||||
Now you are ready to try some other :idf:`examples`, or go straight to developing your own applications.
|
||||
|
||||
.. important::
|
||||
|
||||
Some of examples do not support {IDF_TARGET_NAME} because required hardware is not included in {IDF_TARGET_NAME} so it cannot be supported.
|
||||
|
||||
If building an example, please check the README file for the ``Supported Targets`` table. If this is present including {IDF_TARGET_NAME} target, or the table does not exist at all, the example will work on {IDF_TARGET_NAME}.
|
||||
|
||||
|
||||
Updating ESP-IDF
|
||||
================
|
||||
|
||||
You should update ESP-IDF from time to time, as newer versions fix bugs and provide new features. The simplest way to do the update is to delete the existing ``esp-idf`` folder and clone it again, as if performing the initial installation described in :ref:`get-started-get-esp-idf`.
|
||||
|
||||
Another solution is to update only what has changed. :ref:`The update procedure depends on the version of ESP-IDF you are using <updating>`.
|
||||
|
||||
After updating ESP-IDF, execute the Install script again, in case the new ESP-IDF version requires different versions of tools. See instructions at :ref:`get-started-set-up-tools`.
|
||||
|
||||
Once the new tools are installed, update the environment using the Export script. See instructions at :ref:`get-started-set-up-env`.
|
||||
|
||||
Related Documents
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
establish-serial-connection
|
||||
eclipse-setup
|
||||
vscode-setup
|
||||
../api-guides/tools/idf-monitor
|
||||
toolchain-setup-scratch
|
||||
|
||||
.. _Stable version: https://docs.espressif.com/projects/esp-idf/en/stable/
|
||||
.. _Releases page: https://github.com/espressif/esp-idf/releases
|
||||
Manual <linux-macos-setup>
|
||||
|
251
docs/en/get-started/linux-macos-setup.rst
Normal file
251
docs/en/get-started/linux-macos-setup.rst
Normal file
@ -0,0 +1,251 @@
|
||||
********************************************
|
||||
Standard Toolchain Setup for Linux and macOS
|
||||
********************************************
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Installation Step by Step
|
||||
=========================
|
||||
|
||||
This is a detailed roadmap to walk you through the installation process.
|
||||
|
||||
Setting up Development Environment
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
These are the steps for setting up the ESP-IDF for your {IDF_TARGET_NAME}.
|
||||
|
||||
* :ref:`get-started-prerequisites`
|
||||
* :ref:`get-started-get-esp-idf`
|
||||
* :ref:`get-started-set-up-tools`
|
||||
* :ref:`get-started-set-up-env`
|
||||
* :ref:`get-started-start-a-project`
|
||||
|
||||
.. _get-started-prerequisites:
|
||||
|
||||
Step 1. Install Prerequisites
|
||||
=============================
|
||||
|
||||
In order to use ESP-IDF with the {IDF_TARGET_NAME}, you need to install some software packages based on your Operating System. This setup guide will help you on getting everything installed on Linux and macOS based systems.
|
||||
|
||||
For Linux Users
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
To compile using ESP-IDF you will need to get the following packages. The command to run depends on which distribution of Linux you are using:
|
||||
|
||||
- Ubuntu and Debian::
|
||||
|
||||
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
|
||||
|
||||
- CentOS 7 & 8::
|
||||
|
||||
sudo yum -y update && sudo yum install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache dfu-util libusbx
|
||||
|
||||
CentOS 7 is still supported but CentOS version 8 is recommended for a better user experience.
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make flex bison gperf python-pip cmake ninja ccache dfu-util libusb
|
||||
|
||||
.. note::
|
||||
- CMake version 3.5 or newer is required for use with ESP-IDF. Older Linux distributions may require updating, enabling of a "backports" repository, or installing of a "cmake3" package rather than "cmake".
|
||||
- If you do not see your Linux distribution in the above list then please check its documentation to find out which command to use for package installation.
|
||||
|
||||
For macOS Users
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
ESP-IDF will use the version of Python installed by default on macOS.
|
||||
|
||||
- Install pip::
|
||||
|
||||
sudo easy_install pip
|
||||
|
||||
- Install CMake & Ninja build:
|
||||
|
||||
- If you have HomeBrew_, you can run::
|
||||
|
||||
brew install cmake ninja dfu-util
|
||||
|
||||
- If you have MacPorts_, you can run::
|
||||
|
||||
sudo port install cmake ninja dfu-util
|
||||
|
||||
- Otherwise, consult the CMake_ and Ninja_ home pages for macOS installation downloads.
|
||||
|
||||
- It is strongly recommended to also install ccache_ for faster builds. If you have HomeBrew_, this can be done via ``brew install ccache`` or ``sudo port install ccache`` on MacPorts_.
|
||||
|
||||
.. note::
|
||||
If an error like this is shown during any step::
|
||||
|
||||
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
|
||||
|
||||
Then you will need to install the XCode command line tools to continue. You can install these by running ``xcode-select --install``.
|
||||
|
||||
Installing Python 3
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Based on macOS `Catalina 10.15 release notes`_, use of Python 2.7 is not recommended and Python 2.7 will not be included by default in future versions of macOS. Check what Python you currently have::
|
||||
|
||||
python --version
|
||||
|
||||
If the output is like ``Python 2.7.17``, your default interpreter is Python 2.7. If so, also check if Python 3 isn't already installed on your computer::
|
||||
|
||||
python3 --version
|
||||
|
||||
If the above command returns an error, it means Python 3 is not installed.
|
||||
|
||||
Below is an overview of the steps to install Python 3.
|
||||
|
||||
- Installing with HomeBrew_ can be done as follows::
|
||||
|
||||
brew install python3
|
||||
|
||||
- If you have MacPorts_, you can run::
|
||||
|
||||
sudo port install python38
|
||||
|
||||
.. _get-started-get-esp-idf:
|
||||
|
||||
Step 2. Get ESP-IDF
|
||||
===================
|
||||
|
||||
To build applications for the {IDF_TARGET_NAME}, you need the software libraries provided by Espressif in `ESP-IDF repository <https://github.com/espressif/esp-idf>`_.
|
||||
|
||||
To get ESP-IDF, navigate to your installation directory and clone the repository with ``git clone``, following instructions below specific to your operating system.
|
||||
|
||||
Open Terminal, and run the following commands:
|
||||
|
||||
.. include-build-file:: inc/git-clone-bash.inc
|
||||
|
||||
ESP-IDF will be downloaded into ``~/esp/esp-idf``.
|
||||
|
||||
Consult :doc:`/versions` for information about which ESP-IDF version to use in a given situation.
|
||||
|
||||
.. _get-started-set-up-tools:
|
||||
|
||||
Step 3. Set up the tools
|
||||
========================
|
||||
|
||||
Aside from the ESP-IDF, you also need to install the tools used by ESP-IDF, such as the compiler, debugger, Python packages, etc.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
./install.sh {IDF_TARGET_PATH_NAME}
|
||||
|
||||
or with Fish shell
|
||||
|
||||
.. code-block:: fish
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
./install.fish {IDF_TARGET_PATH_NAME}
|
||||
|
||||
.. note::
|
||||
To install tools for multiple targets you can specify those targets at once. For example: ``./install.sh esp32,esp32c3,esp32s3``.
|
||||
To install tools for all supported targets, run the script without specifying targets ``./install.sh`` or use ``./install.sh all``.
|
||||
|
||||
Alternative File Downloads
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The tools installer downloads a number of files attached to GitHub Releases. If accessing GitHub is slow then it is possible to set an environment variable to prefer Espressif's download server for GitHub asset downloads.
|
||||
|
||||
.. note:: This setting only controls individual tools downloaded from GitHub releases, it doesn't change the URLs used to access any Git repositories.
|
||||
|
||||
To prefer the Espressif download server when installing tools, use the following sequence of commands when running ``install.sh``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/esp-idf
|
||||
export IDF_GITHUB_ASSETS="dl.espressif.com/github_assets"
|
||||
./install.sh
|
||||
|
||||
Customizing the tools installation path
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The scripts introduced in this step install compilation tools required by ESP-IDF inside the user home directory: ``$HOME/.espressif`` on Linux. If you wish to install the tools into a different directory, set the environment variable ``IDF_TOOLS_PATH`` before running the installation scripts. Make sure that your user account has sufficient permissions to read and write this path.
|
||||
|
||||
If changing the ``IDF_TOOLS_PATH``, make sure it is set to the same value every time the Install script (``install.bat``, ``install.ps1`` or ``install.sh``) and an Export script (``export.bat``, ``export.ps1`` or ``export.sh``) are executed.
|
||||
|
||||
.. _get-started-set-up-env:
|
||||
|
||||
Step 4. Set up the environment variables
|
||||
========================================
|
||||
|
||||
The installed tools are not yet added to the PATH environment variable. To make the tools usable from the command line, some environment variables must be set. ESP-IDF provides another script which does that.
|
||||
|
||||
In the terminal where you are going to use ESP-IDF, run:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
. $HOME/esp/esp-idf/export.sh
|
||||
|
||||
or for fish (supported only since fish version 3.0.0):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
. $HOME/esp/esp-idf/export.fish
|
||||
|
||||
Note the space between the leading dot and the path!
|
||||
|
||||
If you plan to use esp-idf frequently, you can create an alias for executing ``export.sh``:
|
||||
|
||||
1. Copy and paste the following command to your shell's profile (``.profile``, ``.bashrc``, ``.zprofile``, etc.)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
alias get_idf='. $HOME/esp/esp-idf/export.sh'
|
||||
|
||||
2. Refresh the configuration by restarting the terminal session or by running ``source [path to profile]``, for example, ``source ~/.bashrc``.
|
||||
|
||||
Now you can run ``get_idf`` to set up or refresh the esp-idf environment in any terminal session.
|
||||
|
||||
Technically, you can add ``export.sh`` to your shell's profile directly; however, it is not recommended. Doing so activates IDF virtual environment in every terminal session (including those where IDF is not needed), defeating the purpose of the virtual environment and likely affecting other software.
|
||||
|
||||
.. _get-started-start-a-project:
|
||||
.. _get-started-build:
|
||||
.. _get-started-configure:
|
||||
.. _get-started-connect:
|
||||
.. _get-started-first-steps:
|
||||
|
||||
Step 5. First Steps on ESP-IDF
|
||||
==============================
|
||||
|
||||
.. include:: start-project.rst
|
||||
|
||||
Tip: Updating ESP-IDF
|
||||
======================
|
||||
|
||||
<<<<<<< HEAD
|
||||
It is recommended to update ESP-IDF from time to time, as newer versions fix bugs and/or provide new features. Please note that each ESP-IDF major and minor release version has an associated support period, and when one release branch is approaching end of life (EOL), all users are encouraged to upgrade their projects to more recent ESP-IDF releases, to find out more about support periods, see ESP-IDF Versions.
|
||||
|
||||
The simplest way to do the update is to delete the existing ``esp-idf`` folder and clone it again, as if performing the initial installation described in :ref:`get-started-get-esp-idf`.
|
||||
=======
|
||||
You should update ESP-IDF from time to time, as newer versions fix bugs and provide new features. The simplest way to do the update is to delete the existing ``esp-idf`` folder and clone it again, as if performing the initial installation described in :ref:`get-started-get-esp-idf`.
|
||||
>>>>>>> [Docs] New getting started based on the ide and os selection
|
||||
|
||||
Another solution is to update only what has changed. :ref:`The update procedure depends on the version of ESP-IDF you are using <updating>`.
|
||||
|
||||
After updating ESP-IDF, execute the Install script again, in case the new ESP-IDF version requires different versions of tools. See instructions at :ref:`get-started-set-up-tools`.
|
||||
|
||||
Once the new tools are installed, update the environment using the Export script. See instructions at :ref:`get-started-set-up-env`.
|
||||
|
||||
Related Documents
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
establish-serial-connection
|
||||
eclipse-setup
|
||||
vscode-setup
|
||||
../api-guides/tools/idf-monitor
|
||||
|
||||
.. _Stable version: https://docs.espressif.com/projects/esp-idf/en/stable/
|
||||
.. _Releases page: https://github.com/espressif/esp-idf/releases
|
||||
.. _AUR: https://wiki.archlinux.org/index.php/Arch_User_Repository
|
||||
.. _First Steps on ESP-IDF: ../get-started/first-steps.html
|
||||
.. _cmake: https://cmake.org/
|
||||
.. _ninja: https://ninja-build.org/
|
||||
.. _ccache: https://ccache.samba.org/
|
||||
.. _homebrew: https://brew.sh/
|
||||
.. _MacPorts: https://www.macports.org/install.php
|
||||
.. _Catalina 10.15 release notes: https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes
|
@ -1,102 +0,0 @@
|
||||
******************************************
|
||||
Setup Linux Toolchain from Scratch
|
||||
******************************************
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
The following instructions are alternative to downloading binary toolchain from Espressif website. To quickly setup the binary toolchain, instead of compiling it yourself, backup and proceed to section :doc:`linux-setup`.
|
||||
|
||||
.. note:: The reason you might need to build your own toolchain is to solve the Y2K38 problem (time_t expand to 64 bits instead of 32 bits).
|
||||
|
||||
Install Prerequisites
|
||||
=====================
|
||||
|
||||
To compile with ESP-IDF you need to get the following packages:
|
||||
|
||||
- CentOS 7::
|
||||
|
||||
sudo yum -y update && sudo yum install git wget ncurses-devel flex bison gperf python3 python3-pip cmake ninja-build ccache dfu-util libusbx
|
||||
|
||||
CentOS 7 is still supported but CentOS version 8 is recommended for a better user experience.
|
||||
|
||||
- Ubuntu and Debian::
|
||||
|
||||
sudo apt-get install git wget libncurses-dev flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -Sy --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools cmake ninja ccache dfu-util libusb
|
||||
|
||||
.. note::
|
||||
CMake version 3.5 or newer is required for use with ESP-IDF. Older Linux distributions may require updating, enabling of a "backports" repository, or installing of a "cmake3" package rather than "cmake".
|
||||
|
||||
Compile the Toolchain from Source
|
||||
=================================
|
||||
|
||||
- Install dependencies:
|
||||
|
||||
- CentOS 7::
|
||||
|
||||
sudo yum install gawk gperf grep gettext ncurses-devel python3 python3-devel automake bison flex texinfo help2man libtool make
|
||||
|
||||
- Ubuntu pre-16.04::
|
||||
|
||||
sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool make
|
||||
|
||||
- Ubuntu 16.04 or newer::
|
||||
|
||||
sudo apt-get install gawk gperf grep gettext python python-dev automake bison flex texinfo help2man libtool libtool-bin make
|
||||
|
||||
- Debian 9::
|
||||
|
||||
sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool libtool-bin make
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -Sy --needed python-pip
|
||||
|
||||
Create the working directory and go into it::
|
||||
|
||||
mkdir -p ~/esp
|
||||
cd ~/esp
|
||||
|
||||
Download ``crosstool-NG`` and build it:
|
||||
|
||||
.. include-build-file:: inc/scratch-build-code.inc
|
||||
|
||||
Build the toolchain::
|
||||
|
||||
./ct-ng {IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
./ct-ng build
|
||||
chmod -R u+w builds/{IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
|
||||
Toolchain will be built in ``~/esp/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}``.
|
||||
|
||||
Add Toolchain to PATH
|
||||
=====================
|
||||
|
||||
The custom toolchain needs to be copied to a binary directory and added to the ``PATH``. Choose a directory, for example ``~/esp/{IDF_TARGET_TOOLCHAIN_PREFIX}/``, and copy the build output to this directory.
|
||||
|
||||
To use it, you will need to update your ``PATH`` environment variable in ``~/.profile`` file. To make ``{IDF_TARGET_TOOLCHAIN_PREFIX}`` available for all terminal sessions, add the following line to your ``~/.profile`` file::
|
||||
|
||||
export PATH="$HOME/esp/{IDF_TARGET_TOOLCHAIN_PREFIX}/bin:$PATH"
|
||||
|
||||
.. note::
|
||||
|
||||
If you have ``/bin/bash`` set as login shell, and both ``.bash_profile`` and ``.profile`` exist, then update ``.bash_profile`` instead. In CentOS, ``alias`` should set in ``.bashrc``.
|
||||
|
||||
Log off and log in back to make the ``.profile`` changes effective. Run the following command to verify if ``PATH`` is correctly set::
|
||||
|
||||
printenv PATH
|
||||
|
||||
You are looking for similar result containing toolchain's path at the beginning of displayed string::
|
||||
|
||||
$ printenv PATH
|
||||
/home/user-name/esp/{IDF_TARGET_TOOLCHAIN_PREFIX}/bin:/home/user-name/bin:/home/user-name/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
|
||||
|
||||
Instead of ``/home/user-name`` there should be a home path specific to your installation.
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
|
||||
To carry on with development environment setup, proceed to :ref:`get-started-get-esp-idf`.
|
@ -1,49 +0,0 @@
|
||||
*********************************************
|
||||
Standard Setup of Toolchain for Linux
|
||||
*********************************************
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Install Prerequisites
|
||||
=====================
|
||||
|
||||
To compile with ESP-IDF you need to get the following packages. The command to run depends on which distribution of Linux you are using:
|
||||
|
||||
- Ubuntu and Debian::
|
||||
|
||||
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
|
||||
|
||||
- CentOS 7 & 8::
|
||||
|
||||
sudo yum -y update && sudo yum install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache dfu-util libusbx
|
||||
|
||||
CentOS 7 is still supported but CentOS version 8 is recommended for a better user experience.
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make flex bison gperf python-pip cmake ninja ccache dfu-util libusb
|
||||
|
||||
.. note::
|
||||
- CMake version 3.5 or newer is required for use with ESP-IDF. Older Linux distributions may require updating, enabling of a "backports" repository, or installing of a "cmake3" package rather than "cmake".
|
||||
- If you do not see your Linux distribution in the above list then please check its documentation to find out which command to use for package installation.
|
||||
|
||||
Additional Tips
|
||||
===============
|
||||
|
||||
Permission issues /dev/ttyUSB0
|
||||
------------------------------
|
||||
|
||||
With some Linux distributions you may get the ``Failed to open port /dev/ttyUSB0`` error message when flashing the {IDF_TARGET_NAME}. :ref:`This can be solved by adding the current user to the dialout group<linux-dialout-group>`.
|
||||
|
||||
Python compatibility
|
||||
====================
|
||||
|
||||
ESP-IDF supports Python 3.7 or newer. It is recommended to upgrade your operating system to a recent version satisfying this requirement. Other options include the installation of Python from `sources <https://www.python.org/downloads/>`_ or the use of a Python version management system such as `pyenv <https://github.com/pyenv/pyenv>`_.
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
|
||||
To carry on with development environment setup, proceed to :ref:`get-started-get-esp-idf`.
|
||||
|
||||
|
||||
.. _AUR: https://wiki.archlinux.org/index.php/Arch_User_Repository
|
@ -1,85 +0,0 @@
|
||||
***********************************************
|
||||
Setup Toolchain for Mac OS from Scratch
|
||||
***********************************************
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Package Manager
|
||||
===============
|
||||
|
||||
To set up the toolchain from scratch, rather than :doc:`downloading a pre-compiled toolchain<macos-setup>`, you will need to install either the MacPorts_ or Homebrew_ package manager.
|
||||
|
||||
MacPorts needs a full XCode installation, while Homebrew only needs XCode command line tools.
|
||||
|
||||
.. _Homebrew: https://brew.sh/
|
||||
.. _MacPorts: https://www.macports.org/install.php
|
||||
|
||||
See :ref:`Customized Setup of Toolchain <get-started-customized-setup>` section for some of the reasons why installing the toolchain from scratch may be necessary.
|
||||
|
||||
Install Prerequisites
|
||||
=====================
|
||||
|
||||
- install pip::
|
||||
|
||||
sudo easy_install pip
|
||||
|
||||
- install pyserial::
|
||||
|
||||
pip install --user pyserial
|
||||
|
||||
- install CMake & Ninja build:
|
||||
|
||||
- If you have Homebrew, you can run::
|
||||
|
||||
brew install cmake ninja dfu-util
|
||||
|
||||
- If you have MacPorts, you can run::
|
||||
|
||||
sudo port install cmake ninja dfu-util
|
||||
|
||||
Compile the Toolchain from Source
|
||||
=================================
|
||||
|
||||
Install dependencies:
|
||||
|
||||
- with MacPorts::
|
||||
|
||||
sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake make
|
||||
|
||||
- with Homebrew::
|
||||
|
||||
brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake make
|
||||
|
||||
Create a case-sensitive filesystem image::
|
||||
|
||||
hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
|
||||
|
||||
Mount it::
|
||||
|
||||
hdiutil mount ~/esp/crosstool.dmg
|
||||
|
||||
Create a symlink to your work directory::
|
||||
|
||||
mkdir -p ~/esp
|
||||
ln -s /Volumes/ctng ~/esp/ctng-volume
|
||||
|
||||
Go into the newly created directory::
|
||||
|
||||
cd ~/esp/ctng-volume
|
||||
|
||||
Download ``crosstool-NG`` and build it:
|
||||
|
||||
.. include-build-file:: inc/scratch-build-code.inc
|
||||
|
||||
Build the toolchain::
|
||||
|
||||
./ct-ng {IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
./ct-ng build
|
||||
chmod -R u+w builds/{IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
|
||||
Toolchain will be built in ``~/esp/ctng-volume/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}``. To use it, you need to add ``~/esp/ctng-volume/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}/bin`` to ``PATH`` environment variable.
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
|
||||
To carry on with development environment setup, proceed to :ref:`get-started-get-esp-idf`.
|
@ -1,70 +0,0 @@
|
||||
**********************************************
|
||||
Standard Setup of Toolchain for Mac OS
|
||||
**********************************************
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Install Prerequisites
|
||||
=====================
|
||||
|
||||
ESP-IDF will use the version of Python installed by default on macOS.
|
||||
|
||||
- install pip::
|
||||
|
||||
sudo easy_install pip
|
||||
|
||||
- install CMake & Ninja build:
|
||||
|
||||
- If you have HomeBrew_, you can run::
|
||||
|
||||
brew install cmake ninja dfu-util
|
||||
|
||||
- If you have MacPorts_, you can run::
|
||||
|
||||
sudo port install cmake ninja dfu-util
|
||||
|
||||
- Otherwise, consult the CMake_ and Ninja_ home pages for macOS installation downloads.
|
||||
|
||||
- It is strongly recommended to also install ccache_ for faster builds. If you have HomeBrew_, this can be done via ``brew install ccache`` or ``sudo port install ccache`` on MacPorts_.
|
||||
|
||||
.. note::
|
||||
If an error like this is shown during any step::
|
||||
|
||||
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
|
||||
|
||||
Then you will need to install the XCode command line tools to continue. You can install these by running ``xcode-select --install``.
|
||||
|
||||
Installing Python 3
|
||||
-------------------
|
||||
|
||||
Basing on macOS `Catalina 10.15 release notes`_, use of Python 2.7 is not recommended and Python 2.7 will not be included by default in future versions of macOS. Check what Python you currently have::
|
||||
|
||||
python --version
|
||||
|
||||
If the output is like ``Python 2.7.17``, your default interpreter is Python 2.7. If so, also check if Python 3 isn't already installed on your computer::
|
||||
|
||||
python3 --version
|
||||
|
||||
If above command returns an error, it means Python 3 is not installed.
|
||||
|
||||
Below is an overview of steps to install Python 3.
|
||||
|
||||
- Installing with HomeBrew_ can be done as follows::
|
||||
|
||||
brew install python3
|
||||
|
||||
- If you have MacPorts_, you can run::
|
||||
|
||||
sudo port install python38
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
|
||||
To carry on with development environment setup, proceed to :ref:`get-started-get-esp-idf`.
|
||||
|
||||
.. _cmake: https://cmake.org/
|
||||
.. _ninja: https://ninja-build.org/
|
||||
.. _ccache: https://ccache.samba.org/
|
||||
.. _homebrew: https://brew.sh/
|
||||
.. _MacPorts: https://www.macports.org/install.php
|
||||
.. _Catalina 10.15 release notes: https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes
|
434
docs/en/get-started/start-project.rst
Normal file
434
docs/en/get-started/start-project.rst
Normal file
@ -0,0 +1,434 @@
|
||||
{IDF_TARGET_CORE_NUM:default="2", esp32s2="1", esp32c3="1"}
|
||||
|
||||
{IDF_TARGET_FEATURES:default="WiFi/BT/BLE, silicon revision 1, 2MB external flash", esp32="WiFi/BT/BLE, silicon revision 1, 2MB external flash", esp32s2="WiFi, silicon revision 0, 2MB external flash", esp32s3="This is esp32s3 chip with 2 CPU core(s), WiFi/BLE, silicon revision 0, 2MB external flash", esp32c3="WiFi/BLE, silicon revision 0, 2MB external flash"}
|
||||
|
||||
{IDF_TARGET_HEAP_SIZE:default="298968", esp32="298968", esp32s2="253900", esp32s3="390684", esp32c3="337332"}
|
||||
|
||||
Now you have all requirements to start using ESP-IDF, the next topic will guide you on how to start your first project.
|
||||
|
||||
This guide will help you on the first steps using ESP-IDF. By following this guide you will able to start a new project, connect the {IDF_TARGET_NAME}, change the project configuration, build, flash, and monitor the project.
|
||||
|
||||
.. note:: If you haven't yet installed the ESP-IDF, please go to :ref:`get-started-step-by-step` and follow the instruction in oder to get all the software needed to use this guide.
|
||||
|
||||
Start a Project
|
||||
===============
|
||||
|
||||
Now you are ready to prepare your application for {IDF_TARGET_NAME}. You can start with :example:`get-started/hello_world` project from :idf:`examples` directory in IDF.
|
||||
|
||||
.. important::
|
||||
|
||||
The ESP-IDF build system does not support spaces in the paths to either ESP-IDF or to projects.
|
||||
|
||||
Copy the project :example:`get-started/hello_world` to ``~/esp`` directory:
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
cd %userprofile%\esp
|
||||
xcopy /e /i %IDF_PATH%\examples\get-started\hello_world hello_world
|
||||
|
||||
Linux/macOS
|
||||
~~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp
|
||||
cp -r $IDF_PATH/examples/get-started/hello_world .
|
||||
|
||||
.. note:: There is a range of example projects in the :idf:`examples` directory in ESP-IDF. You can copy any project in the same way as presented above and run it. It is also possible to build examples in-place, without copying them first.
|
||||
|
||||
Connect Your Device
|
||||
===================
|
||||
|
||||
Now connect your {IDF_TARGET_NAME} board to the computer and check under what serial port the board is visible.
|
||||
|
||||
Serial ports have the following patterns in their names:
|
||||
|
||||
- **Windows**: names like ``COM1``
|
||||
- **Linux**: starting with ``/dev/tty``
|
||||
- **macOS**: starting with ``/dev/cu.``
|
||||
|
||||
If you are not sure how to check the serial port name, please refer to :doc:`establish-serial-connection` for full details.
|
||||
|
||||
.. note::
|
||||
|
||||
Keep the port name handy as you will need it in the next steps.
|
||||
|
||||
Configure your Project
|
||||
======================
|
||||
|
||||
Navigate to your ``hello_world`` directory, set {IDF_TARGET_NAME} chip as the target and run the project configuration utility ``menuconfig``.
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
cd %userprofile%\esp\hello_world
|
||||
idf.py set-target {IDF_TARGET_PATH_NAME}
|
||||
idf.py menuconfig
|
||||
|
||||
Linux/macOS
|
||||
~~~~~~~~~~~
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd ~/esp/hello_world
|
||||
idf.py set-target {IDF_TARGET_PATH_NAME}
|
||||
idf.py menuconfig
|
||||
|
||||
Setting the target with ``idf.py set-target {IDF_TARGET_PATH_NAME}`` 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 :ref:`selecting-idf-target` for additional information.
|
||||
|
||||
If the previous steps have been done correctly, the following menu appears:
|
||||
|
||||
.. figure:: ../../_static/project-configuration.png
|
||||
:align: center
|
||||
:alt: Project configuration - Home window
|
||||
:figclass: align-center
|
||||
|
||||
Project configuration - Home window
|
||||
|
||||
You are using this menu to set up project specific variables, e.g. Wi-Fi network name and password, the processor speed, etc. Setting up the project with menuconfig may be skipped for "hello_word". This example will run with default configuration.
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. attention::
|
||||
|
||||
If you use ESP32-DevKitC board with the **ESP32-SOLO-1** module, or ESP32-DevKitM-1 board with the **ESP32-MIN1-1(1U)** module, enable single core mode (:ref:`CONFIG_FREERTOS_UNICORE`) in menuconfig before flashing examples.
|
||||
|
||||
.. note::
|
||||
|
||||
The colors of the menu could be different in your terminal. You can change the appearance with the option ``--style``. Please run ``idf.py menuconfig --help`` for further information.
|
||||
|
||||
Build the Project
|
||||
=================
|
||||
|
||||
Build the project by running:
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
idf.py build
|
||||
|
||||
This command will compile the application and all ESP-IDF components, then it will generate the bootloader, partition table, and application binaries.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
$ idf.py build
|
||||
Running cmake in directory /path/to/hello_world/build
|
||||
Executing "cmake -G Ninja --warn-uninitialized /path/to/hello_world"...
|
||||
Warn about uninitialized values.
|
||||
-- Found Git: /usr/bin/git (found version "2.17.0")
|
||||
-- Building empty aws_iot component due to configuration
|
||||
-- Component names: ...
|
||||
-- Component paths: ...
|
||||
|
||||
... (more lines of build system output)
|
||||
|
||||
[527/527] Generating hello_world.bin
|
||||
esptool.py v2.3.1
|
||||
|
||||
Project build complete. To flash, run this command:
|
||||
../../../components/esptool_py/esptool/esptool.py -p (PORT) -b 921600 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x10000 build/hello_world.bin build 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin
|
||||
or run 'idf.py -p PORT flash'
|
||||
|
||||
If there are no errors, the build will finish by generating the firmware binary .bin files.
|
||||
|
||||
Flash onto the Device
|
||||
=====================
|
||||
|
||||
Flash the binaries that you just built (bootloader.bin, partition-table.bin and hello_world.bin) onto your {IDF_TARGET_NAME} board by running:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
idf.py -p PORT [-b BAUD] flash
|
||||
|
||||
Replace PORT with your {IDF_TARGET_NAME} board's serial port name.
|
||||
|
||||
You can also change the flasher baud rate by replacing BAUD with the baud rate you need. The default baud rate is ``460800``.
|
||||
|
||||
For more information on idf.py arguments, see :ref:`idf.py`.
|
||||
|
||||
.. note::
|
||||
|
||||
The option ``flash`` automatically builds and flashes the project, so running ``idf.py build`` is not necessary.
|
||||
|
||||
Encountered Issues While Flashing?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
{IDF_TARGET_STRAP_GPIO:default="GPIO0", esp32="GPIO0", esp32s2="GPIO0", esp32s3="GPIO0", esp32c3="GPIO9"}
|
||||
|
||||
If you run the given command and see errors such as "Failed to connect", there might be several reasons for this. One of the reasons might be issues encountered by ``esptool.py``, the utility that is called by the build system to reset the chip, interact with the ROM bootloader, and flash firmware. One simple solution to try is manual reset described below, and if it does not help you can find more details about possible issues in `Troubleshooting <https://github.com/espressif/esptool#bootloader-wont-respond>`_.
|
||||
|
||||
``esptool.py`` resets {IDF_TARGET_NAME} automatically by asserting DTR and RTS control lines of the USB to serial converter chip, i.e., FTDI or CP210x (for more information, see :doc:`establish-serial-connection`). The DTR and RTS control lines are in turn connected to ``{IDF_TARGET_STRAP_GPIO}`` and ``CHIP_PU`` (EN) pins of {IDF_TARGET_NAME}, thus changes in the voltage levels of DTR and RTS will boot {IDF_TARGET_NAME} into Firmware Download mode. As an example, check the `schematic <https://dl.espressif.com/dl/schematics/esp32_devkitc_v4-sch-20180607a.pdf>`_ for the ESP32 DevKitC development board.
|
||||
|
||||
In general, you should have no problems with the `official esp-idf development boards <https://www.espressif.com/en/products/devkits>`_. However, ``esptool.py`` is not able to reset your hardware automatically in the following cases:
|
||||
|
||||
- Your hardware does not have the DTR and RTS lines connected to ``{IDF_TARGET_STRAP_GPIO}`` and ``CHIP_PU``
|
||||
- The DTR and RTS lines are configured differently
|
||||
- There are no such serial control lines at all
|
||||
|
||||
Depending on the kind of hardware you have, it may also be possible to manually put your {IDF_TARGET_NAME} board into Firmware Download mode (reset).
|
||||
|
||||
- For development boards produced by Espressif, this information can be found in the respective getting started guides or user guides. For example, to manually reset an esp-idf development board, hold down the **Boot** button (``{IDF_TARGET_STRAP_GPIO}``) and press the **EN** button (``CHIP_PU``).
|
||||
- For other types of hardware, try pulling ``{IDF_TARGET_STRAP_GPIO}`` down.
|
||||
|
||||
Normal Operation
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
When flashing, you will see the output log similar to the following:
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py --chip esp32 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello_world.bin
|
||||
esptool.py v3.0-dev
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting........_
|
||||
Chip is ESP32D0WDQ6 (revision 0)
|
||||
Features: WiFi, BT, Dual Core, Coding Scheme None
|
||||
Crystal is 40MHz
|
||||
MAC: 24:0a:c4:05:b9:14
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 5962.8 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 26096 bytes to 15408...
|
||||
Writing at 0x00001000... (100 %)
|
||||
Wrote 26096 bytes (15408 compressed) at 0x00001000 in 0.4 seconds (effective 546.7 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 147104 bytes to 77364...
|
||||
Writing at 0x00010000... (20 %)
|
||||
Writing at 0x00014000... (40 %)
|
||||
Writing at 0x00018000... (60 %)
|
||||
Writing at 0x0001c000... (80 %)
|
||||
Writing at 0x00020000... (100 %)
|
||||
Wrote 147104 bytes (77364 compressed) at 0x00010000 in 1.9 seconds (effective 615.5 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
.. only:: esp32s2
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py --chip esp32s2 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x10000 hello_world.bin
|
||||
esptool.py v3.0-dev
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting....
|
||||
Chip is ESP32-S2
|
||||
Features: WiFi
|
||||
Crystal is 40MHz
|
||||
MAC: 18:fe:34:72:50:e3
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 3851.6 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 22592 bytes to 13483...
|
||||
Writing at 0x00001000... (100 %)
|
||||
Wrote 22592 bytes (13483 compressed) at 0x00001000 in 0.3 seconds (effective 595.1 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 140048 bytes to 70298...
|
||||
Writing at 0x00010000... (20 %)
|
||||
Writing at 0x00014000... (40 %)
|
||||
Writing at 0x00018000... (60 %)
|
||||
Writing at 0x0001c000... (80 %)
|
||||
Writing at 0x00020000... (100 %)
|
||||
Wrote 140048 bytes (70298 compressed) at 0x00010000 in 1.7 seconds (effective 662.5 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
.. only:: esp32s3
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py esp32s3 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 2MB 0x0 bootloader/bootloader.bin 0x10000 hello_world.bin 0x8000 partition_table/partition-table.bin
|
||||
esptool.py v3.2-dev
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting....
|
||||
Chip is ESP32-S3
|
||||
Features: WiFi, BLE
|
||||
Crystal is 40MHz
|
||||
MAC: 7c:df:a1:e0:00:64
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Flash will be erased from 0x00000000 to 0x00004fff...
|
||||
Flash will be erased from 0x00010000 to 0x00039fff...
|
||||
Flash will be erased from 0x00008000 to 0x00008fff...
|
||||
Compressed 18896 bytes to 11758...
|
||||
Writing at 0x00000000... (100 %)
|
||||
Wrote 18896 bytes (11758 compressed) at 0x00000000 in 0.5 seconds (effective 279.9 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 168208 bytes to 88178...
|
||||
Writing at 0x00010000... (16 %)
|
||||
Writing at 0x0001a80f... (33 %)
|
||||
Writing at 0x000201f1... (50 %)
|
||||
Writing at 0x00025dcf... (66 %)
|
||||
Writing at 0x0002d0be... (83 %)
|
||||
Writing at 0x00036c07... (100 %)
|
||||
Wrote 168208 bytes (88178 compressed) at 0x00010000 in 2.4 seconds (effective 569.2 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.1 seconds (effective 478.9 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
|
||||
.. only:: esp32c3
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
esptool.py --chip esp32c3 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x0 bootloader/bootloader.bin 0x10000 hello_world.bin
|
||||
esptool.py v3.0
|
||||
Serial port /dev/ttyUSB0
|
||||
Connecting....
|
||||
Chip is ESP32-C3
|
||||
Features: Wi-Fi
|
||||
Crystal is 40MHz
|
||||
MAC: 7c:df:a1:40:02:a4
|
||||
Uploading stub...
|
||||
Running stub...
|
||||
Stub running...
|
||||
Changing baud rate to 460800
|
||||
Changed.
|
||||
Configuring flash size...
|
||||
Compressed 3072 bytes to 103...
|
||||
Writing at 0x00008000... (100 %)
|
||||
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 4238.1 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 18960 bytes to 11311...
|
||||
Writing at 0x00000000... (100 %)
|
||||
Wrote 18960 bytes (11311 compressed) at 0x00000000 in 0.3 seconds (effective 584.9 kbit/s)...
|
||||
Hash of data verified.
|
||||
Compressed 145520 bytes to 71984...
|
||||
Writing at 0x00010000... (20 %)
|
||||
Writing at 0x00014000... (40 %)
|
||||
Writing at 0x00018000... (60 %)
|
||||
Writing at 0x0001c000... (80 %)
|
||||
Writing at 0x00020000... (100 %)
|
||||
Wrote 145520 bytes (71984 compressed) at 0x00010000 in 2.3 seconds (effective 504.4 kbit/s)...
|
||||
Hash of data verified.
|
||||
|
||||
Leaving...
|
||||
Hard resetting via RTS pin...
|
||||
Done
|
||||
|
||||
|
||||
If there are no issues by the end of the flash process, the board will reboot and start up the “hello_world” application.
|
||||
|
||||
If you'd like to use the Eclipse or VS Code IDE instead of running ``idf.py``, check out the :doc:`Eclipse guide <eclipse-setup>`, :doc:`VS Code guide <vscode-setup>`.
|
||||
|
||||
Monitor the Output
|
||||
==================
|
||||
|
||||
To check if "hello_world" is indeed running, type ``idf.py -p PORT monitor`` (Do not forget to replace PORT with your serial port name).
|
||||
|
||||
This command launches the :doc:`IDF Monitor <../api-guides/tools/idf-monitor>` application::
|
||||
|
||||
$ idf.py -p <PORT> monitor
|
||||
Running idf_monitor in directory [...]/esp/hello_world/build
|
||||
Executing "python [...]/esp-idf/tools/idf_monitor.py -b 115200 [...]/esp/hello_world/build/hello_world.elf"...
|
||||
--- idf_monitor on <PORT> 115200 ---
|
||||
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
|
||||
ets Jun 8 2016 00:22:57
|
||||
|
||||
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
|
||||
ets Jun 8 2016 00:22:57
|
||||
...
|
||||
|
||||
After startup and diagnostic logs scroll up, you should see "Hello world!" printed out by the application.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
Hello world!
|
||||
Restarting in 10 seconds...
|
||||
This is {IDF_TARGET_PATH_NAME} chip with {IDF_TARGET_CORE_NUM} CPU core(s), {IDF_TARGET_FEATURES}
|
||||
Minimum free heap size: {IDF_TARGET_HEAP_SIZE} bytes
|
||||
Restarting in 9 seconds...
|
||||
Restarting in 8 seconds...
|
||||
Restarting in 7 seconds...
|
||||
|
||||
To exit IDF monitor use the shortcut ``Ctrl+]``.
|
||||
|
||||
.. only:: esp32
|
||||
|
||||
If IDF monitor fails shortly after the upload, or, if instead of the messages above, you see random garbage similar to what is given below, your board is likely using a 26 MHz crystal. Most development board designs use 40 MHz, so ESP-IDF uses this frequency as a default value.
|
||||
|
||||
.. figure:: ../../_static/get-started-garbled-output.png
|
||||
:align: center
|
||||
:alt: Garbled output
|
||||
:figclass: align-center
|
||||
|
||||
If you have such a problem, do the following:
|
||||
|
||||
1. Exit the monitor.
|
||||
2. Go back to `menuconfig`.
|
||||
3. Go to Component config --> ESP32-specific --> Main XTAL frequency, then change :ref:`CONFIG_ESP32_XTAL_FREQ_SEL` to 26 MHz.
|
||||
4. After that, `build and flash` the application again.
|
||||
|
||||
.. note::
|
||||
|
||||
You can combine building, flashing and monitoring into one step by running::
|
||||
|
||||
idf.py -p PORT flash monitor
|
||||
|
||||
See also:
|
||||
|
||||
- :doc:`IDF Monitor <../api-guides/tools/idf-monitor>` for handy shortcuts and more details on using IDF monitor.
|
||||
- :ref:`idf.py` for a full reference of ``idf.py`` commands and options.
|
||||
|
||||
**That's all that you need to get started with {IDF_TARGET_NAME}!**
|
||||
|
||||
Now you are ready to try some other :idf:`examples`, or go straight to developing your own applications.
|
||||
|
||||
.. important::
|
||||
|
||||
Some of examples do not support {IDF_TARGET_NAME} because required hardware is not included in {IDF_TARGET_NAME} so it cannot be supported.
|
||||
|
||||
If building an example, please check the README file for the ``Supported Targets`` table. If this is present including {IDF_TARGET_NAME} target, or the table does not exist at all, the example will work on {IDF_TARGET_NAME}.
|
||||
|
||||
|
||||
Additional Tips
|
||||
===============
|
||||
|
||||
Permission issues /dev/ttyUSB0
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
With some Linux distributions, you may get the ``Failed to open port /dev/ttyUSB0`` error message when flashing the {IDF_TARGET_NAME}. :ref:`This can be solved by adding the current user to the dialout group<linux-dialout-group>`.
|
||||
|
||||
Python compatibility
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
ESP-IDF supports Python 3.6 or newer. It is recommended to upgrade your operating system to a recent version satisfying this requirement. Other options include the installation of Python from `sources <https://www.python.org/downloads/>`_ or the use of a Python version management system such as `pyenv <https://github.com/pyenv/pyenv>`_.
|
@ -1,26 +0,0 @@
|
||||
.. _get-started-customized-setup:
|
||||
|
||||
*************************************
|
||||
Customized Setup of Toolchain
|
||||
*************************************
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Instead of downloading binary toolchain from Espressif website (see :ref:`get-started-set-up-tools`) you may build the toolchain yourself.
|
||||
|
||||
If you can't think of a reason why you need to build it yourself, then probably it's better to stick with the binary version. However, here are some of the reasons why you might want to compile it from source:
|
||||
|
||||
- if you want to customize toolchain build configuration
|
||||
- if you want to use a different GCC version (such as 4.8.5)
|
||||
- if you want to hack gcc or newlib or libstdc++
|
||||
- if you are curious and/or have time to spare
|
||||
- if you don't trust binaries downloaded from the Internet
|
||||
|
||||
In any case, here are the instructions to compile the toolchain yourself.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
windows-setup-scratch
|
||||
linux-setup-scratch
|
||||
macos-setup-scratch
|
@ -1,110 +0,0 @@
|
||||
********************************************
|
||||
Setup Windows Toolchain from Scratch
|
||||
********************************************
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
This is a step-by-step alternative to running the :doc:`ESP-IDF Tools Installer <windows-setup>` for the CMake-based build system. Installing all of the tools by hand allows more control over the process, and also provides the information for advanced users to customize the install.
|
||||
|
||||
To quickly setup the toolchain and other tools in standard way, using the ESP-IDF Tools installer, proceed to section :doc:`windows-setup`.
|
||||
|
||||
.. _get-esp-idf-windows-command-line:
|
||||
|
||||
Get ESP-IDF
|
||||
===========
|
||||
|
||||
.. note::
|
||||
|
||||
Previous versions of ESP-IDF used the **MSYS2 bash terminal** command line. The current cmake-based build system can run in the regular **Windows Command Prompt** which is used here.
|
||||
|
||||
If you use PowerShell, please note that some command syntax will be different to what is shown below.
|
||||
|
||||
Open Command Prompt and run the following commands:
|
||||
|
||||
.. include-build-file:: inc/git-clone-windows.inc
|
||||
|
||||
ESP-IDF will be downloaded into ``%userprofile%\esp\esp-idf``.
|
||||
|
||||
Consult :doc:`/versions` for information about which ESP-IDF version to use in a given situation.
|
||||
|
||||
.. include-build-file:: inc/git-clone-notes.inc
|
||||
|
||||
.. note::
|
||||
|
||||
Do not miss the ``--recursive`` option. If you have already cloned ESP-IDF without this option, run another command to get all the submodules::
|
||||
|
||||
cd esp-idf
|
||||
git submodule update --init
|
||||
|
||||
|
||||
Tools
|
||||
=====
|
||||
|
||||
CMake
|
||||
^^^^^
|
||||
|
||||
Download the latest stable release of CMake_ for Windows and run the installer.
|
||||
|
||||
When the installer asks for Install Options, choose either "Add CMake to the system PATH for all users" or "Add CMake to the system PATH for the current user".
|
||||
|
||||
Ninja build
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. note::
|
||||
Ninja currently only provides binaries for 64-bit Windows.
|
||||
|
||||
Download the Ninja_ latest stable Windows release from the (`download page <ninja-dl_>`_).
|
||||
|
||||
The Ninja for Windows download is a .zip file containing a single ``ninja.exe`` file which needs to be unzipped to a directory which is then :ref:`added to your Path <add-directory-windows-path>` (or you can choose a directory which is already on your Path).
|
||||
|
||||
|
||||
Python
|
||||
^^^^^^
|
||||
|
||||
Download the latest Python_ for Windows installer, and run it.
|
||||
|
||||
The "Customise" step of the Python installer gives a list of options. The last option is "Add python.exe to Path". Change this option to select "Will be installed".
|
||||
|
||||
Once Python is installed, open a Windows Command Prompt from the Start menu and run the following command::
|
||||
|
||||
pip install --user pyserial
|
||||
|
||||
Toolchain Setup
|
||||
===============
|
||||
|
||||
.. include-build-file:: inc/download-links.inc
|
||||
|
||||
Download the precompiled Windows toolchain:
|
||||
|
||||
|download_link_win32|
|
||||
|
||||
Unzip the zip file to ``C:\Program Files`` (or some other location). The zip file contains a single directory ``{IDF_TARGET_TOOLCHAIN_PREFIX}``.
|
||||
|
||||
Next, the ``bin`` subdirectory of this directory must be :ref:`added to your Path <add-directory-windows-path>`. For example, the directory to add may be ``C:\Program Files\{IDF_TARGET_TOOLCHAIN_PREFIX}\bin``.
|
||||
|
||||
|
||||
.. _add-directory-windows-path:
|
||||
|
||||
Adding Directory to Path
|
||||
========================
|
||||
|
||||
To add any new directory to your Windows Path environment variable:
|
||||
|
||||
Open the System control panel and navigate to the Environment Variables dialog. (On Windows 10, this is found under Advanced System Settings).
|
||||
|
||||
Double-click the ``Path`` variable (either User or System Path, depending if you want other users to have this directory on their path.) Go to the end of the value, and append ``;<new value>``.
|
||||
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
|
||||
To carry on with development environment setup, proceed to :ref:`get-started-set-up-tools`.
|
||||
|
||||
.. _CMake: https://cmake.org/download/
|
||||
.. _Ninja: https://ninja-build.org/
|
||||
.. _ninja-dl: https://github.com/ninja-build/ninja/releases
|
||||
.. _Python: https://www.python.org/downloads/windows/
|
||||
.. _kconfig-frontends releases page: https://github.com/espressif/kconfig-frontends/releases
|
||||
.. Note: These two targets may be used from git-clone-notes.inc depending on version, don't remove
|
||||
.. _Stable version: https://docs.espressif.com/projects/esp-idf/en/stable/
|
||||
.. _Releases page: https://github.com/espressif/esp-idf/releases
|
@ -24,17 +24,27 @@ For this Getting Started we're going to use the Command Prompt, but after ESP-ID
|
||||
ESP-IDF Tools Installer
|
||||
=======================
|
||||
|
||||
The easiest way to install ESP-IDF's prerequisites is to download one of ESP-IDF Tools Installers from this URL: https://dl.espressif.com/dl/esp-idf/?idf=4.4
|
||||
The easiest way to install ESP-IDF's prerequisites is to download one of ESP-IDF Tools Installers.
|
||||
|
||||
+-------------------+--------------------------------+
|
||||
| |download-logo| | `Windows Installer Download`_ |
|
||||
+-------------------+--------------------------------+
|
||||
|
||||
.. |download-logo| image:: ../../_static/logo_windows_install.png
|
||||
:target: https://dl.espressif.com/dl/esp-idf/?idf=4.4
|
||||
|
||||
.. _Windows Installer Download: https://dl.espressif.com/dl/esp-idf/?idf=4.4
|
||||
|
||||
|
||||
What is the usecase for Online and Offline Installer
|
||||
----------------------------------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Online Installer is very small and allows the installation of all available releases of ESP-IDF. The installer will download only necessary dependencies including `Git For Windows`_ during the installation process. The installer stores downloaded files in the cache directory ``%userprofile%\.espressif``
|
||||
|
||||
Offline Installer does not require any network connection. The installer contains all required dependencies including `Git For Windows`_ .
|
||||
|
||||
Components of the installation
|
||||
------------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The installer deploys the following components:
|
||||
|
||||
@ -47,7 +57,7 @@ The installer deploys the following components:
|
||||
The installer also allows reusing the existing directory with ESP-IDF. The recommended directory is ``%userprofile%\Desktop\esp-idf`` where ``%userprofile%`` is your home directory.
|
||||
|
||||
Launching ESP-IDF Environment
|
||||
-----------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
At the end of the installation process you can check out option ``Run ESP-IDF PowerShell Environment`` or ``Run ESP-IDF Command Prompt (cmd.exe)``. The installer will launch ESP-IDF environment in selected prompt.
|
||||
|
||||
@ -96,10 +106,10 @@ Note that this shortcut is specific to the ESP-IDF directory selected in the ESP
|
||||
|
||||
2. Alternatively, run ``cmd.exe``, then change to the ESP-IDF directory you wish to use, and run ``export.bat``. Note that unlike the previous option, this way requires Python and Git to be present in ``PATH``. If you get errors related to Python or Git not being found, use the first option.
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
First Steps on ESP-IDF
|
||||
======================
|
||||
|
||||
If the ESP-IDF Tools Installer has finished successfully, then the development environment setup is complete. Proceed directly to :ref:`get-started-start-project`.
|
||||
.. include:: start-project.rst
|
||||
|
||||
Related Documents
|
||||
=================
|
||||
@ -110,8 +120,12 @@ For advanced users who want to customize the install process:
|
||||
:maxdepth: 1
|
||||
|
||||
windows-setup-update
|
||||
establish-serial-connection
|
||||
eclipse-setup
|
||||
vscode-setup
|
||||
../api-guides/tools/idf-monitor
|
||||
|
||||
|
||||
.. _MSYS2: https://www.msys2.org/
|
||||
.. _CMake: https://cmake.org/download/
|
||||
.. _Ninja: https://ninja-build.org/
|
||||
.. _Python: https://www.python.org/downloads/windows/
|
||||
|
@ -73,12 +73,12 @@ hw-reference/get-started-pico-kit hw-reference/esp32/get-started-p
|
||||
hw-reference/get-started-pico-kit-v3 hw-reference/esp32/get-started-pico-kit-v3
|
||||
hw-reference/get-started-ethernet-kit-v1.0 hw-reference/esp32/get-started-ethernet-kit-v1.0
|
||||
hw-reference/get-started-ethernet-kit hw-reference/esp32/get-started-ethernet-kit
|
||||
hw-reference/esp32s2/user-guide-kaluga-1-v1.2 hw-reference/esp32s2/user-guide-esp32-s2-kaluga-1-kit
|
||||
hw-reference/esp32s2/usermacos-setup_mesh api-reference/network/esp-wifi-mesh
|
||||
|
||||
api-guides/jtag-debugging/configure-wrover api-guides/jtag-debugging/configure-ft2232h-jtag
|
||||
hw-reference/modules-and-boards "https://www.espressif.com/en/products/modules"
|
||||
hw-reference/modules-and-boards-previous "https://www.espressif.com/en/products/modules"
|
||||
|
||||
# rename ESP-MESH to ESP-WIFI-MESH
|
||||
api-guides/mesh api-guides/esp-wifi-mesh
|
||||
api-reference/network/esp_mesh api-reference/network/esp-wifi-mesh
|
||||
# Getting Started
|
||||
get-started/macos-setup get-started/linux-macos-setup
|
||||
get-started/linux-setup get-started/linux-macos-setup
|
||||
get-started/windows-setup-scratch get-started/windows-setup
|
||||
get-started/linux-setup-scratch get-started/linux-macos-setup
|
||||
get-started/macos-setup-scratch get-started/linux-macos-setup
|
||||
get-started/toolchain-setup-scratch get-started/index
|
||||
|
@ -83,7 +83,7 @@ idf.py
|
||||
|
||||
要实现实现 shell `自动补全 <https://click.palletsprojects.com/shell-completion/>`_,请先确保您安装了 Python 3.5 以及 `click <https://click.palletsprojects.com/>`_ 7.1 及以上版本(:ref:`请参考这里 <get-started-get-prerequisites>`)。
|
||||
|
||||
使用 ``export`` 命令来启用 ``idf.py`` 的自动补全功能(:ref:`请参考这里 <get-started-export>`)。按 TAB 键可实现自动补全。输入 “idf.py -” 后按 TAB 键可自动补全选项。
|
||||
使用 ``export`` 命令来启用 ``idf.py`` 的自动补全功能(:ref:`请参考这里 <get-started-set-up-env>`)。按 TAB 键可实现自动补全。输入 “idf.py -” 后按 TAB 键可自动补全选项。
|
||||
|
||||
未来我们也会支持 PowerShell 的自动补全功能。
|
||||
|
||||
|
@ -150,7 +150,7 @@
|
||||
设置开发环境
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* :ref:`get-started-get-prerequisites` (:doc:`Windows <windows-setup>` 、:doc:`Linux <linux-setup>` 和 :doc:`macOS <macos-setup>`)
|
||||
* :ref:`get-started-get-prerequisites` (:doc:`Windows <windows-setup>` 、:doc:`Linux <linux-macos-setup>` 和 :doc:`macOS <linux-macos-setup>`)
|
||||
* :ref:`get-started-get-esp-idf`
|
||||
* :ref:`get-started-set-up-tools`
|
||||
* :ref:`get-started-set-up-env`
|
||||
@ -177,8 +177,8 @@
|
||||
:hidden:
|
||||
|
||||
Windows <windows-setup>
|
||||
Linux <linux-setup>
|
||||
macOS <macos-setup>
|
||||
macOS <linux-macos-setup>
|
||||
Linux <linux-macos-setup>
|
||||
|
||||
+-------------------+-------------------+-------------------+
|
||||
| |windows-logo| | |linux-logo| | |macos-logo| |
|
||||
@ -190,14 +190,14 @@
|
||||
:target: ../get-started/windows-setup.html
|
||||
|
||||
.. |linux-logo| image:: ../../_static/linux-logo.png
|
||||
:target: ../get-started/linux-setup.html
|
||||
:target: ../get-started/linux-macos-setup.html
|
||||
|
||||
.. |macos-logo| image:: ../../_static/macos-logo.png
|
||||
:target: ../get-started/macos-setup.html
|
||||
:target: ../get-started/linux-macos-setup.html
|
||||
|
||||
.. _Windows: ../get-started/windows-setup.html
|
||||
.. _Linux: ../get-started/linux-setup.html
|
||||
.. _macOS: ../get-started/macos-setup.html
|
||||
.. _Linux: ../get-started/linux-macos-setup.html
|
||||
.. _macOS: ../get-started/linux-macos-setup.html
|
||||
|
||||
.. note::
|
||||
|
||||
@ -230,7 +230,7 @@ Windows 操作系统
|
||||
|
||||
请前往 :doc:`/versions`,查看 ESP-IDF 不同版本的具体适用场景。
|
||||
|
||||
除了使用 ESP-IDF 工具安装器,您也可以参考 :ref:`指南 <get-esp-idf-windows-command-line>` 手动下载 ESP-IDF。
|
||||
除了使用 ESP-IDF 工具安装器,您也可以参考 :ref:`指南 <get-started-windows-tools-installer>` 手动下载 ESP-IDF。
|
||||
|
||||
.. _get-started-set-up-tools:
|
||||
|
||||
@ -800,6 +800,13 @@ Windows 操作系统
|
||||
更新 ESP-IDF
|
||||
================
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
Windows Installer <windows-setup>
|
||||
Linux <linux-macos-setup>
|
||||
macOS <linux-macos-setup>
|
||||
|
||||
乐鑫会不时推出更新版本的 ESP-IDF,修复 bug 或提供新的功能。因此,您在使用时,也应注意更新您本地的版本。最简单的方法是:直接删除您本地的 ``esp-idf`` 文件夹,然后按照 :ref:`get-started-get-esp-idf` 中的指示,重新完成克隆。
|
||||
|
||||
此外,您可以仅更新变更部分。具体方式,请前往 :ref:`更新 <updating>` 章节查看。
|
||||
@ -818,7 +825,6 @@ Windows 操作系统
|
||||
eclipse-setup
|
||||
vscode-setup
|
||||
../api-guides/tools/idf-monitor
|
||||
toolchain-setup-scratch
|
||||
|
||||
.. _Stable version: https://docs.espressif.com/projects/esp-idf/zh_CN/stable/
|
||||
.. _Releases page: https://github.com/espressif/esp-idf/releases
|
||||
|
@ -1,104 +0,0 @@
|
||||
******************************************
|
||||
从零开始设置 Linux 环境下的工具链
|
||||
******************************************
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
除了从乐鑫官网直接下载已编译好的二进制工具链外,您还可以按照本文介绍,从头开始设置自己的工具链。如需快速使用已编译好的二进制工具链,可回到 :doc:`linux-setup` 章节。
|
||||
|
||||
.. 注解:: 设置自己的工具链可以解决 Y2K38 问题(time_t 从 32 位扩展到 64 位)。
|
||||
|
||||
安装准备
|
||||
=====================
|
||||
|
||||
编译 ESP-IDF 需要以下软件包:
|
||||
|
||||
- CentOS 7::
|
||||
|
||||
sudo yum -y update && sudo yum install git wget ncurses-devel flex bison gperf python3 python3-pip cmake ninja-build ccache dfu-util libusbx
|
||||
|
||||
目前仍然支持 CentOS 7,但为了更好的用户体验,建议使用 CentOS 8。
|
||||
|
||||
- Ubuntu 和 Debian::
|
||||
|
||||
sudo apt-get install git wget libncurses-dev flex bison gperf python3 python3-pip python3-setuptools python3-serial python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -Sy --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools cmake ninja ccache dfu-util libusb
|
||||
|
||||
.. 注解::
|
||||
使用 ESP-IDF 需要 CMake 3.5 或以上版本。较早的 Linux 发行版可能需要升级自身的软件源仓库,或开启 backports 套件库,或安装 "cmake3" 软件包(不是安装 "cmake")。
|
||||
|
||||
从源代码编译工具链
|
||||
=================================
|
||||
|
||||
安装依赖项:
|
||||
|
||||
- CentOS 7::
|
||||
|
||||
sudo yum install gawk gperf grep gettext ncurses-devel python3 python3-devel automake bison flex texinfo help2man libtool make
|
||||
|
||||
- Ubuntu pre-16.04::
|
||||
|
||||
sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool make
|
||||
|
||||
- Ubuntu 16.04 或以上 ::
|
||||
|
||||
sudo apt-get install gawk gperf grep gettext python python-dev automake bison flex texinfo help2man libtool libtool-bin make
|
||||
|
||||
- Debian 9::
|
||||
|
||||
sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool libtool-bin make
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -Sy --needed python-pip
|
||||
|
||||
创建工作目录,并进入该目录::
|
||||
|
||||
mkdir -p ~/esp
|
||||
cd ~/esp
|
||||
|
||||
下载并编译 ``crosstool-NG``:
|
||||
|
||||
.. include-build-file:: inc/scratch-build-code.inc
|
||||
|
||||
.. 注解:: 在设置支持 64 位 time_t 的工具链时,您需要将 ``crosstool-NG/samples/xtensa-esp32-elf/crosstool.config`` 文件中第 33 和 43 行的可选参数 ``--enable-newlib-long-time_t`` 删除。
|
||||
|
||||
编译工具链::
|
||||
|
||||
./ct-ng {IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
./ct-ng build
|
||||
chmod -R u+w builds/{IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
|
||||
编译得到的工具链会被保存至 ``~/esp/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}``。
|
||||
|
||||
添加工具链到 PATH 环境变量
|
||||
===========================
|
||||
|
||||
需要将自定义工具链复制到一个二进制目录中,并将其添加到 ``PATH`` 中。例如,您可以将编译好的工具链复制到 ``~/esp/{IDF_TARGET_TOOLCHAIN_PREFIX}/`` 目录中。
|
||||
|
||||
为了正常使用工具链,您需要更新 ``~/.profile`` 文件中 ``PATH`` 环境变量。此外,您还可以在 ``~/.profile`` 文件中增加以下代码。这样,所有终端窗口均可以使用 ``{IDF_TARGET_TOOLCHAIN_PREFIX}``::
|
||||
|
||||
export PATH="$HOME/esp/{IDF_TARGET_TOOLCHAIN_PREFIX}/bin:$PATH"
|
||||
|
||||
.. 注解::
|
||||
|
||||
如果您已将 ``/bin/bash`` 设置为登录 shell,且同时存在 ``.bash_profile`` 和 ``.profile`` 两个文件,则请更新 ``.bash_profile``。在 CentOS 环境下, ``alias`` 需要添加到 ``.bashrc`` 文件中。
|
||||
|
||||
退出并重新登录以使 ``.profile`` 的更改生效。运行以下命令来检查 ``PATH`` 设置是否正确::
|
||||
|
||||
printenv PATH
|
||||
|
||||
此时您需要检查输出结果的开头中是否包含类似如下的工具链路径::
|
||||
|
||||
$ printenv PATH
|
||||
/home/user-name/esp/{IDF_TARGET_TOOLCHAIN_PREFIX}/bin:/home/user-name/bin:/home/user-name/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
|
||||
|
||||
注意这里的 ``/home/user-name`` 应该替换成您安装的主路径。
|
||||
|
||||
后续步骤
|
||||
==========
|
||||
|
||||
请前往 :ref:`get-started-get-esp-idf` 章节继续设置开发环境。
|
@ -1,85 +0,0 @@
|
||||
***********************************************
|
||||
从零开始设置 macOS 环境下的工具链
|
||||
***********************************************
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
软件包管理器
|
||||
===============
|
||||
|
||||
从零开始设置工具链,您需要安装 MacPorts_ 或 Homebrew_ 软件包管理器。或者,您也可以直接下载 :doc:`预编译的工具链 <macos-setup>`。
|
||||
|
||||
MacPorts 需要完整的 XCode 软件,而 Homebrew 只需要安装 XCode 命令行工具即可。
|
||||
|
||||
.. _Homebrew: https://brew.sh/
|
||||
.. _MacPorts: https://www.macports.org/install.php
|
||||
|
||||
请参考 :ref:`工具链自定义设置 <get-started-customized-setup>` 章节,查看可能需要从头开始设置工具链的情况。
|
||||
|
||||
安装准备
|
||||
=====================
|
||||
|
||||
- 安装 pip::
|
||||
|
||||
sudo easy_install pip
|
||||
|
||||
- 安装 pyserial::
|
||||
|
||||
pip install --user pyserial
|
||||
|
||||
- 安装 CMake 和 Ninja 编译工具:
|
||||
|
||||
- 若有 Homebrew,您可以运行::
|
||||
|
||||
brew install cmake ninja dfu-util
|
||||
|
||||
- 若有 MacPorts,您可以运行::
|
||||
|
||||
sudo port install cmake ninja dfu-util
|
||||
|
||||
从源代码编译工具链
|
||||
=================================
|
||||
|
||||
安装依赖项:
|
||||
|
||||
- 对于 MacPorts::
|
||||
|
||||
sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake make
|
||||
|
||||
- 对于 Homebrew::
|
||||
|
||||
brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake make
|
||||
|
||||
创建一个文件系统镜像(区分大小写)::
|
||||
|
||||
hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
|
||||
|
||||
挂载::
|
||||
|
||||
hdiutil mount ~/esp/crosstool.dmg
|
||||
|
||||
创建指向您工作目录的符号链接::
|
||||
|
||||
mkdir -p ~/esp
|
||||
ln -s /Volumes/ctng ~/esp/ctng-volume
|
||||
|
||||
前往新创建的目录::
|
||||
|
||||
cd ~/esp/ctng-volume
|
||||
|
||||
下载并编译 ``crosstool-NG``:
|
||||
|
||||
.. include-build-file:: inc/scratch-build-code.inc
|
||||
|
||||
编译工具链::
|
||||
|
||||
./ct-ng {IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
./ct-ng build
|
||||
chmod -R u+w builds/{IDF_TARGET_TOOLCHAIN_PREFIX}
|
||||
|
||||
编译得到的工具链会被保存到 ``~/esp/ctng-volume/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}``。使用工具链前,请将 ``~/esp/ctng-volume/crosstool-NG/builds/{IDF_TARGET_TOOLCHAIN_PREFIX}/bin`` 添加至 ``PATH`` 环境变量。
|
||||
|
||||
后续步骤
|
||||
==========
|
||||
|
||||
请前往 :ref:`get-started-get-esp-idf` 章节继续设置开发环境。
|
@ -1,70 +0,0 @@
|
||||
**********************************************
|
||||
macOS 平台工具链的标准设置
|
||||
**********************************************
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
安装准备
|
||||
=====================
|
||||
|
||||
ESP-IDF 将使用 macOS 上默认安装的 Python 版本。
|
||||
|
||||
- 安装 pip::
|
||||
|
||||
sudo easy_install pip
|
||||
|
||||
- 安装 CMake 和 Ninja 编译工具:
|
||||
|
||||
- 若有 HomeBrew_,您可以运行::
|
||||
|
||||
brew install cmake ninja dfu-util
|
||||
|
||||
- 若有 MacPorts_,您可以运行::
|
||||
|
||||
sudo port install cmake ninja dfu-util
|
||||
|
||||
- 若以上均不适用,请访问 CMake_ 和 Ninja_ 主页,查询有关 macOS 平台的下载安装问题。
|
||||
|
||||
- 强烈建议同时安装 ccache_ 以获得更快的编译速度。如有 HomeBrew_,可通过 MacPorts_ 上的 ``brew install ccache`` 或 ``sudo port install ccache`` 完成安装。
|
||||
|
||||
.. note::
|
||||
如您在上述任何步骤中遇到以下错误::
|
||||
|
||||
``xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:/Library/Developer/CommandLineTools/usr/bin/xcrun``
|
||||
|
||||
则必须安装 XCode 命令行工具,具体可运行 ``xcode-select --install``。
|
||||
|
||||
安装 Python 3
|
||||
---------------------------------------------
|
||||
|
||||
`Catalina 10.15 发布说明`_ 中表示不推荐使用 Python 2.7 版本,在未来的 macOS 版本中也不会默认包含 Python 2.7。执行以下命令来检查您当前使用的 Python 版本::
|
||||
|
||||
python --version
|
||||
|
||||
如果输出结果是 ``Python 2.7.17``,则代表您的默认解析器是 Python 2.7。这时需要您运行以下命令检查电脑上是否已经安装过 Python 3::
|
||||
|
||||
python3 --version
|
||||
|
||||
如果运行上述命令出现错误,则代表电脑上没有安装 Python 3。
|
||||
|
||||
请根据以下步骤安装 Python 3:
|
||||
|
||||
- 使用 HomeBrew_ 进行安装的方法如下::
|
||||
|
||||
brew install python3
|
||||
|
||||
- 使用 MacPorts_ 进行安装的方法如下::
|
||||
|
||||
sudo port install python38
|
||||
|
||||
后续步骤
|
||||
==========
|
||||
|
||||
请前往 :ref:`get-started-get-esp-idf` 章节继续设置开发环境。
|
||||
|
||||
.. _cmake: https://cmake.org/
|
||||
.. _ninja: https://ninja-build.org/
|
||||
.. _ccache: https://ccache.samba.org/
|
||||
.. _homebrew: https://brew.sh/
|
||||
.. _MacPorts: https://www.macports.org/install.php
|
||||
.. _Catalina 10.15 发布说明: https://developer.apple.com/documentation/macos-release-notes/macos-catalina-10_15-release-notes
|
3
docs/zh_CN/get-started/start-project.rst
Normal file
3
docs/zh_CN/get-started/start-project.rst
Normal file
@ -0,0 +1,3 @@
|
||||
************************
|
||||
First Steps with ESP-IDF
|
||||
************************
|
@ -1,26 +0,0 @@
|
||||
.. _get-started-customized-setup:
|
||||
|
||||
*************************************
|
||||
工具链的自定义设置
|
||||
*************************************
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
除了从乐鑫官网(请见 :ref:`get-started-set-up-tools`)下载二进制工具链外,您还可以自行编译工具链。
|
||||
|
||||
如无特殊需求,建议直接使用我们提供的预编译二进制工具链。不过,您可以在以下情况考虑自行编译工具链:
|
||||
|
||||
- 需要定制工具链编译配置
|
||||
- 需要使用其他 GCC 版本(如 4.8.5)
|
||||
- 需要破解 gcc、newlib 或 libstdc++
|
||||
- 有相关兴趣或时间充裕
|
||||
- 不信任从网站下载的 bin 文件
|
||||
|
||||
如需自行编译工具链,请查看以下文档:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
windows-setup-scratch
|
||||
linux-setup-scratch
|
||||
macos-setup-scratch
|
@ -1,110 +0,0 @@
|
||||
********************************************
|
||||
从零开始设置 Windows 环境下的工具链
|
||||
********************************************
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
除了使用 :doc:`ESP-IDF 工具安装器 <windows-setup>`,用户也可以手动设置 Windows 环境下的工具链,这正是本文的主要内容。手动安装工具可以更好地控制安装流程,同时也方便高阶用户进行自定义安装。
|
||||
|
||||
使用 ESP-IDF 工具安装器对工具链及其他工具进行快速标准设置,请参照 :doc:`windows-setup`。
|
||||
|
||||
.. _get-esp-idf-windows-command-line:
|
||||
|
||||
获取 ESP-IDF
|
||||
=================
|
||||
|
||||
.. 注解::
|
||||
|
||||
较早版本 ESP-IDF 使用了 **MSYS2 bash 终端命令行**。目前,基于 CMake 的编译系统可使用常见的 **Windows 命令窗口**,即本指南中使用的终端。
|
||||
|
||||
请注意,如果您使用 PowerShell 终端,一些命令语法将与下面描述有所不同。
|
||||
|
||||
打开命令提示符,运行以下命令:
|
||||
|
||||
.. include-build-file:: inc/git-clone-windows.inc
|
||||
|
||||
ESP-IDF 将下载至 ``%userprofile%\esp\esp-idf``。
|
||||
|
||||
请前往 :doc:`/versions`,查看 ESP-IDF 不同版本的具体适用场景。
|
||||
|
||||
.. include-build-file:: inc/git-clone-notes.inc
|
||||
|
||||
.. 注解::
|
||||
|
||||
在克隆远程仓库时,请加上可选参数 ``--recursive`` 。如果你已经克隆了 ESP-IDF 但没有加上此参数,请运行以下命令获取所有子模块 ::
|
||||
|
||||
cd esp-idf
|
||||
git submodule update --init
|
||||
|
||||
|
||||
工具
|
||||
=====
|
||||
|
||||
CMake 工具
|
||||
^^^^^^^^^^
|
||||
|
||||
下载最新发布的 Windows 平台稳定版 `CMake`_,并运行安装器。
|
||||
|
||||
当安装器询问“安装选项”时,选择 "Add CMake to the system PATH for all users"(为所有用户的系统路径添加 CMake)或 "Add CMake to the system PATH for the current user"(为当前用户的系统路径添加 CMake)。
|
||||
|
||||
Ninja 编译工具
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. 注解::
|
||||
目前,Ninja 仅提供支持 64 位 Windows 版本的 bin 文件。
|
||||
|
||||
请从 `下载页面 <ninja-dl_>`_ 下载最新发布的 Windows 平台稳定版 Ninja_。
|
||||
|
||||
适用于 Windows 平台的 Ninja 下载文件是一个 .zip 文件,包含一个 ``ninja.exe`` 文件。您需要将该文件解压到目录,并 :ref:`添加到 Path 环境变量 <add-directory-windows-path>` (或者选择解压到 Path 变量中已有的目录)。
|
||||
|
||||
|
||||
Python
|
||||
^^^^^^
|
||||
|
||||
下载并运行适用于 Windows 安装器的最新版 Python_。
|
||||
|
||||
Python 安装器的“自定义”菜单可为您提供一系列选项,最后一项为 "Add python.exe to Path"(添加 python.exe 到 Path 环境变量中),请将该选项更改为 "Will be installed"(将会安装)。
|
||||
|
||||
Python 安装完成后,从 Windows 开始菜单中打开“命令提示符”窗口,并运行以下命令::
|
||||
|
||||
pip install --user pyserial
|
||||
|
||||
工具链设置
|
||||
===============
|
||||
|
||||
.. include-build-file:: inc/download-links.inc
|
||||
|
||||
下载预编译的 Windows 工具链:
|
||||
|
||||
|download_link_win32|
|
||||
|
||||
将压缩包文件解压到 ``C:\Program Files``(或其他位置)。压缩包文件包含一个 ``{IDF_TARGET_TOOLCHAIN_PREFIX}`` 目录。
|
||||
|
||||
然后,请将该目录下的 ``bin`` 子目录 :ref:`添加到 Path 环境变量 <add-directory-windows-path>`。例如,将目录 ``C:\Program Files\{IDF_TARGET_TOOLCHAIN_PREFIX}\bin`` 添加到 Path 环境变量。
|
||||
|
||||
|
||||
.. _add-directory-windows-path:
|
||||
|
||||
添加目录到 Path 环境变量
|
||||
========================
|
||||
|
||||
在 Windows 环境下,向 Path 环境变量增加任何新目录,请:
|
||||
|
||||
打开系统“控制面板”,找到环境变量对话框(Windows 10 用户请前往“高级系统设置”)。
|
||||
|
||||
双击 ``Path`` 变量(选择“用户路径”或“系统路径”,具体取决于您是否希望其他用户的 Path 中也存在该目录)。最后在值的末尾增加 ``;<new value>``。
|
||||
|
||||
|
||||
后续步骤
|
||||
==========
|
||||
|
||||
请前往 :ref:`get-started-set-up-tools` 章节继续设置开发环境。
|
||||
|
||||
.. _CMake: https://cmake.org/download/
|
||||
.. _Ninja: https://ninja-build.org/
|
||||
.. _ninja-dl: https://github.com/ninja-build/ninja/releases
|
||||
.. _Python: https://www.python.org/downloads/windows/
|
||||
.. _kconfig-frontends releases page: https://github.com/espressif/kconfig-frontends/releases
|
||||
.. Note: These two targets may be used from git-clone-notes.inc depending on version, don't remove
|
||||
.. _Stable version: https://docs.espressif.com/projects/esp-idf/zh_CN/stable/
|
||||
.. _Releases page: https://github.com/espressif/esp-idf/releases
|
@ -54,6 +54,7 @@ ESP-IDF 编程指南
|
||||
:hidden:
|
||||
|
||||
快速入门 <get-started/index>
|
||||
Start a Project <get-started/start-project>
|
||||
API 参考 <api-reference/index>
|
||||
H/W 参考 <hw-reference/index>
|
||||
API 指南 <api-guides/index>
|
||||
|
Loading…
Reference in New Issue
Block a user