Add QURT to list of HALs we do not build bootloaders for - #33885
Open
peterbarker wants to merge 10 commits into
Open
Add QURT to list of HALs we do not build bootloaders for#33885peterbarker wants to merge 10 commits into
peterbarker wants to merge 10 commits into
Conversation
… blacklist canzero and t3-gem-o1 are AP_HAL_Linux boards, not ChibiOS boards, so they are already added to the bootloader blacklist by the loop which excludes every board whose hal is Linux, ESP32 or SITL. No functional change; the returned set is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The loop which blacklists boards by HAL predates the addition of the QURT HAL, so ModalAI-VOXL2 and ModalAI-VOXL3 were neither excluded by HAL nor named in the explicit blacklist. A bootloader build task was therefore generated for them, which fails; QURT has no bootloader and no hwdef-bl.dat. No QURT board was named in the explicit blacklist, so nothing is removed from there. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
shlex is a character-at-a-time lexer written in Python, and it dominated the cost of processing hwdefs: 65% of the time spent parsing all 443 ChibiOS hwdefs was inside shlex.split(). Almost no hwdef line needs it. A line containing none of shlex's special characters, whose whitespace is only spaces and tabs, is split identically by str.split(); 99.1% of the lines the parser sees qualify. Take that path when it applies and fall back to shlex otherwise. Processing all 443 ChibiOS hwdefs goes from 1.39s to 0.45s. The parse state of all 490 boards, and the hwdef.h, ldscript.ld and hw.dat generated for a sample of 13 boards and their bootloaders, are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
valid_type() rebuilt an 18-entry list of patterns and ran up to 18 uncompiled re.match() calls for every pin line in every hwdef. Compile the alternation once as a class member instead. get_mcu_lib() called importlib.import_module() every time, which is also once per pin line; remember the module we found. Together these take processing all 443 ChibiOS hwdefs from 0.45s to 0.40s. The parse state of all 490 boards is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every line was split into words three times over: once by process_file() to see whether it was an include line, once by the HAL-specific process_line(), and once again by the base process_line() the HAL-specific one delegates to. Have process_line() take the words the caller has already split out, and only split in process_file() for lines which could be an include. That takes the number of splits done to process all 443 ChibiOS hwdefs from 140374 to 56389, and the time from 0.40s to 0.35s. The parse state of all 490 boards, and the hwdef.h, ldscript.ld and hw.dat generated for a sample of 14 boards and their bootloaders, are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
valid_type() still ran nine uncompiled re.match() calls for every pin line, cross-checking the peripheral number in a pin's type against the one in its label. Compile them once as class members. Processing all 443 ChibiOS hwdefs goes from 0.35s to 0.32s. The parse state of all 490 boards is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three places looped over af_labels asking whether a label named an alternative function, and none of them used the entry which matched. str.startswith() takes a tuple of prefixes and does the whole test at once, so ask it that way instead; two of the three are in get_alt_function(), which is called for every pin line. Processing all 443 ChibiOS hwdefs goes from 0.335s to 0.325s. The parse state of all 490 boards is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A board which takes another board's bootloader says so in its own hwdef, so there is no need to name it in the blacklist as well; 23 of the 42 entries were doing that, and each new such board had to be added here by hand. Read the directive with board_list's hwdef_for_board() rather than by matching the hwdef text, so that undefs, overrides and includes are handled the way the build handles them. This became affordable when hwdef processing got faster: parsing all 443 ChibiOS hwdefs takes 0.33s, against the minutes or hours of building which follow. Note that this deliberately does not treat a missing hwdef-bl.dat as meaning a board has no bootloader. A board which needs one but is missing one must fail, not be silently skipped, so those boards stay listed explicitly. The returned set is unchanged: 89 boards, the same 89 as before. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Processing these hwdefs printed "<name> already in defines with same value". In four of them the board repeats a define it has just taken from the hwdef it includes: DAKEFPVH743 DEFAULT_NTF_LED_TYPES from DAKEFPVH743Pro MatekF765-Wing-bdshot DEFAULT_NTF_LED_TYPES from MatekF765-Wing SkystarsH7HDv2 AP_MSP_VIDEOTX_ENABLED from SkystarsH7HD-bdshot TBS_LUCID_H7_WING DEFAULT_NTF_LED_TYPES from TBS_LUCID_H7 and in the other two the same define appears twice in the one file: sparknavi-blue HAL_WITH_RAMTRON esp32diy HAL_LOGGING_BACKENDS_DEFAULT The generated hwdef.h held each of these twice, as an identical redefinition, and now holds it once; the value reaching the compiler is unchanged. hw.dat loses the line too, so it and the ROMFS which embeds it are one line shorter. Parsed state - defines, intdefines, config, pins and the rest - is unchanged for all 490 boards. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Working out the blacklist parses every ChibiOS hwdef, which takes a third of a second, and both build_boards.py and size_compare_branches.py did it while starting up whether or not the run would build a bootloader. Make it a property filled in on first use. All three places which consult it already do so only for the bootloader vehicle, so a run which does not build one now never parses a hwdef for this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
peterbarker
force-pushed
the
pr-claude/bootloader-blacklist-linux-boards
branch
from
July 30, 2026 09:32
a1e2dbb to
dd0440a
Compare
Contributor
Author
|
@khancyr thanks for the review - but I've now kinda extended the scope of this PR somewhat :-)
I'm currently doing a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tweaks the list of boards where bootloader building is blacklisted to exclude QURT
Classification & Testing (check all that apply and add your own)
Description
... also removes a pair of Linux boards - they're already excluded because of their HAL.