Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/esp32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ jobs:
idf-version: 'v5.5.3'
- esp-idf-target: "esp32s3"
idf-version: 'v5.5.3'
- esp-idf-target: "esp32s3"
idf-version: 'v5.5.3'
usb-cdc: 'ON'
- esp-idf-target: "esp32"
idf-version: 'v5.4.3'
libsodium: 'ON'
Expand All @@ -84,11 +87,26 @@ jobs:
. $IDF_PATH/export.sh
idf.py add-dependency "espressif/libsodium^1.0.20~4"

- name: Add ESP TinyUSB dependency
if: matrix.usb-cdc == 'ON'
working-directory: ./src/platforms/esp32/
run: |
. $IDF_PATH/export.sh
idf.py add-dependency "espressif/esp_tinyusb"

- name: Build with idf.py
shell: bash
working-directory: ./src/platforms/esp32/
env:
USB_CDC: ${{ matrix.usb-cdc || 'OFF' }}
run: |
. $IDF_PATH/export.sh
if [[ "${USB_CDC}" == "ON" ]]; then
printf '%s\n' \
'CONFIG_TINYUSB_CDC_ENABLED=y' \
'CONFIG_AVM_ENABLE_USB_CDC_PORT_DRIVER=y' \
>> sdkconfig.defaults.in
fi
export IDF_TARGET=${{matrix.esp-idf-target}}
idf.py set-target ${{matrix.esp-idf-target}}
idf.py ${{ matrix.libsodium == 'ON' && '-DAVM_USE_LIBSODIUM=ON' || '' }} build
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/pico-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ jobs:
platform: "-DPICO_PLATFORM=rp2350-riscv"
jit: "-DAVM_DISABLE_JIT=OFF"

- board: "pico"
platform: ""
jit: ""
usb-cdc: "ON"

steps:
- name: Checkout repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -172,7 +177,7 @@ jobs:
set -euo pipefail
mkdir build
cd build
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} ${{ matrix.platform }} ${{ matrix.jit }}
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} ${{ matrix.platform }} ${{ matrix.jit }} ${{ matrix.usb-cdc == 'ON' && '-DAVM_USB_CDC_PORT_DRIVER_ENABLED=ON' || '' }}
cmake --build . --target=AtomVM

- name: "Perform CodeQL Analysis"
Expand All @@ -187,7 +192,7 @@ jobs:
nvm install 24

- name: Build tests (without SMP)
if: matrix.board != 'pico2' && matrix.board != 'pico2_w'
if: matrix.board != 'pico2' && matrix.board != 'pico2_w' && matrix.usb-cdc != 'ON'
shell: bash
working-directory: ./src/platforms/rp2/
run: |
Expand All @@ -199,7 +204,7 @@ jobs:
cmake --build . --target=rp2_tests

- name: Run tests with rp2040js
if: matrix.board != 'pico2' && matrix.board != 'pico2_w'
if: matrix.board != 'pico2' && matrix.board != 'pico2_w' && matrix.usb-cdc != 'ON'
shell: bash
working-directory: ./src/platforms/rp2/tests
run: |
Expand All @@ -210,7 +215,7 @@ jobs:
npx tsx run-tests.ts ../build.nosmp/tests/rp2_tests.uf2 ../build.nosmp/tests/test_erl_sources/rp2_test_modules.uf2

- name: Rename AtomVM and write sha256sum
if: matrix.platform == '' && matrix.jit == ''
if: matrix.platform == '' && matrix.jit == '' && matrix.usb-cdc != 'ON'
shell: bash
run: |
pushd src/platforms/rp2/build
Expand All @@ -220,14 +225,14 @@ jobs:
popd

- name: Upload AtomVM artifact
if: matrix.platform == '' && matrix.jit == ''
if: matrix.platform == '' && matrix.jit == '' && matrix.usb-cdc != 'ON'
uses: actions/upload-artifact@v4
with:
name: AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
path: src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-*.uf2

