Build an ESP32 example on Windows

In this article, we take you through the process of compiling an ESP32 example on Windows. The example we pick (simple LED blinker) is one of those that come with ESP-IDF.

If you have followed our previous article on ESP32 ESP-IDF Windows development tools setup, you can now build any ESP32 program and the location of the source code should not matter.
For this specific tutorial, we will try to compile an example inside the ESP-IDF examples folder itself.
If you prefer to, you can simply place your program anywhere you like and “cd” into that directory to build the source code.

Launch ESP-IDF Command Terminal for Windows

If you followed the previous article on setting up the development environment for Widnows, there should be a shortcut on your desktop called ESP-IDF Command Prompt (cmd.exe).

Double click to launch that and make sure you see no errors in the terminal window.

esp-idf-windows-command-terminal-ready-esp32-example-windows
ESP-IDF tools terminal successfully launched

You might want to double check the IDF_PATH path to make sure it points to the ESP-IDF folder that you want to use.

If the terminal dispolays Python requirements are not satisfied, you should follow any instructions that are displayed on the terminal. Other than that, you should be good to go if you see the screen as above.

Find the example you want to build

We will build the blink example for now. You can choose to build any example or any other source code. Just make sure you change to that directory.

We select the blink example directory by:
cd examples/get-started/blink

You could also enter an absolute path if your sources are not inside the ESP-IDF path.

Build the example

Build the example by
idf.py build

If you need to change the ESP32 firmware configuration  (for example, blink GPIO) using the menuconfig utility, use this before building the example:
idf.py menuconfig

esp32-windows-example-build-successful
ESP-IDF build successful

If you succeeded in building the example, your terminal should look something like this.

The build output lists the flash offsets where the BIN files have to be flashed at. In addition to that, it also gives you a path to where the BIN files are. The path displayed is relative to the terminal directory.

Next Steps

Next, we recommend the following:

  • Flash the BIN files to ESP32 harwdare using ESP-IDF terminal
  • Flash ESP32 using flash download tool
  • Go back to client corner to see what’s next.

In trouble?

If you face some issue with the above steps and need assistance setting up the ESP32 ESP-IDF development environment on Windows, please reach out to your PCB Artists contact person.