DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • How To Build a Google Photos Clone - Part 1
  • Build a Java Backend That Connects With Salesforce
  • Manage Microservices With Docker Compose
  • The Technology Stack Needed To Build a Web3 Application

Trending

  • GitHub Copilot's New AI Coding Agent Saves Developers Time – And Requires Their Oversight
  • The Future of Java and AI: Coding in 2025
  • Rust, WASM, and Edge: Next-Level Performance
  • Event Driven Architecture (EDA) - Optimizer or Complicator
  1. DZone
  2. Coding
  3. Frameworks
  4. Building and Flashing ESP32 Applications With Eclipse

Building and Flashing ESP32 Applications With Eclipse

Learn how to build ESP32 applications with Eclipse.

By 
Erich Styger user avatar
Erich Styger
·
Aug. 22, 19 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
15.9K Views

Join the DZone community and get the full member experience.

Join For Free

The new semester is approaching in a very fast way, and so is the new lecture and lab module 'Advanced Distributed Systems' at the Lucerne University. For that module, we are going to build a new 'Sumo' style robot with WLAN capabilities using the ESP32 chip. It will be a new robot PCB, and below is the current robot (based on NXP K22FX512) with the WLAN module connected to it:

Image title

Zumo connected to TTGO ESP32 module

The new robot will have the NXP K22FN512 on it, the same device as on the tinyK22 board, with the extension of a Raspberry Pi. The wireless module used is the LILYGO TTGO Wi-Fi/Bluetooth module from http://www.lilygo.cn, which is about 45 percent smaller than typical ESP32 modules. That module includes the ESP32 PICO-D4 from Espressif in a nice and convenient package, including an antenna:

Image title

TTGO module on the DIY adapter

Because the new boards are not ready yet, I had to start software development with the NXP MCUXpresso IDE and SDK using the old platform. And, because the Wi-Fi module only needs UART Rx, Tx, and two control lines (reset and bootloader mode), the wiring is pretty simple. Programming the ESP32 firmware is done through the NXP Kinetis part using USB CDC and is working fine. That way, the Wi-Fi module can be programmed easily from the host using the standard Espressif tools or even with using the Arduino IDE. But that might be the subject of a different post. The TTGO Micro-32 module is available on AliExpress for less than $5.

The current Espressif documentation integrating with Eclipse is kind of broken and did not work for me (they are changing from make files to use CMake).

The good news is that I have found a way to easily integrate the IDF with Eclipse, which is documented below. Because I'm using the ESP32 in combination with the NXP Kinetis and SDK, it makes sense to have everything in the MCUXpresso IDE (I'm using the Version 11.0.0).

