Skip to content

builder: explain builds that do not fit in the board's memory - #260

Open
delilzagros wants to merge 1 commit into
ArduPilot:mainfrom
delilzagros:flash-overflow-hint
Open

delilzagros wants to merge 1 commit into
ArduPilot:mainfrom
delilzagros:flash-overflow-hint

Conversation

@delilzagros

Copy link
Copy Markdown

Fixes #114 (also the report in #152).

When the selected features make the firmware too big for the board, the build currently fails with only a linker error buried in the log:

ld: region `flash' overflowed by 4232 bytes

Users don't know what that means or that deselecting features fixes it.

What this does

After the build step, the builder scans the build log for GNU ld's region ... overflowed by N bytes error. If it finds one, it appends a plain message at the end of the log, where users look first:

BUILD FAILED: the firmware is 4232 bytes too large for the board's flash memory. Deselect some features and build again.
  • If several regions overflow, flash is reported (that is the one users can fix by removing features); otherwise the region is named, e.g. 'ram0'.
  • Nothing changes for successful builds or for other kinds of failures. The message does not contain Total Flash Used, so the progress updater still marks the build as FAILURE.

The parsing is a small pure function (memory_overflow_hint) so it can be tested without running a build.

Testing

  • New tests/builder/test_memory_overflow_hint.py (8 tests): successful build, unrelated compiler error, flash overflow with size, largest of several overflows, flash preferred over RAM, other region named, straight quotes, and a check that the hint never contains Total Flash Used.
  • pytest tests/builder: 11 passed. flake8 .: 0 errors.
  • I did not run a full build on a real server; the linker line in the test is the standard GNU ld message.

AI assistance

This PR was prepared with AI assistance (Claude): it read the builder and progress updater, wrote the change and the tests, and ran pytest and flake8. I reviewed the change before opening this PR and I'm responsible for it.

When the selected features make the firmware too big, the build failed
with only a linker error in the log (region `flash' overflowed by N
bytes). After the build step, look for that error and append a plain
message to the build log: how many bytes too large, and that
deselecting features fixes it.

Fixes ArduPilot#114
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.

Builds that do not fit within the FC's flash should produce a better failure message

1 participant