Introduction

[中文]

It is intended to guide users to build a software environment for ESP-MDF. ESP-MDF is a development framework based on ESP-WIFI-MESH which is encapsulated by ESP-IDF. Therefore, the building of the software environment for ESP-MDF is similar to the building for ESP-IDF. This document focuses on the software environment difference between ESP-MDF and ESP-IDF, as well as provides some related notes. Before developing with ESP-MDF, please read ESP-IDF Get Started.

What you need

To develop applications for ESP32 you need:

  • Router: it is used to connect to the external network
  • Mobile phone: install an ESP-WIFI-MESH network configuration app
  • ESP32 development board: at least two ESP32 development boards are required to build an ESP-WIFI-MESH network

Development board guides

We provide development boards specially designed for the development and testing of ESP-WIFI-MESH.

Get ESP-MDF

Besides the toolchain (that contains programs to compile and build the application), you also need ESP32 specific API / libraries. They are provided by Espressif in ESP-MDF repository.

To obtain a local copy: open terminal, navigate to the directory you want to put ESP-MDF, and clone the repository using git clone command:

cd ~/esp
git clone --recursive https://github.com/espressif/esp-mdf.git

ESP-MDF will be downloaded into ~/esp/esp-mdf.

Note

This command will clone the master branch, which has the latest development (“bleeding edge”) version of ESP-MDF. It is fully functional and updated on weekly basis with the most recent features and bugfixes.

Note

GitHub’s “Download zip file” feature does not work with ESP-MDF.

Set up path to ESP-MDF

The toolchain progarms access ESP-MDF using MDF_PATH environment variable. This variable should be set up on your PC, otherwise projects will not build. The setup method is same as IDF_PATH.

Configure

In the terminal window, go to the directory of get-started by typing cd ~/esp/get-started, and then start project configuation utility menuconfig:

cd ~/esp/get-started
make menuconfig
  • Configure examples under the submenu Example Configuration
  • Configure the function modules under the submenu starting with MDF in Component config

Build and Flash

You can configure the serial port with make menuconfig, or directly use ESPPORT and ESPBAUD environment variable on the command line to specify the serial port and baud rate:

make erase_flash flash -j5 monitor ESPBAUD=921600 ESPPORT=/dev/ttyUSB0

Tools

You can use the scripts under the tool directory to simplify your development process.

You can build and flash with gen_misc.sh, which adds timestamp and log saving functions to make monitor:

cp $MDF_PATH/tools/gen_misc.sh .
./gen_misc.sh /dev/ttyUSB0

multi_downloads.sh and multi_downloads.sh can be used to simultaneously flash multiple devices:

cp $MDF_PATH/tools/multi_*.sh .
./multi_downloads.sh 49
./multi_open_serials.sh 49

format.sh can be used to format the codes:

$MDF_PATH/tools/format.sh .