Skip to content

fix(nrf52840): disable LTO on three Adafruit-BSP boards (arm-gnu 15.2 bug) (fixes #2653) - #2654

Merged
zackees merged 1 commit into
masterfrom
fix/nrf52840-disable-lto-arm-gnu-15.2
May 31, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/nrf52840-disable-lto-arm-gnu-15.2

Conversation

@zackees

@zackees zackees commented May 31, 2026 •

Copy link
Copy Markdown
Member

Summary

Root cause

Identical signature on all three failing runs:

.lto-tmp/cc<random>.s:NNNN: Error: offset out of range
build error: build failed: arm-none-eabi-gcc link failed
lto-wrapper: fatal error: arm-none-eabi-gcc returned 1 exit status

The Adafruit BSP at 1.10601.0 brings in enough core code that the LTO-merged TU exceeds Thumb-2 branch reach across function boundaries — exact same toolchain bug PR #2642 documented for xiaoblesense_adafruit and PR #2644 mirrored for xiaoblesense.

Scope discipline

  • NICE_NANO_NRF52840 and NRFMICRO_NRF52840 use the same BSP + toolchain but currently pass — left alone (don't disable LTO pre-emptively on green builds; risks size regressions). Re-apply only when they fail.

Test plan

  • nrf52840_dk workflow goes green post-merge.
  • adafruit_feather_nrf52840_sense workflow goes green post-merge.
  • nrf52840_supermini workflow goes green post-merge.
  • Existing-green nice_nano_nrf52840, nrfmicro_nrf52840 builds remain green.

Fixes #2653

🤖 Generated with Claude Code

Summary by CodeRabbit

Bug Fixes

  • Fixed compilation errors on three nRF52840-based boards (Adafruit Feather nRF52840 Sense, nRF52840, SuperMini nRF52840) enabling successful project builds and deployment on these platforms.

… bug)

The arm-gnu-toolchain 15.2.rel1 + Adafruit nRF52 BSP combination
produces "offset out of range" assembler errors in the LTO temp file
during link, the same bug that hit xiaoblesense_adafruit (#2641 /
PR #2642). The non-Seeed nRF52840 boards have now crossed the same
threshold:

  .lto-tmp/ccEo9QPb.s:13834: Error: offset out of range
  ...
  build error: build failed: arm-none-eabi-gcc link failed
  lto-wrapper: fatal error: arm-none-eabi-gcc returned 1 exit status

Apply the same `-fno-lto` workaround to:

- NRF52840 (board_name="nrf52840_dk")
- ADA_FEATHER_NRF52840_SENSE (board_name="adafruit_feather_nrf52840_sense")
- SUPERMINI_NRF52840 (board_name="supermini_nrf52840")

NICE_NANO_NRF52840 and NRFMICRO_NRF52840 use the same toolchain but
are currently passing — leave them alone (don't pre-emptively disable
LTO on passing builds; size regressions). Re-apply only when/if they
fail.

Fixes #2653
@coderabbitai

coderabbitai Bot commented May 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 20afcbc8-a2a3-4776-b4c2-93f46383d0c4

📥 Commits

Reviewing files that changed from the base of the PR and between 715b73a and 1a32e42.

📒 Files selected for processing (1)
  • ci/boards.py

📝 Walkthrough

Walkthrough

Three nRF52840-based board definitions in ci/boards.py are updated to disable link-time optimization via build_unflags and build_flags to resolve an arm-gnu 15.2 LTO assembler offset overflow issue. The same pattern is applied to ADA_FEATHER_NRF52840_SENSE, NRF52840, and SUPERMINI_NRF52840.

Changes

LTO workaround for nRF52840 boards

Layer / File(s) Summary
LTO disable on nRF52840 board definitions
ci/boards.py
ADA_FEATHER_NRF52840_SENSE, NRF52840, and SUPERMINI_NRF52840 board definitions each add build_unflags=["-flto"] and build_flags=["-fno-lto"] to disable link-time optimization and resolve arm-gnu 15.2 assembler offset out-of-range errors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

  • FastLED/FastLED#2641: Issue documenting the original arm-gnu 15.2 LTO offset overflow bug and template fix that was applied to xiaoblesense_adafruit first.

Possibly related PRs

  • FastLED/FastLED#2644: Applies the same LTO disable workaround to XIAOBLESENSE_NRF52 using the identical build_unflags=["-flto"] and build_flags=["-fno-lto"] pattern for the same arm-gnu 15.2 issue.

Poem

🐰 Three boards were failing, caught in LTO's snare,
So we disabled the beast with a compiler's care,
-fno-lto whispers, the offset now clear,
nRF52840 breathes easy—no more fear!

🚥 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 clearly and specifically identifies the main change: disabling LTO on three Adafruit-BSP nRF52840 boards to fix an arm-gnu 15.2 bug, with direct reference to the issue number.
Linked Issues check ✅ Passed All code changes directly address issue #2653: three nRF52840 boards receive build_unflags and build_flags modifications matching the exact fix requested.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the three failing boards mentioned in #2653; no changes to other boards like NICE_NANO_NRF52840 or NRFMICRO_NRF52840, respecting stated scope discipline.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 fix/nrf52840-disable-lto-arm-gnu-15.2

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.

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.

nrf52840_dk / adafruit_feather_nrf52840_sense / nrf52840_supermini red: arm-gnu 15.2 LTO offset overflow

1 participant