Published in


How To Get Started — ESP_IDF_Series Episode #00


This tutorial uses the Legacy GNU Make Build System and MSYS2 Unix compatibility environment to build projects of ESP-IDF. This is no longer required, ESP-IDF can be used from the Windows Command Prompt.

For a new one build system, using CMake + Ninja, please use this post:)

In this tutorial, we will be dealing with the installation of the EXPRESSIF ESP-IDF toolchain & ESP_IDF for Windows. This is a GNU Make based build system.Please access this link for official instructions (choose your platform: Windows, Linux or Mac OS)https://my-esp-idf.readthedocs.io/en/latest/get-started/index.html
Fig 1. From https://my-esp-idf.readthedocs.io/en/latest/get-started/index.html — As you can see we will need ESP-IDF framework installed on our PC, a Toolchain, a Project and finally build it and upload it with make utility prog into our WiFi LoRa 32 (v2) — Please, read more :)

Let’s get it on!

Radio operates like this: you send signals here, they receive them there.

Sending data over long distances is like magic.

Most WiFi, Bluetooth, Zigbee, and other wireless radios chipsets use 2.4GHz, which is great for high-speed transfers.

If you aren’t so concerned about streaming a video, you can use a lower license-free frequency such as 433 or 900 MHz. You can’t send data as fast but you can send data a lot farther. And here is where LoRa Radios shine up!

LoRa radios can operate at a frequency of 33 MHz, 868 MHz (Europe), 915 MHz (Australia and South/North America), and 923 MHz (Asia).

Fig 2. Lora Wireless Soil Moisture Temperature Sensor Smart agriculture — Precision Agriculture Application LoRa® Video Library and DEVELOPER PORTAL and What Can I Do With LoRa?

The LoRa radios are exciting and more powerful but also a bit more expensive($20 — $30) compared to The RFM69’s. But not so much like Zigbee ($60-$100).

LoRa packet radios can easily go 2 Km line of sight using simple wire antennas, or up to 20Km with directional antennas and settings tweaking.

This is WiFi LoRa 32 (v2):

Fig 3. WiFi LoRa 32 (v2) is a classic IoT dev-board designed & produced by Heltec Automation(TM), it’s a highly integrated product based on ESP32 + SX127x, it has Wi-Fi, BLE, LoRa functions, also Li-Po battery management system, 0.96″ OLED are also included. It’s my choice :)

This is the 900 MHz radio version, which can be used for either 868MHz or 915MHz transmission/reception — the exact radio frequency is determined when you load the software since it can be tuned around dynamically.

For us, hobbyists, there are 2 ESP32 development options available, via: 1 - Arduino environment, which I already posted here;2 - or an amazing native ec·o·sys·tem: ESP-IDF Toolchain (this very own post).Here we will be dealing with the most powerfull method: ESP-IDF from ESPRESSIF. The native software development framework for the ESP-32 is called the ESPRESSIF IoT Development Framework (ESP-IDF).

The quickest way to start development with ESP-IDF is by installing a prebuilt toolchain.

Here is a step-by-step procedure for Windows users:

01#Step — Download the Windows all-in-one toolchain & MSYS2 zip file from dl.espressif.com (about 710 MB — it takes five minutes @ 50MB internet):

Fig 4. After decompaction, the size of the msys32 folder is 1.3GB!

02#StepUnzip it in your C:/ driver directory and files will end up in the 👆MSYS32👆 directory;

Fig 5. Drag it to C:/ Drive

03#Step — Open an MSYS2 MINGW32 terminal window by running this app: C:\msys32\mingw32.exe

This is a bash shell.

04#Step — Inside the shell, Make a directory named esp, like this:

mkdir -p ~/esp

05#Step — Now access this folder:

cd ~/esp

06#Step —Now get SDK-IDF version 3.3.2, type:

git clone -b v3.3.2 --recursive https://github.com/espressif/esp-idf.git
Fig 6. Here is the whole process until here :)

This process will take ~20' and it’ll cloning important API component, like:

esptool_py/esptool (prog to compile and upload hex into the chip);
json/cJSON (transform JSON);
lwip/lwip (Famous Socket library);
tinyusb/tinyusb (Driver USB);
lib/tinyxml2(XML manipulations);
mbedtls/mbedtls (TTL/SSL Library);
mqtt/esp-mqtt(MQTT Protocol)and others.
Fig 7. This is the final size of the msys32 folder, after the whole process. Roughly 2.70GB!

07#Step Setup Path to IDF_PATH — Create a new script file in C:/msys32/etc/profile.d/ directory. Name it export_idf_path.sh;

The toolchain programs access ESP-IDF using an environment variable. This variable should be set up on your PC, otherwise, projects will not build. To set up it permanently by defining IDF_PATH in the user profile.

The user profile scripts are contained in C:/msys32/etc/profile.d/ directory. They are executed every time you open an MSYS2 window. Let’s do that:

08#Step — Add the export command to the script file, e.g.:

At C:/msys32/etc/profile.d/ directory, type:

vim export_idf_path.sh

Then paste:

export IDF_PATH="C:/msys32/home/user-name/esp/esp-idf"

As an example, this is my path:

And finally, type:

<ESC>, :wq, <ENTER>

and you are #GOODTOGO:)\o/

Here are some tips to help you out:

Fig 8. Here is a helper graph to help you out, just set this shell at C:/msys32/etc/profile.d/ directory
Note: Remember this is a Linux terminal window. You can type it as a normal Windows path, but use forward-slashes instead of back-slashes:)

But there is a much, much easier method:

