Using multiple esp-idf versions for different projects (vscode)

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Using multiple esp-idf versions for different projects (vscode)

Postby zazas321 » Thu Apr 27, 2023 12:07 pm

Hello. I have initially installed v4.4.0 esp-idf version using vscode esp-idf extension and been using this without any issues.

The installation directory:
esp-idf path:

Code: Select all

C:\Users\MY_USER\esp\esp-idf
esp-idf tools path

Code: Select all

C:\Users\MY_USER\.espressif

Recently, I have been given a project which needs esp-idf v5.0.1
I have downloaded esp-idf v5.0.1 offline installer and installed new esp-idf version version
https://dl.espressif.com/dl/esp-idf/

New esp-idf version is now installed in:

Code: Select all

C:\Espressif\frameworks\esp-idf-v5.0.1

.

So now I have 2 different esp-idf versions in different directories. My question is very simple. When I open some project, how can I choose which esp-idf version to choose when building it?

bidrohini
Posts: 202
Joined: Thu Oct 27, 2022 12:55 pm

Re: Using multiple esp-idf versions for different projects (vscode)

Postby bidrohini » Thu Apr 27, 2023 12:32 pm

To use a specific version of the ESP-IDF with your project, you can set the IDF_PATH environment variable to point to the directory of the desired version of the ESP-IDF.

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: Using multiple esp-idf versions for different projects (vscode)

Postby zazas321 » Thu Apr 27, 2023 1:46 pm

Thanks for reply. Il test it out.

Although I was hoping there is more elegant solution rather than changing IDF_PATH variable back and forth

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: Using multiple esp-idf versions for different projects (vscode)

Postby zazas321 » Thu Apr 27, 2023 3:36 pm

The solution that you proposed does not seem to work at all.

I now have installed 2 different esp-idf versions in C:/Espressif/frameworks:
esp-idf-v4.4.4
and
esp-idf-v5.0.1



https://ibb.co/5sDS3Lw


I opene example project from C:\Espressif\frameworks\esp-idf-v5.0.1\examples\get-started\hello_world
and it seems to me that it is using esp-idf v4.4.4 to build v5.0.1 example even though I have added environemnt variable

Code: Select all

IDF_PATH=C:\Espressif\frameworks\esp-idf-v5.0.1

Code: Select all

*  Executing task: cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -B c:\Espressif\frameworks\esp-idf-v5.0.1\examples\get-started\sample_project\build -S c:\Espressif\frameworks\esp-idf-v5.0.1\examples\get-started\sample_project 

-- Found Git: C:/Espressif/tools/idf-git/2.30.1/cmd/git.exe (found version "2.30.1.windows.1") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
Solving dependencies requirements
.Updating lock file at C:/Espressif/frameworks/esp-idf-v5.0.1/examples/get-started/sample_project\dependencies.lock
Processing 1 dependencies:
[1/1] idf (4.4.4)
-- DEBUG: Use esp-modbus component folder: C:/Espressif/frameworks/esp-idf-v4.4.4/components/freemodbus.
-- Project sdkconfig file C:/Espressif/frameworks/esp-idf-v5.0.1/examples/get-started/sample_project/sdkconfig
-- Found Python3: C:/Espressif/python_env/idf4.4_py3.8_env/Scripts/python.exe (found version "3.8.7") found components: Interpreter 
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "main" version: v5.0.1-dirty
-- Adding linker script C:/Espressif/frameworks/esp-idf-v5.0.1/examples/get-started/sample_project/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld      
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld 
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld    
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/soc/esp32/ld/esp32.peripherals.ld
-- DEBUG: Use esp-modbus component folder: C:/Espressif/frameworks/esp-idf-v4.4.4/components/freemodbus.
-- Components: app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_ipc esp_lcd esp_local_ctrl esp_netif esp_phy esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos hal heap idf_test ieee802154 jsmn json libsodium log lwip main mbedtls mdns mqtt newlib nghttp nvs_flash openssl openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: C:/Espressif/frameworks/esp-idf-v4.4.4/components/app_trace C:/Espressif/frameworks/esp-idf-v4.4.4/components/app_update C:/Espressif/frameworks/esp-idf-v4.4.4/components/asio C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader_support C:/Espressif/frameworks/esp-idf-v4.4.4/components/bt C:/Espressif/frameworks/esp-idf-v4.4.4/components/cbor C:/Espressif/frameworks/esp-idf-v4.4.4/components/cmock C:/Espressif/frameworks/esp-idf-v4.4.4/components/coap C:/Espressif/frameworks/esp-idf-v4.4.4/components/console C:/Espressif/frameworks/esp-idf-v4.4.4/components/cxx C:/Espressif/frameworks/esp-idf-v4.4.4/components/driver C:/Espressif/frameworks/esp-idf-v4.4.4/components/efuse C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp-tls C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp32 C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_adc_cal C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_common C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_eth C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_event C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_gdbstub C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_hid C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_http_client C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_http_server C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_https_ota C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_https_server C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_hw_support C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_ipc C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_lcd C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_local_ctrl C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_netif C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_phy C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_pm C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_ringbuf C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_serial_slave_link C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_system C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_timer C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_websocket_client C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_wifi C:/Espressif/frameworks/esp-idf-v4.4.4/components/espcoredump C:/Espressif/frameworks/esp-idf-v4.4.4/components/esptool_py C:/Espressif/frameworks/esp-idf-v4.4.4/components/expat C:/Espressif/frameworks/esp-idf-v4.4.4/components/fatfs C:/Espressif/frameworks/esp-idf-v4.4.4/components/freemodbus C:/Espressif/frameworks/esp-idf-v4.4.4/components/freertos C:/Espressif/frameworks/esp-idf-v4.4.4/components/hal C:/Espressif/frameworks/esp-idf-v4.4.4/components/heap C:/Espressif/frameworks/esp-idf-v4.4.4/components/idf_test C:/Espressif/frameworks/esp-idf-v4.4.4/components/ieee802154 C:/Espressif/frameworks/esp-idf-v4.4.4/components/jsmn C:/Espressif/frameworks/esp-idf-v4.4.4/components/json C:/Espressif/frameworks/esp-idf-v4.4.4/components/libsodium C:/Espressif/frameworks/esp-idf-v4.4.4/components/log C:/Espressif/frameworks/esp-idf-v4.4.4/components/lwip C:/Espressif/frameworks/esp-idf-v5.0.1/examples/get-started/sample_project/main C:/Espressif/frameworks/esp-idf-v4.4.4/components/mbedtls C:/Espressif/frameworks/esp-idf-v4.4.4/components/mdns C:/Espressif/frameworks/esp-idf-v4.4.4/components/mqtt C:/Espressif/frameworks/esp-idf-v4.4.4/components/newlib C:/Espressif/frameworks/esp-idf-v4.4.4/components/nghttp C:/Espressif/frameworks/esp-idf-v4.4.4/components/nvs_flash C:/Espressif/frameworks/esp-idf-v4.4.4/components/openssl C:/Espressif/frameworks/esp-idf-v4.4.4/components/openthread C:/Espressif/frameworks/esp-idf-v4.4.4/components/partition_table C:/Espressif/frameworks/esp-idf-v4.4.4/components/perfmon C:/Espressif/frameworks/esp-idf-v4.4.4/components/protobuf-c C:/Espressif/frameworks/esp-idf-v4.4.4/components/protocomm C:/Espressif/frameworks/esp-idf-v4.4.4/components/pthread C:/Espressif/frameworks/esp-idf-v4.4.4/components/sdmmc C:/Espressif/frameworks/esp-idf-v4.4.4/components/soc C:/Espressif/frameworks/esp-idf-v4.4.4/components/spi_flash C:/Espressif/frameworks/esp-idf-v4.4.4/components/spiffs C:/Espressif/frameworks/esp-idf-v4.4.4/components/tcp_transport C:/Espressif/frameworks/esp-idf-v4.4.4/components/tcpip_adapter C:/Espressif/frameworks/esp-idf-v4.4.4/components/tinyusb C:/Espressif/frameworks/esp-idf-v4.4.4/components/ulp C:/Espressif/frameworks/esp-idf-v4.4.4/components/unity C:/Espressif/frameworks/esp-idf-v4.4.4/components/usb C:/Espressif/frameworks/esp-idf-v4.4.4/components/vfs C:/Espressif/frameworks/esp-idf-v4.4.4/components/wear_levelling C:/Espressif/frameworks/esp-idf-v4.4.4/components/wifi_provisioning C:/Espressif/frameworks/esp-idf-v4.4.4/components/wpa_supplicant C:/Espressif/frameworks/esp-idf-v4.4.4/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Espressif/frameworks/esp-idf-v5.0.1/examples/get-started/sample_project/build

 *  Executing task: ninja  

