IoT and Docker: Using the Espressif Docker Image for ESP32 Development

Use Case:

Use the ESP32 IDF Docker Image from Espressif and create binaries for the ESP32-Lyradt Boards. The Docker Image will be used interactively.

The ESP32 ADF will be local on the Linux Host.

We get the ADF Environment with the command:

git clone –recursive https://github.com/espressif/esp-adf.git

Mount a local host directory inside Docker Image

docker run –rm -v $PWD:/project -w /project -it espressif/idf

Access USB port  /dev/ttyUSB0

sudo docker run –rm –privileged -v $PWD:/project -w /project -it espressif/idf

or (more secure)

sudo docker run –rm –device=/dev/ttyUSB0 -e ADF_PATH=/project -v $PWD:/project -w /project -it espressif/idf

With Env Var like ADF_PATH

sudo docker run –rm –privileged -e ADF_PATH=/project -v $PWD:/project -w /project -it espressif/idf

Available commands:

idf.py build (build with CMake)
idf.py flash
idf.py monitor
xtensa-esp32-elf-gcc --version
make -version 
cmake -version
make menuconfig
make && make flash monitor (build with GNU Make)

Flashing:

idf.py flash

If you have problems then push "Boot" Button and "RST" Button and release first the RST Button.


Possible Problems

How to access the host USB Port

https://stackoverflow.com/questions/24225647/docker-a-way-to-give-access-to-a-host-usb-or-serial-device

Missing Headers (ADF):

cd $ADF_PATH

git fetch

git checkout v2.0

git submodule update –init –recursive

Devices in Containers on Windows

https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/hardware-devices-in-containers

https://sandervandevelde.wordpress.com/2020/05/18/access-com-ports-with-docker-containers-on-windows/

Links:

Other example of ESP32 Development with Docker (2years old)

Complete IDF and ADF Dev. Environment

Espressif Docker Section

ESP32 Dockerized Tool Chain

Docker image rebuilds all every time, doesn't do incremental build
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: