PlatformIO seems to install x86 version of esp32 toolchain when arm64 (apple silicon) is available and works

I am migrating from an older intel based Mac to a new M2 based Mac. I am trying to use native code where ever possible.
I was able to walk thru the ESP-IDF Tool chain set up, and I was able to build, upload, and monitor the hello_world example without issue, and without needing rosetta/rosetta2.

When PlatformIO installs the toolchain in my .platformio/packages/toolchain-riscv32-esp it seems to install the x86 version and trying to use anything in that directory results in bad CPU type in executable. I tried to mv the PlatformIO installed directory and symbolically link to the working arm version in .espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf but PlatformIO seems to notice that an still uses the renamed directory.
What’s the proper way to get this to work? It seems like at this point in time both PlatformIO and Espressif support native apple silicon code, so I would like to avoid using the rosetta emulation layer if possible.

This has been tracked in

but not with movement on PlatformIO side I think. So while you could try and use the modified paltform per the comments in that link, that’s outside of the regular PlatformIO-provided platform that would Rosetta.

Thanks, I thought I saw that issue earlier today, but then lost track of it.
FYI: the comments say 205 but looks like branch is really 205c
platform = GitHub - Jason2866/platform-espressif32: Tasmota Espressif 32: development platform for PlatformIO

I will use this for now and switch to the Rosetta approach if I run in to trouble, but so far so good.

BTW, I will probably need to use Rosetta at some point, I just feel if I install it right away, I will stop looking for the native solutions.

Your setup is somehow damaged. Using latest release of the framework does use native toolchains for Apple silicon.

I can’t confirm this. I did a complete reinstall from scratch and it still bails out like outlined in Apple Silicon support without Rosetta · Issue #897 · platformio/platform-espressif32 · GitHub