[EN] ESP-IDF Ep.1: ESP-IDF on Raspberry Pi

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.

(Figure. 1 Terminal)

Equipment

  1. Raspberry Pi 3 or Raspberry Pi 4
  2. ESP32

Steps

  1. Update the system with the command
    sudo apt update
  2. If there is an upgrade, upgrade with the following command.
    sudo apt full-upgrade -y
  3. Install python3 and pip3
    sudo apt install python3 python3-pip -y
  4. Change the Python interpreter to Python3.
    sudo update-alternatives –install /usr/bin/python python /usr/bin/python3 1
  5. Change package manager from pip to pip3
    sudo update-alternatives –install /usr/bin/pip pip /usr/bin/pip3 1
  6. 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
  7. 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
  8. Proceed with the installation.
    cd esp-idf
    . ./install.sh
  9. Install environment
    . ./export.sh
  10. 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”
  11. 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

  1. ESP-IDF on Ubuntu 20.04.1
  2. Standard Setup of Toolchain for Linux
  3. Setup Linux Toolchain from Scratch

(C) 2021, By Jarut Busarathid and Danai Jedsadathitikul
Updated 2021-10-04