How To Really Get Started — ESP_IDF_Series Episode #02

J3
Jungletronics
6 min readJun 7, 2020

--

Hi, this is CMake-based ESP-IDF build system.

Read this document if you want to know how to organize and build a new ESP-IDF project or component using the CMake-based build system. Welcome o/

Yeap! I chose to start from the beginning using this installer walk-through:

That works beautifully for me:)

Use this link https://docs.espressif.com/projects/esp-idf/en/latest/get-started/windows-setup-scratch.html walk-through official explanation.

It worked like a breeze for me:D

ESP-IDF Tools Installer

The easiest way to install ESP-IDF’s prerequisites is to download the ESP-IDF Tools installer.

The installer includes the cross-compilers, OpenOCD, cmake and Ninja build tool. The installer can also download and run installers for Python 3.7 and Git For Windows if they are not already installed on the computer.

The installer also offers to download one of the ESP-IDF release versions. See my options below…

Here are my definitions that may work for you too:

Fig 1. Python 3.8 (64-bit)
Fig 2. Git 2.21.0
Fig 3. Download ESP-IDF — It will <user-prifile>/desktop
Fig 4. I chose ESP-IDF 4.0.1 version
Fig 5. C:\Users\giljr\.expressif
Fig 6. ESP-IDF official layout 4 Win10:)
Fig 7. A project layout simplified for your reference
Fig 8. The installer opens the prompter window, and all you have to do is to connect your ESP-32 Board, see the Port it is attached, go to C:\Users\giljr\Desktop\esp-idf\examples\get-started\blink directory and run idf.py build and finally idf.py -p COM10 flash or whatever port the device are connected to you platform :)

Here is the code:

Code 1. blink.c ( This example code is in the Public Domain (or CC0 licensed, at your option.)
Fig 9. The blink.c is configured to output to GPIO-5; I put a 3mm LED GPIO 5 together with 1k resistor at GND (see gif below:)
Fig 10. Please run idf.py menuconfig > Example Configuration > (25) Blink GPIO number
Fig 11. Choosing GPIO25 to use built-in LED on WiFi LoRa 32 (v2), a classic IoT dev-board designed & produced by Heltec Automation(TM):)
Fig 12. Everything works fine! I ran this code: idf.py -p COM3 flash (please, go to your Device manager and see what port your ESP32 is connected!)
Gif 1. The flashing GPIO 05 is a 1-second delay each \o/ I put a 3mm LED GPIO 5 together with 1k resistor at GND. Hint: you can set GPIO 25 using idf.py menuconfig command to flash instead (this is build-in LED for this board)😜
Gif 2. The GPIO 25 built-in LED flashes @ 1s interval \o/
Fig 13. Here is the directory created for me: C:\Users\giljr\Desktop\esp-idf
Fig 14. The next time, just execute ESP-IDF Command Prompt (cmd.exe) and YOU ARE GOOD TO GO!

Why I had to start from the beginning

Because the Legacy GNU Make Build System did not work in my Windows 10:/, maybe because of the Anaconda installation (?)

To recreate the problem I’ve taken these steps (previous post):

  • Freshly unzipped msys32 into (C:);
  • create esp directory in the home/user directory;
  • clone idf repo into ‘esp’ directory with git clone — recursive https://github.com/espressif/esp-idf.git;
  • create script to export path variable export IDF_PATH=C:/msys32/home/owen.lyke/esp/esp-idf;
  • close msys32 and reopen, verify path variable existence with printenv IDF_PATH;
  • check python version and which python2.7 (it is /mingw32/bin/python2.7);
  • upgraded pip with python -m pip install — upgrade pip;
  • upgrade setuptools with pip install — upgrade setuptools;
  • used pacman -S mingw-w64-i686-python2-cryptography per above;
  • tried to install requirements with python2.7 -m pip install — user -r $IDF_PATH/requirements.txt;
  • #2480 (comment)

If you want to try for yourself, here are my annotations about my try:

I recommend you to use the new method exposed here:). It is the easiest way ever!

And from what I have been reading at Expressif, perhaps in the near future, it will be the facto ESP-IDF Windows 10 deployer:) — Access Jun 2020.

Fine, now we can go code a new ESP-IDF project:)

But that will be a task for another post…

That’s all for now!

Thank you!

Please see the Troubleshooting section below

Credits & References:

https://docs.espressif.com/projects/esp-idf/en/v3.3/api-guides/build-system-cmake.html

Related Post

00#Episode — ESP_IDF_Series — ESP-IDF Programming Guide + WiFi LoRa 32 (v2) — How To Get Started

01#Episode — ESP_IDF_Series — LoRa LPWAN — Long Range Low Power Wide Area Network — LoRa was developed by Semtech, founder LoRa Alliance —

02#Episode — ESP_IDF_Series — ESP-IDF Programming Guide + WiFi LoRa 32 (v2) + idf.py utility — How To Really Get Started (this one)

03#Episode — ESP_IDF_Series — ESP32-IDF — HelloWorld Get Started — How To Get Started

05#Episode FreeRTOS — A Real Real-Time TV Transmissions — Fundamental Understanding about FreeRTOS Apps — IoT

Troubleshooting — Driver Bridge — WiFi LoRa 32 V2

If the driver is installed previously, a COM port will be allotted as soon as you plug your ESP32 kit (mine is WiFi LoRa 32 V2). Otherwise, download the silicon labs cp2102 driver from here & install it with this utility Program CH341SER.EXE on your PC. Everything will be allright o/

Fig 15 . This is the driver: Silicon Labs CP210x USB to UART Bridge \o/

If it didn’t help, please access this page: Establish Serial Connection with ESP32.

--

--

J3
Jungletronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!