Introduction to ESP-IDF and Platform IO (demo)

Goals

Using the Virtual Machine

We have provided a virtual machine with some of the tools we will be using already installed. Note that you can install everything natively in your system, and I will run faster. We provide the virtual machine just in case you prefer not to install new software in your own computer.

You can download the OVA file from Google Drive or Baidu Netdisk (with code 7spz). An OVA file contains a OVF (Open Virtualizaion Format) file so it can be opened in any virtualization framework.

During the course, we will be using Oracle VM Virtualbox which is a free and open-source hosted hypervisor for x86 virtualization. In order to run the virtual machine just follow the steps:

After importing the virtual machine is imported it should be listed in Virtual Box screen (the one named MIOT_VM_2022_CN)

vbox

Now, you can run the virtual machine. We have installed a recent version of Ubuntu operating system (Ubuntu 20.04.1 LTS). There is a sinlge user (named Ubuntu) whose password is ubuntu (small-caps).

ubuntu

Launching Visual Studio Code and PlatformIO

During this online demo, I will show you how to use Visual Studio Code and the PlatformIO plugin to create a new project, compile it and upload it to our board.

You can install this environment in your own machine, which is recommended since virtualization introduces some overheads. You can download Visual Studio Code from this link. Once installed, you can easily install the PlatformIO plugin from the Extensions: Marketplace in the same Visual Studio Code window:

pio

Installing the native ESP-IDF environment

There is an alternative to PlatformIO: installing the native Espressif environment for ESP-IDF. You have all the steps to install and setup their environment in this link

Just a summary of the information there provided (please check the website, because it could be updated), we include here the most relevant steps for the environment installation in the Ubuntu terminal machine.

sudo apt update
sudo apt upgrade
sudo apt-get install git wget flex bison gperf python python3-pip python-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util

If you are installing the environment in your own Linux machine, make sure your user is also in the dilaout group.

sudo apt-get install python3 python3-pip python3-setuptools
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
git fetch
git pull
git submodule update --init --recursive
sh install.sh
. ./export.sh
$ idf.py --version
ESP-IDF v4.xxxxx