ESP32 (14) – esp-idf v2 is here and how to manage different versions

luca 15/04/2017 1

On 6th of April, Espressif published version 2.0 of the esp-idf framework.

idf2-01

The complete list of the new features and the bugs fixed is available on Github, let’s see the most important ones (in my opinion ;)):

  • they included or made stable new drivers for peripherals like I2C, I2S, SPI Master, SDMMC
  • you can now run a serial monitor using build commands (make monitor)
  • both the two cores (CPU e APP) are now enabled by default
  • the examples have been revised and expanded

It’s very important to notice – if you’re using a dedicated toolchain to build your projects – that the new framework does require version 5 of GCC compiler; you therefore need to download the updated toolchain Espressif prepared (I’ve already updated my tutorial about how to install and configure it).

Git repositories

The framework‘s source code is published on Github, that is a projects web repository based on the version control software Git. To explain how you can download and use the different versions of the framework, I have to do a brief introduction of the main concepts and commands of the tool.

What follows is not meant to be a complete tutorial about Git but only a way to give some information to better understand the commands used afterwards. I strongly suggest the tutorials by Atlassian if you want to explore the complex world of Git.

In Git, the “container” for a project or a set of files is named repository. All the information Git requires to manage a repository are stored in the .git subfolder within the main folder of your project:

idf2-02

To create a local repository, you only need to enter the folder of your project and run the command:

git init

If instead you want to copy on your local PC a remote repository (for example the repository – hosted on Github – that contains the esp-idf framework) you have to use the clone command:

git clone <url>
Notice that the clone command creates a local copy of the whole repository, including all the different versions of the files it contains.

It may happen that, when developing a project, you need to use code from other projects (for example libraries developed by others). In Git, thanks to submodules, you can “include” a Git repository as a folder of another repository. The esp-idf framework uses submodules to include the Wifi and Bluetooth libraries – at the moment for those libraries you cannot access the source code.

Browsing the repository, you can identify submodules thanks to a different icon:

idf2-03

If you click on it, you’re redirected to the Github repository which contains the module:

idf2-04

If a Git repository contains one or more submodules and you want to clone it including those submodules you have to add the –recursive option. The command to have a full local copy of the esp-idf repository is therefore:

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

You can keep the local copy aligned to the remote repository with the command git pull. If the repository contains submodules, you have also to run the command git submodule update to update them as well:

idf2-05

 Branches and tags

Every version control system allows to branch your project, for example to perform parallel developments or to add new features and at the same time do some bugfixing on the actual version.

Moreover, Git allows to “take a snapshot” of the repository in a point in time and to label that snapshot with a tag.

On the Github website, you can select a specific branch or tag using the drop-down menu on the top left corner:

idf2-06

When Espressif releases a new version of the framework – both for stables and RC ones – it creates a specific tag:

idf2-07

We can therefore align the local copy of the repository to a specifig tag (for example version 2.0) with the commands:

git checkout v2.0
git submodule update --init

Working with different versions

Sometimes you may need to have different versions of the framework at the same time on your PC; for example because one of your projects is not compatible with version 2.0, version you’re instead using for a new development.

All the framework’s build process is based on the folder declared in the IDF_PATH env variable:

idf2-08

You can create different folders on your PC and use the git commands explained above to clone in those folders different versions of the repository. It only needs to change the IDF_PATH variable to let you choose which version you’re going to use when you run the make command.

One Comment »

  1. Mauro 21/04/2017 at 10:21 - Reply

    Ciao – Grandiosi tutorial su un chip nuovo (chiaro e preciso, come non se ne trovano in giro).
    Potrei chiederti una cosa? Puoi far vedere un esempio in access point (lo so che la differenza sta nella macro – mettere Ap invece che STA) ma un piccolo server che risponde a richieste GET (parametro passato con & nell’URL)
    Grazie e continua così: sei MITICO!!!

Leave A Response »

Click here to cancel reply.

This website uses cookies to ensure you get the best experience on our website maggiori informazioni

Questo sito utilizza i cookie per fonire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o clicchi su "Accetta" permetti al loro utilizzo.

Chiudi