I am trying to get the Native build to compile my project. I installed “GNU Arm Embedded Toolchain” (and “Arm GNU Toolchain arm-none-eabi” for good measure). Both this packages don’t have just a pure “gcc.exe” they have names like “arm-none-eabi-gcc.exe” and "arm-none-eabi-gcc++.exe.
What is the correct way to handle this in PlatformIO?
Jim
arm-none-eabi is usually for compiling for ARM (32-bit) microcontrollers, not for ARM64 Windows.
With platform = native
in the platformio.ini
, Windows expects the regular gcc.exe
/ g++.exe
to be in your PATH environment variable. So if you have that, it should just work.
Windows for ARM does not include a built in gcc compiler though. I need one. I have it all working on M1 MacOS and I am running Windows ARM in a VM.
Oh, I see.
Hm this actually seems to be an open topic?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108678
https://www.phoronix.com/news/GCC-aarch64-w64-mingw32
There is https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build to get a compiler running on Linux to produce Windows-on-ARM (WoA) binaries, but this says it doesn’t yet run on Windows natively.
Of course, Visual Studio has its working native Windows on ARM compiler, but I don’t think PlatformIO is capable of calling into those. It expects a GCC.
The toolchains found on https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads target either the Baremetal ARM environments (aka, microcontrollers) or Linux ARM environments, but not Windows-on-ARM.
If I’m not mistaken, and maybe I am, I’m only seeing a x86_64 producing GCC now (https://winlibs.com/) that works with the native
platform. Through the built-in emulation, this work normally, but not producing native code.
You may be able to download this Clang version:
https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-x86_64-pc-windows-msvc.tar.xz
Together with having link.exe
from the regular Visual Studio C++ build tools installed and in your PATH, try to compile a simple
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
}
with
clang --target=arm64-pc-windows-msvc -o hello.exe hello.c
Clang is also supported by PlatformIO.
Thanks, I will try to get back to this in a day or two and see if I can get it going.