Docs: Change makes Eclipse setup inline with Mac OS and Linux.

This commit is contained in:
Prasad Alatkar 2018-11-19 12:15:53 +08:00 committed by Angus Gratton
parent 8b6436eb2a
commit b1189e9645
4 changed files with 5 additions and 213 deletions

View file

@ -1,90 +0,0 @@
**********************
Eclipse IDE on Windows
**********************
:link_to_translation:`zh_CN:[中文]`
Configuring Eclipse on Windows requires some different steps. The full configuration steps for Windows are shown below.
(For OS X and Linux instructions, see the :doc:`Eclipse IDE page <eclipse-setup>`.)
Installing Eclipse IDE
======================
Follow the steps under :ref:`Installing Eclipse IDE <eclipse-install-steps>` for all platforms.
.. _eclipse-windows-setup:
Setting up Eclipse on Windows
=============================
Once your new Eclipse installation launches, follow these steps:
Import New Project
------------------
* Eclipse makes use of the Makefile support in ESP-IDF. This means you need to start by creating an ESP-IDF project. You can use the idf-template project from github, or open one of the examples in the esp-idf examples subdirectory.
* Once Eclipse is running, choose File -> Import...
* In the dialog that pops up, choose "C/C++" -> "Existing Code as Makefile Project" and click Next.
* On the next page, enter "Existing Code Location" to be the directory of your IDF project. Don't specify the path to the ESP-IDF directory itself (that comes later). The directory you specify should contain a file named "Makefile" (the project Makefile).
* On the same page, under "Toolchain for Indexer Settings" uncheck "Show only available toolchains that support this platform".
* On the extended list that appears, choose "Cygwin GCC". Then click Finish.
*Note: you may see warnings in the UI that Cygwin GCC Toolchain could not be found. This is OK, we're going to reconfigure Eclipse to find our toolchain.*
Project Properties
------------------
* The new project will appear under Project Explorer. Right-click the project and choose Properties from the context menu.
* Click on the "C/C++ Build" properties page (top-level):
* Uncheck "Use default build command" and enter this for the custom build command: ``python ${IDF_PATH}/tools/windows/eclipse_make.py``
* Click on the "Environment" properties page under "C/C++ Build":
* Click "Add..." and enter name ``BATCH_BUILD`` and value ``1``.
* Click "Add..." again, and enter name ``IDF_PATH``. The value should be the full path where ESP-IDF is installed. The IDF_PATH directory should be specified using forwards slashes not backslashes, ie *C:/Users/user-name/Development/esp-idf*.
* Edit the PATH environment variable. Delete the existing value and replace it with ``C:\msys32\usr\bin;C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin`` (If you installed msys32 to a different directory then you'll need to change these paths to match).
* Click on "C/C++ General" -> "Preprocessor Include Paths, Macros, etc." property page:
* Click the "Providers" tab
* In the list of providers, click "CDT Cross GCC Built-in Compiler Settings". Change "Command to get compiler specs" to ``xtensa-esp32-elf-gcc ${FLAGS} -std=c++11 -E -P -v -dD "${INPUTS}"``.
* In the list of providers, click "CDT GCC Build Output Parser" and change the "Compiler command pattern" to ``xtensa-esp32-elf-(gcc|g\+\+|c\+\+|cc|cpp|clang)``
Navigate to "C/C++ General" -> "Indexer" property page:
* Check "Enable project specific settings" to enable the rest of the settings on this page.
* Uncheck "Allow heuristic resolution of includes". When this option is enabled Eclipse sometimes fails to find correct header directories.
Navigate to "C/C++ Build" -> "Behavior" property page:
* Check "Enable parallel build" to enable multiple build jobs in parallel.
* Setting the number of jobs slightly higher than the "optimal" may give the absolute fastest builds under Windows, depending on the specific hardware being used.
Building in Eclipse
-------------------
Continue from :ref:`Building in Eclipse <eclipse-build-project>` for all platforms.
Technical Details
=================
**Of interest to Windows gurus or very curious parties, only.**
Explanations of the technical reasons for some of these steps. You don't need to know this to use esp-idf with Eclipse on Windows, but it may be helpful background knowledge if you plan to do dig into the Eclipse support:
* The xtensa-esp32-elf-gcc cross-compiler is *not* a Cygwin toolchain, even though we tell Eclipse that it is one. This is because msys2 uses Cygwin and supports Unix-style paths (of the type ``/c/blah`` instead of ``c:/blah`` or ``c:\\blah``). In particular, xtensa-esp32-elf-gcc reports to the Eclipse "built-in compiler settings" function that its built-in include directories are all under ``/usr/``, which is a Unix/Cygwin-style path that Eclipse otherwise can't resolve. By telling Eclipse the compiler is Cygwin, it resolves these paths internally using the ``cygpath`` utility.
* The same problem occurs when parsing make output from esp-idf. Eclipse parses this output to find header directories, but it can't resolve include directories of the form ``/c/blah`` without using ``cygpath``. There is a heuristic that Eclipse Build Output Parser uses to determine whether it should call ``cygpath``, but for currently unknown reasons the esp-idf configuration doesn't trigger it. For this reason, the ``eclipse_make.py`` wrapper script is used to call ``make`` and then use ``cygpath`` to process the output for Eclipse.

View file

@ -18,11 +18,6 @@ The Eclipse IDE gives you a graphical integrated development environment for wri
* When running the Eclipse Installer, choose "Eclipse for C/C++ Development" (in other places you'll see this referred to as CDT.)
Windows Users
=============
Using ESP-IDF with Eclipse on Windows requires different configuration steps. :ref:`See the Eclipse IDE on Windows guide <eclipse-windows-setup>`.
Setting up Eclipse
==================
@ -49,12 +44,14 @@ Project Properties
* Click on the "Environment" properties page under "C/C++ Build". Click "Add..." and enter name ``BATCH_BUILD`` and value ``1``.
* Click "Add..." again, and enter name ``IDF_PATH``. The value should be the full path where ESP-IDF is installed.
* Click "Add..." again, and enter name ``IDF_PATH``. The value should be the full path where ESP-IDF is installed. Windows users can copy the ``IDF_PATH`` from windows explorer.
* Edit the ``PATH`` environment variable. Keep the current value, and append the path to the Xtensa toolchain installed as part of IDF setup, if this is not already listed on the PATH. A typical path to the toolchain looks like ``/home/user-name/esp/xtensa-esp32-elf/bin``. Note that you need to add a colon ``:`` before the appended path.
* Edit the ``PATH`` environment variable. Keep the current value, and append the path to the Xtensa toolchain installed as part of IDF setup, if this is not already listed on the PATH. A typical path to the toolchain looks like ``/home/user-name/esp/xtensa-esp32-elf/bin``. Note that you need to add a colon ``:`` before the appended path. Windows users will need to prepend ``C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin;C:\msys32\usr\bin`` to ``PATH`` environment variable (If you installed msys32 to a different directory then youll need to change these paths to match).
* On macOS, add a ``PYTHONPATH`` environment variable and set it to ``/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages``. This is so that the system Python, which has pyserial installed as part of the setup steps, overrides any built-in Eclipse Python.
**ADDITIONAL NOTE**: If either the IDF_PATH directory or the project directory is located outside ``C:\msys32\home`` directory, you will have to give custom build command in C/C++ Build properties as: ``python ${IDF_PATH}/tools/windows/eclipse_make.py`` (Please note that the build time may get significantly increased by this method.)
Navigate to "C/C++ General" -> "Preprocessor Include Paths" property page:
* Click the "Providers" tab
@ -107,14 +104,6 @@ Note that you will need to use "make menuconfig" to set the serial port and othe
Follow the same steps to add ``bootloader`` and ``partition_table`` targets, if necessary.
Related Documents
-----------------
.. toctree::
:maxdepth: 1
eclipse-setup-windows
.. _eclipse.org: https://www.eclipse.org/

View file

@ -1,95 +0,0 @@
*****************************************************
Eclipse IDE 的创建和烧录指南Windows 平台)
*****************************************************
:link_to_translation:`en:[English]`
Windows 平台上的 Eclipse 配置略有不同,具体步骤请见下文。
注意OS X 和 Linux 平台上的 Eclipse IDE 配置,请见 :doc:`Eclipse IDE page <eclipse-setup>`
安装 Eclipse IDE
==================
Windows 平台的 Eclipse 安装步骤与其他平台相同,请见 :ref:`Installing Eclipse IDE <eclipse-install-steps>`
.. _eclipse-windows-setup:
Windows 平台上的 Eclipse 配置
================================
完成 Eclipse IDE 的安装后,请按照下列步骤继续操作:
导入新项目
-------------
* Eclipse IDE 需使用 ESP-IDF 的 Makefile 功能。因此在使用 Eclipse 前,您需要先创建一个 ESP-IDF 项目。在创建 ESP-IDF 项目时,您可以使用 GitHub 中的 idf-template 项目模版,或从 esp-idf 子目录中选择一个 example。
* 运行 Eclipse选择 “File” -> “Import...”。
* 在弹出的对话框中选择 “C/C++” -> “Existing Code as Makefile Project”然后点击 “Next”。
* 下个界面 “Existing Code Location” 位置输入您的 IDF 项目的路径。注意,这里应填入 ESP-IDF 项目的路径,而非 ESP-IDF 的路径(稍后再填写)。此外,您指定的目录中应包含名为 “Makefile”项目 Makefile的文件。
* 在同一页面上,在 “Toolchain for Indexer Settings” 下取消选中 “Show only available toolchains that support this platform”。
* 在出现的扩展列表中,选择 “Cygwin GCC”。然后点击 “Finish”。
*注意:您可能看到有关“无法找到 Cygwin GCC 工具链”的警告。这种情况并不影响安装,我们只需重新配置 Eclipse并找到我们的工具链即可。*
项目属性
----------
* 新项目将出现在 “Project Explorer” 下。请右键选择该项目并在菜单中选 “Properties”。
* 点击 “C/C++ Build” 属性页。
* 取消选中 “Use default build command”然后输入命令开始自定义创建``python ${IDF_PATH}/tools/windows/eclipse_make.py``
* 点击 “C/C++ Build” 下的 “Environment” 属性页面。
* 选择 “Add...”,并在对应位置输入 ``BATCH_BUILD````1``
* 再次点击 “Add...”,输入名称 ``IDF_PATH``,并填写 ESP-IDF 的完整安装路径。``IDF_PATH`` 目录路径应使用正斜杠,而非反斜线,例如 ``C:/Users/user-name/Development/esp-idf``
* 选择 PATH 环境变量,删除默认值,并将其替换为 ``C:\msys32\usr\bin;C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin`` (如果您已经将 msys32 安装到其他目​​录,这里请自行调整)。
* 点击 “C/C++ General” -> “Preprocessor Include Paths, Macros, etc.” 属性页。
* 点击 “Providers” 选项卡。
* 从 “Providers” 列表中选择 “CDT Cross GCC Built-in Compiler Settings”将 “Command to get compiler specs” 修改为 ``xtensa-esp32-elf-gcc ${FLAGS} -std=c++11 -E -P -v -dD "${INPUTS}"``
* 从 “Providers” 列表中选择 “CDT GCC Build Output Parser”将 “Compiler command pattern” 修改为 ``xtensa-esp32-elf-(gcc|g\+\+|c\+\+|cc|cpp|clang)``
点击 “C/C++ General" -> "Indexer” 属性页。
* 选择 “Enable project specific settings” 以启用本页上的其他设置。
.. note::
取消选中 “Allow heuristic resolution of includes”。因为启用此选项时有时会导致 Eclipse 无法找到正确的头文件目录。
点击 “C/C++ Build” -> “Behavior” 属性页。
* 选中 “Enable parallel build” 以启用多任务并行构建。
* 将作业数设置为略高于“最佳”的推荐值,能够使得在 Windows 下的构建速度达到最快,不过这还要取决于您具体使用的硬件的配置。
在 Eclipse IDE 中创建项目
---------------------------
Windows 平台的 Eclipse 项目创建步骤与其他平台相同,请见 :ref:`Building in Eclipse <eclipse-build-project>`
技术细节
=========
**以下内容仅供 Windows 平台专家或非常感兴趣的开发者阅读。**
Windows 平台的 Eclipse 介绍到此结束,下方将主要将介绍一些关键步骤的原理,助您了解更多 Eclipse 的背景信息。
* 首先xtensa-esp32-elf-gcc 交叉编译器 *并非* Cygwin 工具链,但我们会在 Eclipse 中指定其为 Cygwin 工具链。主要原因在于msys2 需要使用 Cygwin并支持 Unix 风格的路径,即 ``/c/blah``,而非 ``c:/blah`` 或 ``c:\\blah``。特别需要说明的是,``xtensa-esp32-elf-gcc`` 会“告知” Eclipse 的 ``built-in compiler settings`` 功能,其内置 “include” 目录全部位于 ``/usr/`` 路径下,这也是 Eclipse 唯一可以解析的 ``Unix/Cygwin`` 风格路径。通过在 Eclipse 中指定 ``xtensa-esp32-elf-gcc`` 交叉编译器为 Cygwin 编译器,可以让 Eclipse 使用 cygpath 实用程序直接内部解析路径。
* 在解析 ESP-IDF 的 make 结果时也经常会出现同样的问题。Eclipse 可以解析 make 的结果,查找头文件目录,但是无法脱离 ``cygpath``,直接解析类似 ``/c/blah`` 的目录。``Eclipse Build Output Parser`` 将利用该机制确认是否调用 ``cygpath``,但由于未知原因,目前 ESP-IDF 配置并不会触发该功能。出于这个原因,我们会使用 ``eclipse_make.py`` 包装脚本调用 ``make``,然后使用 ``cygpath`` 处理 Eclipse 的结果。

View file

@ -18,10 +18,6 @@ Eclipse IDE 是一个可视化的集成开发环境,可用于编写、编译
* 运行 Eclipse Installer选择 “Eclipse for C/C++ Development”有的版本也可能显示为 CDT
Windows 用户
============
在 Windows 平台上使用 Eclipse IDE 的用户,请参考 :ref:`Windows 用户的 Eclipse IDE 使用指南 <eclipse-windows-setup>`
配置 Eclipse IDE
=================
@ -51,7 +47,7 @@ Windows 用户
* 再次点击 “Add...”,并在 “IDF_PATH” 中输入 ESP-IDF 所在的完整安装路径。
* 选择 “PATH” 环境变量,不要改变默认值。如果 Xtensa 工具链的路径尚不在 “PATH” 列表中,则应将该路径 (``something/xtensa-esp32-elf/bin``) 增加至列表。
* 选择 “PATH” 环境变量,不要改变默认值。如果 Xtensa 工具链的路径尚不在 “PATH” 列表中,则应将该路径 (``something/xtensa-esp32-elf/bin``) 增加至列表,工具链的典型路径类似于 ``/home/user-name/esp/xtensa-esp32-elf/bin``。请注意您需要在附加路径前添加冒号 ``:``。Windows 用户需要将 ``C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin;C:\msys32\usr\bin`` 添加到 ``PATH`` 环境变量的靠前位置(如果您将 msys32 安装到了其它目录,则需要更改对应的路径以匹配您的本地环境)
* 在 macOS 平台上,增加一个 “PYTHONPATH” 环境变量,并将其设置为 ``/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages`` 保证系统中预先安装的 Python (需安装 pyserial 模块)可以覆盖 Eclipse 内置的任何 Python。
@ -113,13 +109,5 @@ Windows 用户
如有需要,请按照相同步骤添加 ``bootloader````partition_table``
相关文档
--------
.. toctree::
:maxdepth: 1
eclipse-setup-windows
.. _eclipse.org: https://www.eclipse.org/