feat(firmware): Use user buttons as bootloader force-stay overrides#49
Merged
Conversation
- Interpret each board's user button as the bootloader force-stay input so operators can intentionally remain in DFU instead of auto-jumping to the app. - Keep the user button as the highest-priority veto while the bootloader is running, including across automatic reboot paths.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough引导加载程序新增“强制驻留”检查:在启动时通过板级GPIO多次采样用户按键状态决定是否阻止跳转到应用镜像;C板与RMCS Lite/Pro 各自增加按键映射、初始化与采样实现,并在启动跳转条件中加入该标志。 Changes
Sequence Diagram(s)sequenceDiagram
participant Bootloader as Bootloader
participant BoardGPIO as Board GPIO / IOC
participant Mailbox as Mailbox (host request)
participant Flash as Flash Validator
participant App as Application
Bootloader->>BoardGPIO: 初始化按键引脚并多次采样(250µs 间隔)
BoardGPIO-->>Bootloader: 返回 force_stay (true/false)
Bootloader->>Mailbox: 检查 force_dfu 请求
Mailbox-->>Bootloader: 返回 force_dfu (true/false)
Bootloader->>Flash: 校验应用镜像有效性
Flash-->>Bootloader: 返回 valid (true/false)
alt 条件: not force_stay && not force_dfu && valid
Bootloader->>App: 跳转到应用
else 否则
Bootloader-->>Bootloader: 保持在引导加载程序 / 进入 DFU
end
Estimated code review effort🎯 3 (中等) | ⏱️ ~20 分钟 Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
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.
固件更新:使用用户按钮作为引导程序强制停留覆盖
概述
本次改动将各板的用户按钮作为引导程序(bootloader)“force-stay”输入:在引导阶段按下用户按钮可阻止引导程序自动跳转到应用程序(进入或保持 DFU 模式)。按钮在引导路径上作为最高优先级的否决信号(veto),跳转条件在两个 bootloader 实现中都加入了对该信号的检查,包括通过自动重启回到引导程序的路径。
主要变化
引导程序逻辑
firmware/c_board/bootloader/src/main.cpp
firmware/rmcs_board/bootloader/src/main.cpp
硬件与 BSP(C-Board)
板级实现(RMCS Board:Lite / Pro)
firmware/rmcs_board/boards/lite/board.c / board.h
firmware/rmcs_board/boards/lite/app/board_app.hpp / board_app.cpp
firmware/rmcs_board/boards/pro/board.c / board.h
公共 API 变更
(注意:没有新增其它公共类型或宏,c_board 的更改局限于 main.h/gpio.c 的引脚定义与初始化。)
代码审查注意点
变更量与复杂度