Skip to content

ESP32: fix gpio:init/1 on GPIO >= 32 #3312

ESP32: fix gpio:init/1 on GPIO >= 32

ESP32: fix gpio:init/1 on GPIO >= 32 #3312

Workflow file for this run

#
# Copyright 2022 Davide Bettio <davide@uninstall.it>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: ESP32 Builds
on:
push:
paths:
- '.github/workflows/esp32-build.yaml'
- 'CMakeLists.txt'
- 'libs/**'
- 'src/platforms/esp32/**'
- 'src/platforms/esp32/**/**'
- 'src/libAtomVM/**'
- 'tools/packbeam/**'
pull_request:
paths:
- '.github/workflows/esp32-build.yaml'
- 'src/platforms/esp32/**'
- 'src/platforms/esp32/**/**'
- 'src/libAtomVM/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
esp-idf:
runs-on: ubuntu-latest
container: espressif/idf:${{ matrix.idf-version }}
strategy:
fail-fast: false
matrix:
esp-idf-target: ["esp32", "esp32c3"]
idf-version:
- 'v5.0.7'
- 'v5.1.4'
- 'v5.2.2'
- 'v5.3.1'
exclude:
- esp-idf-target: "esp32c3"
idf-version: 'v5.0.7'
- esp-idf-target: "esp32c3"
idf-version: 'v5.1.4'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Build with idf.py
shell: bash
working-directory: ./src/platforms/esp32/
run: |
. $IDF_PATH/export.sh
export IDF_TARGET=${{matrix.esp-idf-target}}
idf.py set-target ${{matrix.esp-idf-target}}
idf.py build
idf.py size
- name: Print component size info with idf.py
shell: bash
working-directory: ./src/platforms/esp32/
run: |
. $IDF_PATH/export.sh
idf.py size-components
- name: Install dependencies to build host AtomVM and run qemu
run: |
set -eu
apt update
DEBIAN_FRONTEND=noninteractive apt install -y -q \
doxygen erlang-base erlang-dialyzer \
libglib2.0-0 libpixman-1-0 \
gcc g++ zlib1g-dev libsdl2-2.0-0 libslirp0 libmbedtls-dev
- name: Install qemu binary from espressif/qemu esp32
if: runner.arch != 'ARM64' && runner.os == 'Linux' && matrix.esp-idf-target == 'esp32'
run: |
set -eu
QEMU_VER=esp-develop-9.0.0-20240606
QEMU_XTENSA_DIST=qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz
QEMU_XTENSA_SHA256=071d117c44a6e9a1bc8664ab63b592d3e17ceb779119dcb46c59571a4a7a88c9
wget --no-verbose https://github.com/espressif/qemu/releases/download/${QEMU_VER}/${QEMU_XTENSA_DIST}
echo "${QEMU_XTENSA_SHA256} *${QEMU_XTENSA_DIST}" | sha256sum --check --strict -
tar -xf ${QEMU_XTENSA_DIST} -C /opt && rm ${QEMU_XTENSA_DIST}
- name: Install qemu binary from espressif/qemu esp32c3
if: runner.arch != 'ARM64' && runner.os == 'Linux' && matrix.esp-idf-target == 'esp32c3'
run: |
set -eu
QEMU_VER=esp-develop-9.0.0-20240606
QEMU_RISCV32_DIST=qemu-riscv32-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz
QEMU_RISCV32_SHA256=47120e826cfec7180db8cb611a7a4aed2e9b2191c2a739194f8ce085e63cdd8d
wget --no-verbose https://github.com/espressif/qemu/releases/download/${QEMU_VER}/${QEMU_RISCV32_DIST}
echo "${QEMU_RISCV32_SHA256} *${QEMU_RISCV32_DIST}" | sha256sum --check --strict -
tar -xf ${QEMU_RISCV32_DIST} -C /opt && rm ${QEMU_RISCV32_DIST}
- name: Install qemu binary from espressif/qemu ARM64 esp32
if: runner.arch == 'ARM64' && runner.os == 'Linux' && matrix.esp-idf-target == 'esp32'
run: |
set -eu
QEMU_VER=esp-develop-9.0.0-20240606
QEMU_XTENSA_DIST=qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-aarch64-linux-gnu.tar.xz
QEMU_XTENSA_SHA256=43552f32b303a6820d0d9551903e54fc221aca98ccbd04e5cbccbca881548008
wget --no-verbose https://github.com/espressif/qemu/releases/download/${QEMU_VER}/${QEMU_XTENSA_DIST}
echo "${QEMU_XTENSA_SHA256} *${QEMU_XTENSA_DIST}" | sha256sum --check --strict -
tar -xf ${QEMU_XTENSA_DIST} -C /opt && rm ${QEMU_XTENSA_DIST}
- name: Install qemu binary from espressif/qemu ARM64 esp32c3
if: runner.arch == 'ARM64' && runner.os == 'Linux' && matrix.esp-idf-target == 'esp32c3'
run: |
set -eu
QEMU_VER=esp-develop-9.0.0-20240606
QEMU_RISCV32_DIST=qemu-riscv32-softmmu-esp_develop_9.0.0_20240606-aarch64-linux-gnu.tar.xz
QEMU_RISCV32_SHA256=3b6221a8b1881d2c9b9fa0b0bf8d7065c84153d2a54e429307bde9feae235c27
wget --no-verbose https://github.com/espressif/qemu/releases/download/${QEMU_VER}/${QEMU_RISCV32_DIST}
echo "${QEMU_RISCV32_SHA256} *${QEMU_RISCV32_DIST}" | sha256sum --check --strict -
tar -xf ${QEMU_RISCV32_DIST} -C /opt && rm ${QEMU_RISCV32_DIST}
- name: Install pytest and pytest-embedded plugins
run: |
set -e
. $IDF_PATH/export.sh
pip install pytest==8.2.2 \
pytest-embedded==1.10.3 \
pytest-embedded-serial-esp==1.10.3 \
pytest-embedded-idf==1.10.3 \
pytest-embedded-qemu==1.10.3
- name: Build ESP32 tests using idf.py
working-directory: ./src/platforms/esp32/test/
run: |
set -e
. $IDF_PATH/export.sh
export IDF_TARGET=${{matrix.esp-idf-target}}
idf.py set-target ${{matrix.esp-idf-target}}
idf.py build
- name: Run ESP32 tests using qemu
working-directory: ./src/platforms/esp32/test/
timeout-minutes: 10
run: |
set -e
. $IDF_PATH/export.sh
export PATH=/opt/qemu/bin:${PATH}
pytest --target=${{matrix.esp-idf-target}} --embedded-services=idf,qemu -s