- name: Rename atomvmlib-rp2 and write sha256sum
if: matrix.platform == '' && matrix.jit == ''
if: matrix.platform == '' && matrix.jit == '' && matrix.usb-cdc != 'ON'
shell: bash
run: |
pushd build/libs
Expand All @@ -237,7 +242,7 @@ jobs:
popd

- name: Combine uf2 using uf2tool
if: matrix.platform == '' && matrix.jit == ''
if: matrix.platform == '' && matrix.jit == '' && matrix.usb-cdc != 'ON'
shell: bash
run: |
ATOMVM_COMBINED_FILE=AtomVM-${{ matrix.board }}-combined-${{env.AVM_REF_NAME}}.uf2
Expand All @@ -246,15 +251,15 @@ jobs:
echo "ATOMVM_COMBINED_FILE=${ATOMVM_COMBINED_FILE}" >> $GITHUB_ENV

- name: Upload combined AtomVM artifact
if: matrix.platform == '' && matrix.jit == ''
if: matrix.platform == '' && matrix.jit == '' && matrix.usb-cdc != 'ON'
uses: actions/upload-artifact@v4
with:
name: ${{ env.ATOMVM_COMBINED_FILE }}
path: ${{ env.ATOMVM_COMBINED_FILE }}

- name: Release (Pico & Pico2)
uses: softprops/action-gh-release@v3.0.0
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.board != 'pico2_w' && matrix.platform == '' && matrix.jit == ''
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.board != 'pico2_w' && matrix.platform == '' && matrix.jit == '' && matrix.usb-cdc != 'ON'
with:
draft: true
fail_on_unmatched_files: true
Expand All @@ -268,7 +273,7 @@ jobs:

- name: Release (PicoW & Pico2W)
uses: softprops/action-gh-release@v3.0.0
if: startsWith(github.ref, 'refs/tags/') && (matrix.board == 'pico_w' || matrix.board == 'pico2_w') && matrix.platform == '' && matrix.jit == ''
if: startsWith(github.ref, 'refs/tags/') && (matrix.board == 'pico_w' || matrix.board == 'pico2_w') && matrix.platform == '' && matrix.jit == '' && matrix.usb-cdc != 'ON'
with:
draft: true
fail_on_unmatched_files: true
Expand Down
97 changes: 20 additions & 77 deletions .github/workflows/stm32-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ jobs:
# FinishTransmission() on the I2C slave when a STOP condition
# occurs, causing the BME280 sensor to get stuck in Reading
# state and ignore subsequent writes.
skip_i2c_test: true
tests: "boot gpio spi crypto uart"
- device: stm32f411ceu6
max_size: 393216
renode_platform: stm32f4.repl
avm_address: "0x08060000"
skip_i2c_test: true
# No RNG peripheral on F411, so the firmware has no crypto NIFs
# (mbedTLS is excluded by STM32_HAS_RNG in CMake).
skip_crypto_test: true
tests: "boot gpio spi uart"
- device: stm32f429zit6
max_size: 524288
- device: stm32h743vit6
max_size: 524288
renode_platform: stm32h743.repl
avm_address: "0x08080000"
tests: "boot gpio i2c spi crypto uart"
- device: stm32h743zit6
max_size: 524288
- device: stm32u585ait6q
Expand All @@ -87,10 +87,15 @@ jobs:
max_size: 524288
- device: stm32h562rgt6
max_size: 524288
usb-cdc: "OFF"
- device: stm32h562rgt6
max_size: 524288
usb-cdc: "ON"
Comment thread
pguyot marked this conversation as resolved.
- device: stm32f746zgt6
max_size: 524288
renode_platform: stm32f746.repl
avm_address: "0x08080000"
tests: "boot gpio i2c spi crypto uart"
- device: stm32g474ret6
max_size: 393216
- device: stm32l476rgt6
Expand All @@ -102,10 +107,9 @@ jobs:
# Renode's built-in stm32l552.repl uses STM32F4_I2C (legacy I2C
# register layout) but the L5 HAL uses the newer I2C registers
# (TIMINGR, ISR, etc.), causing a complete register mismatch.
skip_i2c_test: true
# 512 KB flash with avm_address=0x08060000 leaves only 128 KB,
# but the crypto AVM is 207 KB and gets truncated.
skip_crypto_test: true
tests: "boot gpio spi uart"
- device: stm32f207zgt6
max_size: 524288
- device: stm32u375rgt6
Expand All @@ -117,7 +121,7 @@ jobs:
# No RNG peripheral on G0B1 (only G041/G061/G081/G0C1 have one),
# so the firmware has no crypto NIFs (mbedTLS is excluded by
# STM32_HAS_RNG in CMake).
skip_crypto_test: true
tests: "boot gpio i2c spi uart"

