Introduction to ESP32 programming using official development framework, ESP-IDF and Arduino for ESP32.
Every demo code is published in this github repository:
https://github.com/alwint3r/RTR_Surabaya2017
13. What is ESP-IDF?
ESP IoT Development Framework or abbreviated as ESP-IDF is
the official development framework for ESP32.
source code: https://github.com/espressif/esp-idf
documentation: http://esp-idf.readthedocs.io
18. Prerequisites - GNU/Linux (Debian-based)
git wget make libncurses-dev flex bison gperf python python-serial
Install the following packages using the package manager
20. Toolchain Setup - GNU/Linux (Debian-based)
https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-61-gab8375a-5.2.0.tar.gz
Toolchain for 32 bit system
https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
Toolchain for 64 bit system
21. Toolchain Setup - GNU/Linux (Debian-based)
$ mkdir -p ~/esp
$ cd ~/esp
$ tar -xzf ~/Downloads/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-
5.2.0.tar.gz
Download & extract the toolchain to the ~/esp directory.
22. Toolchain Setup - GNU/Linux (Debian-based)
$ export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin
"Introduce" the toolchain so the system knows they're there.
You can also append above line to the .bashrc, .profile, or .bash_profile, so you only need
to do this only once.
23. Toolchain Setup - macOS
https://dl.espressif.com/dl/xtensa-esp32-elf-osx-1.22.0-61-gab8375a-5.2.0.tar.gz
The steps are pretty much the same with the previous one. Only the
filename & URL of the toolchain that is different with the GNU/Linux.
24. Toolchain Setup - Windows
https://dl.espressif.com/dl/esp32_win32_msys2_environment_and_toolchain-20170330.zip
You only need to download the toolchain + msys2 environment from this
URL & extract the archive to C: drive.
Open msys2 terminal & create esp directory inside home folder.
$ mkdir -p ~/esp
25. ESP-IDF Setup
$ cd ~/esp
$ git clone -- recursive https://github.com/espressif/esp-idf.git
Clone the esp-idf repository.
26. ESP-IDF Setup - GNU/Linux & macOS
$ export IDF_PATH=$HOME/esp/esp-idf
Set a new environment variable with the path to ESP-IDF directory as its
value.
It is recommended to append above line to the .bashrc, .profile, or .bash_profile, so you
only need to do this only once.
27. ESP-IDF Setup - Windows
$ touch /etc/profile.d/export_idf_path.sh
Create a user script file inside the C:/msys32/etc/profile.d/ directory. We'll
call it export_idf_path.sh.
Export the ESP-IDF path
$ echo export IDF_PATH=C:/msys32/home/user-name/esp/esp-idf >>
/etc/profile.d/export_idf_path.sh
31. ├── main
│ ├── component.mk
│ └── hello_world_main.c
├── Makefile
└── README.md
Project Tree
32. Build & Flash the Firmware
We need to configure the project first. The configuration includes the serial
port of the ESP32 board, the baud rate, and so many more!
$ make menuconfig
33. Build & Flash the Firmware
$ make -j3
$ make flash
$ make monitor
$ make -j3 flash monitor
Or even better, a one liner!