Do you have any examples of that hardware? I’m wondering what could be achieved with a couple hundred of them working together on something
Right now the primary target is the Espressif ESP32 and the ST Electronics STM32 microntrollers, though honestly the ESP32 has gotten a lot more attention, because it is cheap, readily available, has built-in WiFi and Bluetooth, and a pretty active user community. The VM also runs on MacOS/Linux/FreeBSD, for testing.
What is/isn’t included?
Here is a sneak peek at some of the documentation:
Currently, AtomVM implements a strict subset of the BEAM instruction set, as of Erlang/OTP R21. Previous versions of Erlang/OTP are not supported.
A high level overview of the supported language features include:
- All the major Erlang types, including
- integers (with size limits)
- limited support for floats (not supported on all platforms)
- tuples
- lists
- binaries
- maps
- support for many Erlang BIFs and guard expressions to support the above types
- pattern matching (case statements, function clause heads, etc)
try ... catch ... finally
constructs
- anonymous functions
- process
spawn
and spawn_link
- send (
!
) and receive
messages
- bit syntax (with some restrictions)
- reference counted binaries
In addition, several features are supported specifically for integration with micro-controllers, including:
- Wifi networking (
network
)
- UDP and TCP/IP support (
inet
, gen_tcp
and gen_udp
)
- HTTP server
- Peripheral and system support on micro-controllers, including
- GPIO, including pins reads, writes, and interrupts
- I2C interface
- SPI interface
- UART interface
- LEDC (PWM)
- non-volatile storage (NVS)
- deep sleep
While the list of supported features is long and growing, the currently unsupported Erlang/OTP and BEAM features include (but are not limited to):
- Arbitrary bingnums (integers > 64 bits)
- SMP support
epmd
and the disterl
protocol
- Hot swapping of code
- Read-Eval-Print-Loop (REPL)
- Numerous modules and functions from Erlang/OTP standard libraries (
kernel
, stdlib
, sasl
, etc)
As such, it is highly unlikely that an existing Erlang program targeted for Erlang/OTP will run unmodified on AtomVM. And indeed, even as AtomVM matures and additional features are added, it is more likely than not that Erlang applications will need to targeted specifically for the AtomVM platform. The intended target environment (small, cheap micro-controllers) differs enough from desktop or server-class systems in both scale and APIs that special care and attention is needed to target applications for such embedded environments.
That being said, many of the features of the BEAM are supported and provide a rich and compelling development environment for embedded devices, which Erlang and Elixir developers will find natural and productive.
I should also add that there are some downstream extensions that are not part of the AtomVM codebase, including support for:
- MQTT client
- ADC
- (NEMA-based) GPS sensors
- BME280 temp/hum/pressure sensors
- DHT temp/hum sensors (via bit banging)
- BH1750 Luminosity sensors
- SSD1306 OLED displays
- SX127X LoRa modems
- ESP32Camera
- WS2812 (Neopixels)
among other minor enhancements, some of which should make their way into the VM.
I look at AtomVM as being geared for the hacker/maker community, and maybe a way to bridge the maker community with the Erlang/Elixir communities. Getting Erlangers interested in hacking hardware and makers interested in Erlang and Elixir as a development platform would be a fantastic outcome!