Skip to content

Fetch REx drivers dependencies automatically#218

Open
ekoeppen wants to merge 1 commit into
masterfrom
rex-build
Open

Fetch REx drivers dependencies automatically#218
ekoeppen wants to merge 1 commit into
masterfrom
rex-build

Conversation

@ekoeppen

@ekoeppen ekoeppen commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Use CMake to fetch the NCT headers, DCL, and tntk to enable building the REx drivers in one go.

Summary by CodeRabbit

  • Chores

    • Build now supports ARM cross-compilation and will auto-detect or build required host tooling; it can use prebuilt binaries when toolchain components are absent.
    • Driver packaging and conversion steps now run via resolved toolpaths; final runtime artifact is produced and uploaded by CI. CI adds a "Get dependencies" step and simplifies intermediate steps.
  • Documentation

    • Prerequisites and cross-compilation guidance clarified; NCT_PROJECTS env var no longer required; tooling/packaging instructions condensed.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Build system converted to arm-aware ExternalProject/FetchContent flows: CMake now detects an ARM toolchain, fetches or builds NCT_Projects/DCL/TNTK as needed, and drives driver packaging into Einstein.rex. The GitHub workflow now installs system build tools and skips building those dependencies.

Changes

Build-system: Fetch/Host/Target integration and CI wiring

Layer / File(s) Summary
Toolchain detection & CI prep
CMakeLists.txt, .github/workflows/rex.yml
Detects arm-none-eabi GCC; CI workflow adds a "Get dependencies" step installing gcc-arm-none-eabi, cmake, make and removes prior checkout/build of DCL/TNTK/NCT_Projects.
FetchContent / Host tool builds
Drivers/CMakeLists.txt, Drivers/host/CMakeLists.txt
Adds FetchContent for NCT_Projects and ExternalProject-based host tool build targets (dcl_host, tntk_host), exporting their bin dirs (DCL_BIN_DIR, TNTK_BIN_DIR).
Drivers external project & wiring
Drivers/CMakeLists.txt, CMakeLists.txt
Adds ExternalProject_Add for drivers_target when ARM toolchain present; passes host compiler and tool paths as CMake args; conditionally uses prebuilt _Data_/Einstein.rex when no toolchain.
Driver target layout & packaging
Drivers/target/CMakeLists.txt
Introduces define_driver() macro, builds Runtime and multiple driver executables, adds post-build packaging (ELF->PKG/REX) steps, and composes an Einstein ALL target producing Einstein.rex.
PortEnabler tool resolution & conversion flow
Drivers/EinsteinPortEnabler/CMakeLists.txt
Bumps CMake min version; adds override variables for TNTK/ELFTONTK; returns early to use prebuilt package when TNTK missing; adds dependencies on host tool targets if present; runs ${ELFTONTK} and ${TNTK} in post-build steps.
Documentation updates
Drivers/README.md
Updates REx introduction, clarifies cross-compilation prerequisites, removes prior compile/install instructions for DCL, removes NCT_PROJECTS env requirement, and simplifies build commands; notes optional packages in packages/ directory.

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Workflow
    participant CMake as CMake
    participant Fetch as FetchContent / Git (NCT_Projects)
    participant Host as Host Tool Builds (DCL / TNTK)
    participant Drivers as Drivers ExternalProject

    GH->>GH: install system packages (gcc-arm-none-eabi, cmake, make)
    GH->>CMake: run cmake configure/build
    CMake->>CMake: detect ARM toolchain?
    alt ARM toolchain present
        CMake->>Fetch: FetchContent NCT_Projects (if needed)
        Fetch-->>CMake: provide NCT headers
        CMake->>Host: ExternalProject_Add(dcl / tntk) -> build/install
        Host-->>CMake: export DCL_BIN_DIR / TNTK_BIN_DIR
        CMake->>Drivers: ExternalProject_Add(drivers_target) with tool paths
        Drivers-->>CMake: build drivers, packaging -> Einstein.rex
    else no ARM toolchain
        CMake->>CMake: use prebuilt `_Data_/Einstein.rex`
    end
    CMake-->>GH: upload `Einstein/_Data_/Einstein.rex` artifact
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I dug a patch in cmake loam,

