# Espressif SoC toolchains

**URL:** https://discourse.cmake.org/t/espressif-soc-toolchains/822
**Category:** Development
**Created:** [March 19, 2020, 7:35pm UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822 "2020-03-19T19:35:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![cplusplus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/8491ac/32.png) [@cplusplus](https://discourse.cmake.org/u/cplusplus)
#### Post date: [March 19, 2020, 7:35pm UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822/1 "2020-03-19T19:35:21Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [March 19, 2020, 8:06pm UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822/2 "2020-03-19T20:06:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cplusplus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/8491ac/32.png) [@cplusplus](https://discourse.cmake.org/u/cplusplus)
#### Post date: [March 19, 2020, 8:55pm UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822/3 "2020-03-19T20:55:22Z")

</div>

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 ?

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [March 20, 2020, 10:48am UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822/4 "2020-03-20T10:48:17Z")

</div>

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

Please also see the cross-compiling section of the [cmake-toolchains(7)](https://cmake.org/cmake/help/v3.17/manual/cmake-toolchains.7.html) manual for information on creating a `CMAKE_TOOLCHAIN_FILE`.

---

<div class="post-metadata">

### Author: ![cplusplus](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/8491ac/32.png) [@cplusplus](https://discourse.cmake.org/u/cplusplus)
#### Post date: [March 20, 2020, 7:14pm UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822/5 "2020-03-20T19:14:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [March 23, 2020, 10:37am UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822/6 "2020-03-23T10:37:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![McMartin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mcmartin/32/150_2.png) [@McMartin](https://discourse.cmake.org/u/McMartin)
#### Post date: [March 23, 2020, 4:07pm UTC](https://discourse.cmake.org/t/espressif-soc-toolchains/822/7 "2020-03-23T16:07:09Z")

</div>

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