From c2818e775c15b73aa5553a8184d07cbc8861d4c6 Mon Sep 17 00:00:00 2001 From: Dai Zi Yan Date: Wed, 25 Nov 2020 14:45:26 +0800 Subject: [PATCH] Updated CN translation for index.rst and establish-serial-connection.rst and add CN translation for VScode-setup.rst in get-started folder to get EN and CN translation in sync --- .../establish-serial-connection.rst | 18 +- docs/en/get-started/vscode-setup.rst | 3 +- .../establish-serial-connection.rst | 83 ++++-- docs/zh_CN/get-started/index.rst | 248 +++++++++++++----- docs/zh_CN/get-started/vscode-setup.rst | 38 ++- 5 files changed, 286 insertions(+), 104 deletions(-) diff --git a/docs/en/get-started/establish-serial-connection.rst b/docs/en/get-started/establish-serial-connection.rst index 09c2f1281d..ad75ef1169 100644 --- a/docs/en/get-started/establish-serial-connection.rst +++ b/docs/en/get-started/establish-serial-connection.rst @@ -7,7 +7,7 @@ This section provides guidance how to establish serial connection between {IDF_T Connect {IDF_TARGET_NAME} to PC -------------------------------- +---------------------------------- Connect the {IDF_TARGET_NAME} board to the PC using the USB cable. If device driver does not install automatically, identify USB to serial converter chip on your {IDF_TARGET_NAME} board (or external converter dongle), search for drivers in internet and install them. @@ -36,7 +36,7 @@ Below are the links to drivers for {IDF_TARGET_NAME} boards produced by Espressi * CP210x: `CP210x USB to UART Bridge VCP Drivers `_ * FTDI: `FTDI Virtual COM Port Drivers `_ -The drivers above are primarily for reference. Under normal circumstances, the drivers should be bundled with and operating system and automatically installed upon connecting one of the listed boards to the PC. +The drivers above are primarily for reference. Under normal circumstances, the drivers should be bundled with an operating system and automatically installed upon connecting one of the listed boards to the PC. Check port on Windows @@ -61,7 +61,7 @@ Figures below show serial port for ESP32 DevKitC and ESP32 WROVER KIT Two USB Serial Ports of ESP-WROVER-KIT in Windows Device Manager -Check port on Linux and MacOS +Check port on Linux and macOS ----------------------------- To check the device name for the serial port of your {IDF_TARGET_NAME} board (or external converter dongle), run this command two times, first with the board / dongle unplugged, then with plugged in. The port which appears the second time is the one you need: @@ -70,13 +70,13 @@ Linux :: ls /dev/tty* -MacOS :: +macOS :: ls /dev/cu.* .. note:: - MacOS users: if you don't see the serial port then check you have the USB/serial drivers installed as shown in the Getting Started guide for your particular development board. For MacOS High Sierra (10.13), you may also have to explicitly allow the drivers to load. Open System Preferences -> Security & Privacy -> General and check if there is a message shown here about "System Software from developer ..." where the developer name is Silicon Labs or FTDI. + macOS users: if you don't see the serial port then check you have the USB/serial drivers installed as shown in the Getting Started guide for your particular development board. For macOS High Sierra (10.13), you may also have to explicitly allow the drivers to load. Open System Preferences -> Security & Privacy -> General and check if there is a message shown here about "System Software from developer ..." where the developer name is Silicon Labs or FTDI. .. _linux-dialout-group: @@ -128,12 +128,12 @@ Then open serial port in terminal and check, if you see any log printed out by { Close the serial terminal after verification that communication is working. If you keep the terminal session open, the serial port will be inaccessible for uploading firmware later. -MacOS -^^^^^ +macOS +^^^^^^^^ -To spare you the trouble of installing a serial terminal program, MacOS offers the **screen** command. +To spare you the trouble of installing a serial terminal program, macOS offers the **screen** command. -- As discussed in `Check port on Linux and MacOS`_, run:: +- As discussed in `Check port on Linux and macOS`_, run:: ls /dev/cu.* diff --git a/docs/en/get-started/vscode-setup.rst b/docs/en/get-started/vscode-setup.rst index 244f5333d2..1525d86bfd 100644 --- a/docs/en/get-started/vscode-setup.rst +++ b/docs/en/get-started/vscode-setup.rst @@ -2,6 +2,7 @@ Getting Started with VS Code IDE ******************************** +:link_to_translation:`zh_CN:[中文]` We have official support for VS Code and we aim to provide complete end to end support for all actions related to ESP-IDF namely build, flash, monitor, debug, tracing, core-dump, System Trace Viewer, etc. @@ -22,7 +23,7 @@ Supported Features * **App & Heap Tracing**, provides support for collecting traces from your application and simplified UI for analyzing them. * **System View Tracing Viewer**, aims to read and display the *.svdat* files into trace UI, we also support multiple core tracing views. * **IDF Size Analysis Overview** presents an UI for binary size analysis. -* **`Rainmaker Cloud `_**, we have inbuilt Rainmaker Cloud support where you can edit/read state of your connected IoT devices easily. +* `Rainmaker Cloud `_, we have inbuilt Rainmaker Cloud support where you can edit/read state of your connected IoT devices easily. * **Code Coverage**, we have inbuilt code coverage support which shall highlight in color which line have been covered. We also render the existing HTML report directly inside the IDE. diff --git a/docs/zh_CN/get-started/establish-serial-connection.rst b/docs/zh_CN/get-started/establish-serial-connection.rst index f469bbbd57..3731df18aa 100644 --- a/docs/zh_CN/get-started/establish-serial-connection.rst +++ b/docs/zh_CN/get-started/establish-serial-connection.rst @@ -7,7 +7,7 @@ 连接 {IDF_TARGET_NAME} 和 PC ---------------------------- +------------------------------ 用 USB 线将 {IDF_TARGET_NAME} 开发板连接到 PC。如果设备驱动程序没有自动安装,请先确认 {IDF_TARGET_NAME} 开发板上的 USB 转串口芯片(或外部转串口适配器)型号,然后在网上搜索驱动程序,并进行手动安装。 @@ -36,12 +36,12 @@ * CP210x: `CP210x USB 至 UART 桥 VCP 驱动程序 `_ * FTDI: `FTDI 虚拟 COM 端口驱动程序 `_ -以上驱动仅用于参考。一般情况下,当上述任一 {IDF_TARGET_NAME} 开发板与 PC 连接时,对应驱动程序应该已经被打包在操作系统中,并已经自动安装。 +以上驱动仅供参考。一般情况下,当上述任一 {IDF_TARGET_NAME} 开发板与 PC 连接时,对应驱动程序应该已经被打包在操作系统中,并已经自动安装。 在 Windows 上查看端口 --------------------- -检查 Windows 设备管理器中的 COM 端口列表。断开 {IDF_TARGET_NAME} 与 PC 的连接,然后重新连接,查看哪个端口从列表中消失,然后再次出现。 +检查 Windows 设备管理器中的 COM 端口列表。断开 {IDF_TARGET_NAME} 与 PC 的连接,然后重新连接,查看哪个端口从列表中消失后又再次出现。 以下为 ESP32 DevKitC 和 ESP32 WROVER KIT 串口: @@ -60,29 +60,29 @@ Windows 设备管理器中 ESP-WROVER-KIT 的两个 USB 串行端口 -在 Linux 和 MacOS 上查看端口 +在 Linux 和 macOS 上查看端口 ----------------------------- -查看 {IDF_TARGET_NAME} 开发板(或外部转串口适配器)的串口设备名称,请运行两次以下命令。首先,断开开发板或适配器,第一次运行命令;然后,连接开发板或适配器,第二次运行命令。其中,第二次运行命令后出现的端口即是 {IDF_TARGET_NAME} 对应的串口: +查看 {IDF_TARGET_NAME} 开发板(或外部转串口适配器)的串口设备名称,请将以下命令运行两次。首先,断开开发板或适配器,首次运行以下命令;然后,连接开发板或适配器,再次运行以下命令。其中,第二次运行命令后出现的端口即是 {IDF_TARGET_NAME} 对应的串口: -Linux :: +Linux:: ls /dev/tty* -MacOS :: +macOS:: ls /dev/cu.* -.. note:: +.. 注解:: - 对于 MacOS 用户:若你没有看到串口,请检查你是否已按照《入门指南》安装了适用于你特定开发板的 USB/串口驱动程序。对于 MacOS High Sierra (10.13) 的用户,你可能还需要手动允许驱动程序的加载,具体可打开 ``系统偏好设置`` -> ``安全和隐私`` -> ``通用``,检查是否有信息显示:“来自开发人员的系统软件...”,其中开发人员的名称为 Silicon Labs 或 FTDI。 + 对于 macOS 用户:若你没有看到串口,请检查你是否已按照《入门指南》安装了适用于你特定开发板的 USB/串口驱动程序。对于 macOS High Sierra (10.13) 的用户,你可能还需要手动允许驱动程序的加载,具体可打开 ``系统偏好设置`` -> ``安全和隐私`` -> ``通用``,检查是否有信息显示:“来自开发人员的系统软件...”,其中开发人员的名称为 Silicon Labs 或 FTDI。 .. _linux-dialout-group: 在 Linux 中添加用户到 ``dialout`` ----------------------------------- -当前登录用户应当可以通过 USB 对串口进行读写操作。在多数 Linux 版本中,你都可以通过以下命令,将用户添加到 ``dialout`` 组,来获许读写权限:: +当前登录用户应当可以通过 USB 对串口进行读写操作。在多数 Linux 版本中,您都可以通过以下命令,将用户添加到 ``dialout`` 组,从而获许读写权限:: sudo usermod -a -G dialout $USER @@ -90,15 +90,21 @@ MacOS :: sudo usermod -a -G uucp $USER -请重新登录,确保串口读写权限可以生效。 +请重新登录,确保串口读写权限生效。 确认串口连接 ------------------------ -现在,请使用串口终端程序,验证串口连接是否可用。在本示例中,我们将使用 `PuTTY SSH Client `_, `PuTTY SSH Client `_ 既可用于 Windows 也可用于 Linux。你也可以使用其他串口程序并设置如下的通信参数。 +现在,请使用串口终端程序,查看重置 {IDF_TARGET_NAME} 后终端上是否有输出,从而验证串口连接是否可用。 -运行终端,配置串口:波特率 = 115200,数据位 = 8,停止位 = 1,奇偶校验 = N。以下截屏分别展示了在 Windows 和 Linux 中配置串口和上述通信参数(如 115200-8-1-N)。注意,这里一定要选择在上述步骤中确认的串口进行配置。 + +Windows 和 Linux 操作系统 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +在本示例中,我们将使用 `PuTTY SSH Client `_, `PuTTY SSH Client `_ 既可用于 Windows 也可用于 Linux。你也可以使用其他串口程序并设置如下的通信参数。 + +运行终端,配置在上述步骤中确认的串口:波特率 = 115200,数据位 = 8,停止位 = 1,奇偶校验 = N。以下截屏分别展示了如何在 Windows 和 Linux 中配置串口和上述通信参数(如 115200-8-1-N)。注意,这里一定要选择在上述步骤中确认的串口进行配置。 .. figure:: ../../_static/putty-settings-windows.png :align: center @@ -115,7 +121,45 @@ MacOS :: 在 Linux 操作系统中使用 PuTTY 设置串口通信参数 -然后,请检查 {IDF_TARGET_NAME} 是否有打印日志。如有,请在终端打开串口进行查看。这里,日志内容取决于加载到 {IDF_TARGET_NAME} 的应用程序,下图即为一个示例。 +然后,请检查 {IDF_TARGET_NAME} 是否有打印日志。如有,请在终端打开串口进行查看。这里的日志内容取决于加载到 {IDF_TARGET_NAME} 的应用程序,请参考 `输出示例`_。 + + +.. 注解:: + + 请在验证完串口通信正常后,关闭串口终端。如果您让终端一直保持打开的状态,之后上传固件时将无法访问串口。 + + +macOS 操作系统 +^^^^^^^^^^^^^^^^^ + +macOS 提供了 **屏幕** 命令,因此您不用安装串口终端程序。 + +- 参考 `在 Linux 和 macOS 上查看端口`_,运行以下命令:: + + ls /dev/cu.* + +- 您会看到类似如下输出:: + + /dev/cu.Bluetooth-Incoming-Port /dev/cu.SLAB_USBtoUART /dev/cu.SLAB_USBtoUART7 + +- 根据您连接到电脑上的开发板类型和数量,输出结果会有所不同。请选择开发板的设备名称,并运行以下命令:: + + screen /dev/cu.device_name 115200 + +将 ``device_name`` 替换为运行 ``ls /dev/cu.*`` 后出现的设备串口号。 + +- 您需要的正是 **屏幕** 显示的日志。日志内容取决于加载到 {IDF_TARGET_NAME} 的应用程序,请参考 `输出示例`_。请使用 Ctrl-A + \\ 键退出 **屏幕** 会话。 + +.. 注解:: + + 请在验证完串口通信正常后,关闭 **屏幕** 会话。如果直接关闭终端窗口而没有关闭 **屏幕**,之后上传固件时将无法访问串口。 + + +输出示例 +^^^^^^^^^^^ + +以下是 {IDF_TARGET_NAME} 的一个日志示例。如果没看到任何输出,请尝试重置开发板。 + .. highlight:: none @@ -140,17 +184,14 @@ MacOS :: ... -如果打印出的日志是可读的(而不是乱码),则表示串口连接正常。此时,你可以继续进行安装,并最终将应用程序上载到 {IDF_TARGET_NAME}。 +如果打印出的日志是可读的(而不是乱码),则表示串口连接正常。此时,您可以继续进行安装,并最终将应用程序上载到 {IDF_TARGET_NAME}。 -.. note:: +.. 注解:: - 在某些串口接线方式下,在 {IDF_TARGET_NAME} 启动并开始打印串口日志前,需要在终端程序中禁用串口 RTS & DTR 引脚。该问题仅存在于将 RTS & DTR 引脚直接连接到 EN & GPIO0 引脚上的情况,绝大多数开发板(包括乐鑫所有的开发板)都没有这个问题。更多详细信息,参见 `esptool 文档`_。 + 在某些串口接线方式下,在 {IDF_TARGET_NAME} 启动并开始打印串口日志前,需要在终端程序中禁用串口 RTS & DTR 管脚。该问题仅存在于将 RTS & DTR 管脚直接连接到 EN & GPIO0 管脚上的情况,绝大多数开发板(包括乐鑫所有的开发板)都没有这个问题。更多详细信息,请参考 `esptool 文档`_。 -.. note:: - 请在验证完串口通信正常后,关闭串口终端。下一步,我们将使用另一个应用程序将新的固件上传到 {IDF_TARGET_NAME}。此时,如果串口被占用则无法成功。 - -如你在安装 {IDF_TARGET_NAME} 硬件开发的软件环境时,从 :ref:`get-started-connect` 跳转到了这里,请从 :ref:`get-started-configure` 继续阅读。 +如您在安装 {IDF_TARGET_NAME} 硬件开发的软件环境时,从 :ref:`get-started-connect` 跳转到了这里,请从 :ref:`get-started-configure` 继续阅读。 .. _esptool 文档: https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection#automatic-bootloader diff --git a/docs/zh_CN/get-started/index.rst b/docs/zh_CN/get-started/index.rst index 823bf0ddf0..c3a26f4c86 100644 --- a/docs/zh_CN/get-started/index.rst +++ b/docs/zh_CN/get-started/index.rst @@ -22,7 +22,7 @@ ESP32 SoC 芯片支持以下功能: * 2.4 GHz Wi-Fi - * 蓝牙 4.2 + * 蓝牙 * 高性能双核 * 超低功耗协处理器 * 多种外设 @@ -32,8 +32,11 @@ ESP32-S2 SoC 芯片支持以下功能: * 2.4 GHz Wi-Fi - * 超低功耗协处理器 + * 高性能单核 + * 运行 RISC-V 或 FSM 内核的超低功耗协处理器 * 多种外设 + * 内置安全硬件 + * USB OTG 接口 {IDF_TARGET_NAME} 采用 40 nm 工艺制成,具有最佳的功耗性能、射频性能、稳定性、通用性和可靠性,适用于各种应用场景和不同功耗需求。 @@ -46,15 +49,20 @@ * 一款 **{IDF_TARGET_NAME}** 开发板 * **USB 数据线** (A 转 Micro-B) -* PC(Windows、Linux 或 Mac OS) +* 电脑(Windows、Linux 或 Mac OS) 软件: -* 设置 **工具链**,用于编译 {IDF_TARGET_NAME} 代码; -* **编译工具** —— CMake 和 Ninja 编译工具,用于编译 {IDF_TARGET_NAME} **应用程序**; -* 获取 **ESP-IDF** 软件开发框架。该框架已经基本包含 {IDF_TARGET_NAME} 使用的 API(软件库和源代码)和运行 **工具链** 的脚本; -* 安装 C 语言编程(**工程**)的 **文本编辑器**,例如 `Eclipse `_。 +您可以选择下载并手动安装以下软件: + * 设置 **工具链**,用于编译 {IDF_TARGET_NAME} 代码; + * **编译构建工具** —— CMake 和 Ninja 编译构建工具,用于编译 {IDF_TARGET_NAME} **应用程序**; + * 获取 **ESP-IDF** 软件开发框架。该框架已经基本包含 {IDF_TARGET_NAME} 使用的 API(软件库和源代码)和运行 **工具链** 的脚本; + +或者,您也可以通过以下集成开发环境 (IDE) 中的官方插件完成安装流程: + + * `Eclipse 插件 `_ (`安装 `__) + * `VS Code 插件 `_ (`安装 `__) .. figure:: ../../_static/what-you-need.png :align: center @@ -67,7 +75,7 @@ 开发板简介 =========================== -请点击下方连接,了解有关具体开发板的详细信息。 +请点击下方连接,了解有关开发板的详细信息。 .. only:: esp32 @@ -80,6 +88,7 @@ ESP32-Ethernet-Kit <../hw-reference/esp32/get-started-ethernet-kit> ESP32-DevKit-S(-R) <../hw-reference/esp32/user-guide-devkits-r-v1.1> + .. only:: esp32s2 .. toctree:: @@ -127,12 +136,12 @@ Windows Linux - MacOS + macOS +-------------------+-------------------+-------------------+ | |windows-logo| | |linux-logo| | |macos-logo| | +-------------------+-------------------+-------------------+ -| `Windows`_ | `Linux`_ | `Mac OS`_ | +| `Windows`_ | `Linux`_ | `macOS`_ | +-------------------+-------------------+-------------------+ .. |windows-logo| image:: ../../_static/windows-logo.png @@ -146,11 +155,11 @@ .. _Windows: ../get-started/windows-setup.html .. _Linux: ../get-started/linux-setup.html -.. _Mac OS: ../get-started/macos-setup.html +.. _macOS: ../get-started/macos-setup.html .. note:: - 在本文档中,Linux 和 MacOS 操作系统中 ESP-IDF 的默认安装路径为 ``~/esp``;Windows 操作系统的默认路径为 ``%userprofile%\esp``。您也可以将 ESP-IDF 安装在任何其他路径下,但请注意在使用命令行时进行相应替换。注意,ESP-IDF 不支持带有空格的路径。 + 在本文档中,Linux 和 macOS 操作系统中 ESP-IDF 的默认安装路径为 ``~/esp``;Windows 操作系统中的默认安装路径为 ``%userprofile%\esp``。您也可以将 ESP-IDF 安装在任何其他路径下,但请注意在使用命令行时进行相应替换。注意,ESP-IDF 不支持带有空格的路径。 .. _get-started-get-esp-idf: @@ -162,7 +171,7 @@ 获取 ESP-IDF 的本地副本:打开终端,切换到您要保存 ESP-IDF 的工作目录,使用 ``git clone`` 命令克隆远程仓库。针对不同操作系统的详细步骤,请见下文。 -Linux 和 MacOS 操作系统 +Linux 和 macOS 操作系统 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 打开终端,后运行以下命令: @@ -208,7 +217,7 @@ Windows 操作系统 cd ~/esp/esp-idf ./install.ps1 -Linux 和 MacOS 操作系统 +Linux 和 macOS 操作系统 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash @@ -219,9 +228,9 @@ Linux 和 MacOS 操作系统 自定义工具安装路径 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -本步骤中介绍的脚本将 ESP-IDF 所需的编译工具默认安装在用户根文件夹中,即 Linux 和 MacOS 系统中的 ``$HOME/.espressif`` 和 Windows 系统的 ``%USERPROFILE%\.espressif``。此外,您可以可以将工具安装到其他目录中,但请在运行安装脚本前,重新设置环境变量 ``IDF_TOOLS_PATH``。注意,请确保您的用户已经具备了读写该路径的权限。 +本步骤中介绍的脚本将 ESP-IDF 所需的编译工具默认安装在用户的根目录中,即 Linux 和 macOS 系统中的 ``$HOME/.espressif`` 和 Windows 系统的 ``%USERPROFILE%\.espressif``。此外,您可以将工具安装到其他目录中,但请在运行安装脚本前,重新设置环境变量 ``IDF_TOOLS_PATH``。注意,请确保您的用户已经具备了读写该路径的权限。 -如果修改了 ``IDF_TOOLS_PATH`` 变量,请确保该变量在每次执行“安装脚本” (``install.bat``、``install.ps1`` 或 ``install.sh``) 和导出脚本 (``export.bat``、``export.ps1`` 或 ``export.sh``) 均保持一致。 +如果修改了 ``IDF_TOOLS_PATH`` 变量,请确保该变量在每次执行安装脚本 (``install.bat``、``install.ps1`` 或 ``install.sh``) 和导出脚本 (``export.bat``、``export.ps1`` 或 ``export.sh``) 均保持一致。 .. _get-started-set-up-env: @@ -247,18 +256,38 @@ Windows 安装器(:ref:`get-started-windows-tools-installer` )可在“开 .$HOME/esp/esp-idf/export.ps1 -Linux 和 MacOS 操作系统 +.. _get-started-export: + +Linux 和 macOS 操作系统 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -请在您需要运行 ESP-IDF 的“命令提示符”窗口运行以下命令: +请在需要运行 ESP-IDF 的终端窗口运行以下命令: .. code-block:: bash . $HOME/esp/esp-idf/export.sh +对于 fish shell(仅支持 fish 3.0.0 及以上版本),请运行以下命令: + +.. code-block:: bash + + . $HOME/esp/esp-idf/export.fish + 注意,命令开始的 "." 与路径之间应有一个空格! -此外,您也可以将这行代码增加至您的 ``.profile`` 或 ``.bash_profile`` 脚本中,这样您就可以在任何命令窗口使用 ESP-IDF 工具了。 +如果您需要经常运行 ESP-IDF,您可以为执行 ``export.sh`` 创建一个别名,具体步骤如下: + +1. 复制并粘贴以下命令到 shell 配置文件中(``.profile``, ``.bashrc``, ``.zprofile`` 等) + + .. code-block:: bash + + alias get_idf='. $HOME/esp/esp-idf/export.sh' + +2. 通过重启终端窗口或运行 ``source [path to profile]``,如 ``source ~/.bashrc`` 来刷新配置文件。 + +现在您可以在任何终端窗口中运行 ``get_idf`` 来设置或刷新 esp-idf 环境。 + +这里不建议您直接将 ``export.sh`` 添加到 shell 的配置文件。因为这会导致在每个终端会话中都激活 IDF 虚拟环境(包括无需使用 IDF 的情况),从而破坏使用虚拟环境的目的,并可能影响其他软件的使用。 .. _get-started-start-project: @@ -267,9 +296,9 @@ Linux 和 MacOS 操作系统 现在,您可以开始准备开发 {IDF_TARGET_NAME} 应用程序了。您可以从 ESP-IDF 中 :idf:`examples` 目录下的 :example:`get-started/hello_world` 工程开始。 -将 :example:`get-started/hello_world` 复制至您本地的 ``~/esp`` 目录下: +将 :example:`get-started/hello_world` 工程复制至您本地的 ``~/esp`` 目录下: -Linux 和 MacOS 操作系统 +Linux 和 macOS 操作系统 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash @@ -302,7 +331,7 @@ ESP-IDF 的 :idf:`examples` 目录下有一系列示例工程,都可以按照 - **Windows 操作系统:** ``COM1`` 等 - **Linux 操作系统:** 以 ``/dev/tty`` 开始 -- **MacOS 操作系统:** 以 ``/dev/cu.`` 开始 +- **macOS 操作系统:** 以 ``/dev/cu.`` 开始 有关如何查看串口名称的详细信息,请见 :doc:`establish-serial-connection`。 @@ -318,7 +347,7 @@ ESP-IDF 的 :idf:`examples` 目录下有一系列示例工程,都可以按照 请进入 :ref:`get-started-start-project` 中提到的 ``hello_world`` 目录,并运行工程配置工具 ``menuconfig``。 -Linux 和 MacOS 操作系统 +Linux 和 macOS 操作系统 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash @@ -345,17 +374,7 @@ Windows 操作系统 :alt: 工程配置 — 主窗口 :figclass: align-center -工程配置 — 主窗口 - -``menuconfig`` 工具的常见操作见下。 - -* 上下箭头:移动 -* ``回车``:进入子菜单 -* ``ESC 键``:返回上级菜单或退出 -* ``英文问号``:调出帮助菜单(退出帮助菜单,请按回车键)。 -* ``空格``或 ``Y 键``:选择 ``[*]`` 配置选项;``N 键``:禁用 ``[*]`` 配置选项 -* ``英文问号`` (查询配置选项):调出有关该选项的帮助菜单 -* ``/ 键``:寻找配置工程 +您可以通过此菜单设置项目的具体变量,包括 Wi-Fi 网络名称、密码和处理器速度等. ``hello_world`` 示例项目会以默认配置运行,因此可以跳过使用 ``menuconfig`` 进行项目配置这一步骤。 .. only:: esp32 @@ -363,6 +382,10 @@ Windows 操作系统 如果您使用的是 ESP32-DevKitC(板载 ESP32-SOLO-1 模组),请在烧写示例程序前,前往 ``menuconfig`` 中使能单核模式(:ref:`CONFIG_FREERTOS_UNICORE`)。 +.. 注解:: + + 您终端窗口中显示出的菜单颜色可能会与上图不同。您可以通过选项 ``--style`` 来改变外观。更多信息,请运行 ``idf.py menuconfig --help`` 命令。 + .. _get-started-build: 第八步:编译工程 @@ -402,9 +425,11 @@ Windows 操作系统 第九步:烧录到设备 ============================= -请使用以下命令,将刚刚生成的二进制文件烧录 (bootloader.bin, partition-table.bin 和 hello-world.bin) 至您的 {IDF_TARGET_NAME} 开发板: +请使用以下命令,将刚刚生成的二进制文件 (bootloader.bin, partition-table.bin 和 hello-world.bin) 烧录至您的 {IDF_TARGET_NAME} 开发板: - ``idf.py -p PORT [-b BAUD] flash`` +.. code-block:: bash + + idf.py -p PORT [-b BAUD] flash 请将 PORT 替换为 {IDF_TARGET_NAME} 开发板的串口名称,具体可见 :ref:`get-started-connect`。 @@ -416,42 +441,114 @@ Windows 操作系统 勾选 ``flash`` 选项将自动编译并烧录工程,因此无需再运行 ``idf.py build``。 -.. code-block:: none - Running esptool.py in directory [...]/esp/hello_world - Executing "python [...]/esp-idf/components/esptool_py/esptool/esptool.py -b 460800 write_flash @flash_project_args"... - esptool.py -b 460800 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin 0x10000 hello-world.bin - esptool.py v2.3.1 - Connecting.... - Detecting chip type... {IDF_TARGET_NAME} - Chip is {IDF_TARGET_NAME}D0WDQ6 (revision 1) - Features: WiFi, BT, Dual Core - Uploading stub... - Running stub... - Stub running... - Changing baud rate to 460800 - Changed. - Configuring flash size... - Auto-detected Flash size: 4MB - Flash params set to 0x0220 - Compressed 22992 bytes to 13019... - Wrote 22992 bytes (13019 compressed) at 0x00001000 in 0.3 seconds (effective 558.9 kbit/s)... - Hash of data verified. - Compressed 3072 bytes to 82... - Wrote 3072 bytes (82 compressed) at 0x00008000 in 0.0 seconds (effective 5789.3 kbit/s)... - Hash of data verified. - Compressed 136672 bytes to 67544... - Wrote 136672 bytes (67544 compressed) at 0x00010000 in 1.9 seconds (effective 567.5 kbit/s)... - Hash of data verified. +烧录过程中可能遇到的问题 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +如果在运行给定命令时出现如“连接失败”这样的错误,原因之一则可能是运行 ``esptool.py`` 出现错误。``esptool.py`` 是编译系统调用的程序,用于重置芯片、与 ROM 引导加载器交互以及烧录固件的工具。解决该问题的一个简单的方法就是按照以下步骤进行手动复位。如果问题仍未解决,请参考 `Troubleshooting `_ 获取更多信息。 - Leaving... - Hard resetting via RTS pin... + +``esptool.py`` 通过使 USB 转串口转接器芯片(如 FTDI 或 CP210x)的 DTR 和 RTS 控制线生效来自动复位 {IDF_TARGET_NAME}(请参考 :doc:`establish-serial-connection` 获取更多详细信息)。DTR 和 RTS 控制线又连接到 {IDF_TARGET_NAME} 的 ``GPIO0`` 和 ``CHIP_PU`` (EN) 管脚上,因此 DTR 和 RTS 的电压水平变化会使 {IDF_TARGET_NAME} 进入固件下载模式。相关示例可查看 ESP32 DevKitC 开发板的 `原理图 `_。 + +一般来说,使用官方的 esp-idf 开发板不会出现问题。但是,``esptool.py`` 在以下情况下不能自动重置硬件。 + +- 您的硬件没有连接到 ``GPIO0`` 和 ``CIHP_PU`` 的 DTR 和 RTS 控制线。 +- DTR 和 RTS 控制线的配置方式不同 +- 根本没有这样的串行控制线路 + +根据您硬件的种类,也可以将您 {IDF_TARGET_NAME} 开发板手动设置成固件下载模式(复位)。 +- 对于 Espressif 的开发板,您可以参考对应开发板的入门指南或用户指南。例如,可以通过按住 **Boot** 按钮 (``GPIO0``) 再按住 **EN** 按钮(``CHIP_PU``) 来手动复位 esp-idf 开发板。 +- 对于其他类型的硬件,可以尝试将 ``GPIO0`` 拉低。 + + + +常规操作 +~~~~~~~~~~~~~~~~ + +在烧录过程中,您会看到类似如下的输出日志: + +.. 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 如果一切顺利,烧录完成后,开发板将会复位,应用程序 "hello_world" 开始运行。 -.. note:: - - (目前不支持)如果您希望使用 Eclipse IDE,而非 ``idf.py``,请参考 :doc:`Eclipse 指南 `。 +如果您希望使用 Eclipse 或是 VS Code IDE,而非 ``idf.py``,请参考 :doc:`Eclipse 指南 `,以及 :doc:`VS Code 指南 `。 .. _get-started-build-monitor: @@ -459,7 +556,7 @@ Windows 操作系统 第十步:监视器 =============== -您可以使用 ``idf.py -p PORT monitor`` 命令,监视 “hello_world” 的运行情况。注意,不要忘记将 PORT 替换为您的串口名称。 +您可以使用 ``idf.py -p PORT monitor`` 命令,监视 “hello_world” 工程的运行情况。注意,不要忘记将 PORT 替换为您的串口名称。 运行该命令后,:doc:`IDF 监视器 <../api-guides/tools/idf-monitor>` 应用程序将启动::: @@ -491,7 +588,7 @@ Windows 操作系统 .. only:: esp32 - 如果 IDF 监视器在烧录后很快发生错误,或打印信息全是乱码(见下),很有可能是因为您的开发板采用了 26 MHz 晶振,而 ESP-IDF 默认支持大多数开发板使用的 40 MHz 晶振。 + 如果 IDF 监视器在烧录后很快发生错误,或打印信息全是乱码(如下),很有可能是因为您的开发板采用了 26 MHz 晶振,而 ESP-IDF 默认支持大多数开发板使用的 40 MHz 晶振。 .. figure:: ../../_static/get-started-garbled-output.png :align: center @@ -520,16 +617,23 @@ Windows 操作系统 现在,您可以尝试一些其他 :idf:`examples`,或者直接开发自己的应用程序。 +.. 重要:: + + 一些示例程序不支持 {IDF_TARGET_NAME},因为 {IDF_TARGET_NAME} 中不包含所需的硬件。 + + 在编译示例程序前请查看 README 文件中 ``Supported Targets`` 表格。如果表格中包含 {IDF_TARGET_NAME}, 或者不存在这个表格,那么即表示 {IDF_TARGET_NAME} 支持这个示例程序。 + + 更新 ESP-IDF ================ -乐鑫会不时推出更新版本的 ESP-IDF,修复 bug 或提出新的特性。因此,您在使用时,也应注意更新您本地的版本。最简单的方法是:直接删除您本地的 ``esp-idf`` 文件夹,然后按照 :ref:`get-started-get-esp-idf` 中的指示,重新完成克隆。 +乐鑫会不时推出更新版本的 ESP-IDF,修复 bug 或提供新的功能。因此,您在使用时,也应注意更新您本地的版本。最简单的方法是:直接删除您本地的 ``esp-idf`` 文件夹,然后按照 :ref:`get-started-get-esp-idf` 中的指示,重新完成克隆。 此外,您可以仅更新变更部分。具体方式,请前往 :ref:`更新 ` 章节查看。 -注意,更新完成后,请执行 ``install.sh`` (Windows 系统中为 ``install.bat``)脚本,避免新版 ESP-IDF 所需的工具也有所更新。具体请参考 :ref:`get-started-set-up-tools`。 +注意,更新完成后,请再次运行安装脚本,以防新版 ESP-IDF 所需的工具也有所更新。具体请参考 :ref:`get-started-set-up-tools`。 -一旦重新安装好工具,请使用“导出脚本”更新环境,具体请参考 :ref:`get-started-set-up-env`。 +一旦重新安装好工具,请使用导出脚本更新环境,具体请参考 :ref:`get-started-set-up-env`。 相关文档 ================= diff --git a/docs/zh_CN/get-started/vscode-setup.rst b/docs/zh_CN/get-started/vscode-setup.rst index bd09d0a171..2dc39f7f75 100644 --- a/docs/zh_CN/get-started/vscode-setup.rst +++ b/docs/zh_CN/get-started/vscode-setup.rst @@ -1 +1,37 @@ -.. include:: ../../en/get-started/vscode-setup.rst \ No newline at end of file +******************************** +VS Code IDE 快速入门 +******************************** + +:link_to_translation:`en:[English]` + +我们支持 VS code,并且致力于为所有与 ESP-IDF 相关的操作提供完善的端到端支持,包括构建、烧录、监控、调试、追踪、core-dump、以及系统追踪查看器等操作。 + + +快速安装指南 +=============== + +推荐您从 `VS Code 插件市场 `_ 中下载 ESP-IDF VS Code 插件,或根据 `快速安装指南 `_ 安装 ESP-IDF VS Code 插件。 + + +支持如下功能 +================== + +* **安装**:帮助您迅速安装 ESP-IDF 及其相关工具链。 +* **构建**:通过一键构建和多目标构建,轻松构建并部署您的应用程序。 +* **烧录**:UART 和 JTAG 均可完成烧录。 +* **监控**:内置终端带有监控功能,您可以在 VS Code 中启用 IDF 监控命令,操作方法和传统终端一样。 +* **调试**:提供立即可用的硬件调试功能,同时支持事后剖析调试如 core-dump 功能,分析 bug 更加方便。 +* **GUI 菜单配置**:提供简化的用户界面,用于配置您的芯片。 +* **应用程序追踪 & 堆追踪**:支持从应用程序中收集跟踪,并提供简化的用户界面分析跟踪。 +* **系统视图查看器**:读取并显示 *.svdat* 文件到用户追踪界面,同时支持多个内核追踪视图。 +* **IDF 二进制大小分析**:为分析二进制文件大小提供用户界面。 +* `Rainmaker Cloud `_:我们有内置的 Rainmaker Cloud 支持,您可以轻松编辑/读取连接的物联网设备的状态。 +* **代码覆盖**:我们有内置的代码覆盖支持,将用颜色突出显示已经覆盖的行。我们也会在 IDE 内部直接渲染现有的 HTML 报告。 + + +Bugs 问题 & 功能请求 +======================= + +如果您在使用 VS Code 或其某些功能上遇到问题,建议您在 `论坛 `_ 或是 `github `__ 上提出您的问题,我们开发团队会对问题进行解答。 + +我们也欢迎您提出新的功能需求,正是由于用户要求新功能或是建议对现有功能进行改善,才成就我们今天所具备的大多数功能。欢迎您在 `github `__ 上提出功能请求。 \ No newline at end of file