Skip to content

Commit

Permalink
Forward port changes from v0.6 release branch
Browse files Browse the repository at this point in the history
Merge v0.6.5 into main.
  • Loading branch information
bettio committed Oct 14, 2024
2 parents 1bedd1c + 388940d commit 24084c5
Show file tree
Hide file tree
Showing 62 changed files with 3,148 additions and 169 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-and-test-other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ jobs:
- arch: "arm32v7"
platform: "arm/v7"
tag: "bullseye"
cflags: "-mcpu=cortex-a7 -mfloat-abi=hard -O2 -mthumb -mthumb-interwork"
# -D_FILE_OFFSET_BITS=64 is required for making atomvm:posix_readdir/1 test work
# otherwise readdir will fail due to 64 bits inode numbers with 32 bit ino_t
cflags: "-mcpu=cortex-a7 -mfloat-abi=hard -O2 -mthumb -mthumb-interwork -D_FILE_OFFSET_BITS=64"
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"

- arch: "arm64v8"
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,14 @@ jobs:
cflags: ""
elixir_version: "1.14"

# master/main version of OTP/Elixir
- os: "ubuntu-24.04"
cc: "cc"
cxx: "c++"
otp: "master"
elixir_version: "main"
# 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"

# Additional default compiler builds
- os: "ubuntu-20.04"
Expand Down
27 changes: 21 additions & 6 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
- 'doc/**'
- 'libs/**'
- 'src/libAtomVM/**'
- 'UPDATING.md'
- 'CONTRIBUTING.md'
- 'CHANGELOG.md'
- 'CODE_OF_CONDUCT.md'
push:
repositories:
- '!atomvm/AtomVM'
Expand All @@ -32,6 +36,10 @@ on:
- 'doc/**'
- 'libs/**'
- 'src/libAtomVM/**'
- 'UPDATING.md'
- 'CONTRIBUTING.md'
- 'CHANGELOG.md'
- 'CODE_OF_CONDUCT.md'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -44,29 +52,35 @@ concurrency:
jobs:
# This workflow contains a single job called "build"
build:

strategy:
fail-fast: false
## don't add more than one OS to matrix, this is only to retrieve the full os-name for keeping cache in sync
matrix:
os: [ ubuntu-24.04 ]
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: erlang:27
runs-on: ${{ matrix.os }}
# Documentation currently fails to build with OTP-27 and recent OTP-26.
container: erlang:26.0.2

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

- name: Install Deps
run: |
apt update -y
DEBIAN_FRONTEND=noninteractive apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3.11-venv python3-setuptools python3-stemmer wget
DEBIAN_FRONTEND=noninteractive apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget
- uses: actions/cache@v4
id: sphinx-cache
with:
path: /home/runner/python-env/sphinx
key: ${{ runner.os }}-sphinx-install
key: ${{ matrix.os }}-${{ job.container.id }}-sphinx-install

- name: Install Sphinx
if: ${{ steps.sphinx-cache.outputs.cache-hit != 'true' }}
run: |
python3 -m venv /home/runner/python-env/sphinx
virtualenv /home/runner/python-env/sphinx
. /home/runner/python-env/sphinx/bin/activate
python3 -m pip install sphinx
python3 -m pip install myst-parser
Expand Down Expand Up @@ -100,6 +114,7 @@ jobs:
done
- name: Build Site
id: build
shell: bash
run: |
. /home/runner/python-env/sphinx/bin/activate
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/esp32-mkimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ jobs:
./mkimage.sh
else
FLAVOR_SUFFIX=$(echo "${{ matrix.flavor }}" | sed 's/-//g')
BOOT_FILE="build/libs/esp32boot/${FLAVOR_SUFFIX}_esp32boot.avm"
./mkimage.sh --boot="$BOOT_FILE"
BOOT_FILE="../../../../build/libs/esp32boot/${FLAVOR_SUFFIX}_esp32boot.avm"
./mkimage.sh --boot "$BOOT_FILE"
mv atomvm-${{ matrix.soc }}.img atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img
fi
ls -l *.img
Expand Down
57 changes: 33 additions & 24 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,52 @@ on:
- 'doc/**'
- 'libs/**'
- 'src/libAtomVM/**'
- 'UPDATING.md'
- 'CONTRIBUTING.md'
- 'CHANGELOG.md'
- 'CODE_OF_CONDUCT.md'

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

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
cancel-in-progress: false