Fetched the trees and built a home.
Tools arrive or spring to life,
Workflow trimmed, no extra strife.
Einstein.rex hops out—cheerful rife!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change—automating dependency fetching for REx drivers via CMake modifications across build configuration files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rex-build

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ekoeppen
ekoeppen marked this pull request as ready for review May 4, 2026 17:02
@ekoeppen
ekoeppen requested a review from MatthiasWM May 4, 2026 17:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
Drivers/CMakeLists.txt (1)

17-17: ⚡ Quick win

Pin all three GIT_TAG values to specific commit SHAs or version tags

All three FetchContent/ExternalProject declarations use floating branch refs (main, master). Any new commit pushed upstream silently changes what gets fetched on the next clean configure, making builds non-reproducible and potentially breaking the CI without any local code change.

📌 Suggested fix
     FetchContent_Declare(
         nct_projects
         GIT_REPOSITORY https://github.com/ekoeppen/NCT_Projects.git
-        GIT_TAG        main
+        GIT_TAG        <commit-sha>
     )
     ExternalProject_Add(dcl
         GIT_REPOSITORY https://github.com/pguyot/DCL.git
-        GIT_TAG        master
+        GIT_TAG        <commit-sha>
         ...
     )
     ExternalProject_Add(tntk_ext
         GIT_REPOSITORY https://github.com/ekoeppen/tntk.git
-        GIT_TAG        master
+        GIT_TAG        <commit-sha>
         ...
     )

Also applies to: 32-32, 52-52

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Drivers/CMakeLists.txt` at line 17, Search the three
FetchContent/ExternalProject declarations that currently set GIT_TAG to floating
branches ("main" and "master") and pin each GIT_TAG to a reproducible identifier
(a specific commit SHA or a released version tag) instead of the branch name;
update the GIT_TAG values for all occurrences (the GIT_TAG entries at the shown
locations and the other two occurrences referenced in the comment) so they
reference exact SHAs or tags, and ensure the commit SHAs/tags you choose are
valid for the corresponding repositories and recorded in project docs or
changelog for future maintenance.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Drivers/CMakeLists.txt`:
- Around line 47-62: The ExternalProject_Add call for tntk currently always
injects -DCMAKE_INSTALL_RPATH=${CMAKE_BINARY_DIR}/dcl-install/lib; change it so
the RPATH args (-DCMAKE_INSTALL_RPATH=... and
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON) are only appended to the CMAKE_ARGS when
DCL is being built as the external dependency (i.e., when you create the dcl
external target and set DCL_BINARY_DIR). Concretely, compute a variable like
TntkCMakeArgs (or conditionally push to CMAKE_ARGS) and only include the RPATH
entries when DCL_EXTERNAL or DCL_BINARY_DIR is defined, keep DEPENDS dcl and
keep setting TNTK_BINARY_DIR when external, otherwise omit the RPATH args so
system-installed DCL is used without a hardcoded dcl-install path.

In `@Drivers/README.md`:
- Line 18: Update the phrase "ARM provided downloads" in the Drivers README to
use the compound adjective form "ARM-provided downloads" (i.e., add a hyphen) so
the sentence reads "...for the general ARM-provided downloads, or a [brew
tap]..." to correct the grammar; locate the occurrence in the README text and
replace it accordingly.

---

Nitpick comments:
In `@Drivers/CMakeLists.txt`:
- Line 17: Search the three FetchContent/ExternalProject declarations that
currently set GIT_TAG to floating branches ("main" and "master") and pin each
GIT_TAG to a reproducible identifier (a specific commit SHA or a released
version tag) instead of the branch name; update the GIT_TAG values for all
occurrences (the GIT_TAG entries at the shown locations and the other two
occurrences referenced in the comment) so they reference exact SHAs or tags, and
ensure the commit SHAs/tags you choose are valid for the corresponding
repositories and recorded in project docs or changelog for future maintenance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 978454a1-9120-4bfb-8e8a-4b71f038bdc4

📥 Commits

