Skip to content

Commit

Permalink
Merge branch 'main' into feature/distributed-erlang
Browse files Browse the repository at this point in the history
  • Loading branch information
bettio committed Jan 7, 2025
2 parents 27ffddd + 23b0781 commit a3ba968
Show file tree
Hide file tree
Showing 20 changed files with 264 additions and 71 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ concurrency:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
Expand All @@ -61,7 +61,7 @@ jobs:
uses: actions/checkout@v4

- name: "Initialize CodeQL"
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql
Expand All @@ -74,4 +74,4 @@ jobs:
ninja
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
11 changes: 6 additions & 5 deletions .github/workflows/esp32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ concurrency:

jobs:
esp-idf:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container: espressif/idf:${{ matrix.idf-version }}

strategy:
Expand All @@ -39,15 +39,16 @@ jobs:
esp-idf-target: ["esp32", "esp32c3"]
idf-version:
- 'v5.0.7'
- 'v5.1.4'
- 'v5.2.2'
- 'v5.3.1'
- 'v5.1.5'
- 'v5.2.3'
- 'v5.3.2'
- 'v5.4'

exclude:
- esp-idf-target: "esp32c3"
idf-version: 'v5.0.7'
- esp-idf-target: "esp32c3"
idf-version: 'v5.1.4'
idf-version: 'v5.1.5'
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/esp32-mkimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

strategy:
matrix:
idf-version: ["5.3.1"]
idf-version: ["5.3.2"]
cc: ["clang-14"]
cxx: ["clang++-14"]
cflags: ["-O3"]
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/esp32-simtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,26 @@ jobs:
fail-fast: false
# focus on device diversity.
matrix:
esp-idf-target: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c6"]
idf-version: ${{ ((contains(github.event.head_commit.message, 'full_sim_test')||contains(github.event.pull_request.title, 'full_sim_test')) && fromJSON('["v5.1.5", "v5.2.3", "v5.3.2", "v5.4-beta1"]')) || fromJSON('["v5.3.2"]') }}
include:
esp-idf-target:
[
"esp32",
"esp32s2",
"esp32s3",
"esp32c3",
"esp32c6",
"esp32h2",
"esp32p4",
]
idf-version: ${{ ((contains(github.event.head_commit.message, 'full_sim_test')||contains(github.event.pull_request.title, 'full_sim_test')) && fromJSON('["v5.1.5", "v5.2.3", "v5.3.2", "v5.4"]')) || fromJSON('["v5.3.2"]') }}
exclude:
- esp-idf-target: "esp32p4"
idf-version: "v5.3.2"
idf-version: "v5.1.5"
- esp-idf-target: "esp32p4"
idf-version: "v5.2.3"
- esp-idf-target: "esp32h2"
idf-version: "v5.1.5"
- esp-idf-target: "esp32h2"
idf-version: "v5.3.2"
idf-version: "v5.2.3"

steps:
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pico-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ concurrency:

