Repository navigation
espressif: fix bootloader build when UF2_DETECTION_DELAY_MS is 0 - #8
Merged
Merged
Conversation
The detection loop compared the delay macro with an unsigned elapsed time: `UF2_DETECTION_DELAY_MS > (esp_log_early_timestamp() - tm_start)`. With the macro set to 0, as the intechstudio_grid and intechstudio_knot boards do, that is `0 > unsigned`, which the ESP-IDF v6.1 toolchain rejects: bootloader_start.c:246:45: error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits] Compare against a variable, so a zero delay still runs the detection once and every other value behaves as before. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The variable alone fixes the type-limits error, flipping the comparison was not needed. Restore `delay > elapsed` so the change to the loop is just the macro replaced by the variable. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Problem
masterhas been red since the upstream merge (#6): theintechstudio_gridandintechstudio_knotESP jobs fail withBoth boards set
UF2_DETECTION_DELAY_MS 0, so the loop conditionUF2_DETECTION_DELAY_MS > (esp_log_early_timestamp() - tm_start)becomes0 > unsigned, which the ESP-IDF v6.1 toolchain (GCC 15.2) turns into an error. All other boards use 500 or 1000 and are not affected.Fix
Compare the elapsed time with a
uint32_t constcopy of the macro. A zero delay still runs the detection once (the loop is ado/while), and every other value behaves as before.Test plan
-std=gnu23 -Wall -Wextra -Werror): the old condition fails to compile with delay 0, the new one compiles clean for 0, 1 and 500.claude/testandpre-commit run --all-filesintechstudio_gridandintechstudio_knotjobs should turn green🤖 Generated with Claude Code