Reviewing files that changed from the base of the PR and between c2a9379 and 4724372.

📒 Files selected for processing (4)
  • .github/workflows/rex.yml
  • Drivers/CMakeLists.txt
  • Drivers/EinsteinPortEnabler/CMakeLists.txt
  • Drivers/README.md
💤 Files with no reviewable changes (1)
  • .github/workflows/rex.yml

Comment thread Drivers/CMakeLists.txt Outdated
Comment thread Drivers/README.md Outdated
@ekoeppen
ekoeppen force-pushed the rex-build branch 2 times, most recently from 1901945 to 836aa4c Compare May 5, 2026 05:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Drivers/README.md`:
- Around line 12-13: Update the README text to hyphenate the three compound
modifiers: change "cross compiled" to "cross-compiled", "NewtonOS compatible
tool chain" to "NewtonOS-compatible tool chain" (or "toolchain" if preferred by
project style), and "NewtonOS specific tools" to "NewtonOS-specific tools" so
the compound adjectives are properly hyphenated.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 02641a56-ebff-40e4-8323-95cc6fa6f7f9

📥 Commits

Reviewing files that changed from the base of the PR and between 1901945 and 836aa4c.

📒 Files selected for processing (4)
  • .github/workflows/rex.yml
  • Drivers/CMakeLists.txt
  • Drivers/EinsteinPortEnabler/CMakeLists.txt
  • Drivers/README.md
💤 Files with no reviewable changes (1)
  • .github/workflows/rex.yml
🚧 Files skipped from review as they are similar to previous changes (2)
  • Drivers/EinsteinPortEnabler/CMakeLists.txt
  • Drivers/CMakeLists.txt

Comment thread Drivers/README.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
Drivers/README.md (1)

12-13: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Compound-modifier hyphens still missing on lines 12-13.

"cross compiled", "NewtonOS compatible tool chain", and "NewtonOS specific tools" each need hyphens before their nouns.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Drivers/README.md` around lines 12 - 13, Update the sentence in
Drivers/README.md (the phrase shown in the diff) to add compound-word hyphens:
change "cross compiled" to "cross-compiled", "NewtonOS compatible tool chain" to
"NewtonOS-compatible toolchain", and "NewtonOS specific tools" to
"NewtonOS-specific tools" so all compound modifiers are hyphenated correctly.
🧹 Nitpick comments (1)
Drivers/CMakeLists.txt (1)

14-15: ⚡ Quick win

Pin GIT_TAG to a specific commit hash or release tag for reproducible builds.

All three external dependencies (nct_projects, dcl, tntk_ext) currently track mutable branch heads (main/master). Any upstream commit will silently change build inputs across machines or CI runs, making failures hard to diagnose and bisect.

♻️ Proposed fix
 FetchContent_Declare(
     nct_projects
     GIT_REPOSITORY https://github.com/ekoeppen/NCT_Projects.git
-    GIT_TAG        main
+    GIT_TAG        <commit-sha-or-release-tag>
 )
 ExternalProject_Add(dcl
     GIT_REPOSITORY https://github.com/pguyot/DCL.git
-    GIT_TAG        master
+    GIT_TAG        <commit-sha-or-release-tag>
     ...
 )
 ExternalProject_Add(tntk_ext
     GIT_REPOSITORY https://github.com/ekoeppen/tntk.git
-    GIT_TAG        master
+    GIT_TAG        <commit-sha-or-release-tag>
     ...
 )

Also applies to: 28-29, 58-59

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Drivers/CMakeLists.txt` around lines 14 - 15, The CMake ExternalProject
entries currently pin GIT_TAG to mutable branch names ("main"/"master") for
repositories like nct_projects (GIT_REPOSITORY
https://github.com/ekoeppen/NCT_Projects.git), dcl and tntk_ext; change each
GIT_TAG to a specific commit hash or release tag (a full SHA or stable tag) for
reproducible builds, updating the GIT_TAG values for the occurrences that
reference nct_projects, dcl, and tntk_ext (the three ExternalProject blocks) so
all three use immutable commits/tags instead of "main"/"master".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Drivers/README.md`:
- Around line 37-39: The sentence describing tntk is missing the verb "is";
update the README text "If it not installed, the precompiled packages are
included in the REx." to read "If it is not installed, the precompiled packages
are included in the REx." so the tntk description is grammatically correct.

---

Duplicate comments:
In `@Drivers/README.md`:
- Around line 12-13: Update the sentence in Drivers/README.md (the phrase shown
in the diff) to add compound-word hyphens: change "cross compiled" to
"cross-compiled", "NewtonOS compatible tool chain" to "NewtonOS-compatible
toolchain", and "NewtonOS specific tools" to "NewtonOS-specific tools" so all
compound modifiers are hyphenated correctly.

---

Nitpick comments:
In `@Drivers/CMakeLists.txt`:
- Around line 14-15: The CMake ExternalProject entries currently pin GIT_TAG to
mutable branch names ("main"/"master") for repositories like nct_projects
(GIT_REPOSITORY https://github.com/ekoeppen/NCT_Projects.git), dcl and tntk_ext;
change each GIT_TAG to a specific commit hash or release tag (a full SHA or
stable tag) for reproducible builds, updating the GIT_TAG values for the
occurrences that reference nct_projects, dcl, and tntk_ext (the three
ExternalProject blocks) so all three use immutable commits/tags instead of
"main"/"master".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 497c5e1d-1e7f-414b-a0e9-cc263f74c71b

📥 Commits

Reviewing files that changed from the base of the PR and between 836aa4c and b2fb8ff.

📒 Files selected for processing (5)
  • .github/workflows/rex.yml
  • Drivers/CMakeLists.txt
  • Drivers/EinsteinPortEnabler/CMakeLists.txt
  • Drivers/EinsteinPortEnabler/portenabler.pkg
  • Drivers/README.md
💤 Files with no reviewable changes (1)
  • .github/workflows/rex.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • Drivers/EinsteinPortEnabler/CMakeLists.txt

Comment thread Drivers/README.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Drivers/EinsteinPortEnabler/CMakeLists.txt`:
- Around line 76-78: The custom post-build command for target "portenabler" uses
the Unix-only rm executable; replace the raw rm call with CMake's portable file
removal helper by invoking ${CMAKE_COMMAND} -E rm -f so the
add_custom_command(TARGET portenabler POST_BUILD ...) becomes cross-platform;
update the first COMMAND (which currently removes
${PROJECT_SOURCE_DIR}/portenabler.ntkc) to use ${CMAKE_COMMAND} -E rm -f
${PROJECT_SOURCE_DIR}/portenabler.ntkc while leaving the ELFTONTK invocation and
other arguments (${ELFTONTK} -via ${PROJECT_SOURCE_DIR}/portenabler.exp -o
${PROJECT_SOURCE_DIR}/portenabler.ntkc $<TARGET_FILE:portenabler>) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 95da136a-2ec7-4a3d-9256-3d5b53b3966e

📥 Commits

Reviewing files that changed from the base of the PR and between b2fb8ff and 76f6933.

📒 Files selected for processing (9)
  • .github/workflows/rex.yml
  • CMakeLists.txt
  • Drivers/CMakeLists.txt
  • Drivers/EinsteinPortEnabler/CMakeLists.txt
  • Drivers/EinsteinPortEnabler/portenabler.pkg
  • Drivers/README.md
  • Drivers/host/CMakeLists.txt
  • Drivers/target/CMakeLists.txt
  • _Data_/Einstein.rex
💤 Files with no reviewable changes (1)
  • .github/workflows/rex.yml

Comment thread Drivers/EinsteinPortEnabler/CMakeLists.txt
@ekoeppen
ekoeppen force-pushed the rex-build branch 5 times, most recently from 17ecfcf to 09576e2 Compare May 7, 2026 16:06
Use CMake to fetch the NCT headers, DCL, and tntk to enable
building the REx drivers in one go.

Restructure the CMake file to build host and target portions
separately.
@MatthiasWM

Copy link
Copy Markdown
Collaborator

Sorry, I was out for the last two months. I'll try to look into this this weekend ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants