]> granicus.if.org Git - esp-idf/blob - docs/eclipse-setup-windows.rst
esptool: Update esptool.py to integrate reset fix for older dev boards
[esp-idf] / docs / eclipse-setup-windows.rst
1 Eclipse IDE on Windows
2 **********************
3
4 Configuring Eclipse on Windows requires some different steps. The full configuration steps for Windows are shown below.
5
6 (For OS X and Linux instructions, see the :doc:`Eclipse IDE page <eclipse-setup>`.)
7
8 Installing Eclipse IDE
9 ======================
10
11 Follow the steps under :ref:`Installing Eclipse IDE <eclipse-install-steps>` for all platforms.
12
13 .. _eclipse-windows-setup:
14
15 Setting up Eclipse on Windows
16 =============================
17
18 Once your new Eclipse installation launches, follow these steps:
19
20 Import New Project
21 ------------------
22
23 * 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.
24
25 * Once Eclipse is running, choose File -> Import...
26
27 * In the dialog that pops up, choose "C/C++" -> "Existing Code as Makefile Project" and click Next.
28
29 * 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).
30
31 * On the same page, under "Toolchain for Indexer Settings" uncheck "Show only available toolchains that support this platform".
32
33 * On the extended list that appears, choose "Cygwin GCC". Then click Finish.
34
35 *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.*
36
37 Project Properties
38 ------------------
39
40 * The new project will appear under Project Explorer. Right-click the project and choose Properties from the context menu.
41
42 * Click on the "C/C++ Build" properties page (top-level):
43
44   * Uncheck "Use default build command" and enter this for the custom build command: ``python ${IDF_PATH}/tools/windows/eclipse_make.py``.
45
46 * Click on the "Environment" properties page under "C/C++ Build":
47
48   * Click "Add..." and enter name ``BATCH_BUILD`` and value ``1``.
49
50   * 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/MyUser/Development/esp-idf*.
51
52   * 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).
53
54 * Click on "C/C++ General" -> "Preprocessor Include Paths, Macros,etc." property page:
55
56   * Click the "Providers" tab
57
58      * In the list of providers, click "CDT GCC Built-in Compiler Settings Cygwin". Under "Command to get compiler specs", replace the text ``${COMMAND}`` at the beginning of the line with ``xtensa-esp32-elf-gcc``. This means the full "Command to get compiler specs" should be ``xtensa-esp32-elf-gcc ${FLAGS} -E -P -v -dD "${INPUTS}"``.
59
60      * In the list of providers, click "CDT GCC Build Output Parser" and type ``xtensa-esp32-elf-`` at the beginning of the Compiler command pattern. This means the full Compiler command pattern should be ``xtensa-esp32-elf-(g?cc)|([gc]\+\+)|(clang)``
61
62
63 Building in Eclipse
64 -------------------
65
66 Continue from :ref:`Building in Eclipse <eclipse-build-project>` for all platforms.
67
68 Technical Details
69 =================
70
71 **Of interest to Windows gurus or very curious parties, only.**
72
73 Explanations of the technical reasons for some of these steps. You don't need to know this in order 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:
74
75 * 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 Cygwin 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.
76
77 * 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.