env:
AVM_DOCS_NAME: ${{ github.ref_name }}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
strategy:
## don't add more than one OS to matrix, this is only to retrieve the full os-name for keeping cache in sync
matrix:
os: [ ubuntu-24.04 ]
# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
AVM_DOCS_NAME: ${{ github.ref_name }}
runs-on: ${{ matrix.os }}
container: erlang:26.0.2

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

- name: Install Deps
run: |
sudo apt update -y
DEBIAN_FRONTEND=noninteractive sudo apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget
apt update -y
DEBIAN_FRONTEND=noninteractive apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget
- uses: actions/cache@v4
id: sphinx-cache
with:
path: /home/runner/python-env/sphinx
key: ${{ runner.os }}-sphinx-install
key: ${{ matrix.os }}-${{ job.container.id }}-sphinx-install

- name: Install Sphinx
if: ${{ steps.sphinx-cache.outputs.cache-hit != 'true' }}
run: |
python3 -m venv /home/runner/python-env/sphinx
virtualenv /home/runner/python-env/sphinx
. /home/runner/python-env/sphinx/bin/activate
python3 -m pip install sphinx
python3 -m pip install myst-parser
Expand All @@ -70,15 +79,6 @@ jobs:
python3 -m pip install breathe
python3 -m pip install pygments
- uses: erlef/setup-beam@v1
with:
otp-version: "27"
elixir-version: "1.17"
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: Install rebar3
working-directory: /tmp
run: |
Expand Down Expand Up @@ -115,25 +115,34 @@ jobs:
cmake ..
cd doc
make GitHub_CI_Publish_Docs
rm -frv "/__w/AtomVM/AtomVM/www/doc/${{ github.ref_name }}"
cp -av html "/__w/AtomVM/AtomVM/www/doc/${{ github.ref_name }}"
- name: Commit files
id: commit_files
if: github.repository == 'atomvm/AtomVM'
working-directory: /home/runner/work/AtomVM/AtomVM/www
run: |
git checkout Production
git config --local user.email "[email protected]"
git config --local user.name "AtomVM Doc Bot"
ls -la doc/
git status "doc/${{ github.ref_name }}"
git add "doc/${{ github.ref_name }}"
git add .
git commit -m "Update Documentation"
git diff --exit-code Production || echo "Going to commit"
git diff --exit-code Production || git commit -m "Update Documentation"
git log -1
- name: Push changes
if: github.repository == 'atomvm/AtomVM'
working-directory: /home/runner/work/AtomVM/AtomVM/www
run: |
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no"
eval `ssh-agent -t 60 -s`
echo "${{ secrets.PUBLISH_ACTION_KEY }}" | ssh-add -
mkdir -p ~/.ssh/
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > ~/.ssh/known_hosts
echo "github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=" >> ~/.ssh/known_hosts
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
git remote add push_dest "[email protected]:atomvm/atomvm_www.git"
git fetch push_dest
git push --set-upstream push_dest Production
git diff --exit-code push_dest/Production || echo "Going to push"
git diff --exit-code push_dest/Production || git push --set-upstream push_dest Production
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a limited implementation of the OTP `ets` interface
- Added `code:all_loaded/0` and `code:all_available/0`

## [0.6.5] - Unreleased
## [0.6.5] - 2024-10-15

### Added

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

### Changed

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

## [0.6.4] - 2024-08-18

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

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

Expand Down
4 changes: 2 additions & 2 deletions doc/src/build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ $ make
### Changing the target device

The default build is based on the STM32F4Discovery board chip (`stm32f407vgt6`). If you want to target a different
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.
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.

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

### Configuring the Console

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.
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.

Example to configure a `NUCLEO-F429ZI`:

Expand Down
2 changes: 1 addition & 1 deletion doc/src/getting-started-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ total 16
-rwxrwxrwx 1 joe staff 241 Sep 5 2008 INDEX.HTM*
-rwxrwxrwx 1 joe staff 62 Sep 5 2008 INFO_UF2.TXT*

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

... and again, at this point, the device will auto-unmount.
Expand Down
1 change: 1 addition & 0 deletions doc/src/network-programming-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Callback functions are optional, but are highly recommended for building robust
In addition, the following optional parameters can be specified to configure the AP network (ESP32 only):

* `{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).
* `{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).

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.

Expand Down
Loading

0 comments on commit 24084c5

Please sign in to comment.