Hi to all,
I am trying to compile an AVR project (ATmega644P). I have 32 bit enum. When I use the PlatformIO AVR toolchain (avr-gcc 7.3.0), I get warnings like:
ISO C restricts enumerator values to range of ‘int’ before C23 [-Wpedantic]
267 | VAL1 = 0x00DAA541,
This happens because the built-in toolchain is too old and doesn’t fully support C23.. If I compile with linux native GCC and C23 I don’t get this warnings.
I tried to override the compiler using a pre:extra_script to use the system GCC on Linux (currently 14.2), but PlatformIO still seems to use the internal toolchain for some parts of the build, causing warnings and errors.
Is it currently possible to fully replace the PlatformIO AVR toolchain with the native Linux GCC?
Hallo, finally I managed to fully replace the PlatformIO AVR toolchain with the native Linux GCC (14.2.0) and compile with C23 without warnings. Here’s the solution step by step:
I create the following folders for the custom toolchain
mkdir -p ~/toolchains/avr-gcc/bin
mkdir -p ~/toolchains/avr-gcc/include
mkdir -p ~/toolchains/avr-gcc/lib
After I linked the system binaries
ln -s /usr/bin/avr-gcc
ln -s /usr/bin/avr-g++
ln -s /usr/bin/avr-ar
ln -s /usr/bin/avr-as
ln -s /usr/bin/avr-objcopy
ln -s /usr/bin/avr-objdump
ln -s /usr/bin/avr-ranlib
ln -s /usr/bin/avr-size
At at the end I create in ~/toolchains/avr-gcc/ the file package.json with**:**
{
“name”: “toolchain-atmelavr”,
“version”: “14.2.0”,
“description”: “Custom AVR-GCC toolchain 14.2.0 (system)”,
“system”: [“linux_x86_64”],
“url”: “``https://gcc.gnu.org/”
}
in platformio.ini i added following line
platform_packages =
toolchain-atmelavr@symlink:///home/myuser/toolchains/avr-gcc
Is this enough?
Gian Carlo
Why not cleanly make a new toolchain-atmelavr that is fully self contained instead of symlinks? The entire idea of PlatformIO is reusability and package management, symlinking system compilers is breaking all of that.
Your package.json and platform_packages is fine, but if you fix the thing above, it’ll be working and redistributable as intended.