Skip to content

chore: drop the 64-bit division and keep INFO_UF2.TXT text in flash only - #74

Merged
jamesarich merged 2 commits into
masterfrom
fix/startup-timer-32bit
Oct 25, 2026
Merged

jamesarich merged 2 commits into
masterfrom
fix/startup-timer-32bit

Conversation

@jamesarich

@jamesarich jamesarich commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Checklist

  • PR title specifically describes the change
  • tools/build_all.py (or CI's board matrix) passes

Description of Change

About 980 B smaller on every board, no behavior change. APP_TIMER_TICKS was the only 64-bit division in the image and pulled in __udivmoddi4; the startup timeout is now computed in 32 bits with the same rounding for any timeout under 131 s. The 384 B INFO_UF2.TXT buffer was initialized data, so its text sat in flash and RAM; it is now built at runtime from a const string, which also makes uf2_init safe to call twice.

No 64-bit division symbols remain on any board. Tested merged on four boards: the 3 s UF2 timeout behaves as before and INFO_UF2.TXT reads correctly.

Summary by CodeRabbit

  • Improvements
    • Serial DFU startup timing retains the same rounding for timeouts under 131 seconds.
    • UF2 drive information continues to include its standard text and SoftDevice details.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5bba8b1-4a42-453a-b21f-ddc26158fceb
Commits

Reviewing files that changed from the base of the PR and between ed0aaff and bb12eea.

Files selected for processing: 2
  • lib/sdk11/components/libraries/bootloader_dfu/bootloader.c
  • src/usb/uf2/ghostfat.c

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f5a4b61-e01c-4293-9e6e-b34171eaf364
Commits

Reviewing files that changed from the base of the PR and between d4f5dda and ed0aaff.

Files selected for processing: 2
  • lib/sdk11/components/libraries/bootloader_dfu/bootloader.c
  • src/usb/uf2/ghostfat.c

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Serial DFU startup now calculates timeout ticks with integer arithmetic. UF2 initialization now copies its base information text into the information buffer before appending SoftDevice information.

Changes: Serial DFU timeout

Layer / File(s) Summary
Convert serial DFU timeout
lib/sdk11/components/libraries/bootloader_dfu/bootloader.c
For nonzero timeouts, the timer tick calculation now uses (timeout_ms * 32768u + 500u) / 1000u instead of APP_TIMER_TICKS(timeout_ms).

UF2 information initialization

Layer / File(s) Summary
Initialize UF2 information buffer
src/usb/uf2/ghostfat.c
The base UF2 information text is now held in infoUf2Text and copied into infoUf2File during uf2_init() before SoftDevice information is appended.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: hathach

Merge Risk: Minimal · up to ed0aa

No concrete merge-blocking risk remains in the reviewed changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two changes in the PR: dropping the 64-bit division in the startup-timeout calculation and keeping INFO_UF2.TXT text in flash only. The raw summary confirms both changes in bootloa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two changes in the PR: dropping the 64-bit division in the startup-timeout calculation and keeping INFO_UF2.TXT text in flash only. The raw summary confirms both changes in bootloader.c and ghostfat.c. The title is specific and accurate, and it follows a conventional commit style. It uses the term 'chore:' prefix, which is acceptable. The title is 72 characters, slightly above the usual 50-72 range, but it is still readable.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the timer’s pace,
Then copies text into its place.
The UF2 words are set in line,
SoftDevice details join in time.
Two small changes, the boot steps flow,
And off through fields the rabbits go.

Comment @coderabbitai help to get the list of available commands.

@jamesarich jamesarich changed the title fix(dfu): compute the startup timeout ticks in 32 bits chore: drop the 64-bit division and keep INFO_UF2.TXT text in flash only Oct 24, 2026
@jamesarich

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

APP_TIMER_TICKS is 64-bit and pulls __udivmoddi4 into the image for one
call site. The 32-bit form gives the same tick count for any timeout under
131 s.
@jamesarich
jamesarich force-pushed the fix/startup-timer-32bit branch from ed0aaff to bb12eea Compare October 25, 2026 22:41
@jamesarich
jamesarich added this pull request to the merge queue Oct 25, 2026
Merged via the queue into master with commit fa3faff Oct 25, 2026
23 checks passed
@jamesarich
jamesarich deleted the fix/startup-timer-32bit branch October 25, 2026 22:46
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