Simply in your Windows Explorer directory C:\mysys32\etc\profile.d copy & paste another file as a template, rename it to export_idf_path.sh and open it at Notepad++ app, edit it, and paste this:

export IDF_PATH="C:/msys32/home/giljr/esp/esp-idf"

And save it:

Fig 9. Here is the shell file just created in this step. (please, change to your profile username:)

And You are #GOODTOGOTOO:)\o/

09#Step — Now to test the environment, close the MSYS2 MINGW32 terminal shell, and open it again (I reinitiate my machine, just in case;)

Now type:

printenv IDF_PATH
Fig 10. The path previously entered in the script file should be printed out.

10# Step Install the Required Python Packages;

Python packages required by ESP-IDF are located in the $IDF_PATH/requirements.txt file. You can install them in this Linux env by running:

python -m pip install --user -r $IDF_PATH/requirements.txt
Fig 11. all python 3.8 libs are already satisfied, I already installed Python 3 previously in my machine \o/

If your system complains about updating pip, type:/

python -m pip install --upgrade pip

Then, run again:

python -m pip install --user -r $IDF_PATH/requirements.txt

Start a Project

Now you are ready to prepare your application for ESP32. To start off quickly, we will use a get-started/hello_world project from the examples directory in IDF.

Copy get-started/hello_world to ~/esp the directory:

cd ~/esp
cp -r $IDF_PATH/examples/get-started/hello_world

You can also find a range of example projects under the examples directory in ESP-IDF. These example project directories can be copied in the same way as presented above, to begin your own projects.


You are almost there. To be able to proceed further, connect the ESP32 board to the PC, check under what serial port the board is visible, and verify if serial communication works. If you are not sure how to do it, check the instructions in section Establish Serial Connection with ESP32. Note the port number, as it will be required in the next step.


Being in a terminal window, go to the directory of hello_world the application by typing cd ~/esp/hello_world. Then start project configuration utility menuconfig:

cd ~/esp/hello_world
make menuconfig

If previous steps have been done correctly, the following menu will be displayed:

Fig 12. Project configuration — Home window

In the menu, navigate to Serial flasher config > Default serial port to configure the serial port (mine is COM10), where the project will be loaded to. Confirm the selection by pressing enter, save the configuration by selecting<Save> and then exit the application by selecting <Exit>.


Now go to your sys_config.h file at C:\msys32\home\giljr\esp\esp-idf\examples\get-started\hello_world and modify these entries:

copy the path access it 

Save the project, now type:

make -j5 flash monitor
Fig 13. Click on solve compatibility problem in my win 10 and Flashing the IC o/ It takes 10 minutes to end up :/
I (212) cpu_start: App cpu up.I (238) heap_init: Initializing. RAM available for dynamic allocation:I (245) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAMI (251) heap_init: At 3FFB2EE0 len 0002D120 (180 KiB): DRAMI (257) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAMI (263) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAMI (270) heap_init: At 40088470 len 00017B90 (94 KiB): IRAMI (276) cpu_start: Pro cpu start user codeI (294) cpu_start: Starting scheduler on PRO CPU.I (0) cpu_start: Starting scheduler on APP CPU.Hello world!This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 8MB external flashRestarting in 10 seconds...Restarting in 9 seconds...Restarting in 8 seconds...Restarting in 7 seconds...Restarting in 6 seconds...Restarting in 5 seconds...Restarting in 4 seconds...Restarting in 3 seconds...Restarting in 2 seconds...Restarting in 1 seconds...Restarting in 0 seconds...Restarting now.ets Jun  8 2016 00:22:57rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)configsip: 0, SPIWP:0xeeclk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00mode:DIO, clock div:2load:0x3fff0018,len:4load:0x3fff001c,len:6784ho 0 tail 12 room 4load:0x40078000,len:12072ho 0 tail 12 room 4load:0x40080400,l

What happens here is that the HelloWorld program simply reset your device via software…nothing fancy, right?

Now If you got here, congratulations!


That’s all for now, In the next episode let’s talk about ESP-IDF and Semtech’s LoRa radio ;)

See you soon!



.Troubleshooting Driver Bridge(see below, right below...).What is MSYS2? (https://www.msys2.org/)MSYS2 is a software distro and building platform for Windows.It features a package management system, Pacman, to provide easy installation of packages. It brings many powerful features such as dependency resolution and simple complete system upgrades, as well as straight-forward package building.Please, Update the package database and core system packages with:pacman -Syu. On Windows, while executing C:\msys32\mingw32.exe remember to execute it all as an administrator privileges :)

Related Post

Related Post

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

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

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

Credits & References

Microgênios — Treinamento em Sistemas Embarcados — Microchip Regional Partner certified Training Courses a Simplício-owned enterprise


Troubleshooting — Driver Bridge

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 12 . 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.

Edited @ Dez/2020 — downloads updates, text complementation, minor typos corrections:)




J of Jungle + 3 Plats Arduino/RPi/Pic = J3

Recommended from Medium

Static Functions and Subs

Let’s start exploring DGraph — How to get started?

Getting Social Media Links Couldn’t Be Easier With This API

PicoCTF 2022 — Binary Exploitation: ropfu

Screenflow 8 for Mac Beginners Tutorial! Download, Install, Configure Recording, Test Sync, Edit!

Screenflow 8 for Mac Beginners Tutorial! Download, Install, Configure Recording, Test Sync, Edit!

AT-TLS Aware Mode in a Mainframe Java Application

Practices to Avoid Merge Conflicts on Git

Calculating Fibonacci Series using Dynamic Programming

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


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

More from Medium


CTF Ware : Part 001 — Let Me Explain.

Phishing Emails 1 [Write-up]