Skip to content
Merged
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
60 changes: 57 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
idf_matrix: ${{ steps.matrix.outputs.idf_matrix }}
nuttx_matrix: ${{ steps.matrix.outputs.nuttx_matrix }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -202,14 +203,67 @@ jobs:
path: dist/
if-no-files-found: error

# tiny-edge's NuttX agent (`framework: nuttx` in release/devices.yml): the
# tiny-edge release west.yml pins, built in tiny-edge's own NuttX container
# with its ports/nuttx/scripts/build.sh, the same assets and metadata.
build-nuttx:
name: ${{ matrix.group }}
needs: matrix
if: ${{ fromJSON(needs.matrix.outputs.nuttx_matrix).include[0] != null }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.nuttx_matrix) }}
steps:
- uses: actions/checkout@v4
with:
path: app
- name: The tiny-edge release west.yml pins
id: tiny-edge
run: |
rev=$(grep -A3 -- '- name: tiny-edge' app/west.yml | sed -n 's/^ *revision: *//p')
echo "revision=$rev" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
repository: thin-edge/tiny-edge
ref: ${{ steps.tiny-edge.outputs.revision }}
path: tiny-edge
- uses: docker/setup-buildx-action@v3
- name: tiny-edge's NuttX container
uses: docker/build-push-action@v6
with:
context: tiny-edge/ports/nuttx/docker
tags: tiny-edge-nuttx
load: true
cache-from: type=gha,scope=nuttx
cache-to: type=gha,scope=nuttx,mode=max
- name: Build and package
run: |
docker run --rm -v "$GITHUB_WORKSPACE":/ws -w /ws/app \
-e TINY_EDGE_DIR=/ws/tiny-edge tiny-edge-nuttx bash -c '
set -e
scripts/release/check-version.sh --apply "${{ github.ref_name }}"
for name in ${{ matrix.builds }}; do
echo "::group::$name"
scripts/release/build.sh "$name" --build-dir "/ws/build/$name" --out /ws/dist
echo "::endgroup::"
done'
- uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.group }}
path: dist/
if-no-files-found: error

release:
name: Publish the release
# build-idf is skipped when release/devices.yml lists no ESP-IDF build.
# build-idf and build-nuttx are skipped when release/devices.yml lists no
# build of theirs.
if: >-
startsWith(github.ref, 'refs/tags/v') && !cancelled() &&
needs.build.result == 'success' &&
(needs.build-idf.result == 'success' || needs.build-idf.result == 'skipped')
needs: [matrix, build, build-idf]
(needs.build-idf.result == 'success' || needs.build-idf.result == 'skipped') &&
(needs.build-nuttx.result == 'success' || needs.build-nuttx.result == 'skipped')
needs: [matrix, build, build-idf, build-nuttx]
runs-on: ubuntu-24.04
permissions:
contents: write
Expand Down
24 changes: 24 additions & 0 deletions DEVICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,30 @@ parameters, and the cloud shell were tested with the same FreeRTOS port in
tiny-edge's own ESP-IDF sample on this board (tiny-edge 0.4.0, 2026-11-11),
not yet with this application.

### NuttX agent on the ESP32-C6 (2026-11-17)

The `nuttx` variant of `tedge-agent` is tiny-edge's NuttX agent (NuttX 13.1,
tiny-edge's `ports/nuttx`), built with tiny-edge's `build.sh` and booting
through MCUboot. Its update image is 1,415,232 B, 92 % of its 1.5 MB slot
(the 4 MB layout's largest; tiny-edge's NuttX README). dram0 holds
271,904 of 452,112 B.

On an ESP32-C6-DevKitC (eu-latest, `tedge-e8f60afb8198`), with no program
reading the USB port, from tiny-edge's NuttX change (`ports/nuttx/REPORT.md`):

- **Set-up:** from an erased data partition with `tedge-onboard` over USB,
the board's Wi-Fi scan, and a wrong password that brought it back to its
stored network; certificate enrollment and renewal.
- **Cumulocity:** `c8y_Agent`, `tedge_OS` (`nuttx` 13.1.0), `c8y_Hardware`,
the `device` and health measurements, and type `thin-edge.io-nuttx`.
- **Operations:** a restart, log upload, the cloud shell, parameters that
kept their values across a restart, a remote access tunnel to the LAN, a
firmware update from Cumulocity that confirmed, the rollback of an image
that could not connect, and an operation interrupted by a reset, which was
failed after the reboot.
- **30 minutes** with telemetry and 52 tunnels: no gap in the measurements,
free heap steady at about 96 KB, at most 63 % of any thread's stack.

