Setting Target esp32s2 Fails

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

Setting Target esp32s2 Fails

Postby markjuggles » Sun Jan 17, 2021 6:22 pm

I re-re-re-re-re-installed the ESP-IDF but cannot get the target changed to esp32s2.

Code: Select all

C:\esp\projects\hello_world>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 c:\esp\projects\hello_world\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32s2 -DCCACHE_ENABLE=1 c:\esp\projects\hello_world"...
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.29.2.windows.3")
CMake Error at C:/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):
  C:/esp/esp-idf/tools/cmake/project.cmake:35 (__target_init)
  CMakeLists.txt:5 (include)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1
Building the project will succeed but flashing it fails because I have an esp32s2 chip.

Code: Select all

A fatal error occurred: This chip is ESP32-S2 not ESP32. Wrong --chip argument?
CMake Error at run_serial_tool.cmake:50 (message):
  C:/esp/.espressif/python_env/idf4.3_py3.9_env/Scripts/python.exe
  C:/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 failed

My environment is the latest Python, the latest git, today's ESP-IDF master branch, and esp-idf-tools-setup-2.3.

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

Can anyone tell me how to create a working ESP32S2 build environment?

Thank you

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Setting Target esp32s2 Fails

Postby chegewara » Sun Jan 17, 2021 7:05 pm

markjuggles wrote:
Sun Jan 17, 2021 6:22 pm
CMake Error at C:/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
Try to delete build folder in hello-world project, then set-target again.

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

Re: Setting Target esp32s2 Fails

Postby markjuggles » Sun Jan 17, 2021 8:12 pm

Same results.

Code: Select all

C:\esp\projects\hello_world>rm -rf build

C:\esp\projects\hello_world>idf.py set-target esp32s2
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory 'c:\esp\projects\hello_world\build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32s2, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory c:\esp\projects\hello_world\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32s2 -DCCACHE_ENABLE=1 c:\esp\projects\hello_world"...
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.29.2.windows.3")
CMake Error at C:/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):
  C:/esp/esp-idf/tools/cmake/project.cmake:35 (__target_init)
  CMakeLists.txt:5 (include)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1

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

Re: Setting Target esp32s2 Fails

Postby markjuggles » Sun Jan 17, 2021 8:44 pm

Since following the instructions step by step wasn't working, I tried something different.

idf.py set-target esp32s2 # still fails
set IDF_TARGET=esp32s2 # just guessing
idf.py menuconfig
idf.py build
idf.py -p com15 flash
idf.py -p com15 monitor

It works!!!!

So hello_world is running. I will try a real networking project.... Wish me luck.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Setting Target esp32s2 Fails

Postby chegewara » Sun Jan 17, 2021 8:45 pm

Do you have by accident sdkconfig.default in project folder?

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

Re: Setting Target esp32s2 Fails

Postby markjuggles » Sun Jan 17, 2021 10:00 pm

There is a "sdkconfig.defaults" file.

I don't know which step created it but it wasn't in the original "esp-idf\examples\get-started\hello_world" folder.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Setting Target esp32s2 Fails

Postby chegewara » Sun Jan 17, 2021 11:53 pm

markjuggles wrote:
Sun Jan 17, 2021 10:00 pm
There is a "sdkconfig.defaults" file.

I don't know which step created it but it wasn't in the original "esp-idf\examples\get-started\hello_world" folder.
Is this set in sdkconfig.defaults:

Code: Select all

CONFIG_IDF_TARGET=

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

Re: Setting Target esp32s2 Fails

Postby markjuggles » Mon Jan 18, 2021 2:16 am

No, after getting the project to work by setting the environment manually, the file contained this:

Code: Select all

# Enable FATFS read only with long filename support
# for loading Cert/CA/etc from filesystem
# (if enabled in config)
CONFIG_FATFS_READONLY=y
CONFIG_FATFS_CODEPAGE_437=y
CONFIG_FATFS_LFN_HEAP=y

# Enable TLS asymmetric in/out content length
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
Going back to the 'blink' project which I had not configured via the environment, there was also a "sdkconfig.defaults" file but it only contained this:

Code: Select all

#

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

Re: Setting Target esp32s2 Fails

Postby ESP_Angus » Mon Jan 18, 2021 5:07 am

Hi Mark,

I'm glad you were able to get the project to build, and sorry for all the hassles encountered.
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
This error, and the success you had with "set IDF_TARGET=esp32s2" seems to suggest that your system already had an environment variable named IDF_TARGET set. This isn't part of the getting started guide for recent ESP-IDF versions, is it possible this variable was set somehow while following an earlier/different set of steps?

If you open a new Command Prompt, can you get it to build without setting this variable? If you run "echo %IDF_TARGET%" in the same window, what do you see?

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

Re: Setting Target esp32s2 Fails

Postby markjuggles » Mon Jan 18, 2021 1:19 pm

I have evaluated several WiFi chips and have two products in production with competing radios. The ESP32 has the best price but by far the most challenging development environment.

Trying to re-build with a clean environment:

Created a CMD window.
Ran 'esp-idf\export.bat'.

C:\esp\projects\esp-aws-iot\aws-projects\subscribe_publish>idf.py build
Executing action: all (aliases: build)
Project sdkconfig was generated for target 'esp32s2', but environment variable IDF_TARGET is set to 'esp32'. Run 'idf.py set-target esp32' to generate new sdkconfig file for target esp32.

C:\esp\projects\esp-aws-iot\aws-projects\subscribe_publish>echo %IDF_TARGET%
esp32

Who is online

Users browsing this forum: Google [Bot] and 362 guests