This article is a step-by-step guide to installing ESP-IDF on a Raspberry Pi 3 or 4 board with the Raspbian operating system (Or can be applied to other operating systems with AMD/Intel processors) to be used as a C++ interpreter for developing programs for the ESP32 board, which is called bare metal or used to compile MicroPython, in particular mpy-cross, a translator from Python (.py) to bytecode (.mpy), which protects source code, allowing faster execution of instructions. (because it has been translated before) and the file size is smaller.
Equipment
Steps
- Update the system with the command
sudo apt update - If there is an upgrade, upgrade with the following command.
sudo apt full-upgrade -y - Install python3 and pip3
sudo apt install python3 python3-pip -y - Change the Python interpreter to Python3.
sudo update-alternatives –install /usr/bin/python python /usr/bin/python3 1 - Change package manager from pip to pip3
sudo update-alternatives –install /usr/bin/pip pip /usr/bin/pip3 1 - Install the required packages.
sudo apt install -y \
git wget flex bison \
gperf python-setuptools \
cmake ninja-build ccache \
libffi-dev libssl-dev dfu-util - Clone the code from github.
cd ~
git clone https://github.com/espressif/esp-idf.git esp-idf
cd esp-idf
git submodule update –init –recursive - Proceed with the installation.
cd esp-idf
. ./install.sh - Install environment
. ./export.sh - Configure the environment for ESP-IDF every time you enter the terminal by adding the following line in .bashrc so that every time you enter the terminal, the system will recognize the ESP-IDf as shown in Figure 1.
. “$HOME/esp-idf/export.sh” - Assign our account to access the communication port used to connect to the ESP32/ESP32-S2. After completing the task reboot the Raspberry Pi.
sudo usermod -a -G dialout,tty $USER
Conclusion
From this article, you can install the C++ Development Tool for ESP32 on the Raspbian operating system of the Raspberry Pi board. MicroPython can be installed and interpreted by following this article. In addition, you can read C++ basics on data types, Operators, Expressions, Conditions and Repetitions, which are basic programming styles from the previous article.
Feel free to leave comments below !
Finally, have fun with programming.
References
(C) 2021, By Jarut Busarathid and Danai Jedsadathitikul
Updated 2021-10-04