Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feature/distributed…
Browse files Browse the repository at this point in the history
…-erlang
  • Loading branch information
pguyot committed Feb 15, 2025
2 parents 035ab6f + d3f73ce commit d9f9faa
Show file tree
Hide file tree
Showing 57 changed files with 1,371 additions and 507 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build-and-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ jobs:
run: |
./tests/test-enif
- name: "Test: test-heap"
working-directory: build
run: |
./tests/test-heap
- name: "Test: test-mailbox"
working-directory: build
run: |
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/build-and-test-on-freebsd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
copyback: false

prepare: |
pkg install -y curl cmake gperf erlang elixir rebar3 mbedtls
pkg install -y curl cmake gperf erlang elixir rebar3 mbedtls3
run: |
set -e
Expand All @@ -80,6 +80,8 @@ jobs:
echo "**hw.ncpu:**"
sysctl -n hw.ncpu
sed -i '' 's/test_http_server/%test_http_server/g' tests/libs/eavmlib/tests.erl
echo "%%"
echo "%% Running CMake ..."
echo "%%"
Expand All @@ -102,6 +104,11 @@ jobs:
echo "%%"
./tests/test-enif
echo "%%"
echo "%% Running test-heap ..."
echo "%%"
./tests/test-heap
echo "%%"
echo "%% Running test-mailbox ..."
echo "%%"
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/build-and-test-other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ jobs:

build-and-test-other:
needs: compile_tests
runs-on: ubuntu-24.04
# GCC on qemu segfaults on s390x and arm64v8 when using 24.04
# See also https://github.com/actions/runner-images/issues/11471
runs-on: ubuntu-22.04

strategy:
fail-fast: false
Expand Down Expand Up @@ -128,7 +130,7 @@ jobs:
path: build_tests

- name: Set up QEMU
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
uses: docker/setup-qemu-action@v3

- name: "Build and Test: AtomVM on foreign arch"
timeout-minutes: 15
Expand Down Expand Up @@ -168,12 +170,15 @@ jobs:
make AtomVM &&
make test-erlang &&
make test-enif &&
make test-heap &&
make test-mailbox &&
make test-structs &&
file ./tests/test-erlang &&
./tests/test-erlang -s prime_smp &&
file ./tests/test-enif &&
./tests/test-enif &&
file ./tests/test-heap &&
./tests/test-heap &&
file ./tests/test-mailbox &&
./tests/test-mailbox &&
file ./tests/test-structs &&
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,12 @@ jobs:
elixir_version: "1.14"
rebar3_version: "3.23.0"

# TODO: enable master again
# master will not work until we don't adapt to atom table changes
# # master/main version of OTP/Elixir
# - os: "ubuntu-24.04"
# cc: "cc"
# cxx: "c++"
# otp: "master"
# elixir_version: "main"
# rebar3_version: "3.24.0"
- os: "ubuntu-24.04"
cc: "cc"
cxx: "c++"
otp: "master"
elixir_version: "main"
rebar3_version: "3.24.0"

# Additional default compiler builds
- os: "ubuntu-20.04"
Expand Down Expand Up @@ -378,6 +375,13 @@ jobs:
./tests/test-enif
valgrind ./tests/test-enif
- name: "Test: test-heap"
working-directory: build
run: |
ulimit -c unlimited
./tests/test-heap
valgrind ./tests/test-heap
- name: "Test: test-mailbox"
working-directory: build
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-linux-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,15 @@ jobs:
VERBOSE=1 make AtomVM &&
make test-erlang &&
make test-enif &&
make test-heap &&
make test-mailbox &&
make test-structs &&
file ./tests/test-erlang &&
./tests/test-erlang -s prime_smp &&
file ./tests/test-enif &&
./tests/test-enif &&
file ./tests/test-heap &&
./tests/test-heap &&
file ./tests/test-mailbox &&
./tests/test-mailbox &&
file ./tests/test-structs &&
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/stm32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
id: builddeps-cache
with:
path: |
/home/runner/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi
/home/runner/libopencm3
key: ${{ runner.os }}-build-deps

Expand All @@ -44,24 +43,23 @@ jobs:
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: "apt update"
run: sudo apt update

- name: "Install deps"
run: sudo apt install -y cmake gperf gcc-arm-none-eabi

- name: Checkout and build libopencm3
if: ${{ steps.builddeps-cache.outputs.cache-hit != 'true' }}
working-directory: /home/runner
run: |
set -euo pipefail
cd /home/runner
test -d libopencm3 && rm -fr libopencm3
export PATH=/home/runner/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin:${PATH}
git clone https://github.com/libopencm3/libopencm3.git -b v0.8.0
cd libopencm3
make
- name: "apt update"
run: sudo apt update

- name: "Install deps"
run: sudo apt install -y cmake gperf gcc-arm-none-eabi

- name: Checkout repo
uses: actions/checkout@v4

Expand All @@ -70,7 +68,6 @@ jobs:
working-directory: ./src/platforms/stm32/
run: |
set -euo pipefail
export PATH=/home/runner/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin:${PATH}
mkdir build
cd build
# -DAVM_WARNINGS_ARE_ERRORS=ON
Expand Down
33 changes: 26 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `net:gethostname/0` on platforms with gethostname(3).
- Added `socket:getopt/2`
- Added `supervisor:terminate_child/2`, `supervisor:restart_child/2` and `supervisor:delete_child/2`
- Added support for 'erlang:--/2'.
- Added `esp:partition_read/3`, and documentation for `esp:partition_erase_range/2/3` and `esp:partition_write/3`
- Added support for list insertion in 'ets:insert/2'.
- Support to OTP-28
- Added `atomvm:subprocess/4` to perform pipe/fork/execve on POSIX platforms
- Added `externalterm_to_term_with_roots` to efficiently preserve roots when allocating memory for external terms.
- Added `erl_epmd` client implementation to epmd using `socket` module
Expand All @@ -41,9 +45,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added the ability to run beams from the CLI for Generic Unix platform (it was already possible with nodejs and emscripten).
- Added support for 'erlang:--/2'.
- Added the ability to run beams from the CLI for Generic Unix platform (it was already possible
with nodejs and emscripten)
- Added preliminary support for ESP32P4 (no networking support yet).
- Added memory info in `out_of_memory` crash logs to help developers fix memory issues.

### Fixed

