Skip to content

Commit 24084c5

Browse files
committed
Forward port changes from v0.6 release branch
Merge v0.6.5 into main.
2 parents 1bedd1c + 388940d commit 24084c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3148
-169
lines changed

.github/workflows/build-and-test-other.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ jobs:
9393
- arch: "arm32v7"
9494
platform: "arm/v7"
9595
tag: "bullseye"
96-
cflags: "-mcpu=cortex-a7 -mfloat-abi=hard -O2 -mthumb -mthumb-interwork"
96+
# -D_FILE_OFFSET_BITS=64 is required for making atomvm:posix_readdir/1 test work
97+
# otherwise readdir will fail due to 64 bits inode numbers with 32 bit ino_t
98+
cflags: "-mcpu=cortex-a7 -mfloat-abi=hard -O2 -mthumb -mthumb-interwork -D_FILE_OFFSET_BITS=64"
9799
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"
98100

99101
- arch: "arm64v8"

.github/workflows/build-and-test.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,14 @@ jobs:
197197
cflags: ""
198198
elixir_version: "1.14"
199199

200-
# master/main version of OTP/Elixir
201-
- os: "ubuntu-24.04"
202-
cc: "cc"
203-
cxx: "c++"
204-
otp: "master"
205-
elixir_version: "main"
200+
# TODO: enable master again
201+
# master will not work until we don't adapt to atom table changes
202+
# # master/main version of OTP/Elixir
203+
# - os: "ubuntu-24.04"
204+
# cc: "cc"
205+
# cxx: "c++"
206+
# otp: "master"
207+
# elixir_version: "main"
206208

207209
# Additional default compiler builds
208210
- os: "ubuntu-20.04"

.github/workflows/build-docs.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
- 'doc/**'
2424
- 'libs/**'
2525
- 'src/libAtomVM/**'
26+
- 'UPDATING.md'
27+
- 'CONTRIBUTING.md'
28+
- 'CHANGELOG.md'
29+
- 'CODE_OF_CONDUCT.md'
2630
push:
2731
repositories:
2832
- '!atomvm/AtomVM'
@@ -32,6 +36,10 @@ on:
3236
- 'doc/**'
3337
- 'libs/**'
3438
- 'src/libAtomVM/**'
39+
- 'UPDATING.md'
40+
- 'CONTRIBUTING.md'
41+
- 'CHANGELOG.md'
42+
- 'CODE_OF_CONDUCT.md'
3543

3644
# Allows you to run this workflow manually from the Actions tab
3745
workflow_dispatch:
@@ -44,29 +52,35 @@ concurrency:
4452
jobs:
4553
# This workflow contains a single job called "build"
4654
build:
55+
56+
strategy:
57+
fail-fast: false
58+
## don't add more than one OS to matrix, this is only to retrieve the full os-name for keeping cache in sync
59+
matrix:
60+
os: [ ubuntu-24.04 ]
4761
# The type of runner that the job will run on
48-
runs-on: ubuntu-latest
49-
container: erlang:27
62+
runs-on: ${{ matrix.os }}
63+
# Documentation currently fails to build with OTP-27 and recent OTP-26.
64+
container: erlang:26.0.2
5065

5166
# Steps represent a sequence of tasks that will be executed as part of the job
5267
steps:
5368
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
54-
5569
- name: Install Deps
5670
run: |
5771
apt update -y
58-
DEBIAN_FRONTEND=noninteractive apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3.11-venv python3-setuptools python3-stemmer wget
72+
DEBIAN_FRONTEND=noninteractive apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget
5973
6074
- uses: actions/cache@v4
6175
id: sphinx-cache
6276
with:
6377
path: /home/runner/python-env/sphinx
64-
key: ${{ runner.os }}-sphinx-install
78+
key: ${{ matrix.os }}-${{ job.container.id }}-sphinx-install
6579

6680
- name: Install Sphinx
6781
if: ${{ steps.sphinx-cache.outputs.cache-hit != 'true' }}
6882
run: |
69-
python3 -m venv /home/runner/python-env/sphinx
83+
virtualenv /home/runner/python-env/sphinx
7084
. /home/runner/python-env/sphinx/bin/activate
7185
python3 -m pip install sphinx
7286
python3 -m pip install myst-parser
@@ -100,6 +114,7 @@ jobs:
100114
done
101115
102116
- name: Build Site
117+
id: build
103118
shell: bash
104119
run: |
105120
. /home/runner/python-env/sphinx/bin/activate