Doug Schaefer documented the steps how to use Eclipse with CMake in 2018 (see https://cdtdoug.ca/2018/07/02/cdt-for-esp32.html), but somehow, this does not work correctly in Eclipse 2019-06.

Preconditions

I assume a working IDF installation/setup. I'm using:

  • Windows 10, 64bit
  • NXP MCUXpresso IDE V11.0.0
  • Python 2.7.16
  • CMake V3.15.1 with ninja v1.9.0
  • Git: 2.21.0.windows.1
  • MenuConfig: v4.6.0.0
  • Xtensa ESP32 toolchain: xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-win32
  • Espressif IDF v4.0-dev-1443-g39f090a4f

The IDF requires the following (with my own settings shown):

The following steps describe how to use the 'hello world' project with the Eclipse IDE.

  1. Create a folder where to place the project. Note that the path shall *not* include any spaces. Example:
    c:\esp\projects\idf_hello_world
  2. Copy the files from the IDF example projects into that folder, e.g. from:
    C:\esp\esp-idf\examples\get-started\hello_world
  3. Because we are going to use CMake, the make files (Makefile and main\component.mk) can be deleted.
  4. In the Eclipse IDE, create a new ‘Makefile Project with Existing Code:'Image titleMakefile Project with Existing Code
  5. Give the project a name and point to the folder created:Image titleNew Project
  6. This creates the project:Image titleProject in Project Explorer
  7. In the project properties, C/C++ Build uncheck 'Use default build command' and use the following instead: Image titleBuilder Settings
    python ${IDF_PATH}/tools/idf.py
  8. Add a new build target and use build for the name:Image titleNew Build Target
  9. Add a new build target and use build for the name:Image titleBuild build target
  10. In the same way, it adds targets for clean and fullclean.
  11. UPDATE: To automatically parse the include path settings, use the  -v(verbose) command line:Image titleVerbose build target
  12. For programming, add a new target 'flash' with the following arguments (update the COM port for your system):
    --port COM78 --baud 115200 flash

Image titleFlash Builder Settings

Now, I have all the needed targets I can double-click to build, clean, and flash the ESP32 application:
Image title

ESP32 IDF Project in Eclipse

The targets call the idf.py, as I would do it on the command line, and all the output is written to the Eclipse Console:

Image title

IDF Build With Eclipse and Console Output

In the same way, I can flash the application:
Image title

Programming ESP32 from Eclipse

The Eclipse built-in terminal can be used for the serial connection to the target. In my case, this is a USB CDC connection through the NXP Kinetis to the ESP32 module:
Image title

Serial connection to ESP32

With this, we have all the needed parts working. But there are a few things to tweak for a better experience, as explained in the next sections.

Unresolved Inclusion: The ‘Naive’ Way

UPDATE: There is a better way using a 'verbose' build (see above, added -v to the build command) and using 'Preprocessor Include Path' providers (see below). So you can skip this section and jump to the 'Using Providers' one.

Because we have set up the project without toolchain, the Eclipse IDE editor will report unresolved includes:

Image title

Unresolved Includes

This can be solved by adding entries to the Paths and Symbols project settings.

It makes sense to have a variable ESP32TOOLCHAIN pointing to the Xtensa ESP32 toolchain folder:

C:\esp\toolchain\xtensa-esp32-elf


Then, I can add the following include paths:

${IDF_PATH}/components/freertos/include
${IDF_PATH}/components/spi_flash/include
${IDF_PATH}/components/esp_common/include
${ESP32TOOLCHAIN}/xtensa-esp32-elf/include


It is painful to add all the missing paths, but so far the best solution I have found so far.

Using Providers

There is a way to let Eclipse parsing the include paths from the compiler command line. For this, the build has to be done with the -v option:

Image title

verboseBuildTarget

Enable in the Providers tab of the Preprocessor Include Path the ' CDT GCC Build Output Parser ' and set the following compiler command line pattern:

xtensa-esp32-elf-(gcc|g\+\+|c\+\+|cc|cpp|clang)

Image title

CDT GCC Build Output Parser

Enable as well the CDT GCC Built-in Compiler settings with the following specs:

xtensa-esp32-elf-gcc ${FLAGS} -std=c++11 -E -P -v -dD "${INPUTS}"

Image title

CDT GCC Build-in Compiler Settings

Now with a -v  (verbose) build, the includes should show up resolved in the editor.

You might need to turn off heuristics (see " Fixing the Eclipse Index ") and to rebuild the Index for the project.

Summary

The Eclipse support for CMake and Espressif ESP32 did not work for me with Eclipse 2019.06. It can work initially, but after a workspace reloads, the projects report errors, plus the include paths are not resolved. So, I ended up with a simple and working solution using make file projects in Eclipse, which call the idf.py using CMake: so using CMake with make projects which are not using make. Serial connection to the ESP32 module is with the Eclipse built-in Terminal. What is not working within Eclipse is using the idf.py menuconfig, but maybe a reader has an idea how to enable this?

Post a comment if you have additional tips. If I find an even better way, I will update this article.

Happy ESPing!

Eclipse application Build (game engine) Flashing (cinematography)

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How To Build a Google Photos Clone - Part 1
  • Build a Java Backend That Connects With Salesforce
  • Manage Microservices With Docker Compose
  • The Technology Stack Needed To Build a Web3 Application

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!