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
38 changes: 29 additions & 9 deletions ci/measure_baseline_205.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
3. Probes the resulting firmware.elf for ``.text`` / ``.data`` / ``.bss`` /
``.dmabuffers`` section sizes via ``arm-none-eabi-size`` (preferred for
ARM targets) or ``llvm-size``.
4. Scans compile_commands.json for FNET / Snooze / RadioHead / mbedtls
entries (the libraries that #204 root-caused as wrongly-selected).
4. Scans compile_commands.json for compiled FNET / Snooze / RadioHead /
mbedtls source files (the libraries that #204 root-caused as
wrongly-selected). Counts are by ``file`` field only — never by the
``-I.../libraries/<lib>`` header search-path flag, which is on every
TU regardless of which sources were compiled.

Skipping behaviour:

Expand Down Expand Up @@ -207,7 +210,20 @@ def generate_compdb(project: Path, env: str) -> tuple[bool, str]:

# ── Parsers ──────────────────────────────────────────────────────────────────
def parse_compile_commands(path: Path) -> tuple[Optional[int], dict]:
"""Return (tu_count, excluded_lib_hits)."""
"""Return (tu_count, excluded_lib_hits).

``excluded_lib_hits[lib]`` counts TUs whose ``file`` field is under
``.../libraries/<lib>/`` — i.e. the library actually had a source
file compiled. We deliberately do NOT scan the ``arguments`` /
``command`` fields: the framework's full ``-I.../libraries/<lib>``
flag is propagated to every TU as a header search path, so a naive
substring match would report counts equal to the TU count even
when zero ``<lib>/*.c`` files were compiled.

AC#1 from FastLED/fbuild#205 is "FNET / Snooze / RadioHead /
mbedtls are not compiled" — that question is answered by the
``file`` field alone.
"""
try:
with path.open(encoding="utf-8") as fh:
entries = json.load(fh)
Expand All @@ -222,11 +238,13 @@ def parse_compile_commands(path: Path) -> tuple[Optional[int], dict]:
for entry in entries:
if not isinstance(entry, dict):
continue
haystack = " ".join(
str(entry.get(key, "")) for key in ("file", "directory", "command", "arguments")
)
file_field = entry.get("file")
if not isinstance(file_field, str):
continue
# Normalize separators so the same check works on Windows + Unix.
normalized = file_field.replace("\\", "/")
for needle in EXCLUDED_LIB_NEEDLES:
if needle.lower() in haystack.lower():
if f"/libraries/{needle}/" in normalized:
hits[needle] += 1
return tu_count, hits

Expand Down Expand Up @@ -332,10 +350,12 @@ def render_markdown(results: List[TargetResult], git_sha: str, branch: str, carg
lines.append(f"- {section}: section absent or size tool unavailable")
else:
lines.append(f"- {section}: {value:,} bytes")
lines.append("- Excluded library hits in compile_commands.json:")
lines.append(
"- Excluded-library source files compiled (AC#1 must be 0 for all):"
)
for needle in EXCLUDED_LIB_NEEDLES:
count = r.excluded_lib_hits.get(needle, 0)
label = "not present" if count == 0 else f"{count} entries"
label = "0 (not compiled)" if count == 0 else f"{count} TU(s) compiled"
lines.append(f" - {needle}: {label}")
if r.notes:
lines.append(f"- Notes: {r.notes}")
Expand Down
46 changes: 23 additions & 23 deletions tasks/baseline-205.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Baseline measurements for #205

Captured: 2026-05-10T15:14:08Z
Git SHA: fffb1b4cc6389942bf63cc2ae0f01e65484e10fe
Branch: chore/fix-baseline-205-teensylc-env
Captured: 2026-05-10T15:40:43Z
Git SHA: 52b517511baeba28344e8cb7630aa4772e8420ac
Branch: chore/baseline-205-tighten-excluded-libs-scan
Tooling: cargo 1.94.1 (29ea6fb6a 2026-03-24), size tool: arm-none-eabi-size.exe

Generated by `uv run python ci/measure_baseline_205.py`. See module docstring for methodology.
Expand All @@ -16,11 +16,11 @@ Generated by `uv run python ci/measure_baseline_205.py`. See module docstring fo
- .data: 380 bytes
- .bss: 1,068 bytes
- .dmabuffers: 192 bytes
- Excluded library hits in compile_commands.json:
- FNET: 68 entries
- Snooze: 68 entries
- RadioHead: 68 entries
- mbedtls: not present
- Excluded-library source files compiled (AC#1 must be 0 for all):
- FNET: 0 (not compiled)
- Snooze: 0 (not compiled)
- RadioHead: 0 (not compiled)
- mbedtls: 0 (not compiled)

## teensy30 / Blink

Expand All @@ -31,11 +31,11 @@ Generated by `uv run python ci/measure_baseline_205.py`. See module docstring fo
- .data: 272 bytes
- .bss: 1,120 bytes
- .dmabuffers: 248 bytes
- Excluded library hits in compile_commands.json:
- FNET: 68 entries
- Snooze: 68 entries
- RadioHead: 68 entries
- mbedtls: not present
- Excluded-library source files compiled (AC#1 must be 0 for all):
- FNET: 0 (not compiled)
- Snooze: 0 (not compiled)
- RadioHead: 0 (not compiled)
- mbedtls: 0 (not compiled)

## teensy41 / Blink

Expand All @@ -46,11 +46,11 @@ Generated by `uv run python ci/measure_baseline_205.py`. See module docstring fo
- .data: 3,776 bytes
- .bss: 1,664 bytes
- .dmabuffers: section absent or size tool unavailable
- Excluded library hits in compile_commands.json:
- FNET: 85 entries
- Snooze: 85 entries
- RadioHead: 85 entries
- mbedtls: not present
- Excluded-library source files compiled (AC#1 must be 0 for all):
- FNET: 0 (not compiled)
- Snooze: 0 (not compiled)
- RadioHead: 0 (not compiled)
- mbedtls: 0 (not compiled)

## stm32f103c8 / Blink

Expand All @@ -60,11 +60,11 @@ Generated by `uv run python ci/measure_baseline_205.py`. See module docstring fo
- .text: 12,192 bytes
- .data: 240 bytes
- .bss: 1,012 bytes
- Excluded library hits in compile_commands.json:
- FNET: not present
- Snooze: not present
- RadioHead: not present
- mbedtls: not present
- Excluded-library source files compiled (AC#1 must be 0 for all):
- FNET: 0 (not compiled)
- Snooze: 0 (not compiled)
- RadioHead: 0 (not compiled)
- mbedtls: 0 (not compiled)

## Build status

Expand Down
Loading