How to build an esp32 object? I could build `generic_unix`, though

I am a newbie and followed to build target.

$ mkdir build
$ cd build
$ cmake -DAVM_DISABLE_FP=on ..
$ make
$ ./src/AtomVM ./examples/erlang/hello_world.avm

I succeeded it to build src/platforms/generic_unix, but there is no esp32.

Q1: To build ESP32 object, what should I set or do to switch generic_unix to esp32?

There is esp32 folder on AtomVM/src/platforms.
README.ESP32.Md says:

cd src/platforms/esp32/ set-target esp32 (or esp32c3, esp32s2, esp32s3) menuconfig build

We have two src folders under AtomVM.
Q2: which folder does cd src/platforms/esp32 indicate, AtomVM/src/ or AtomVM/build/src/?

My environment:

MacOS Ventura
elixir  1.13.4-otp-23
erlang  23.2.7
gcc --version -> Apple clang version 14.0.0 (clang-1400.0.29.202)
cmake version 3.23.1
~/esp -> esp-idf/          xtensa-esp32-elf/
target: ESP32-WROOM
python 3.10.8 currently -> 2.7.18

Please help me to make an esp32 object.


Have a look at AtomVM/ at master · atomvm/AtomVM · GitHub, which should have the latest instructions.

Also, you will probably want to build a full release image, which is referenced in the same document (this requires building the Erlang and Elixir libraries and packaging them up with the AtomVM binary into a single image.

Please note that the team is also working on some CI to build images on commits to master, which should be available by the next release.


You should definitely follow the build-instructions that fadushin posted a link to. But to answer your question directly, the correct folder for working in for esp32 is AtomVM/src/platforms/esp32.


Thank you for your quick response.
I found the instruction, and I will try.

1 Like

So I should build under AtomVM/src/platforms/esp32, though I first have to follow the instruction @fadushin instructed.

By the way, generic_unix is for simulating AtomVM on Host, isn’t it?
Or AtomVM works on MacOS instead of erlang VM(erts)?

1 Like

Yes, it works great for quickly testing on the development host. You could also use it to run AtomVM applications, for example as a server that several esp32 AtomVM clients could connect to. It should be able to run most applications as long as you pass the extra beam, or packed avm modules as parameters when you execute your application.

1 Like

Thanks for the interesting info.
I learn first, then ask questions, again.

1 Like

You will need to do three things, in order to create a full AtomVM image:

Follow the generic_unix instructions for building AtomVM [1]. This will not only build the AtomVM executable for UNIX (which you don’t need except for maybe testing or experimentation), but it will also build and package the AtomVM Erlang and Elixir Libraries.

Next, follow the ESP32 build instructions [2]. This will build several ESP32 components, such as as the boot loader, partition map, and AtomVM VM (an IDF application written in C, but compiled for Xtensa).

Finally, build a release image [3]. This will assemble all the needed components into a single .img file, which you can then flash to your ESP32.

Once that is done, you can use rebar3 to build your applications.

Hopefully in the future this will all be done via CI, so you can just download a nightly. (There is not a 0.6.0 release yet)

[1] Generic Unix Build Instructions
[2] ESP32 Build Instructions
[3] Build Release Image


Could anyone help me about cmake issue?

line 83-xx in

shell$ mkdir xcode                     // /AtomVM/.
shell$ cmake -G Xcode ..          // /AtomVM/xcode/.
shell$ open AtomVM.xcodeproj

When I follow the above, I got an Error:

CMake Error at CMakeLists.txt:23 (project):
  No CMAKE_C_COMPILER could be found.

While generic_unix is OK for cmake and gcc compile can be accessed, why does this error come out?

1 Like

Do you have all of the Xcode tools installed? My (generated) .../xcode/CMakeFiles/3.22.3/CMakeCCompiler.cmake has:

set(CMAKE_C_COMPILER "/Applications/")

Thanks for everything.

This compiler issue is resolved by upgrading cmake 3.23.1 → 3.25.1 latest one.


I finally succeeded to build AtomVM kernel into ESP32 with passing through some problems so that I got the ATOMVM banner. But It is still at the starting point, which is repeatedly rebooted.

AtomVM of master tag didn’t work on esp-idf v3.3. So I upgraded esp-idf v4.4, then it works well.


Hi Mikio,

Have you:

  1. Built a complete release image (including the core atomvmlib.avm libraries)?
  2. Flashed your application using the atomvm_rebar3_plugin?

There is an open PR for building release images via git workflows. You can get a preview of pre-built images here, so you don’t have to build them yourself:


Hi fadushin,

Thanks for your information.
Sorry, I didn’t mean to ask you about a new issue. The issue of to build an esp32 object has been resolved. Then I just wanted to set this issue closed.
I am now going to the next stage of mkimage by following your documents.

Thank you again, and let me ask you a question when I hit the wall.