steps:
- uses: erlef/setup-beam@v1
Expand Down Expand Up @@ -162,7 +166,7 @@ jobs:
set -euo pipefail
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/arm-toolchain.cmake -DDEVICE=${{ matrix.device }}
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/arm-toolchain.cmake -DDEVICE=${{ matrix.device }} ${{ matrix.usb-cdc == 'ON' && '-DAVM_USB_CDC_PORT_DRIVER_ENABLED=ON' || '' }}
cmake --build .

- name: "Perform CodeQL Analysis"
Expand Down Expand Up @@ -195,7 +199,7 @@ jobs:
mkdir build-host
cd build-host
cmake .. -G Ninja
cmake --build . -t stm32_boot_test stm32_gpio_test stm32_i2c_test stm32_spi_test stm32_crypto_test
cmake --build . -t stm32_boot_test stm32_gpio_test stm32_i2c_test stm32_spi_test stm32_crypto_test stm32_uart_test

- name: Install Renode
if: matrix.renode_platform
Expand All @@ -207,52 +211,7 @@ jobs:
echo "$PWD/renode-portable" >> $GITHUB_PATH
pip install -r renode-portable/tests/requirements.txt

- name: Run Renode boot test
if: matrix.renode_platform
run: |
LOCAL_REPL="src/platforms/stm32/tests/renode/${{ matrix.renode_platform }}"
if [ -f "$LOCAL_REPL" ]; then
PLATFORM="@$PWD/$LOCAL_REPL"
else
PLATFORM="@platforms/cpus/${{ matrix.renode_platform }}"
fi
renode-test src/platforms/stm32/tests/renode/stm32_boot_test.robot \
--variable ELF:@$PWD/src/platforms/stm32/build/AtomVM-${{ matrix.device }}.elf \
--variable AVM:@$PWD/build-host/src/platforms/stm32/tests/test_erl_sources/stm32_boot_test.avm \
--variable AVM_ADDRESS:${{ matrix.avm_address }} \
--variable PLATFORM:$PLATFORM

- name: Run Renode GPIO test
if: matrix.renode_platform
run: |
LOCAL_REPL="src/platforms/stm32/tests/renode/${{ matrix.renode_platform }}"
if [ -f "$LOCAL_REPL" ]; then
PLATFORM="@$PWD/$LOCAL_REPL"
else
PLATFORM="@platforms/cpus/${{ matrix.renode_platform }}"
fi
renode-test src/platforms/stm32/tests/renode/stm32_gpio_test.robot \
--variable ELF:@$PWD/src/platforms/stm32/build/AtomVM-${{ matrix.device }}.elf \
--variable AVM:@$PWD/build-host/src/platforms/stm32/tests/test_erl_sources/stm32_gpio_test.avm \
--variable AVM_ADDRESS:${{ matrix.avm_address }} \
--variable PLATFORM:$PLATFORM

