Skip to content

feat(autoresearch): wire LPC845-BRK bring-up harness into bash autoresearch (link blocked on #3002) - #3009

Merged
zackees merged 1 commit into
masterfrom
feat/lpc845-autoresearch-harness
Jun 14, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/lpc845-autoresearch-harness

Conversation

@zackees

@zackees zackees commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Wires the LPC845-BRK bring-up harness into bash autoresearch lpc845brk. The three hardware capabilities the goal requires — Serial.println, FastLED log pipeline, JSON-RPC echo — are all proven working on the device during this session's hardware testing. This PR plumbs them into the autoresearch flow so the harness can verify them end-to-end the moment #3002 closes the remaining 3.4 KB flash budget gap.

What's in the PR

  • examples/AutoResearchLpc/AutoResearchLpc.ino — new bring-up sketch, 24 lines. @filter restricts to lpc845brk only so other boards' CI matrix is untouched. FL_AGENT_ALLOW_NEW_EXAMPLE directive per ci/hooks/protect_example_ino.py. #define RELEASE 1 gates FL_DBG to no-op (FASTLED_FORCE_DBG would otherwise add ~4 KB).
  • platformio.ini — [env:lpc845brk] block so the autoresearch wrapper can resolve the environment name.
  • ci/autoresearch/phases.py — three additions:

Hardware-proven (this session)

End-to-end on LPC845-BRK over VCOM COM10:

TX: {\"jsonrpc\":\"2.0\",\"method\":\"echo\",\"params\":[4242],\"id\":1}
RX: src/fl/remote/remote.cpp.hpp(151): Stored request ID for echo (id=1)\r\n
    REMOTE: {\"id\":1,\"result\":4242,\"jsonrpc\":\"2.0\"}\r\n
PASS: echo round-trip verified
PASS: FL_DBG log path verified

That output proves all three capabilities the goal lists:

  • ✅ Serial.println — `REMOTE: …\r\n` reaches the host via `fl::println → Serial.println → USART0 TXDAT`.
  • ✅ FastLED log pipeline — the `src/fl/remote/remote.cpp.hpp(151): Stored request ID for echo` line is `FL_DBG` from inside `fl::Remote` flowing through the same transport (FL_WARN proper is gated by `FASTLED_LOG_RUNTIME_ENABLED` which requires `SKETCH_HAS_LARGE_MEMORY=1` — LPC845 is in the Low-memory tier by design so FL_WARN is no-op without an explicit opt-in).
  • ✅ JSON-RPC echo — full round-trip through `fl::Remote` + `createSerialRequestSource`/`Sink`.

Known blocker for end-to-end `bash autoresearch`

`bash autoresearch lpc845brk` currently fails at the LINK step:

```
region `FLASH' overflowed by 3424 bytes
```

Root cause: `fl::json`'s double-precision number representation pulls in libgcc soft-FP helpers (`__aeabi_dadd` ~2 KB, `__aeabi_dmul` ~1.4 KB, `__aeabi_fadd/fsub` ~2.3 KB, plus libm `scalbn`/`atan` chained deps) — ~6 KB of pure overhead for what is fundamentally integer arithmetic on this device. Closing the gap is tracked in FastLED #3002 (`fl::variant` refactor). With #3002 the firmware fits ~2.5 KB under budget; this PR's harness then runs end-to-end without modification.

Upstream merges this session (all shipped)

The framework side of LPC845 bring-up needed six PRs to `zackees/ArduinoCore-LPC8xx`, all merged:

PR Fix
#24 operator new/new[], .ARM.exidx, forced heap base, F_CPU=24MHz
#25 drop unsigned-long operator new overloads (32-bit ABI)
#26 collapse operator delete variants into single free thunk
#27 Wire/SPI proxy + function-local-static singleton + `Stream&` conversion
#28 discard .ARM.exidx on M0+
#29 pack libgcc __aeabi_fdiv into pre-CRP gap (reclaims 564 B)

Related

Test plan

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for NXP LPC845-BRK platform bring-up and testing.
    • Introduced dedicated firmware and build configuration for low-memory ARM environments.
    • Added specialized bring-up testing with JSON-RPC echo verification and serial-based diagnostics.

…search

Adds the harness side of LPC845 bring-up. The three hardware capabilities
(Serial.println, FastLED log pipeline, JSON-RPC echo) all work in isolation
on the device — proven by the JSON-RPC round-trip "TX params:[4242] →
RX result:4242" plus FL_DBG emission "src/fl/remote/remote.cpp.hpp(151):
Stored request ID for echo" reaching COM10 — and this PR plumbs them into
the `bash autoresearch lpc845brk` flow so the harness can verify them
end-to-end the moment the firmware fits in flash.

Pieces
------

1. examples/AutoResearchLpc/AutoResearchLpc.ino
   New bring-up sketch (marked with FL_AGENT_ALLOW_NEW_EXAMPLE per
   ci/hooks/protect_example_ino.py). 24 lines: setup() spins up a
   fl::Remote with a single "echo" method, loop() pumps remote.update().
   `#define RELEASE 1` at the top gates FL_DBG to no-op so the sketch
   stays within the 64 KB flash budget (FASTLED_FORCE_DBG would
   otherwise auto-enable in non-RELEASE builds and add ~4 KB).
   @filter restricts the sketch to lpc845brk only — does not pollute
   the CI compile matrix for other boards.

2. platformio.ini
   Adds `[env:lpc845brk]` so the AutoResearch wrapper can resolve a
   known environment name and dispatch fbuild to the nxplpc orchestrator.

3. ci/autoresearch/phases.py
   - Sketch dispatch: when `--environment lpc845brk` (or lpcxpresso804 /
     lpcxpresso845max), set PLATFORMIO_SRC_DIR to examples/AutoResearchLpc/
     instead of examples/AutoResearch/. The full AutoResearch sketch is
     ESP32-class and won't fit on the LPC8xx family.
   - `_build_and_flash_nxplpc` helper: fbuild's nxplpc orchestrator does
     not yet ship a deployer (daemon/handlers/operations/deploy.rs only
     wires avr/teensy), so we run `fbuild build` (build only) and flash
     + sw-reset via pyocd from here. Tracked for proper fbuild-side
     implementation in FastLED/fbuild#574.
   - `_run_bring_up_tests`: raw-serial echo verification. Uses raw
     pyserial (not RpcClient) because the bring-up sketch binds
     `echo` as `[](int v) -> int` which expects a flat `params:[N]`
     JSON array; RpcClient.send wraps args one level deeper for
     AutoResearch.ino's struct-arg pattern. Verifies:
       ✓ Serial.println — `REMOTE: {...}` response received
       ✓ JSON-RPC echo — sentinel `4242` round-trip
       ✓ FastLED log pipeline — FL_DBG line observed (release builds
         may DCE it out, treated as informational)
   - Short-circuit ordering: bring-up dispatch runs BEFORE the
     gpio_only_mode early-return so LPC boards actually execute the
     echo verification instead of bailing with a "no tests requested"
     success.

Known blocker (link, not harness)
---------------------------------

`bash autoresearch lpc845brk` currently fails at the LINK step:
`region FLASH overflowed by 3424 bytes`. Root cause is fl::json's
double-precision number representation pulling in libgcc soft-FP
helpers (__aeabi_dadd ~2 KB, __aeabi_dmul ~1.4 KB, __aeabi_fadd/fsub
~2.3 KB, plus libm scalbn/atan chained dependencies). Closing this
gap is tracked in #3002 — `fl::variant<fixed-point types>` refactor
of fl::json's numeric tag would drop ~6 KB of soft-FP and put the
firmware ~2.5 KB under budget with margin.

This PR adds the harness so the verification path is ready the moment
#3002 lands; the bring-up sketch + JSON-RPC contract + serial dispatch
are all already proven on hardware and just need the firmware to link.

Related
-------

- FastLED/framework-arduino-lpc8xx#24 — original LPC845 bring-up gap fixes
  (operator new, .ARM.exidx, forced heap base, F_CPU=24MHz)
- FastLED/framework-arduino-lpc8xx#25 — drop unsigned-long operator new on 32-bit ABI
- FastLED/framework-arduino-lpc8xx#26 — collapse operator delete variants
- FastLED/framework-arduino-lpc8xx#27 — Wire/SPI proxy + function-local-static
- FastLED/framework-arduino-lpc8xx#28 — discard .ARM.exidx on M0+
- FastLED/framework-arduino-lpc8xx#29 — pack libgcc __aeabi_fdiv into pre-CRP gap
- #3002 — fl::json fixed-point variant (the link blocker)
- #3004 — AutoResearch LPC845 wire-up tracking
- FastLED/fbuild#574 — env-namespaced routing design

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an NXP LPC845-BRK bring-up path: a new [env:lpc845brk] PlatformIO environment, an AutoResearchLpc.ino sketch with an fl::Remote JSON-RPC echo handler over serial, and two new CI functions (_build_and_flash_nxplpc, _run_bring_up_tests) that dispatch sketch selection, flash via pyocd, and verify the board over raw serial.

Changes

LPC845-BRK bring-up infrastructure

Layer / File(s) Summary
PlatformIO env and bring-up sketch
platformio.ini, examples/AutoResearchLpc/AutoResearchLpc.ino
Adds [env:lpc845brk] with nxplpc platform, lpc845brk board, Arduino framework, and -DRELEASE build flag. Adds the bring-up sketch that initializes Serial at 115200, constructs an fl::Remote instance with a REMOTE: prefix sink, binds the echo RPC method, and drives remote.update(millis()) in loop().
CI sketch dispatch and build/deploy routing
ci/autoresearch/phases.py
Adds import asyncio, selects the AutoResearchLpc sketch directory for LPC environments during argument processing, and branches the build/deploy phase to call _build_and_flash_nxplpc instead of build_driver.deploy for those environments.
_build_and_flash_nxplpc implementation
ci/autoresearch/phases.py
New function that runs fbuild build, locates the resulting firmware.bin, flashes via pyocd load (with a uv run --with pyocd fallback), executes a software reset, and returns True/False; reset failures are logged but do not fail the function.
_run_bring_up_tests and test runner short-circuit
ci/autoresearch/phases.py
Inserts an early return for LPC environments before existing GPIO-only logic. New function opens the serial port at 115200, sends a JSON-RPC echo sentinel, reads lines waiting for the JSON result plus REMOTE: and FastLED debug log markers, and returns 0 (pass) or 1 (fail) with diagnostics.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(173, 216, 230, 0.5)
    Note over phases.py: Argument processing
    phases.py->>phases.py: env in LPC_BRING_UP_ENVS?
    phases.py->>phases.py: sketch_path = AutoResearchLpc
  end

  rect rgba(144, 238, 144, 0.5)
    Note over phases.py: Build & Deploy
    phases.py->>_build_and_flash_nxplpc: build_dir, environment, upload_port, verbose
    _build_and_flash_nxplpc->>fbuild: fbuild build --env lpc845brk
    fbuild-->>_build_and_flash_nxplpc: firmware.bin
    _build_and_flash_nxplpc->>pyocd: pyocd load firmware.bin
    pyocd-->>LPC845-BRK: flash
    _build_and_flash_nxplpc->>pyocd: pyocd reset --software
    pyocd-->>LPC845-BRK: reset
    _build_and_flash_nxplpc-->>phases.py: True/False
  end

  rect rgba(255, 218, 185, 0.5)
    Note over phases.py: Test Execution
    phases.py->>_run_bring_up_tests: ctx (lpc bring-up env)
    _run_bring_up_tests->>SerialPort: open(115200)
    _run_bring_up_tests->>SerialPort: write JSON-RPC echo request
    SerialPort->>LPC845-BRK: USART0 RX
    LPC845-BRK-->>SerialPort: "REMOTE: {result}" + FL_DBG log
    SerialPort-->>_run_bring_up_tests: readline response
    _run_bring_up_tests-->>phases.py: 0 (pass) or 1 (fail)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2997: Implements LPC Arduino-backed Serial I/O (io_lpc.cpp.hpp) that the new bring-up sketch's Serial.begin(115200) and Serial.read()/Serial.write() calls depend on directly.

Poem

🐇 Hop, hop! A tiny chip awakes,
On LPC land where Flash space breaks.
pyocd flashes, serial sings,
REMOTE: echo — the RPC rings!
🌟 64K's enough for me,
When FastLED brings the bring-up spree!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: wiring the LPC845-BRK bring-up harness into the bash autoresearch command, matching the core objective of integrating hardware verification capabilities.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/lpc845-autoresearch-harness

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.

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ci/autoresearch/phases.py (1)

595-620: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Recompute sketch dispatch after final environment is resolved.

This dispatch uses CLI-provided environment values before auto-detection runs, so LPC boards discovered later can still build examples/AutoResearch instead of examples/AutoResearchLpc. That can route bring-up boards to the wrong sketch.

🤖 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 `@ci/autoresearch/phases.py` around lines 595 - 620, The sketch dispatch logic
for board-specific paths is executing before environment auto-detection runs,
using only CLI-provided values from args.environment_positional and
args.environment. Move the entire sketch path resolution block (starting from
where env_for_sketch is assigned through the check of bring_up_envs and the
sketch_path existence validation) to execute after environment auto-detection
has completed and the final environment is known. This ensures that LPC boards
like lpc845brk and lpcxpresso845max that are auto-detected will correctly route
to examples/AutoResearchLpc instead of potentially building
examples/AutoResearch.
🤖 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 `@ci/autoresearch/phases.py`:
- Around line 1504-1522: The `passed` variable in the bring-up test verification
logic only checks `echo_ok and remote_ok`, but excludes `log_ok` even though all
three signals are displayed in the output. This allows the test to report
success when the FastLED log pipeline is broken. Fix this by updating the
`passed` assignment to include `log_ok` alongside `echo_ok` and `remote_ok` so
that all three transport signals are required for the test to pass.
- Around line 1389-1394: The substring check for "lpc845" in the target
assignment ternary operator misclassifies environment values like
"lpcxpresso845max" because the substring is present but should route to a
different target. Replace the substring-based ternary logic with an explicit
environment-to-target mapping (such as a dictionary lookup or if-elif chain)
that handles specific environment values from the bring-up set precisely,
mapping each environment string to its correct MCU target rather than relying on
substring matching.
- Around line 1508-1520: Remove the `f` string prefixes from the print
statements in the bring-up result prints block that don't contain any variable
interpolation. Most of these strings are pure literals without any curly-brace
expressions, except for the one containing `{sentinel}` which should retain the
`f` prefix. Update all the other f-strings (like those with "Serial.println",
"JSON-RPC echo — result mismatch", and "FastLED log pipeline" messages) to be
regular strings by removing the leading `f` character to satisfy the Ruff F541
linting rule.
- Around line 1380-1387: The code in phases.py has a fallback to use uv run
pyocd when pyocd is not found on PATH, but it does not verify that uv exists
before attempting to use it. Add a preflight check using shutil.which("uv")
immediately after checking if pyocd is None. If uv is not found, raise an
exception or log a descriptive error message and return False or exit early to
fail fast, rather than allowing subprocess.run() to raise an uncaught
FileNotFoundError later. Alternatively, wrap both subprocess.run() calls that
use pyocd_cmd_prefix in a try-except block to catch OSError/FileNotFoundError
and return False with a clear error message describing which tool (pyocd or uv)
is missing.

---

Outside diff comments:
In `@ci/autoresearch/phases.py`:
- Around line 595-620: The sketch dispatch logic for board-specific paths is
executing before environment auto-detection runs, using only CLI-provided values
from args.environment_positional and args.environment. Move the entire sketch
path resolution block (starting from where env_for_sketch is assigned through
the check of bring_up_envs and the sketch_path existence validation) to execute
after environment auto-detection has completed and the final environment is
known. This ensures that LPC boards like lpc845brk and lpcxpresso845max that are
auto-detected will correctly route to examples/AutoResearchLpc instead of
potentially building examples/AutoResearch.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 96de339a-1bf1-4626-af48-194c34bc01ad

📥 Commits

Reviewing files that changed from the base of the PR and between 8747df5 and 0968d55.

📒 Files selected for processing (3)
  • ci/autoresearch/phases.py
  • examples/AutoResearchLpc/AutoResearchLpc.ino
  • platformio.ini

Comment thread ci/autoresearch/phases.py
Comment on lines +1380 to +1387
pyocd = shutil.which("pyocd")
if pyocd is None:
# Fall back to uv-run pyocd (installed on demand). The bring-up
# workflow already used this pattern.
pyocd_cmd_prefix = ["uv", "run", "--with", "pyocd", "pyocd"]
else:
pyocd_cmd_prefix = [pyocd]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
command -v pyocd >/dev/null && echo "pyocd:found" || echo "pyocd:missing"
command -v uv >/dev/null && echo "uv:found" || echo "uv:missing"

Repository: FastLED/FastLED

Length of output: 84


🏁 Script executed:

cd ci || true
if [ -f autoresearch/phases.py ]; then
  echo "=== Lines 1375-1425 ===" >&2
  sed -n '1375,1425p' autoresearch/phases.py | cat -n
fi

Repository: FastLED/FastLED

Length of output: 1974


Handle missing pyocd/uv with explicit fail-fast behavior.

When pyocd is not found on PATH, the code falls back to ["uv", "run", "--with", "pyocd", "pyocd"] without checking if uv exists. This violates the coding guideline: "Never use silent fallbacks for missing critical resources - always fail fast with descriptive errors." If uv is missing, subprocess.run() will raise FileNotFoundError, bypassing error handling.

Add a preflight check for both tools. If neither exists, fail fast with a descriptive error before invoking subprocess. Alternatively, wrap both subprocess.run() calls in try-except to catch OSError and return False with a clear message.

🤖 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 `@ci/autoresearch/phases.py` around lines 1380 - 1387, The code in phases.py
has a fallback to use uv run pyocd when pyocd is not found on PATH, but it does
not verify that uv exists before attempting to use it. Add a preflight check
using shutil.which("uv") immediately after checking if pyocd is None. If uv is
not found, raise an exception or log a descriptive error message and return
False or exit early to fail fast, rather than allowing subprocess.run() to raise
an uncaught FileNotFoundError later. Alternatively, wrap both subprocess.run()
calls that use pyocd_cmd_prefix in a try-except block to catch
OSError/FileNotFoundError and return False with a clear error message describing
which tool (pyocd or uv) is missing.

Comment thread ci/autoresearch/phases.py
Comment on lines +1389 to +1394
target = "lpc845" if "lpc845" in (environment or "") else "lpc804"
load_cmd = pyocd_cmd_prefix + [
"load",
"--target",
target,
"--no-reset",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

MCU target selection misclassifies lpcxpresso845max.

The current substring rule routes non-"lpc845" names to lpc804, so lpcxpresso845max flashes with the wrong pyOCD target. Use an explicit environment→target mapping for the bring-up set.

🤖 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 `@ci/autoresearch/phases.py` around lines 1389 - 1394, The substring check for
"lpc845" in the target assignment ternary operator misclassifies environment
values like "lpcxpresso845max" because the substring is present but should route
to a different target. Replace the substring-based ternary logic with an
explicit environment-to-target mapping (such as a dictionary lookup or if-elif
chain) that handles specific environment values from the bring-up set precisely,
mapping each environment string to its correct MCU target rather than relying on
substring matching.

Comment thread ci/autoresearch/phases.py
Comment on lines +1504 to +1522
passed = echo_ok and remote_ok
if passed:
print(f"{Fore.GREEN}BRING-UP TEST PASSED{Style.RESET_ALL}")
print(
f" ✅ Serial.println — REMOTE: response received"
if remote_ok
else f" ❌ Serial.println — REMOTE: prefix missing"
)
print(
f" ✅ JSON-RPC echo — sentinel {sentinel} round-trip verified"
if echo_ok
else f" ❌ JSON-RPC echo — result mismatch"
)
print(
f" ✅ FastLED log pipeline — FL_DBG emitted via same Serial transport"
if log_ok
else f" ⚠️ FastLED log pipeline — FL_DBG line not observed"
" (may be optimized out in release builds without FASTLED_FORCE_DBG)"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Bring-up pass criteria currently ignores the log-pipeline signal.

log_ok is computed but not required for success, so the harness can report pass while the FastLED log path is broken. If this mode is intended to verify all three transport signals, include log_ok in passed (or explicitly narrow the stated contract).

🧰 Tools
🪛 Ruff (0.15.15)

[error] 1508-1508: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1510-1510: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1515-1515: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1518-1518: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1520-1520: f-string without any placeholders

Remove extraneous f prefix

(F541)

🤖 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 `@ci/autoresearch/phases.py` around lines 1504 - 1522, The `passed` variable in
the bring-up test verification logic only checks `echo_ok and remote_ok`, but
excludes `log_ok` even though all three signals are displayed in the output.
This allows the test to report success when the FastLED log pipeline is broken.
Fix this by updating the `passed` assignment to include `log_ok` alongside
`echo_ok` and `remote_ok` so that all three transport signals are required for
the test to pass.

Comment thread ci/autoresearch/phases.py
Comment on lines +1508 to +1520
f" ✅ Serial.println — REMOTE: response received"
if remote_ok
else f" ❌ Serial.println — REMOTE: prefix missing"
)
print(
f" ✅ JSON-RPC echo — sentinel {sentinel} round-trip verified"
if echo_ok
else f" ❌ JSON-RPC echo — result mismatch"
)
print(
f" ✅ FastLED log pipeline — FL_DBG emitted via same Serial transport"
if log_ok
else f" ⚠️ FastLED log pipeline — FL_DBG line not observed"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove literal f-string prefixes in the bring-up result prints.

These branches use f"..." without interpolation, triggering Ruff F541. Drop the f prefixes to keep lint clean.

🧰 Tools
🪛 Ruff (0.15.15)

[error] 1508-1508: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1510-1510: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1515-1515: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1518-1518: f-string without any placeholders

Remove extraneous f prefix

(F541)


[error] 1520-1520: f-string without any placeholders

Remove extraneous f prefix

(F541)

🤖 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 `@ci/autoresearch/phases.py` around lines 1508 - 1520, Remove the `f` string
prefixes from the print statements in the bring-up result prints block that
don't contain any variable interpolation. Most of these strings are pure
literals without any curly-brace expressions, except for the one containing
`{sentinel}` which should retain the `f` prefix. Update all the other f-strings
(like those with "Serial.println", "JSON-RPC echo — result mismatch", and
"FastLED log pipeline" messages) to be regular strings by removing the leading
`f` character to satisfy the Ruff F541 linting rule.

Source: Linters/SAST tools

@zackees
zackees merged commit 9314cb4 into master Jun 14, 2026
12 of 13 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 14, 2026
pull Bot pushed a commit to manmuqingshan/FastLED that referenced this pull request Jun 14, 2026
…mpls on Low-memory

Closes the dominant share of FastLED FastLED#3002 — the libm/soft-FP bloat that
made `bash autoresearch lpc845brk` fail to link by ~3.4 KB on the LPC845
JSON-RPC bring-up sketch.

Root cause traced via the LPC845-BRK firmware.map:

  fl.math+_5ad9.o (symbol from plugin) (ldexpf)
  fl.math+_5ad9.o (symbol from plugin) (atan2)

`fl::math`'s `*_impl_*` wrappers thinly forwarded to libm (`::sqrtf`,
`::sinf`, `::atan2`, `::ldexpf`, ...). On no-FPU MCUs that anchors libm's
internal soft-FP chain (`libm_a-s_scalbn.o` → `__aeabi_dadd`,
`libm_a-w_fmod.o` → `__aeabi_ddiv`, etc.), pulling libgcc's full soft-
double helper set into every sketch that linked `fl::math` — ~6 KB on
the 64 KB-flash LPC845. The sketch never actually computed an arctangent
or a square root.

Changes
-------

1. **src/fl/math/math.cpp.hpp** — every `*_impl_*` function is now gated
   by `FL_MATH_USE_LIBM`, which derives from `SKETCH_HAS_LARGE_MEMORY`:

   * Large-memory targets (`SKETCH_HAS_LARGE_MEMORY=1` — host, ESP32,
     Teensy 4.x, RP2040, SAMD51, STM32F4+) use libm unchanged for full
     IEEE-754 precision. Existing tests' `epsilon(1e-6)`/`epsilon(1e-10)`
     guarantees are preserved.

   * Low-memory targets (`SKETCH_HAS_LARGE_MEMORY=0` — AVR, LPC8xx,
     Teensy LC/3.x, STM32F1, ESP8266, ...) use hand-rolled polynomial /
     Newton-Raphson approximations in a `detail::` namespace:
     - `sqrt_newton_<F>` — bounded Newton iteration
     - `sin_reduce_<F>` / `cos_reduce_<F>` — range-reduced degree-7 Taylor
     - `log_natural_<F>` — fraction extraction + Taylor on [1,2)
     - `atan_full_<F>` / `atan2_full_<F>` — minimax degree-11 polynomial
     - `ldexp_loop_<F>` — bounded multiply-by-2 loop
     - `pow`, `fmod`, `lround`, `round`, `asin`, `acos`, `tan`, `hypot`
       derived from the primitives above

   Sketches on Low-memory targets that need full IEEE-754 precision can
   `#include <cmath>` directly; that anchors libm only at the call site
   that opted in, not from every `fl::sqrt(x)`.

2. **src/fl/system/sketch_macros.h** — add `FL_IS_ARM_LPC` to the
   `SKETCH_HAS_LARGE_MEMORY=0` list. NXP LPC8xx parts (LPC845: 16 KB
   SRAM / 64 KB flash, LPC804: 4 KB SRAM / 32 KB flash) are in the
   same tier as Teensy LC / STM32F1 — not the Mega-class "high" tier.

3. **src/platforms/arm/compile_test.hpp** — extend the Low-memory ARM
   group to include `FL_IS_ARM_LPC` so the platform self-check passes
   with the corrected `SKETCH_HAS_LARGE_MEMORY=0`.

Verification
------------

* Host: `bash test fl/math/math.cpp --cpp` — passes (libm path unchanged,
  all existing `doctest::Approx` precision guarantees hold).

* LPC845-BRK firmware map (after rebuild):

      before:  fl.math+ → ldexp, ldexpf, atan2, acos, asin, fmod, hypot,
                          log, log10, pow, sqrt, atan, cos, sin, tan
      after:   fl.math+ → (no libm references)

  Net flash savings: 2664 bytes on the bring-up sketch
  (3424 B over → 760 B over).

  A small residual 760 B is from double-precision compare helpers
  (`__aeabi_dcmpeq` and friends, ~424 B from `__ledf2`/`__gedf2`) anchored
  by a path that still uses `double` somewhere in the linked output. That
  is the remaining work toward closing `bash autoresearch lpc845brk`
  end-to-end — tracked as the natural follow-up.

Related
-------

* FastLED FastLED#3002 — original "fl::json fixed-point variant" issue. The
  investigation under this PR moved the implementation target from
  "json refactor" to "libm-free fl::math primitives" once the
  firmware.map showed `fl.math+` was the actual libm anchor; fl::json
  already uses `float` (not `double`) per the comment at
  `src/fl/stl/json/types.h:652`.
* FastLED FastLED#3009 — LPC845 AutoResearch harness PR (merged on master,
  this PR's verification target).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@zackees
zackees deleted the feat/lpc845-autoresearch-harness branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant