3

Just had a go at running up the most recent version of ESP-IDF on my machine. All good.

Current Version = 4.3.2 Latest Version = 5.0.1

I work in Visual Studio, but use the ESP cmd terminal directly to build etc. Haven't managed to figure out the Visual Studio plug ins properly.

But when I tried to go back to the old version, ran into an error. The error was already picked up in github: https://github.com/espressif/esp-idf/issues/9837 . So I was able to repair my working version by deleting the ~/.espressif/idf-env.json file and rerun $IDF_PATH/install.sh.

My question here is this - is it possible to run 2 versions of ESP-IDF at once on the same machine? What settings are needed to achieve this?

Cheers.

monkey
  • 1,213
  • 2
  • 13
  • 35

1 Answers1

3

It's quite simple if you install them into separate directories using the manual installation procedure

Let's assume you wish to install ESP-IDF v4 into ~/espressif/v4 and v5 into ~/espressif/v5.

First install v4:

$ export IDF_TOOLS_PATH="$HOME/espressif/v4/bin" IDF_PATH="$HOME/espressif/v4/esp-idf"
$ mkdir -p "$HOME/espressif/v4" && cd "$HOME/espressif/v4"
$ git clone -j8 -b v4.3.2 --recursive https://github.com/espressif/esp-idf.git
$ cd esp-idf
$ ./install.sh
$ . export.sh

Then v5:

$ export IDF_TOOLS_PATH="$HOME/espressif/v5/bin" IDF_PATH="$HOME/espressif/v5/esp-idf"
$ mkdir -p "$HOME/espressif/v5" && cd "$HOME/espressif/v5"
$ git clone -j8 -b v5.0.1 --recursive https://github.com/espressif/esp-idf.git
$ cd esp-idf
$ ./install.sh
$ . export.sh

Using the command line you can subsequently activate either one of them running the usual environment setup:

$ export IDF_TOOLS_PATH="$HOME/espressif/v4/bin" IDF_PATH="$HOME/espressif/v4/esp-idf" && . "$IDF_PATH/export.sh"

or

$ export IDF_TOOLS_PATH="$HOME/espressif/v5/bin" IDF_PATH="$HOME/espressif/v5/esp-idf" && . "$IDF_PATH/export.sh"

As for VSCode, you can tell its ESP-IDF plugin which one you want to use. Here are some instructions (sorry, I'm too lazy to adapt them to the specific example above): https://github.com/DaStoned/beegram#optional-visual-studio-code-setup

If you have different VSCode workspaces with different versions of ESP-IDF, make sure you're saving this setting on Workspace level (as opposed to global level).

Tarmo
  • 3,728
  • 1
  • 8
  • 25
  • A few clarifications. I'm working in windows, so using the bat files - shouldn't make a difference... Why are your tool paths in a bin dir? Aren't tools in IDF_PATH/tools? Does Espressif have a standard folder structure - seems my v5 went into C:/Espressif/frameworks by default. And 4.3 went into ~/esp-idf. And I also have a ~/.espressif folder. This is so confusing?!?! – monkey Mar 28 '23 at 10:11
  • 1
    TBH I'm not entirely sure where the tools are installed by default these days. Back in 3.x they were installed into a random directory in my home (possibly `~/.espressif`) so I just picked my own location which is guaranteed to be unique. I don't want them to be installed under `$IDF_PATH` because it makes the git repo dirty :) I don't pay much attention to their standard folder structure as I have my own plan. The point is, you can customize your installation by setting those two environment variables (`IDF_PATH`, `IDF_TOOLS_PATH`) beforehand. – Tarmo Mar 28 '23 at 22:33
  • 1
    Got it. That seems like extremely good advice. Will follow. – monkey Mar 29 '23 at 00:49