About some custom toolchains in PlatformIO

I enjoy PlatfromIO for being straightforward. But I want to use my own built toolchains instead of the default supplied toolchains from PlatformIO Storage website because I am having platfrom issues (gcc and g++ are needed to be built and configured manually for Termux). Is there any way I can build my own gcc toolchain and use it with PlatformIO? And one more question. Is there any way to build use Clang toolchains (e.g. avr-clang instead of avr-gcc) for PlatformIO? I actually like gcc and not Clang (but again Clang is supported by termux). If it is possible then I am willing to contribute for it. Wouldn’t it be nice to have a new range of toolchains for PlatformIO?

1 Like

Partial duplicate of Compiler and build environment configuration.

Check which toolchain-x package is being used (pio run shows that the beginning of the compilation) and use platform_packages to supply your own package (with package.json, e.g. referenced from existing packages), e.g.

platform_packages = 
     toolchain-atmelavr @ <link to new toolchain package here>

Clang is not supported for building in any of the platforms I know. E.g. for avr, you would have to adapt the build flags being used during compilation, see topic above.

I actually referred to this Building and Installing the GNU Tool Chain
And as you are telling, I think I need to build the package from source, then create a descriptory .json file and then in the .ini file I have to link the new toolchain, right?(Correct me if I am wrong). And as for the Clang toolchains, I was actually referring to the xtensa-llvm project GitHub - espressif/llvm-project: Fork of LLVM with Xtensa specific patches. To be upstreamed.. I want to know if PlatformIO supports Clang. If yes then I will try to create a new toolchain for it. Any guidances would be extremely appreciated.

1 Like