[20/1051] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************
[350/1051] Building C object esp-idf/wpa_supplicant/CMakeFiles/__idf_wpa_supplicant.dir/esp_supplicant/src/esp_wps.c.obj

Another strange thing, when I build project, a dependancies.lock file is created and added to my project directory. It contains the following:

Code: Select all

dependencies:
  idf:
    component_hash: null
    source:
      type: idf
    version: 4.4.4
manifest_hash: dcf4d39b94252de130019eadceb989d72b0dbc26b552cfdcbb50f6da531d2b92
target: esp32
version: 1.0.0

I dont know why it does that
Attachments
image.png
image.png (10.74 KiB) Viewed 3643 times

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: Using multiple esp-idf versions for different projects (vscode)

Postby zazas321 » Thu Apr 27, 2023 3:49 pm

I think I just found a bug.

I completely deleted the v.4.4.4 esp-idf version from my computer and only have esp-idf-v5.0.1 now.


I open a blank example project from:

Code: Select all

C:\Espressif\frameworks\esp-idf-v5.0.1\examples\get-started\sample_project
When trying to build now, I get an error:

Code: Select all

Executing task: cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -B c:\Espressif\frameworks\esp-idf-v5.0.1\examples\get-started\sample_project\build -S c:\Espressif\frameworks\esp-idf-v5.0.1\examples\get-started\sample_project 

CMake Error at CMakeLists.txt:7 (include):
  include could not find requested file:

    C:/Espressif/frameworks/esp-idf-v4.4.4//tools/cmake/project.cmake


-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:8 (project):
  No CMAKE_C_COMPILER could be found.
  
It wont build because for some reason its looking for esp-idf-v4.4.4 even though I have just deleted it and its DEFINATELY not set in environment variables.

Why vscode wants to use v4.4.4? Is there a setting that tells vscode which esp-idf version to use?

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Using multiple esp-idf versions for different projects (vscode)

Postby MicroController » Thu Apr 27, 2023 4:22 pm

In VS code, press F1 then search for and start >ESP-IDF: Configure ESP-IDF extension to set up the correct paths/version of ESP-IDF. This should get you one step closer to making it work.

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: Using multiple esp-idf versions for different projects (vscode)

Postby zazas321 » Thu Apr 27, 2023 5:07 pm

MicroController wrote:
Thu Apr 27, 2023 4:22 pm
In VS code, press F1 then search for and start >ESP-IDF: Configure ESP-IDF extension to set up the correct paths/version of ESP-IDF. This should get you one step closer to making it work.
Yep that seems to work fine. Thanks!

Who is online

Users browsing this forum: No registered users and 86 guests