In Part 1 of Getting Started with ESP32 ESP-IDF, we set up VirtualBox and successfully created a virtual machine that runs Ubuntu 14.04 LTS. In this part, we prepare the Ubuntu OS and make it into an ESP32 Development Environment to be able to compile projects for the ESP32.
Prepare Ubuntu for ESP32 development
Now that you have installed Ubuntu on your virtual machine, you are ready to start installing relevant packages that can get you started with the ESP32 development work.
Here are the steps you should be following:
- Head over to Software & Updates in System Settings and check all the options as shown in the screenshot. Reload the cache when asked to.
- Update Ubuntu now by opening the command terminal (ctrl+alt+T) and type command:
sudo apt-get update
Let the process complete. Restart if required.
- Start installing required packages:
sudo apt-get install git
sudo apt-get install wget
sudo apt-get install make
sudo apt-get install libncurses-dev
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install gperf
sudo apt-get install python
sudo apt-get install python-serial
Many of these packages may already be pre-installed. Now your Ubuntu is armed with all software resources to start installing the ESP32 toolchain.
Download the toolchain
Download the compressed toolchain package from Espressif server:
Save the tar.gz file to your desktop.
Follow these steps to install the toolchain:
- Create a folder esp32 in home/
This folder will contain the toolchain for the ESP32.
- Open the command terminal and switch to esp32 directory:
- Extract the xtensa toolchain tar.gz archive contents into esp32 by the command:
tar -xzf ~/Desktop/xtensa-esp32-elf-linux32-1.22.0-59.tar.gzThis will extract and place the toolchain into ~/esp32/xtensa-esp32-elf
- Now add the toolchain path to the environment (permanently) by editing the bashrc file:
sudo gedit ~/.bashrc
to the end of the bashrc file (as shown here):
- Save changes to the bashrc file. Now open a new terminal window and type the command
You should see the xtensa-esp32-elf/bin path in the output as shown here:
Verify toolchain installation!
Whew! That has been a long run! Now is the time to verify that everything is installed and working fine.
To check if the toolchain was properly installed, close all terminal windows and open a fresh terminal using ctrl+alt+T and use this command:
This should print the version information of components for you as shown here:
If you see this output, congratulations! Your toolchain is now installed and ready to use.
If you get a response like
xtensa-esp32-elf-gcc: Command not found
Then you have probably missed a step or done something wrong, sorry!
You may have to follow the procedure again…
Compiling the ESP32 blinking LED example
Now that the ESP32 toolchain is installed, we have an ESP32 Development Environment completely set up. It should now be possible to compile projects and generate BIN files to run on the ESP32.
The process of compiling a sample project for the ESP32 is covered in the next part, Part 3 of this series.
If you have something to talk about, feel free to leave your comments below! Also, scroll to the bottom of the page and SUBSCRIBE to stay updated with more awesome articles!