I’m just starting with platformio and esp32.
I use the esp32-wrover dev kit.
It works. I was able to do several sample projects
I have some environmental questions.
Where can I find the configuration of the compiler? Which one is used?
Is there a way between z. clang and the gcc compiler to switch?
How do you do that? Is platform.ini the right place?
My goal here is to know how to configure the environment so that another compiler can be used.
There are 2 ways to create a project.
a) Via the internal platform configuration - here the platformio.ini.
When the build button is pressed, this build process starts.
But what about the cmake environment?
Can this build process only be started in the terminal?
This is basically not a problem, but when the uplaod button is pressed, the software is compiled again (maybe I’m wrong here)
and here again with platformio.ini configuration and then it is flashed.
My goal here is to build and debug SW automatically via Cmake.
In terms of configuration flags? Each “platform” (Espressif32, Espressif8266, Atmel AVR,…) defines that in its build scripts and needed packages. E.g., for the ESP32, it configurates xtensa-esp32-elf-gcc and friends in general, and then specific build flags for each framework, e.g. Arduino
The one set by the python build scripts, see above.
You are referring to https://github.com/espressif/llvm-project? I haven’t seen that used by even ESP-IDF or the Arduino platform. You could theoretically create a new package like toolchain-xtensa32-clang and adapt the build scripts. I’m not aware that such work has been done before. You can also create a feature request at https://github.com/platformio/platform-espressif32/issues/. So currently you cannot switch the compiler, most platforms only use their one dedicated compiler (which is GCC for that microcontroller platform in like 99% of the cases, exceptions for e.g. STM8 with their sdcc compiler and other exotics).
You can export a CMake project, but all that will do is create an instruction to call platformio run for compiling (plus all include paths for code completion). . PlatformIO internally uses the SCons build framework and not CMake. It configures it via its Python API and lets it run. See documentation and code above. For CLion / CMake export see https://docs.platformio.org/en/latest/ide/clion.html (i.e., run pio init --ide clion in the project).
You can still just call the unified interfaces for building, uploading and starting a debugging server, see pio debug and pio run.
I can see the flags, but I cannot find a place in the framework where they are set.
Where can you e.g. switch between gcc (flag CC) and g ++ (flag CXX). As I said, unfortunately I did not find any place in the Python code in the framework.
What role does the configuration file platformio.ini play here?
As for CMake, I saw that some examples were built with it in the framework (may be that they were originally created with CLion). As I understand it now, the platformio.ini serves the SCon configuration. And SCon itself is a native platformio make system.
If you want to use CMake instead, then via terminal and / or via task commands. Is it right?