.github/workflows/esp32-mkimage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ jobs:
142142
./mkimage.sh
143143
else
144144
FLAVOR_SUFFIX=$(echo "${{ matrix.flavor }}" | sed 's/-//g')
145-
BOOT_FILE="build/libs/esp32boot/${FLAVOR_SUFFIX}_esp32boot.avm"
146-
./mkimage.sh --boot="$BOOT_FILE"
145+
BOOT_FILE="../../../../build/libs/esp32boot/${FLAVOR_SUFFIX}_esp32boot.avm"
146+
./mkimage.sh --boot "$BOOT_FILE"
147147
mv atomvm-${{ matrix.soc }}.img atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img
148148
fi
149149
ls -l *.img

.github/workflows/publish-docs.yaml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,52 @@ on:
2323
- 'doc/**'
2424
- 'libs/**'
2525
- 'src/libAtomVM/**'
26+
- 'UPDATING.md'
27+
- 'CONTRIBUTING.md'
28+
- 'CHANGELOG.md'
29+
- 'CODE_OF_CONDUCT.md'
2630

2731
# Allows you to run this workflow manually from the Actions tab
2832
workflow_dispatch:
2933

3034
concurrency:
3135
group: ${{ github.workflow }}-${{ github.ref_name }}
32-
cancel-in-progress: true
36+
cancel-in-progress: false
37+
38+
env:
39+
AVM_DOCS_NAME: ${{ github.ref_name }}
3340

3441
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
3542
jobs:
3643
# This workflow contains a single job called "build"
3744
build:
45+
strategy:
46+
## don't add more than one OS to matrix, this is only to retrieve the full os-name for keeping cache in sync
47+
matrix:
48+
os: [ ubuntu-24.04 ]
3849
# The type of runner that the job will run on
39-
runs-on: ubuntu-latest
40-
41-
env:
42-
AVM_DOCS_NAME: ${{ github.ref_name }}
50+
runs-on: ${{ matrix.os }}
51+
container: erlang:26.0.2
4352

4453
# Steps represent a sequence of tasks that will be executed as part of the job
4554
steps:
4655
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
4756

4857
- name: Install Deps
4958
run: |
50-
sudo apt update -y
51-
DEBIAN_FRONTEND=noninteractive sudo apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget
59+
apt update -y
60+
DEBIAN_FRONTEND=noninteractive apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget
5261
5362
- uses: actions/cache@v4
5463
id: sphinx-cache
5564
with:
5665
path: /home/runner/python-env/sphinx
57-
key: ${{ runner.os }}-sphinx-install
66+
key: ${{ matrix.os }}-${{ job.container.id }}-sphinx-install
5867

5968
- name: Install Sphinx
6069
if: ${{ steps.sphinx-cache.outputs.cache-hit != 'true' }}
6170
run: |
62-
python3 -m venv /home/runner/python-env/sphinx
71+
virtualenv /home/runner/python-env/sphinx
6372
. /home/runner/python-env/sphinx/bin/activate
6473
python3 -m pip install sphinx
6574
python3 -m pip install myst-parser
@@ -70,15 +79,6 @@ jobs:
7079
python3 -m pip install breathe
7180
python3 -m pip install pygments
7281
73-
- uses: erlef/setup-beam@v1
74-
with:
75-
otp-version: "27"
76-
elixir-version: "1.17"
77-
hexpm-mirrors: |
78-
https://builds.hex.pm
79-
https://repo.hex.pm
80-
https://cdn.jsdelivr.net/hex
81-
8282
- name: Install rebar3
8383
working-directory: /tmp
8484
run: |
@@ -115,25 +115,34 @@ jobs:
115115
cmake ..
116116
cd doc
117117
make GitHub_CI_Publish_Docs
118-
118+
rm -frv "/__w/AtomVM/AtomVM/www/doc/${{ github.ref_name }}"
119+
cp -av html "/__w/AtomVM/AtomVM/www/doc/${{ github.ref_name }}"
119120
- name: Commit files
121+
id: commit_files
120122
if: github.repository == 'atomvm/AtomVM'
121123
working-directory: /home/runner/work/AtomVM/AtomVM/www
122124
run: |
123-
git checkout Production
124125
git config --local user.email "atomvm-doc-bot@users.noreply.github.com"
125126
git config --local user.name "AtomVM Doc Bot"
127+
ls -la doc/
128+
git status "doc/${{ github.ref_name }}"
129+
git add "doc/${{ github.ref_name }}"
126130
git add .
127-
git commit -m "Update Documentation"
131+
git diff --exit-code Production || echo "Going to commit"
132+
git diff --exit-code Production || git commit -m "Update Documentation"
133+
git log -1
128134
- name: Push changes
129135
if: github.repository == 'atomvm/AtomVM'
130136
working-directory: /home/runner/work/AtomVM/AtomVM/www
131137
run: |
138+
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no"
132139
eval `ssh-agent -t 60 -s`
133140
echo "${{ secrets.PUBLISH_ACTION_KEY }}" | ssh-add -
134141
mkdir -p ~/.ssh/
135-
ssh-keyscan github.com >> ~/.ssh/known_hosts
142+
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > ~/.ssh/known_hosts
143+
echo "github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=" >> ~/.ssh/known_hosts
144+
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts
136145
git remote add push_dest "git@github.com:atomvm/atomvm_www.git"
137146
git fetch push_dest
138-
git push --set-upstream push_dest Production
139-
147+
git diff --exit-code push_dest/Production || echo "Going to push"
148+
git diff --exit-code push_dest/Production || git push --set-upstream push_dest Production