jobs:
pico:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
board: ["pico", "pico_w", "pico2"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reuse-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: REUSE Compliance Check
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/stm32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ jobs:
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: Install arm-embedded toolchain
if: ${{ steps.builddeps-cache.outputs.cache-hit != 'true' }}
working-directory: /home/runner
run: |
set -euo pipefail
cd /home/runner
wget https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz \
--output-document=$RUNNER_TEMP/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz
tar xJf $RUNNER_TEMP/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz
pwd && ls
- name: Checkout and build libopencm3
if: ${{ steps.builddeps-cache.outputs.cache-hit != 'true' }}
working-directory: /home/runner
Expand All @@ -71,7 +60,7 @@ jobs:
run: sudo apt update

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

- name: Checkout repo
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wasm-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:

wasm_build_and_test_node:
needs: compile_tests
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container: emscripten/emsdk
steps:
- name: Checkout repo
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.wasm.sha256
wasm_build_web:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container: emscripten/emsdk
steps:
- name: Checkout repo
Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:

wasm_test_web:
needs: [compile_tests, wasm_build_web]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for `registered_name` in `erlang:process_info/2` and `Process.info/2`
- 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 `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.

Expand Down Expand Up @@ -56,6 +57,9 @@ certain VM instructions are used.
- Fixed an issue where a timeout would occur immediately in a race condition
- Fixed SPI close command
- Added missing lock on socket structure
- 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

## [0.6.5] - 2024-10-15

Expand Down
7 changes: 4 additions & 3 deletions doc/release-notes.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ AtomVM currently supports the following versions of ESP-IDF:
| IDF SDK supported versions | AtomVM support |
|------------------------------|----------------|
| ESP-IDF [v5.0](https://docs.espressif.com/projects/esp-idf/en/v5.0.7/esp32/get-started/index.html) | ✅ |
| ESP-IDF [v5.1](https://docs.espressif.com/projects/esp-idf/en/v5.1.4/esp32/get-started/index.html) | ✅ |
| ESP-IDF [v5.2](https://docs.espressif.com/projects/esp-idf/en/v5.2.2/esp32/get-started/index.html) | ✅ |
| ESP-IDF [v5.3](https://docs.espressif.com/projects/esp-idf/en/v5.3/esp32/get-started/index.html) | ✅ |
| ESP-IDF [v5.1](https://docs.espressif.com/projects/esp-idf/en/v5.1.5/esp32/get-started/index.html) | ✅ |
| ESP-IDF [v5.2](https://docs.espressif.com/projects/esp-idf/en/v5.2.3/esp32/get-started/index.html) | ✅ |
| ESP-IDF [v5.3](https://docs.espressif.com/projects/esp-idf/en/v5.3.2/esp32/get-started/index.html) | ✅ |
| ESP-IDF [v5.4](https://docs.espressif.com/projects/esp-idf/en/v5.4/esp32/get-started/index.html) | ✅ |

Building the AtomVM virtual machine for ESP32 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. We recommend you to use the latest subminor (patch) versions for source builds. You can check the current version used for testing in the [esp32-build.yaml](https://github.com/atomvm/AtomVM/actions/workflows/esp32-build.yaml) workflow.

Expand Down
40 changes: 21 additions & 19 deletions libs/estdlib/src/gen_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ init_it(Starter, Module, Args, Options) ->
end,
case StateT of
undefined -> ok;
{State, {continue, Continue}} -> loop(State, {continue, Continue});
{State, Timeout} -> loop(State, Timeout)
{State, {continue, Continue}} -> loop(Starter, State, {continue, Continue});
{State, Timeout} -> loop(Starter, State, Timeout)
end.

init_ack(Parent, Return) ->
Expand Down Expand Up @@ -499,34 +499,34 @@ reply({Pid, Ref}, Reply) ->
%%

%% @private
loop(#state{mod = Mod, mod_state = ModState} = State, {continue, Continue}) ->
loop(Parent, #state{mod = Mod, mod_state = ModState} = State, {continue, Continue}) ->
case Mod:handle_continue(Continue, ModState) of
{noreply, NewModState} ->
loop(State#state{mod_state = NewModState}, infinity);
loop(Parent, State#state{mod_state = NewModState}, infinity);
{noreply, NewModState, {continue, NewContinue}} ->
loop(State#state{mod_state = NewModState}, {continue, NewContinue});
loop(Parent, State#state{mod_state = NewModState}, {continue, NewContinue});
{stop, Reason, NewModState} ->
do_terminate(State, Reason, NewModState)
end;
loop(#state{mod = Mod, mod_state = ModState} = State, Timeout) ->
loop(Parent, #state{mod = Mod, mod_state = ModState} = State, Timeout) ->
receive
{'$gen_call', {_Pid, _Ref} = From, Request} ->
case Mod:handle_call(Request, From, ModState) of
{reply, Reply, NewModState} ->
ok = reply(From, Reply),
loop(State#state{mod_state = NewModState}, infinity);
loop(Parent, State#state{mod_state = NewModState}, infinity);
{reply, Reply, NewModState, {continue, Continue}} ->
ok = reply(From, Reply),
loop(State#state{mod_state = NewModState}, {continue, Continue});
loop(Parent, State#state{mod_state = NewModState}, {continue, Continue});
{reply, Reply, NewModState, NewTimeout} ->
ok = reply(From, Reply),
loop(State#state{mod_state = NewModState}, NewTimeout);
loop(Parent, State#state{mod_state = NewModState}, NewTimeout);
{noreply, NewModState} ->
loop(State#state{mod_state = NewModState}, infinity);
loop(Parent, State#state{mod_state = NewModState}, infinity);
{noreply, NewModState, {continue, Continue}} ->
loop(State#state{mod_state = NewModState}, {continue, Continue});
loop(Parent, State#state{mod_state = NewModState}, {continue, Continue});
{noreply, NewModState, NewTimeout} ->
loop(State#state{mod_state = NewModState}, NewTimeout);
loop(Parent, State#state{mod_state = NewModState}, NewTimeout);
{stop, Reason, Reply, NewModState} ->
ok = reply(From, Reply),
do_terminate(State, Reason, NewModState);
Expand All @@ -538,24 +538,26 @@ loop(#state{mod = Mod, mod_state = ModState} = State, Timeout) ->
{'$gen_cast', Request} ->
case Mod:handle_cast(Request, ModState) of
{noreply, NewModState} ->
loop(State#state{mod_state = NewModState}, infinity);
loop(Parent, State#state{mod_state = NewModState}, infinity);
{noreply, NewModState, {continue, Continue}} ->
loop(State#state{mod_state = NewModState}, {continue, Continue});
loop(Parent, State#state{mod_state = NewModState}, {continue, Continue});
{noreply, NewModState, NewTimeout} ->
loop(State#state{mod_state = NewModState}, NewTimeout);
loop(Parent, State#state{mod_state = NewModState}, NewTimeout);
{stop, Reason, NewModState} ->
do_terminate(State, Reason, NewModState);
_ ->
do_terminate(State, {error, unexpected_reply}, ModState)
end;
{'$stop', Reason} ->
do_terminate(State, Reason, ModState);
{'EXIT', Parent, Reason} ->
do_terminate(State, Reason, ModState);
Info ->
case Mod:handle_info(Info, ModState) of
{noreply, NewModState} ->
loop(State#state{mod_state = NewModState}, infinity);
loop(Parent, State#state{mod_state = NewModState}, infinity);
{noreply, NewModState, NewTimeout} ->
loop(State#state{mod_state = NewModState}, NewTimeout);
loop(Parent, State#state{mod_state = NewModState}, NewTimeout);
{stop, Reason, NewModState} ->
do_terminate(State, Reason, NewModState);
_ ->
Expand All @@ -564,9 +566,9 @@ loop(#state{mod = Mod, mod_state = ModState} = State, Timeout) ->
after Timeout ->
case Mod:handle_info(timeout, ModState) of
{noreply, NewModState} ->
loop(State#state{mod_state = NewModState}, infinity);
loop(Parent, State#state{mod_state = NewModState}, infinity);
{noreply, NewModState, NewTimeout} ->
loop(State#state{mod_state = NewModState}, NewTimeout);
loop(Parent, State#state{mod_state = NewModState}, NewTimeout);
{stop, Reason, NewModState} ->
do_terminate(State, Reason, NewModState);
_ ->
Expand Down
Loading

0 comments on commit a3ba968

Please sign in to comment.