ARM linux and esp32

Hey all, I was trying to figure out how to get arduino working on arm linux. I have an M1 mac and am running Ubuntu arm64. I'm trying to actually load something into an ESP32 and when I try to compile I get the following error

xtensa-esp32-elf-g++: exec format error

Is this the right place to ask or is this ESP32 specific? Just kind of wondering if this is a toolchain issue?
I'm not stuck at this point cause I can just use the mac native ide but I'd like to work through getting it up on this VM if possible.

I don't know how to help you, but I can tell you I agree this is the right place to ask.

EDIT: I think I know a person on this forum who could help you. @ruilviana Can you help this guy, please?

Hi @doubleopinter. I believe the cause of this error is that the ESP32 toolchain does not have support for the 64 bit ARM architecture of your M1 Mac.

This is being tracked by the ESP32 boards platform developers here:

I notice this comment:

Seems like arm64 support was originally added by #4117, but broke due to the introduction of the riscv32 core support.

So it seems that there was support, but then that support was lost in the latest release. If so, you should be able to fix the problem by rolling back to the version from before the support was lost.

I'll provide instructions for doing that:

  1. Select Tools > Board > Boards Manager from the Arduino IDE's menus.
  2. Wait for the updates to finish.
  3. Scroll down through the list of boards platforms until you see "esp32 by Espressif Systems". Click on it.
  4. From the "Select Version" menu, select "1.0.6".
  5. Click the Install button.
  6. Wait for the installation to finish.
  7. Click the Close button.

Now you can try compiling again to see if that was an effective workaround.

Hi @leon_usmiani @doubleopinter ,

@leon_usmiani thanks for the reference to my name.

But in this case I don't think I'm able to help, as I know very little about Linux and I've never had or used a MAC.

RV mineirin

1 Like

Hey guys, thank you all for the help, sent me down some paths. Turns out that it is an esp issue for sure and I'd have build the toolchain from scratch which isn't a problem except that the locations where the toolchain dependencies are hosted seem to all be down. Looks like the people in that project have been chasing the issues for a long time and it's a moving target. I don't have the time to deal with, already wasted more time than I wanted to, so I will just run this on the mac directly and hope it works. Worst case I'll find some windows machine.

I do my Arduino developments with Eclipse/Sloeber on Linux Mint (arm64) since years, also for ESP 32. There are versions for Windows, Linux and MAC available. There is also an issue handling at GitHub.

I don't think switching to Sloeber would help in this particular case. The reason is this isn't a problem with the Arduino IDE. This is a problem with the toolchain for compiling and uploading to the ESP32. Arduino IDE and Sloeber both are using the same toolchain. They just pass the appropriate commands to it. So you'll have the same problem no matter which IDE you use so long as they depend on the same toolchain.

For this reason, you would find that the M1 can be used no problem with some other boards.