ESP32-S2 build toolchain not working

Hi everyone,

I’m pretty new to the ESP world and I just received a few lonlin S2 mini, and installed ESP Home add-on on my Raspberry Pi 3b+ running Home Assistant OS.

For the configuration, I just selected ESP32-S2 as device type and left everything as default for now:

esphome:
  name: kettle

esp32:
  board: esp32-s2-saola-1
  framework:
    type: esp-idf

...

Then, I connect the device on my Raspberry, set it in DFU mode, and click install.

Unfortunately it seems not to set up the build toolchain correctly, here is the log:

INFO Reading configuration /config/esphome/kettle.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing kettle (board: esp32-s2-saola-1; framework: espidf; platform: platformio/espressif32 @ 3.5.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf 3.40302.0 (4.3.2) 
 - tool-cmake 3.16.9 
 - tool-ninja 1.10.2 
 - toolchain-riscv32-esp 8.4.0+2021r2-patch2 
 - toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
Reading CMake configuration...
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc -- broken
-- Configuring incomplete, errors occurred!
See also "/data/kettle/.pioenvs/kettle/CMakeFiles/CMakeOutput.log".
See also "/data/kettle/.pioenvs/kettle/CMakeFiles/CMakeError.log".

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at /data/cache/platformio/packages/tool-cmake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /data/kettle/.pioenvs/kettle/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/data/cache/platformio/packages/tool-ninja/ninja cmTC_e41a9 && [1/2] Building C object CMakeFiles/cmTC_e41a9.dir/testCCompiler.c.obj
    FAILED: CMakeFiles/cmTC_e41a9.dir/testCCompiler.c.obj 
    /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc   -mlongcalls -o CMakeFiles/cmTC_e41a9.dir/testCCompiler.c.obj   -c testCCompiler.c
    /bin/sh: 1: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc: not found
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:311 (__project)
  CMakeLists.txt:3 (project)



========================= [FAILED] Took 19.46 seconds =========================

On my first attempt, I realized the storage on my Raspberry was full, and maybe it could have not installed something correctly. So I removed the ESP Home add-on completely, did some cleanup dans reinstalled it again.

I also tried to use the arduino framework but I encountered some issues because the board is not officially supported.

Here is the full log where it initially gathered the dependancies:

Full installation log
INFO Reading configuration /config/esphome/kettle.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing kettle (board: esp32-s2-saola-1; framework: espidf; platform: platformio/espressif32 @ 3.5.0)
--------------------------------------------------------------------------------
Platform Manager: Installing platformio/espressif32 @ 3.5.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Platform Manager: espressif32 @ 3.5.0 has been installed!
The platform 'platformio/espressif32 @ 3.5.0' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.
Tool Manager: Installing platformio/toolchain-esp32s2ulp @ ~1.22851.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: toolchain-esp32s2ulp @ 1.22851.191205 has been installed!
Tool Manager: Installing espressif/toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch2
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch2 has been installed!
Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: toolchain-riscv32-esp @ 8.4.0+2021r2-patch2 has been installed!
Tool Manager: Installing platformio/framework-espidf @ ~3.40302.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: framework-espidf @ 3.40302.0 has been installed!
Tool Manager: Installing platformio/tool-esptoolpy @ ~1.30100.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: tool-esptoolpy @ 1.30100.210531 has been installed!
Tool Manager: Installing platformio/tool-cmake @ ~3.16.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          
Tool Manager: tool-cmake @ 3.16.9 has been installed!
Tool Manager: Installing platformio/tool-ninja @ ^1.7.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%
Tool Manager: tool-ninja @ 1.10.2 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40300.0
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%
Tool Manager: tool-scons @ 4.40300.220706 has been installed!
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf 3.40302.0 (4.3.2) 
 - tool-cmake 3.16.9 
 - tool-ninja 1.10.2 
 - toolchain-riscv32-esp 8.4.0+2021r2-patch2 
 - toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2
Installing ESP-IDF's Python dependencies
Collecting future>=0.15.2
  Downloading future-0.18.2.tar.gz (829 kB)
Collecting pyparsing<2.4.0,>=2.0.3
  Downloading pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
Building wheels for collected packages: future
  Building wheel for future (setup.py): started
  Building wheel for future (setup.py): finished with status 'done'
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491058 sha256=6310e2e82ad88f0daa1d62299c32112b36e7e15e9d7210dfb028f5f2141097ee
  Stored in directory: /root/.cache/pip/wheels/2f/a0/d3/4030d9f80e6b3be787f19fc911b8e7aa462986a40ab1e4bb94
Successfully built future
Installing collected packages: pyparsing, future
  Attempting uninstall: pyparsing
    Found existing installation: pyparsing 3.0.9
    Uninstalling pyparsing-3.0.9:
      Successfully uninstalled pyparsing-3.0.9
Successfully installed future-0.18.2 pyparsing-2.3.1
Reading CMake configuration...
-- Found Git: /usr/bin/git (found version "2.30.2") 
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc
-- Check for working C compiler: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc -- broken
-- Configuring incomplete, errors occurred!
See also "/data/kettle/.pioenvs/kettle/CMakeFiles/CMakeOutput.log".
See also "/data/kettle/.pioenvs/kettle/CMakeFiles/CMakeError.log".

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at /data/cache/platformio/packages/tool-cmake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /data/kettle/.pioenvs/kettle/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/data/cache/platformio/packages/tool-ninja/ninja cmTC_f17b8 && [1/2] Building C object CMakeFiles/cmTC_f17b8.dir/testCCompiler.c.obj
    FAILED: CMakeFiles/cmTC_f17b8.dir/testCCompiler.c.obj 
    /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc   -mlongcalls -o CMakeFiles/cmTC_f17b8.dir/testCCompiler.c.obj   -c testCCompiler.c
    /bin/sh: 1: /data/cache/platformio/packages/toolchain-xtensa-esp32s2/bin/xtensa-esp32s2-elf-gcc: not found
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:311 (__project)
  CMakeLists.txt:3 (project)



======================== [FAILED] Took 2031.09 seconds ========================

Anyone has managed to install correctly a ESP32-S2 board ?
I also found this topic: ESP32-S2 DevkitM-1 V1.0, but it’s not the same problem as he manage to get to the compilation.

I am also getting exactly similar errors throughout. Using ESP32-C3 module. Did you manage to find the issue and resolve it?

Yes !

Unfortunately, the Raspberry Pi 3b+ seems too low on RAM to compile a firmware for esp32-s2 (it works for ESP8266 however, maybe the S2 firmware embed more stuff)

I simply installed esphome of my desktop computer and I can compile using both arduino and esp-idf thanks to this post.

But i’m still stuck in my project because I wanted to use addressable lights and it’s not supported in esp-idf, and not working with arduino framework…