Espressif SoC toolchains

Hello,

I am writing here to suggest the addition of the Espressif ESP8266, ESP32 and ESP32S2
SoC to the list ot toolchains known to CMake. I know that the toolchain offered by Espressif
is a customized version of GCC and I think there may better support from CMake… or
perhaps that is not needed and is an error from my part.

Best regards,

Antonio

A toolchain file is usually necessary (or at least very helpful) for cross compilation. @brad.king would know better whether adding it to CMake makes sense.

This is just a case of cross compilation. Given the small memory of the ESP32, no native compilation may be achieved, at least using GCC or CLang… perhaps TCC may be used
to compile C user code exclusively ?

@cplusplus what is the output of the compiler’s --version flag?

Please also see the cross-compiling section of the cmake-toolchains(7) manual for information on creating a CMAKE_TOOLCHAIN_FILE.

command line:
C:\Users\User.espressif\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-cc.exe --version
tool response:
xtensa-esp32-elf-cc.exe (crosstool-NG esp-2019r2) 8.2.0
Copyright © 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks. That looks like a gcc cross-compiler so CMake should just be able to use it with a proper toolchain file. See my previous link for help writing one.

@cplusplus you might want to have a look at https://github.com/espressif/esp-idf/tree/master/tools/cmake, especially the toolchain-esp32.cmake and toolchain-esp32s2.cmake files.