Skip to content

espressif: fix bootloader build when UF2_DETECTION_DELAY_MS is 0 - #8

Merged
SukuWc merged 2 commits into
masterfrom
fix/espressif-zero-detection-delay
Oct 19, 2026
Merged

SukuWc merged 2 commits into
masterfrom
fix/espressif-zero-detection-delay

Conversation

@SukuWc

@SukuWc SukuWc commented Oct 19, 2026

Copy link
Copy Markdown
Member

Problem

master has been red since the upstream merge (#6): the intechstudio_grid and intechstudio_knot ESP jobs fail with

ports/espressif/bootloader_components/main/bootloader_start.c:246:45:
error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits]

Both boards set UF2_DETECTION_DELAY_MS 0, so the loop condition UF2_DETECTION_DELAY_MS > (esp_log_early_timestamp() - tm_start) becomes 0 > 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 const copy of the macro. A zero delay still runs the detection once (the loop is a do/while), and every other value behaves as before.

Test plan

  • Reproduced with GCC 15.2 (-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/test and pre-commit run --all-files
  • ESP-IDF jobs (need CI's docker image); the intechstudio_grid and intechstudio_knot jobs should turn green

🤖 Generated with Claude Code

SukuWc and others added 2 commits October 19, 2026 14:47
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>
@SukuWc
SukuWc merged commit 5bd28c3 into master Oct 19, 2026
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.

1 participant