From 49f6de7a10d2fc65419089182aeed6e65da0208d Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Mon, 16 Nov 2026 09:59:12 +1000 Subject: [PATCH] feat: take tiny-edge 0.6.0 and install it with the ESP-IDF component manager - west.yml: tiny-edge v0.6.0 for the Zephyr apps. - tedge-agent-idf: tiny-edge comes from the component manager (main/idf_component.yml) instead of FetchContent. TINY_EDGE_DIR still builds against a local checkout. - package_idf.py: the release's device type is the image's own, thin-edge.io-esp-idf-agent, since tedge-onboard 0.6.0 registers devices with it; the tiny-edge version is read from the component's fetch directory. Co-Authored-By: Claude Opus 5.5 --- apps/tedge-agent-idf/CMakeLists.txt | 23 +-------------------- apps/tedge-agent-idf/README.md | 18 +++++++--------- apps/tedge-agent-idf/main/idf_component.yml | 10 +++++++++ scripts/release/package_idf.py | 16 +++++++------- west.yml | 2 +- 5 files changed, 28 insertions(+), 41 deletions(-) create mode 100644 apps/tedge-agent-idf/main/idf_component.yml diff --git a/apps/tedge-agent-idf/CMakeLists.txt b/apps/tedge-agent-idf/CMakeLists.txt index 73714d0..e65cf71 100644 --- a/apps/tedge-agent-idf/CMakeLists.txt +++ b/apps/tedge-agent-idf/CMakeLists.txt @@ -21,28 +21,7 @@ if(_EXTRAVERSION) string(APPEND PROJECT_VER "-${_EXTRAVERSION}") endif() -# tiny-edge, pinned to a release. The whole repository is fetched, not only -# its ESP-IDF component: the component builds the portable core and the -# shared ports from beside it, which the component manager's git+path -# dependency does not bring along. TINY_EDGE_DIR (environment or -D) uses a -# local checkout instead, to try a client change. -set(TINY_EDGE_VERSION v0.5.0) -if(NOT TINY_EDGE_DIR AND DEFINED ENV{TINY_EDGE_DIR}) - set(TINY_EDGE_DIR $ENV{TINY_EDGE_DIR}) -endif() -if(NOT TINY_EDGE_DIR) - include(FetchContent) - FetchContent_Declare(tiny_edge - GIT_REPOSITORY https://github.com/thin-edge/tiny-edge.git - GIT_TAG ${TINY_EDGE_VERSION} - GIT_SHALLOW TRUE - # Only the sources: tiny-edge has no top-level project to add. - SOURCE_SUBDIR do-not-add) - FetchContent_MakeAvailable(tiny_edge) - set(TINY_EDGE_DIR ${tiny_edge_SOURCE_DIR}) -endif() -message(STATUS "tiny-edge: ${TINY_EDGE_DIR}") -set(EXTRA_COMPONENT_DIRS ${TINY_EDGE_DIR}/ports/freertos/esp-idf/tiny_edge) +# tiny-edge comes from the component manager: main/idf_component.yml. include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(tedge-agent-idf) diff --git a/apps/tedge-agent-idf/README.md b/apps/tedge-agent-idf/README.md index d49ca36..2f78338 100644 --- a/apps/tedge-agent-idf/README.md +++ b/apps/tedge-agent-idf/README.md @@ -31,19 +31,16 @@ idf.py set-target esp32c6 idf.py build ``` -The build fetches tiny-edge at the tag in `CMakeLists.txt` -(`TINY_EDGE_VERSION`). To try a change to the client, point it at a local -checkout: +tiny-edge comes from the ESP-IDF component manager, at the tag in +`main/idf_component.yml`. The component fetches the rest of tiny-edge (the +portable core and the shared port code) into the build directory on the +first build, so that build needs `git` and network access. To try a change +to the client, point it at a local checkout: ```sh idf.py -D TINY_EDGE_DIR=/path/to/tiny-edge build ``` -tiny-edge is fetched as a whole repository, not through the component -manager: its ESP-IDF component builds the portable core from beside it, and -the component manager's `git` + `path` dependency copies only the -component's own directory. - ## Flash and set up Flash the whole image the first time: @@ -78,5 +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.5.0, so the client's parameter sets are `tiny_edge` and - `tiny_edge_remote_access`, not `zephyr_tedge`. +- tiny-edge 0.6.0, 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`. diff --git a/apps/tedge-agent-idf/main/idf_component.yml b/apps/tedge-agent-idf/main/idf_component.yml new file mode 100644 index 0000000..2f04f3d --- /dev/null +++ b/apps/tedge-agent-idf/main/idf_component.yml @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +dependencies: + # tiny-edge, pinned to a release. The component fetches the rest of + # tiny-edge into the build directory on the first build (git and network + # access). To build against a local checkout instead: + # idf.py -D TINY_EDGE_DIR=/path/to/tiny-edge build + tiny_edge: + git: https://github.com/thin-edge/tiny-edge.git + path: ports/freertos/esp-idf/tiny_edge + version: v0.6.0 diff --git a/scripts/release/package_idf.py b/scripts/release/package_idf.py index 8f41ff1..511a96a 100644 --- a/scripts/release/package_idf.py +++ b/scripts/release/package_idf.py @@ -208,7 +208,9 @@ def main(argv=None): z.writestr(f"{stem}/flash.json", json.dumps(flash, indent=2) + "\n") z.writestr(f"{stem}/README.txt", readme) - tiny_edge = bdir / "_deps" / "tiny_edge-src" / "VERSION" + # The rest of tiny-edge, which the component fetches into the build + # directory beside the component the component manager installed. + tiny_edge = next(iter(sorted(bdir.glob("tiny_edge-src-*/VERSION"))), None) meta = { **{k: flash[k] for k in ("device", "device_name", "board", "app", "variant", "version", "firmware_name", "chip", @@ -216,16 +218,14 @@ def main(argv=None): "framework": "esp-idf", "stem": stem, "tedge": True, - # No device type for the firmware repository's filter: tedge-onboard - # registers every device as "thin-edge.io", so an entry restricted to - # the image's own type would not be offered in the devices' Firmware - # tab. The firmware name already names the app, variant and board. - "device_type": None, - "image_device_type": cfg.get("APP_DEVICE_TYPE"), + # tedge-onboard (tiny-edge 0.6.0 and later) registers the device with + # the type the image reports, so the firmware repository entry is + # offered to exactly the devices running this app. + "device_type": cfg.get("APP_DEVICE_TYPE") or None, "features": [k.lower().replace("_", "-") for k in FEATURES if cfg.get(f"TEDGE_{k}") is True], "tedge_zephyr_version": (tiny_edge.read_text().strip() - if tiny_edge.is_file() else None), + if tiny_edge else None), "measured": build.measured, "signing": SIGNING, "assets": {p.name: sha256(p) for p in (factory, app_bin, bundle)}, diff --git a/west.yml b/west.yml index e65bc15..4333ae9 100644 --- a/west.yml +++ b/west.yml @@ -51,7 +51,7 @@ manifest: # CONFIG_TEDGE=y. Pin a release tag; move the pin to pick up a new one. - name: tiny-edge remote: thin-edge - revision: v0.5.0 + revision: v0.6.0 path: modules/lib/tiny-edge self: