Get started
At the begining it is necessary to set up development enviroment. Programming gateways is supported on every popular operating systems like Windows, Linux and MAC OS. This document was prepared in reference to Windows.
ESP-IDF framework
The main tool is ESP-IDF framework provided by Espressif. To get more information about installation, visit manufacturer’s
website: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/
Manual Installation of ESP-IDF https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup.html
During the ESP-IDF installation you might be asked for install Eclipse additionally.
After successful process it is necessary to add new enviroment variable.
Variable name: IDF_PATH. Then paste the path of the directory with ESP-IDF files.
Finally you can run ESP-IDF CMD and start to manage your project. There should be an icon on the desktop
for easy access to ESP-IDF.
Create new project
idf.py create-project -p <name>
Build project
idf.py -p <port> build
Flash project
idf.py -p <port> flash
idf.py -p <port> flash monitor
Erase flash
esptool.py --port <port> erase_flash
MinGW
Download MinGW with GUI from https://sourceforge.net/projects/mingw/ and install on your PC. After successful installation run MinGW Installation Manager (GUI):
Now we need to install Basic Setup. Right click on every square fields in “Package” tab, then “Mark for Installation”. Next, in “Installation” tab click on “Apply Changes”, and then “Apply”.
To check if the installation is successfull, open Command line and type gcc --version
IDE
Here is an open choice of IDE. Final build and flash will be realized by ESP-IDF but code you can edit in preferred one.
Recommanded IDEs:
Visual Studio Code
Download package with example projects for IoT Gateway
Select one of these demo and copy to new directory
Open Visual Studio Code and click on extension tab
Install and configure C/C++ extensions
Open directory in VS Code
If you get errors, edit “includePath” settings
Add the line ${env:IDF_PATH}/**
Now you are ready to modify code
To build or flash project, use ESP-IDF CMD
Visual Studio Code provides an extension “Espressif IDF” which has some issues at this moment. Actually it is not essential for editing code.
CodeBlocks
Download package with example projects for IoT Gateway
Select one of these demo and copy to new directory
Run ESP-IDF CMD, set the path to your project and then generate project for CodeBlocks
cmake -G "CodeBlocks - MinGW Makefiles"Run CodeBlocks. File → Open… , find .cbp type file and click on “Open”
Now you have access to project tree and you are ready to modify code.
To build or flash project, use ESP-IDF CMD
Thonny IDE
Download and install Python interpreter
Download package with example projects for IoT Gateway
Select one of these demo and copy to new directory
Run ESP-IDF CMD, erase flash using esptool.py --port <COMX> erase_flash
Download firmware which allows to run microPython on ESP32 https://micropython.org/resources/firmware/esp32-idf4-20210202-v1.14.bin
Flash .bin file using esptool.py --port <COMX> write_flash -z 0x1000 <name_of_the_bin_file>
Open serial port monitor like “Putty”, set COM port, baudrate, connection type to serial and click on “Open”
Now you can run Python console on ESP32
Download and install Thonny IDE
Tools → Options → Interpreter. In this tab you can choose the kind of interpreter and COM port
After all the process you are ready to use Thonny IDE
If you want to flash demo, open file in this IDE. Next click on green button to run current script.
Uploading firmware
To upload firmware, you need to use external programmer with Tag-connect.