</div>
</div>
</figure></iframe></div></div></figure><h2 id="a623">1.Menu Configuration</h2><p id="0613">Let’s connect our device to a USB port.</p><p id="b2a2">Go to Device Manager and find the port that your ESP device is attached:</p><figure id="0a75"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*eDM6H0356ODZfMTihXTVFg.png"><figcaption>Fig 5. Mine is <b>COM10</b> — If you have problems with USB Driver, please refer to this <a href="https://readmedium.com/esp-idf-programming-guide-wifi-lora-32-v2-53f89e12c96e">post </a>(Troubleshooting — Driver Bridge section)</figcaption></figure><p id="8bc8">Go to<i> <b>ESP-IDF commands prompt (cmd.exe)</b>:</i></p><figure id="e2b5"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*w_I33WtHU9fnw6pjP5n18g.png"><figcaption>Fig 6. Execute the ESP-IDF prompter</figcaption></figure><p id="dd0a">Now go to directory <i>C:\Users\</i>%userprofile%<i>\Desktop\esp-idf\examples\get-started\blink</i> and type:</p><div id="b5fd"><pre>idf<span class="hljs-selector-class">.py</span> menuconfig</pre></div><figure id="faa3"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*fyMOl5T4uPQWotHKpr-tvQ.png"><figcaption>Fig 7. The first thing to do is to check what GPIO pin is the output — Go to Example Configuration and …</figcaption></figure><figure id="da5f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*PbmcUjrXWk--xxYh4Ye-tQ.png"><figcaption>Fig 8. Choose <b>GPIO25</b> as output — This is the built-in LED for my first board — Then <b>Save</b> and <b>Exit</b>, and you are good to go o/</figcaption></figure><div id="31f7"><pre><span class="hljs-built_in">Type</span> <span class="hljs-keyword">cls</span> to <span class="hljs-keyword">clear</span> the <span class="hljs-keyword">screen</span>.</pre></div><h2 id="52bf">2.Building</h2><p id="cb88">Type:</p><div id="6dff"><pre>idf.py <span class="hljs-keyword">build</span></pre></div><p id="4c7e">This process will take a long time. Please, take a coffee and relax! ☕</p><h2 id="ac9e">3.Flashing firmware onto an ESP32 board at \main sub-directory:</h2><p id="828f">When it finishes type:</p><div id="5b3b"><pre>idf<span class="hljs-selector-class">.py</span> -<span class="hljs-selector-tag">p</span> <PORT_NUMBER> flash monitor</pre></div><figure id="7c19"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*XVSiPKLT-JIycHh2cN9eZg.png"><figcaption>Fig 9. Running blink at the monitor.</figcaption></figure><figure id="f87b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*-sJi0AuNPUWHHbHPt8ZLcA.gif"><figcaption>Gig 1. The built-in LED flashes @ 1s interval \o/</figcaption></figure><p id="737f">That’s all for now!</p><p id="b96f">In the next episode we won't be shy, let’s get some more stamina, right?</p><p id="6141">Thank you!</p><p id="0cf5"><a href="https://drive.google.com/drive/folders/13YVCv25xzIQdOgt00mhdwd-FWay4GsfX?usp=sharing">Download All Files For This Project</a></p><h2 id="8cb2">Credits & References</h2><p id="6cf4"><a href="https://docs.espressif.com/projects/esp-idf/en/v3.3/api-guides/build-system-cmake.html">https://docs.espressif.com/projects/esp-idf/en/v3.3/api-guides/build-system-cmake.html</a></p><p id="32c4"><a href="https://cmake.org/cmake/help/latest/guide/tutorial/index.html#cmake-tutorial">CMake Tutorial — CMake 3.17.3 Documentation</a></p><p id="8b5a"><a href="https://cmake.org/cmake/help/latest/guide/tutorial/index.html#cmake-tutorial">The CMake tutorial provides a step-by-step guide that covers common build system issues that CMake helps address…</a></p><p id="c5cf"><a href="https://cmake.org/cmake/help/latest/guide/tutorial/index.html#cmake-tutorial">cmake.org</a></p><h1 id="e7ae">Related Post</h1><p id="18a9">00#Episode — ESP_IDF_Series — <a href="https://readmedium.com/esp-idf-programming-guide-wifi-lora-32-v2-53f89e12c96e">ESP-IDF Programming Guide + WiFi LoRa 32 (v2)</a> — How To Get Started</p><p id="5ea9">01#Episode — ESP_IDF_Series — <a href="https://readmedium.com/lora-lpwan-long-range-low-power-wide-area-network-65cfa264d7c6">LoRa LPWAN — Long Range Low Power Wide Area Network</a> — LoRa was developed by Semtech, founder LoRa Alliance</p><p id="db51">02#Episode — ESP_IDF_Series — <a href="https://readmedium.com/esp-idf-programming-guide-wifi-lora-32-v2-idf-py-utility-339b8371bb8f">ESP-IDF Programming Guide + WiFi LoRa 32 (v2) + idf.py utility — How To Really Get Started</a></p><p id="3f81">03#Episode — ESP_IDF_Series — ESP32-IDF — HelloWorld Get Started — How To Get Started (this one:)</p></article></body>
ESP32-IDF —HelloWorld Get Started
How To Get Started — ESP_IDF_Series Episode #03
This post will review the code example published by Espressif located at directory <IDF_PATH>\examples\get-started\blink of ESP-IDF installation.
It follows the CMake build system software environment for the hardware-based on the ESP32 chip produced by Expressif.
For official tutorial, please head overto:
(the stable versionasof June 2020):
For Installation of ESP-IDF (Expressif IoT Development Framework) on Windows 10 using the CMake-based build system please take a look at this other post.
These are the steps for an ESP-IDF project:
ESP-IDF
Menu Configuration
Building
Flashing firmware onto an ESP32 board
Let me show you what I have in my atelier:)
Fig 1. 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 :)Fig 2. 24M Byte (32M bit )Pro ESP32 OLED V2.0 TTGO & For Arduino ESP32 OLED WiFi Modules+Bluetooth Double ESP-32 ESP8266 OLED from AliExpress.com
Material Needed
ESP32 kit board
High quality TypeB-Micro USB Cable
The ESP-IDF is an amalgamation of a number of components:
1.ESP32 base library;2.WiFi Drivers;3.TCP/IP stack;4.FreeRTOS stack;5.Webserver;6.Driver for sensor(s);7.Main code tying it all together
Follows some concepts and jargons about ESP-IDF:
. ESP-IDF makes these components explicit & configurable;
. To config project use text-based new system (customizable);
. After config, the build system will compile the project;
. The app is inside a directory with all the support files;
. You can modify project config (sdkconfig file) by typing idf.py menuconfig at prompt;
. 1 project builds 2 apps: a) proj app = exe & b) boot app = launcher;
. components = modular pieces linked into app;
. target = hadware = ESP32;
. IDF_PATH = link ESP-IDF project;
. Toolchain = for compilation - should be on the PATH;
Annotation about The CMake-based build system:
There are 2 main build Tools: CMake + Ninja tobuild a full Application for ESP32 (this post) or GNU Make buildsystem (other post);
For CMake build system:
. The CMake-based build system is a front-end command line tool;
. What is idf.py ? idf.py is a top-level config/build command line tool for ESP-IDF;
. It easily managing your project builds;
. esptool.py = Flasher;
. idf.py is a wrapper around CMake for programmer convinience;
. idf.py Commands:
idf.py menuconfig = to config the app;
idf.py build = multiple steps build process; it creaes sub-directories; run Ninja or GNU Make; Building is incremental (no-change; nothing done)
idf.py clean = delating build output files except config files;
idf.py fullclean = delete build directory recursively;
idf.py flash -p PORT -b BAUD RATE = it flashes prog onto chip;
idf.py monitor -p PORT -b BAUD RATE = Serial output;
. You can combine commands, like this: idf.py -p COM4 flash monitor;
. The order isnot important (it automatically will be executed inthe correct order);
. Python interpreter - ESP-IDF works with Python 2.7or3.8;
The first example that I will review is the blink project.
You can find it at this location: C:\Users\%userprofile%\Desktop\esp-idf\examples\get-started\blink.
Here is the blink.c code at \main sub-directory:
1.Menu Configuration
Let’s connect our device to a USB port.
Go to Device Manager and find the port that your ESP device is attached:
Fig 5. Mine is COM10 — If you have problems with USB Driver, please refer to this post (Troubleshooting — Driver Bridge section)
Go toESP-IDF commands prompt (cmd.exe):
Fig 6. Execute the ESP-IDF prompter
Now go to directory C:\Users\%userprofile%\Desktop\esp-idf\examples\get-started\blink and type:
idf.py menuconfig
Fig 7. The first thing to do is to check what GPIO pin is the output — Go to Example Configuration and …Fig 8. Choose GPIO25 as output — This is the built-in LED for my first board — Then Save and Exit, and you are good to go o/
Typecls to clear the screen.
2.Building
Type:
idf.py build
This process will take a long time. Please, take a coffee and relax! ☕
3.Flashing firmware onto an ESP32 board at \main sub-directory:
When it finishes type:
idf.py -p <PORT_NUMBER> flash monitor
Fig 9. Running blink at the monitor.Gig 1. The built-in LED flashes @ 1s interval \o/
That’s all for now!
In the next episode we won't be shy, let’s get some more stamina, right?