### Identify measured (2026-10-06)

`device-identify` adds `tedge identify [seconds]` (cloud shell) and the sw0
Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Every [release](https://github.com/thin-edge/microcontroller-devices/releases)
carries ready-to-flash images for these devices — no toolchain, no build:

<!-- devices:start (generated by scripts/release/matrix.py --markdown; do not edit) -->
| Device | Zephyr board | standalone | tedge-full | tedge-ota | tedge-onboard |
|---|---|---|---|---|---|
| ESP32-C6-DevKitC-1 (N4) | `esp32c6_devkitc/esp32c6/hpcore` | `modbus-server`, `opcua-server`, `snmp-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `tedge-agent-idf` |
| ESP32-S3-DevKitC-1 (N16R8) | `esp32s3_devkitc/esp32s3/procpu` | `modbus-server`, `opcua-server`, `snmp-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | — |
| Adafruit QT Py ESP32-S3 (N4R2) | `adafruit_qt_py_esp32s3/esp32s3/procpu` | `modbus-server`, `opcua-server`, `snmp-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `modbus-server`, `opcua-server`, `snmp-agent`, `tedge-agent` | — |
| ESP32-WROOM-32 DevKitC | `esp32_devkitc/esp32/procpu` | `modbus-server`, `opcua-server`, `snmp-agent` | — | `modbus-server`, `tedge-agent` | — |
| ESP32-CAM (ESP32 + 4 MB PSRAM) | `esp32_devkitc/esp32/procpu` | — | — | `snmp-agent`, `modbus-server`, `tedge-agent` | — |
| Device | Zephyr board | standalone | tedge-full | tedge-ota | tedge-onboard | nuttx |
|---|---|---|---|---|---|---|
| ESP32-C6-DevKitC-1 (N4) | `esp32c6_devkitc/esp32c6/hpcore` | `modbus-server`, `opcua-server`, `snmp-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `tedge-agent-idf` | `tedge-agent` |
| ESP32-S3-DevKitC-1 (N16R8) | `esp32s3_devkitc/esp32s3/procpu` | `modbus-server`, `opcua-server`, `snmp-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | — | — |
| Adafruit QT Py ESP32-S3 (N4R2) | `adafruit_qt_py_esp32s3/esp32s3/procpu` | `modbus-server`, `opcua-server`, `snmp-agent` | `modbus-server`, `snmp-agent`, `tedge-agent` | `modbus-server`, `opcua-server`, `snmp-agent`, `tedge-agent` | — | — |
| ESP32-WROOM-32 DevKitC | `esp32_devkitc/esp32/procpu` | `modbus-server`, `opcua-server`, `snmp-agent` | — | `modbus-server`, `tedge-agent` | — | — |
| ESP32-CAM (ESP32 + 4 MB PSRAM) | `esp32_devkitc/esp32/procpu` | — | — | `snmp-agent`, `modbus-server`, `tedge-agent` | — | — |
<!-- devices:end -->

- **standalone** — the protocol server on its own (Modbus TCP, OPC-UA or
Expand All @@ -39,13 +39,19 @@ carries ready-to-flash images for these devices — no toolchain, no build:
[tedge-onboard](https://github.com/thin-edge/tiny-edge/tree/main/tools/onboard):
it gives the device your computer's Wi-Fi network and registers it in your
tenant. The images are not signed (ESP-IDF's bootloader, no MCUboot).
- **nuttx** — `tedge-agent` on [NuttX](https://nuttx.apache.org/): tiny-edge's
NuttX agent with every thin-edge.io feature, set up over USB with
`tedge-onboard` like `tedge-onboard` (on a DevKitC, the connector labelled
USB). It boots through MCUboot, so a firmware update that cannot connect is
rolled back. The images are not signed with a key: MCUboot checks their
hash.

Each image comes as `<app>-<variant>-<device>-<version>` with:

| File | What it is for |
|---|---|
| `.factory.bin` | The first flash: everything in one image, written at `0x0` |
| `.app.bin` | Updates: `flash.sh --app-only`, or Cumulocity firmware update |
| `.app.bin` | Updates: `flash.sh --app-only`, or Cumulocity firmware update. For `nuttx` images it is the update image, which MCUboot boots on trial; `flash.sh --app-only` writes the bundle's confirmed image instead |
| `.zip` | The three images with their offsets (`flash.json`) and instructions, for `scripts/flash.sh` |

### From your browser
Expand Down
2 changes: 1 addition & 1 deletion apps/tedge-agent-idf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ tiny-edge Smart Functions and DTM definitions:
slots and the rollback, and set-up is `tedge-onboard` over USB instead of
Improv BLE or lab-ztp-provisioner.
- No status LED or identify pattern yet.
- tiny-edge 0.6.0, so the client's parameter sets are `tiny_edge` and
- tiny-edge 0.6.0 and later, so the client's parameter sets are `tiny_edge` and
`tiny_edge_remote_access`, not `zephyr_tedge`, and `tedge-onboard`
registers the device with the image's type, `thin-edge.io-esp-idf-agent`.
2 changes: 1 addition & 1 deletion apps/tedge-agent-idf/main/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ dependencies:
tiny_edge:
git: https://github.com/thin-edge/tiny-edge.git
path: ports/freertos/esp-idf/tiny_edge
version: v0.6.0
version: v0.7.0
15 changes: 15 additions & 0 deletions release/devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
# `framework: esp-idf` marks an ESP-IDF application (apps/<app> built with
# idf.py, the device's `chip` as the target): no Zephyr profile, board files
# or tiny-edge board configuration; it brings its own sdkconfig.defaults.
#
# `framework: nuttx` marks tiny-edge's NuttX agent, built with tiny-edge's
# ports/nuttx/scripts/build.sh for the device's `nuttx_board` (a board
# tiny-edge's NuttX port has a configuration for). The build's `extra_conf`
# are NuttX configuration fragments, such as
# "{tiny-edge}/ports/nuttx/configs/esp32s3-psram-octal.conf".
variants:
standalone:
description: the protocol server alone; Wi-Fi over Improv BLE
Expand All @@ -45,6 +51,10 @@ variants:
description: the device agent on ESP-IDF (FreeRTOS) with every thin-edge.io feature; Wi-Fi and Cumulocity over USB with tedge-onboard
framework: esp-idf
provisioner: tedge-onboard
nuttx:
description: the device agent on NuttX with every thin-edge.io feature; Wi-Fi and Cumulocity over USB with tedge-onboard
framework: nuttx
provisioner: tedge-onboard

provisioners:
improv: null
Expand All @@ -60,6 +70,7 @@ devices:
flash_size: 4MB
esptool_before: usb-reset
tedge_board_conf: "{tiny-edge}/ports/zephyr/profiles/boards/esp32c6-devkitc.conf"
nuttx_board: esp32c6-devkitc
builds:
- { app: modbus-server, variant: standalone, pr: true }
- { app: opcua-server, variant: standalone }
Expand Down Expand Up @@ -92,6 +103,10 @@ devices:
variant: tedge-onboard
pr: true
measured: DEVICES.md#esp-idf-agent-on-the-esp32-c6-2026-11-12
- app: tedge-agent
variant: nuttx
pr: true
measured: DEVICES.md#nuttx-agent-on-the-esp32-c6-2026-11-17

- id: esp32s3-devkitc
name: ESP32-S3-DevKitC-1 (N16R8)
Expand Down
12 changes: 8 additions & 4 deletions scripts/flash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@
# An ESP-IDF bundle (a `tedge-onboard` image: flash.json says
# "framework": "esp-idf") is flashed the same way: everything, or with
# --app-only the application into ota_0; --erase-storage erases its NVS
# partition (the Wi-Fi network and the Cumulocity certificate).
# partition (the Wi-Fi network and the Cumulocity certificate). A NuttX
# bundle ("framework": "nuttx", tiny-edge's NuttX agent) too: MCUboot and
# the confirmed image, or with --app-only the image into the primary slot;
# --erase-storage erases its LittleFS data partition.
#
# Local builds are signed with MCUboot's public development key: fine for
# development, never for production devices. A bundle's flash.json says which
# key signed it.
set -euo pipefail

usage() { sed -n '4,29p' "$0" | sed 's/^# \{0,1\}//'; exit "${1:-0}"; }
usage() { sed -n '4,37p' "$0" | sed 's/^# \{0,1\}//'; exit "${1:-0}"; }

[[ $# -ge 1 ]] || usage 1
build=$1; shift
Expand All @@ -58,15 +61,16 @@ run() {
[[ $dry -eq 1 ]] || "$@"
}

if [[ -f $build/flash.json ]] && grep -q '"framework": "esp-idf"' "$build/flash.json"; then
if [[ -f $build/flash.json ]] && grep -qE '"framework": "(esp-idf|nuttx)"' "$build/flash.json"; then
vars=$(python3 - "$build" <<'PY'
import json, shlex, sys
from pathlib import Path
d = Path(sys.argv[1])
f = json.loads((d / "flash.json").read_text())
imgs = [(i["offset"], str(d / i["file"])) for i in f["images"]]
app = next(i for i in f["images"] if i["name"] == "app")
nvs = f["partitions"].get("nvs", {})
# The partition with the device's settings: NVS on ESP-IDF, LittleFS on NuttX.
nvs = f["partitions"].get("nvs") or f["partitions"].get("data") or {}
for k, v in {"CHIP": f["chip"], "ESPTOOL_BEFORE": f["esptool_before"],
"FLASH_ARGS": " ".join(f["flash_args"]),
"ALL_IMAGES": " ".join(f"{o} {shlex.quote(p)}" for o, p in imgs),
Expand Down
46 changes: 45 additions & 1 deletion scripts/release/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
# environment exported; scripts/release/package_idf.py packages it and fails
# it when the application takes more than 80 % of its OTA slot.
#
# A NuttX build (`framework: nuttx`) is tiny-edge's NuttX agent: it runs
# tiny-edge's ports/nuttx/scripts/build.sh for the device's `nuttx_board`,
# inside tiny-edge's NuttX container (ports/nuttx/docker), with the release's
# firmware name and apps/<app>/VERSION, and the build's `extra_conf` as
# NuttX fragments. TINY_EDGE_DIR names the tiny-edge checkout where west is
# not installed; NUTTX_WS, NuttX's workspace (default: in the build
# directory). scripts/release/package_nuttx.py packages it.
#
# The size step (scripts/release/size.py) fails the build when an image is
# over its flash budget or when any RAM region or image has grown past the
# build's entry in release/size-baseline.json. A change that moves a build's
# size updates that entry with --write-baseline (scripts/release/baseline.sh
# does every build) and commits it in the same pull request.
set -euo pipefail

[[ $# -ge 1 ]] || { sed -n '4,23p' "$0" | sed 's/^# \{0,1\}//'; exit 1; }
[[ $# -ge 1 ]] || { sed -n '4,32p' "$0" | sed 's/^# \{0,1\}//'; exit 1; }
name=$1; shift
root=$(cd "$(dirname "$0")/../.." && pwd)
build=$root/build-release/$name
Expand Down Expand Up @@ -67,6 +75,42 @@ if [[ $FRAMEWORK == esp-idf ]]; then
exit 0
fi

if [[ $FRAMEWORK == nuttx ]]; then
te=$(python3 - "$root" <<'PY'
import sys
sys.path.insert(0, sys.argv[1] + "/scripts/release")
import matrix
print(matrix.west_project_dir("tiny-edge") or "")
PY
)
[[ -x $te/ports/nuttx/scripts/build.sh ]] || {
echo "tiny-edge's NuttX port not found (set TINY_EDGE_DIR)" >&2; exit 1; }
v=$root/apps/$APP/VERSION
field() { sed -n "s/^$1 *= *\([^ #]*\).*/\1/p" "$v"; }
version="$(field VERSION_MAJOR).$(field VERSION_MINOR).$(field PATCHLEVEL)"
extra=$(field EXTRAVERSION)
[[ -z $extra ]] || version="$version-$extra"
rm -rf "$build"
mkdir -p "$build" "$out"
# The release's firmware name, which an update must carry.
printf 'CONFIG_TINY_EDGE_FIRMWARE_NAME="%s"\n' "$FIRMWARE_NAME" \
> "$build/release.conf"
args=(--agent --version "$version")
while IFS= read -r frag; do
case $frag in "") continue ;; /*) ;; *) frag=$root/$frag ;; esac
args+=(--extra "$frag")
done < <(tr ';' '\n' <<< "$CONF_FILES")
ws=${NUTTX_WS:-$build/nuttx}
NUTTX_WS=$ws "$te/ports/nuttx/scripts/build.sh" \
"$NUTTX_BOARD" "${args[@]}" --extra "$build/release.conf" \
--out "$build/out"
python3 "$root/scripts/release/package_nuttx.py" "$build/out" \
--config "$ws/nuttx/.config" \
--device "$DEVICE" --app "$APP" --variant "$VARIANT" --out "$out" \
--version "$version" --tiny-edge "$te"
exit 0
fi

abs() { # "a;/x/b" repository-relative or absolute -> "/root/a;/x/b"
[[ -n $1 ]] || return 0
tr ';' '\n' <<< "$1" | sed "s#^\([^/]\)#$root/\1#" | paste -sd';' -
Expand Down
Loading
Loading