Expand All @@ -52,11 +57,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Adding missing check, passing a non numeric argument to a function expecting a floating point
might lead to a crash in certain situations.
- Fixed several bugs in `http_server` (#1366)
- Fixed generic\_unix `socket_driver` to return `{gen_tcp, closed}` when socket is closed on Linux instead of `{gen_tcp, {recv, 104}}`
- Fixed generic\_unix `socket_driver` to return `{gen_tcp, closed}` when socket is closed on Linux
instead of `{gen_tcp, {recv, 104}}`
- Fixed a memory leak where modules were not properly destroyed when the global context is destroyd
- alisp: fix support to variables that are not binaries or integers.
- Fixed destruction of ssl-related resources
- Fix corruption when dealing with specific situations that involve more than 16 x registers when
- Fixed corruption when dealing with specific situations that involve more than 16 x registers when
certain VM instructions are used.
- Fixed ESP32 GPIO interrupt trigger `none`
- Fixed an issue where a timeout would occur immediately in a race condition
Expand All @@ -65,9 +71,22 @@ certain VM instructions are used.
- Fixed a race condition affecting multi-core MCUs where a timeout would not be properly cleared
- Fixed a double free when esp32 uart driver was closed, yielding an assert abort
- Fixed compilation with latest debian gcc-arm-none-eabi
- Fix `network:stop/0` on ESP32 so the network can be started again
- Fix matching of binaries on unaligned boundaries for code compiled with older versions of OTP
- Fix a memory corruption caused by `binary:split/2,3`
- Fixed `network:stop/0` on ESP32 so the network can be started again
- Fixed a memory corruption caused by `binary:split/2,3`
- Fixed deadlock in socket code
- Fixed bug in opcode implementation (`select_val`): when selecting a value among many others a
shallow comparison was performed, so it was working just for plain values such as atoms and small
integers
- Fixed support for setting esp32 boot_path in NVS.
- Fixed race conditions in network:start/stop.
- Fixed crash calling network:sta_rssi(), when network not up.
- Fixed error handling when calling `min` and `max` with code compiled before OTP-26: there was a
bug when handling errors from BIFs used as NIFs (when called with `CALL_EXT` and similar opcodes)
- Fixed matching of binaries on unaligned boundaries for code compiled with older versions of OTP
- Added missing out of memory handling in binary_to_atom
- Fixed call to funs such as fun erlang:'not'/1, that make use of BIFs
- Fixed potential crashes or memory leaks caused by a mistake in calculation of reference counts
and a race condition in otp_socket code

## [0.6.5] - 2024-10-15

Expand Down
9 changes: 6 additions & 3 deletions doc/release-notes.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ AtomVM will run BEAM files that have been compiled using the following Erlang an
| ✅ OTP 24 | ✅ 1.14 |
| ✅ OTP 25 | ✅ 1.14 |
| ✅ OTP 26 | ✅ 1.15 |
| ✅ OTP 27 | ✅ 1.17 |
| ✅ OTP 28 | ✅ 1.17 |

```{note}
Versions of Elixir that are compatible with a particular OTP version may work. This table reflects the versions that are tested.
Expand Down Expand Up @@ -62,6 +64,7 @@ AtomVM currently supports the following [Espressif ESP SoCs](https://www.espress
| [ESP32h2](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf) | ✅ |
| [ESP32s2](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) | ✅ |
| [ESP32s3](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) | ✅ |
| [ESP32p4](https://www.espressif.com/sites/default/files/documentation/esp32-p4_datasheet_en.pdf) Datasheet Pending | ✅ |

AtomVM currently supports the following versions of ESP-IDF:

Expand Down Expand Up @@ -96,13 +99,13 @@ AtomVM tests this build on the latest Ubuntu github runner.

### Raspberry Pi Pico Support

AtomVM supports deployment on the [Raspberry Pico RP2040](https://www.raspberrypi.com/documentation/microcontrollers/rp2040.html) architecture.
AtomVM supports deployment on the [Raspberry Pico RP2040](https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html#pico-1-family) architecture.

AtomVM currently supports the following Raspberry Pico development boards:

| Development Board | AtomVM support |
|------------------------------|----------------|
| [Raspberry Pico and Pico H](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#raspberry-pi-pico-and-pico-h) | ✅ |
| [Raspberry Pico W and Pico WH](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#raspberry-pi-pico-w-and-pico-wh) | ✅ |
| [Raspberry Pico and Pico H](https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html#pico-1-technical-specification) | ✅ |
| [Raspberry Pico W and Pico WH](https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html#picow-technical-specification) | ✅ |

Building the AtomVM virtual machine for Raspberry Pico is optional. In most cases, you can simply download a release image from the AtomVM [release](https://github.com/atomvm/AtomVM/releases) repository. If you wish to work on development of the VM or use one on the additional drivers that are available in the [AtomVM repositories](https://github.com/atomvm) you will to build AtomVM from source. See the [Build Instructions](build-instructions.md) for information about how to build AtomVM from source code.
7 changes: 1 addition & 6 deletions doc/src/atomvm-tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,6 @@ For instructions about how to install AtomVM on the `generic_unix` platform, see

The [`ExAtomVM`](https://github.com/atomvm/ExAtomVM) plugin supports flash targets for various device types. These targets are described in more detail below.

```{attention}
Currently, the [`ExAtomVM`](https://github.com/atomvm/ExAtomVM) tool only supports flash targets for the ESP32 and
STM32 platforms.
```

#### ESP32 flash task

To flash AtomVM packbeam file to an ESP32 device, use the `mix.esp32.flash` target. Users will typically specify the device port and baud rate as command-line options to this target.
Expand Down Expand Up @@ -401,7 +396,7 @@ You can now use a serial console program such as [minicom](https://en.wikipedia.
I (922) AtomVM: Starting esp32init.beam...
---
AtomVM init.
I (932) sys: Loaded BEAM partition main.avm at address 0x210000 (size=1048576 bytes)
I (932) sys: Loaded BEAM partition main.avm at address 0x250000 (size=1048576 bytes)
Starting application...
Hello World
AtomVM finished with return value: ok
Expand Down
Loading

0 comments on commit d9f9faa

Please sign in to comment.