Setting Target esp32s2 Fails

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Setting Target esp32s2 Fails

Postby ESP_Angus » Tue Jan 19, 2021 10:44 pm

Hi Mark,

Thanks for bearing with us. It seems like the Windows environment variable IDF_TARGET is being set to "esp32" somewhere. We don't have any explanation for why this has happened, though. Setting this environment variable is not required to use ESP-IDF, but it is optional to automatically override the selected target (which is why you keep getting these errors - there's a conflict between the "overridden" value in the environment variable and the target you're asking to build).
  • If you open a clean cmd window and then immediately run "echo %IDF_TARGET%" (before running export.bat or anything else), do you still see esp32?
  • If you "edit system environment variables" and check the list of environment variables for both the system and your user (both lists are in the same window), then do you see IDF_TARGET in the list anywhere? If it's there, please delete it.
  • If that doesn't lead anywhere, could you please post the output of "idf.py version" (after running export.bat)?
Thanks again for your patience.

markjuggles
Posts: 16
Joined: Thu Dec 31, 2020 3:34 am

Re: Setting Target esp32s2 Fails

Postby markjuggles » Sat Jan 23, 2021 10:27 pm

When I echo %IDF_TARGET% in a clean CMD window, it does report esp32. I'm pretty sure that I didn't set that myself but it was easy to fix.

After changing the environment through Windows "Advanced System Settings", closing the old CMD window, and opening another, project building works as documented without having to change the IDF_TARGET variable.

Everything seems to be pretty good now.

Thank you Angus!

kaitlinburke
Posts: 2
Joined: Fri Feb 19, 2021 4:54 pm

Re: Setting Target esp32s2 Fails

Postby kaitlinburke » Fri Feb 19, 2021 5:21 pm

I'm running into this same issue on MacOS and haven't been able to solve it. I can't set the target to esp32. I get the same error message:

Code: Select all

e0499421@USATLWCF5M3LVDL blink % idf.py set-target esp32s2
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Executing action: set-target
Set Target to: esp32s2, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory /Users/e0499421/Desktop/blink/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32s2 -DCCACHE_ENABLE=0 /Users/e0499421/Desktop/blink"...
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)") 
CMake Error at /Users/e0499421/esp/esp-idf/tools/cmake/targets.cmake:19 (message):
  IDF_TARGET in CMake cache does not match IDF_TARGET environment variable.
  To change the target, clear the build directory and sdkconfig file, and
  build the project again
Call Stack (most recent call first):
  /Users/e0499421/esp/esp-idf/tools/cmake/project.cmake:34 (__target_init)
  CMakeLists.txt:5 (include)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1
What do I need to change to avoid this error? I've tried following the steps in this thread, but they don't seem to change anything.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Setting Target esp32s2 Fails

Postby ESP_Sprite » Sat Feb 20, 2021 1:44 am

Possibly your IDF_TARGET variable is set to something. Can you do an 'echo $IDF_TARGET' and post what it says?

moefear85
Posts: 44
Joined: Sun Sep 05, 2021 4:55 pm

Re: Setting Target esp32s2 Fails

Postby moefear85 » Fri Jan 28, 2022 5:35 pm

all of a sudden I'm getting this error too. I opened a the touch_pad_interrupt example in vscode on ubuntu 21.10

Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:39:46.686Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.13.0-27-generic snap

but even after selecting esp32s2 as a target, i get:

Code: Select all

IDF_TARGET in CMake cache does not match IDF_TARGET environment variable
. At first, after selecting esp32s2, the entry would change. After restarting vscode, it no longer changes either, and I still get the error. when I go to the integrated bash terminal or open any external terminal and type

Code: Select all

echo $IDF_TARGET
all I get is an empty line.

borisbergman
Posts: 4
Joined: Mon Feb 27, 2023 4:24 pm

Re: Setting Target esp32s2 Fails

Postby borisbergman » Mon Feb 27, 2023 4:27 pm

I've the same problem too, idf v5.01, ubuntu 22.04.

Code: Select all

idf.py set-target esp32c3
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory '/home/bergm006/esp-projects/gatt_client/build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32c3, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory /home/bergm006/esp-projects/gatt_client/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32c3 -DCCACHE_ENABLE=0 /home/bergm006/esp-projects/gatt_client"...
CMake Error at /home/bergm006/esp/esp-idf/tools/cmake/targets.cmake:19 (message):
  IDF_TARGET in CMake cache does not match IDF_TARGET environment variable.
  To change the target, clear the build directory and sdkconfig file, and
  build the project again
Call Stack (most recent call first):
  /home/bergm006/esp/esp-idf/tools/cmake/project.cmake:7 (__target_init)
  CMakeLists.txt:5 (include)


-- Configuring incomplete, errors occurred!

borisbergman
Posts: 4
Joined: Mon Feb 27, 2023 4:24 pm

Re: Setting Target esp32s2 Fails

Postby borisbergman » Tue Feb 28, 2023 8:00 am

I found out it's only regarding the esp-idf terminal window in vscode. When I open a regular terminal and run an export.sh from esp/esp-idf directory, the conversion to another chip works fine.

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

Re: Setting Target esp32s2 Fails

Postby zazas321 » Fri Jul 14, 2023 5:28 pm

@ESP_Angus

Hello. I have come across this post and I thought I would ask for help. I am trying to set the esp-idf target via the ESP-IDF terminal but it does not work! I cannot wrap my head around this issue and its driving me nuts:

```
PS C:\Users\Lukas\esp\esp-idf\examples\get-started\sample_project> idf.py set-target esp32s3
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory 'c:\users\lukas\esp\esp-idf\examples\get-started\sample_project\build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32s3, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory c:\users\lukas\esp\esp-idf\examples\get-started\sample_project\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32s3 -DCCACHE_ENABLE=1 c:\users\lukas\esp\esp-idf\examples\get-started\sample_project"...
CMake Error at C:/Users/Lukas/esp4/esp-idf/tools/cmake/targets.cmake:19 (message):
IDF_TARGET in CMake cache does not match IDF_TARGET environment variable.
To change the target, clear the build directory and sdkconfig file, and
build the project again
Call Stack (most recent call first):
C:/Users/Lukas/esp4/esp-idf/tools/cmake/project.cmake:7 (__target_init)
CMakeLists.txt:7 (include)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1
PS C:\Users\Lukas\esp\esp-idf\examples\get-started\sample_project>

```

Who is online

Users browsing this forum: No registered users and 236 guests