Skip to content
Open
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
arch: "x86_64"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: ./.github/actions/setup-target
with:
Expand All @@ -79,7 +79,7 @@ jobs:
arch: "armhf"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: ./.github/actions/setup-target
with:
Expand All @@ -105,7 +105,7 @@ jobs:
arch: "armhf"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: ./.github/actions/setup-target
with:
Expand All @@ -120,7 +120,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable

- run: cargo check -p xtask --all-features
Expand All @@ -133,7 +133,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-target

- run: cargo test --lib
Expand All @@ -146,7 +146,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
Expand All @@ -159,7 +159,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
Expand Down
155 changes: 99 additions & 56 deletions .github/workflows/hil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,95 +28,138 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

jobs:
build-espflash:
name: Build espflash
runs-on: ubuntu-22.04
container:
image: ubuntu:20.04
build-packages:
name: Build packages | (${{ matrix.target.host }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- host: aarch64
target: aarch64-unknown-linux-gnu
- host: armv7
target: armv7-unknown-linux-gnueabihf

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
repository: ${{ github.event.inputs.repository || github.repository }}
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: apt-get update && apt-get -y install curl musl-tools pkg-config

- name: Install toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Install cross
uses: taiki-e/install-action@v2
with:
tool: cross

- name: Build espflash
run: $HOME/.cargo/bin/cargo build --release
working-directory: espflash
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2

- name: Build xtask
run: $HOME/.cargo/bin/cargo build --release --locked
working-directory: xtask
- name: Build binaries
run: cross build --release --target ${{ matrix.target.target }} -p espflash -p xtask

- uses: actions/upload-artifact@v4
- name: Upload espflash-${{ matrix.target.host }}
uses: actions/upload-artifact@v4
with:
name: espflash
path: target/release/espflash
name: espflash-${{ matrix.target.host }}
path: target/${{ matrix.target.target }}/release/espflash
if-no-files-found: error

- uses: actions/upload-artifact@v4
- name: Upload xtask-${{ matrix.target.host }}
uses: actions/upload-artifact@v4
with:
name: xtask
path: target/release/xtask
name: xtask-${{ matrix.target.host }}
path: target/${{ matrix.target.target }}/release/xtask
if-no-files-found: error

run-target:
run-packages:
if: github.repository_owner == 'esp-rs'
name: ${{ matrix.board.mcu }}${{ matrix.board.freq }}
needs: build-espflash
runs-on:
[
self-hosted,
linux,
x64,
"${{ matrix.board.mcu }}${{ matrix.board.freq }}",
]

name: HIL | ${{ matrix.target.soc }} | ${{ matrix.target.port }}
needs: build-packages
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could duplicate a bit of code to speed things up, and only wait for the packages of their arch to be finished, not sure if its worth though

runs-on: [self-hosted, "${{ matrix.target.runner }}"]
env:
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.board.mcu }}
ESPFLASH_PORT: /dev/serial_ports/${{ matrix.target.port }}

strategy:
fail-fast: false
matrix:
board:
- mcu: esp32
- mcu: esp32c2
freq: -26mhz
flag: -x 26mhz
- mcu: esp32c3
- mcu: esp32c6
- mcu: esp32h2
- mcu: esp32s2
- mcu: esp32s3
target:
- soc: esp32c2
runner: esp32c2-jtag
port: uart
host: aarch64
- soc: esp32c3
runner: esp32c3-usb
port: usb
host: armv7
- soc: esp32c5
runner: esp32c5-usb
port: usb
host: aarch64
- soc: esp32c5
runner: esp32c5-usb
port: uart
host: aarch64
- soc: esp32c6
runner: esp32c6-usb
port: usb
host: armv7
- soc: esp32c6
runner: esp32c6-usb
port: uart
host: armv7
- soc: esp32h2
runner: esp32h2-usb
port: usb
host: armv7
- soc: esp32h2
runner: esp32h2-usb
port: uart
host: armv7
- soc: esp32p4
runner: esp32p4
port: usb
host: aarch64
- soc: esp32
runner: esp32-jtag
port: uart
host: aarch64
- soc: esp32s2
runner: esp32s2-jtag
port: uart
host: armv7
- soc: esp32s3
runner: esp32s3-usb
port: usb
host: armv7
- soc: esp32s3
runner: esp32s3-usb
port: uart
host: armv7

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: espflash
name: espflash-${{ matrix.target.host }}
path: espflash_app

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
name: xtask
name: xtask-${{ matrix.target.host }}
path: xtask_app

- name: Set up espflash binary
- name: Set up binaries
run: |
chmod +x espflash_app/espflash
echo "$PWD/espflash_app" >> "$GITHUB_PATH"
chmod +x xtask_app/xtask
echo "$PWD/espflash_app" >> "$GITHUB_PATH"
echo "$PWD/xtask_app" >> "$GITHUB_PATH"

- name: Reset device
run: |
espflash reset
sleep 5

- name: Run all tests
run: xtask run-tests --chip ${{ matrix.board.mcu }} -t 60 --no-build
run: xtask run-tests --chip ${{ matrix.target.soc }} -t 60 --no-build
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
arch: "x86_64"
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: ./.github/actions/package
with:
Expand Down
24 changes: 24 additions & 0 deletions espflash/resources/70-espflash.rules
Copy link
Member Author

@SergioGasquez SergioGasquez Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the best way, and I guess this could supersede probe-rs udev rules in the runner (https://github.com/esp-rs/esp-hal/tree/main/hil-test#rpi-setup), but having the symlink to /dev/serial_ports/usb and /dev/serial_ports/uart is quite useful I think.

I only tested this locally, I haven't yet added this file to the runners, I'll wait for some input before

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copy this file to /etc/udev/rules.d/
# If rules fail to reload automatically, you can refresh udev rules
# with the command "udevadm control --reload"

# This rules are based on the udev rules from the OpenOCD project, with unsupported probes removed.
# See http://openocd.org/ for more details.
#
# This file is available under the GNU General Public License v2.0

ACTION!="add|change", GOTO="espflash_rules_end"

SUBSYSTEM=="gpio", MODE="0660", GROUP="plugdev", TAG+="uaccess"

SUBSYSTEM!="usb|tty|hidraw", GOTO="espflash_rules_end"

# Please keep this list sorted by VID:PID

# Espressif USB JTAG/serial debug unit and USB Bridge
ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="660", GROUP="plugdev", TAG+="uaccess", SYMLINK+="serial_ports/usb"
ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1002", MODE="660", GROUP="plugdev", TAG+="uaccess", SYMLINK+="serial_ports/usb"
# Silicon Labs CP210x UART Bridge
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="serial_ports/uart"

LABEL="espflash_rules_end"
Binary file modified espflash/resources/bootloaders/esp32p4-bootloader.bin
Binary file not shown.
10 changes: 10 additions & 0 deletions espflash/tests/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,13 @@ cargo build --release

`esp_hal_binary_with_overlapping_defmt_and_embedded_test_sections` is the ESP-HAL `gpio_unstable` test built for ESP32.
This file is used in a unit test in espflash, and is not flashed as a HIL test.

The `esp32c5` and `esp32p4` elf files under this folder have been generated using `[email protected]`:
```
git clone -b v5.5.2 --recursive https://github.com/espressif/esp-idf.git
cd esp-idf/
./install.sh all
cd examples/get-started/hello_world/
idf.py set-target $CHIP
idf.py build
```
Binary file added espflash/tests/data/esp32c5
Binary file not shown.
Binary file added espflash/tests/data/esp32p4
Binary file not shown.
Loading
Loading