- name: Run Renode I2C test
if: matrix.renode_platform && !matrix.skip_i2c_test
run: |
LOCAL_REPL="src/platforms/stm32/tests/renode/${{ matrix.renode_platform }}"
if [ -f "$LOCAL_REPL" ]; then
PLATFORM="@$PWD/$LOCAL_REPL"
else
PLATFORM="@platforms/cpus/${{ matrix.renode_platform }}"
fi
renode-test src/platforms/stm32/tests/renode/stm32_i2c_test.robot \
--variable ELF:@$PWD/src/platforms/stm32/build/AtomVM-${{ matrix.device }}.elf \
--variable AVM:@$PWD/build-host/src/platforms/stm32/tests/test_erl_sources/stm32_i2c_test.avm \
--variable AVM_ADDRESS:${{ matrix.avm_address }} \
--variable PLATFORM:$PLATFORM

- name: Run Renode SPI test
- name: Run Renode tests
if: matrix.renode_platform
run: |
LOCAL_REPL="src/platforms/stm32/tests/renode/${{ matrix.renode_platform }}"
Expand All @@ -261,26 +220,10 @@ jobs:
else
PLATFORM="@platforms/cpus/${{ matrix.renode_platform }}"
fi
renode-test src/platforms/stm32/tests/renode/stm32_spi_test.robot \
--variable ELF:@$PWD/src/platforms/stm32/build/AtomVM-${{ matrix.device }}.elf \
--variable AVM:@$PWD/build-host/src/platforms/stm32/tests/test_erl_sources/stm32_spi_test.avm \
--variable AVM_ADDRESS:${{ matrix.avm_address }} \
--variable PLATFORM:$PLATFORM

- name: Run Renode crypto test
# Devices without RNG hardware (F411 / G0) don't ship mbedTLS at all;
# L562 has only 512 KB of flash and the 207 KB crypto AVM is truncated
# at AVM_ADDRESS=0x08060000, which kills kernel boot.
if: matrix.renode_platform && !matrix.skip_crypto_test
run: |
LOCAL_REPL="src/platforms/stm32/tests/renode/${{ matrix.renode_platform }}"
if [ -f "$LOCAL_REPL" ]; then
PLATFORM="@$PWD/$LOCAL_REPL"
else
PLATFORM="@platforms/cpus/${{ matrix.renode_platform }}"
fi
renode-test src/platforms/stm32/tests/renode/stm32_crypto_test.robot \
--variable ELF:@$PWD/src/platforms/stm32/build/AtomVM-${{ matrix.device }}.elf \
--variable AVM:@$PWD/build-host/src/platforms/stm32/tests/test_erl_sources/stm32_crypto_test.avm \
--variable AVM_ADDRESS:${{ matrix.avm_address }} \
--variable PLATFORM:$PLATFORM
for TEST in ${{ matrix.tests }}; do
renode-test "src/platforms/stm32/tests/renode/stm32_${TEST}_test.robot" \
--variable ELF:@$PWD/src/platforms/stm32/build/AtomVM-${{ matrix.device }}.elf \
--variable AVM:@$PWD/build-host/src/platforms/stm32/tests/test_erl_sources/stm32_${TEST}_test.avm \
--variable AVM_ADDRESS:${{ matrix.avm_address }} \
--variable PLATFORM:$PLATFORM
done
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for `nif_start`, `executable_line` and `debug_line` opcodes
- Added named variable debugging support in DWARF when modules are compiled with `beam_debug_info`
- Added more reset reasons and ensured `esp:reset_reason/0` doesn't return `undefined`
- Added I2C and SPI APIs to stm32 platform
- Added I2C, SPI and UART APIs to stm32 platform
- Added `Transfer-Encoding: chunked` response support to `ahttp_client`, including HTTP trailers
- Added `proc_lib:init_fail/2,3`
- Added UART API to rp2 platform
- Added USB CDC port drivers for ESP32, RP2, and STM32 platforms

### Changed
- Updated network type db() to dbm() to reflect the actual representation of the type
Expand Down
Loading
Loading