CHANGELOG.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Added a limited implementation of the OTP `ets` interface
1111
- Added `code:all_loaded/0` and `code:all_available/0`
1212

13-
## [0.6.5] - Unreleased
13+
## [0.6.5] - 2024-10-15
1414

1515
### Added
1616

@@ -40,6 +40,20 @@ also non string parameters (e.g. `Enum.join([1, 2], ",")`
4040
- Support for Elixir `IO.chardata_to_string/1`
4141
- Support for Elixir `List.duplicate/2`
4242
- Support for `binary:copy/1,2`
43+
- Support for directory listing using POSIX APIs: (`atomvm:posix_opendir/1`,
44+
`atomvm:posix_readdir/1`, `atomvm:posix_closedir/1`).
45+
- ESP32: add support for `esp_adc` ADC driver, with Erlang and Elixir examples
46+
- Add handler for ESP32 network driver STA mode `beacon_timeout` (event: 21), see issue
47+
[#1100](https://github.com/atomvm/AtomVM/issues/1100)
48+
- Support for mounting/unmounting storage on ESP32 (such as SD or internal flash) using
49+
`esp:mount/4` and `esp:umount/1`
50+
- Support for `binary_to_integer/2`
51+
- Support for `binary:decode_hex/1` and `binary:encode_hex/1,2`
52+
- Support for Elixir `Base.decode16/2` and `Base.encode16/2`
53+
- Make external term serialize functions available without using `externalterm_to_binary` so terms
54+
can be written directly to a buffer.
55+
- Support for `erlang:list_to_integer/2`
56+
- Add `externalterm_to_term_copy` that can be safely used from NIFs taking temporary buffers
4357

4458
### Changed
4559

@@ -58,6 +72,11 @@ instead
5872
- `unicode:characters_to_list`: fixed bogus out_of_memory error on some platforms such as ESP32
5973
- Fix crash in Elixir library when doing `inspect(:atom)`
6074
- General inspect() compliance with Elixir behavior (but there are still some minor differences)
75+
- Fix several uses of free on prevously released memory on ESP32, under certain error condition using
76+
`network:start/1`, that would lead to a hard crash of the VM.
77+
- Fix a bug in ESP32 network driver where the low level driver was not being stopped and resoureces were not freed
78+
when `network:stop/0` was used, see issue [#643](https://github.com/atomvm/AtomVM/issues/643)
79+
- `uart:open/1,2` now works with uppercase peripheral names
6180

6281
## [0.6.4] - 2024-08-18
6382

UPDATING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
- ESP32: partitioning schema for Elixir flavor is different, so app offset has been changed for
1414
Elixir images. Make sure to use `0x250000` as offset in your mix.exs or when performing manual
1515
flashing.
16+
- ESP32 a bug was discovered in `i2c:write_bytes/2` that has not been fixed yet. Writing bytes
17+
sequentally using `i2c:write_byte/2` still works as a temporary workaround.
18+
- STM32 devices with 512k of flash are not supported in this release, due to lack of
19+
flash space. Support may return in a future release.
1620

1721
## v0.6.0-beta.1 -> v0.6.0-rc.0
1822

doc/src/build-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ $ make
668668
### Changing the target device
669669

670670
The default build is based on the STM32F4Discovery board chip (`stm32f407vgt6`). If you want to target a different
671-
chip, pass the `-DDEVICE` flag when invoking cmake. For example, to use the BlackPill V2.0, pass `-DDEVICE=STM32F411CEU6`. At this time any `STM32F4` or `STM32F7` device with 512KB or more of on package flash should work with AtomVM. If an unsupported device is passed with the `DEVICE` parameter the configuration will fail. For devices with either 512KB or 768KB of flash the available application flash space will be limited to 128KB. Devices with only 512KB of flash may also suffer from slightly reduced performance because the compiler must optimize for size rather than performance.
671+
chip, pass the `-DDEVICE` flag when invoking cmake. For example, to use the BlackPill V2.0, pass `-DDEVICE=stm32f411ceu6`. At this time any `STM32F4` or `STM32F7` device with 512KB or more of on package flash should work with AtomVM. If an unsupported device is passed with the `DEVICE` parameter the configuration will fail. For devices with either 512KB or 768KB of flash the available application flash space will be limited to 128KB. Devices with only 512KB of flash may also suffer from slightly reduced performance because the compiler must optimize for size rather than performance.
672672

673673
```{attention}
674674
For devices with only 512KB of flash the application address is different and must be adjusted when flashing your
@@ -678,7 +678,7 @@ devices is `0x8060000`.
678678

679679
### Configuring the Console
680680

681-
The default build for any `DEVICE` will use `USART2` and output will be on `PA2`. This default will work well for most `Discovery` and generic boards that do not have an on-board TTL to USB-COM support (including the `STM32F411CEU6` A.K.A. `BlackPill V2.0`). For `Nucleo` boards that do have on board UART to USB-COM support you may pass the `cmake` parameter `-DBOARD=nucleo` to have the correct USART and TX pins configured automatically. The `Nucleo-144` series use `USART3` and `PD8`, while the supported `Nucleo-64` boards use `USART2`, but passing the `BOARD` parameter along with `DEVICE` will configure the correct `USART` for your model. If any other boards are discovered to have on board USB UART support pull requests, or opening issues with the details, are more than welcome.
681+
The default build for any `DEVICE` will use `USART2` and output will be on `PA2`. This default will work well for most `Discovery` and generic boards that do not have an on-board TTL to USB-COM support (including the `stm32f411ceu6` A.K.A. `BlackPill V2.0`). For `Nucleo` boards that do have on board UART to USB-COM support you may pass the `cmake` parameter `-DBOARD=nucleo` to have the correct USART and TX pins configured automatically. The `Nucleo-144` series use `USART3` and `PD8`, while the supported `Nucleo-64` boards use `USART2`, but passing the `BOARD` parameter along with `DEVICE` will configure the correct `USART` for your model. If any other boards are discovered to have on board USB UART support pull requests, or opening issues with the details, are more than welcome.
682682

683683
Example to configure a `NUCLEO-F429ZI`:
684684

doc/src/getting-started-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ total 16
353353
-rwxrwxrwx 1 joe staff 241 Sep 5 2008 INDEX.HTM*
354354
-rwxrwxrwx 1 joe staff 62 Sep 5 2008 INFO_UF2.TXT*
355355

356-
$ cp ~/Downloads/atomvmlib-v0.6.0.avm /Volumes/RPI-RP2/.
356+
$ cp ~/Downloads/atomvmlib-v0.6.0.uf2 /Volumes/RPI-RP2/.
357357
```
358358

359359
... and again, at this point, the device will auto-unmount.

doc/src/network-programming-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Callback functions are optional, but are highly recommended for building robust
4646
In addition, the following optional parameters can be specified to configure the AP network (ESP32 only):
4747

4848
* `{dhcp_hostname, string()|binary()}` The DHCP hostname as which the device should register (`<<"atomvm-<hexmac>">>`, where `<hexmac>` is the hexadecimal representation of the factory-assigned MAC address of the device).
49+
* `{beacon_timeout, fun(() -> term())}` A callback function which will be called when the device does not receive a beacon frame from the connected access point during the "inactive time" (6 second default, currently not configurable).
4950

5051
The following example illustrates initialization of the WiFi network in STA mode. The example program will configure the network to connect to a specified network. Events that occur during the lifecycle of the network will trigger invocations of the specified callback functions.
5152

0 commit comments

Comments
 (0)