build(ci): Select build mode and artifact suffix by version#65
Conversation
Make CI SDK and firmware packaging choose release or debug automatically from the generated project version. Stable numeric versions use release presets with no artifact suffix, while prerelease or dirty versions use debug presets and append -debug to packaged outputs. Keep debug builds optimized with -O3 and control debug assertions with LIBRMCS_DEBUG_ASSERTS so assertion behavior matches the selected build mode.
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough该 PR 将调试断言开关从 Changes核心断言逻辑迁移
固件端调试断言接入
host 打包与 Docker 构建流水线
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
firmware/c_board/cmake/gcc-arm-none-eabi.cmake (1)
30-33: 🚀 Performance & Scalability | 🔵 TrivialDebug 构建改用 -O3,符合 PR 目标;提醒潜在调试体验影响。
调整符合本 PR "keeps debug builds optimized with -O3" 的目标。需注意
-O3会导致部分变量被优化掉或代码重排,调试时单步执行、变量查看可能与源码行为不完全对应,建议在文档或提交说明中提示使用者该权衡。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@firmware/c_board/cmake/gcc-arm-none-eabi.cmake` around lines 30 - 33, The CMAKE debug flag changes in gcc-arm-none-eabi.cmake already match the PR goal, but the debug-optimized behavior should be documented. Update the relevant user-facing note or build documentation to mention that CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG now use -O3 -g3, and briefly call out the expected tradeoff that variables may be optimized away and stepping may not exactly match source; reference the debug/release flag definitions in the gcc-arm-none-eabi.cmake configuration when updating the description.firmware/c_board/bootloader/src/utility/assert.hpp (1)
3-6: 📐 Maintainability & Code Quality | 🔵 Trivial断言分支切换逻辑正确,但与 rmcs_board 版本完全重复。
#if LIBRMCS_DEBUG_ASSERTS/#error逻辑正确,且用assert_always/[[assume(...)]]区分调试与发布行为符合预期。但此文件与firmware/rmcs_board/bootloader/src/utility/assert.hpp内容完全一致,两处需要同步维护,后续若断言逻辑再变更容易遗漏其中一处。可考虑将该断言实现提取到firmware/common下的共享头文件,供两个 bootloader 复用。Also applies to: 16-22
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@firmware/c_board/bootloader/src/utility/assert.hpp` around lines 3 - 6, 此处的断言实现与 rmcs_board 版本完全重复,需要避免两处同步维护带来的遗漏风险。请把 assert.hpp 中的断言分支逻辑抽到 firmware/common 下的共享头文件,并让 bootloader 的 assert.hpp 通过该共享实现复用;保留现有 LIBRMCS_DEBUG_ASSERTS、assert_always 和 [[assume(...)]] 的行为不变。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@host/CMakeLists.txt`:
- Around line 175-186: `CPACK_PACKAGE_FILE_NAME` in `host/CMakeLists.txt` uses a
suffix rule based only on an exact "release" match, which is inconsistent with
how `LIBRMCS_DEBUG_ASSERTS` treats Release-like builds. Update the packaging
logic around the `PACKAGE_BUILD_MODE` / `CPACK_PACKAGE_FILE_NAME` block so
`Release`, `RelWithDebInfo`, and `MinSizeRel` are all treated as non-debug and
generate the same no-suffix package name, while only debug-style build modes
keep a build-mode suffix.
---
Nitpick comments:
In `@firmware/c_board/bootloader/src/utility/assert.hpp`:
- Around line 3-6: 此处的断言实现与 rmcs_board 版本完全重复,需要避免两处同步维护带来的遗漏风险。请把 assert.hpp
中的断言分支逻辑抽到 firmware/common 下的共享头文件,并让 bootloader 的 assert.hpp 通过该共享实现复用;保留现有
LIBRMCS_DEBUG_ASSERTS、assert_always 和 [[assume(...)]] 的行为不变。
In `@firmware/c_board/cmake/gcc-arm-none-eabi.cmake`:
- Around line 30-33: The CMAKE debug flag changes in gcc-arm-none-eabi.cmake
already match the PR goal, but the debug-optimized behavior should be
documented. Update the relevant user-facing note or build documentation to
mention that CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG now use -O3 -g3, and
briefly call out the expected tradeoff that variables may be optimized away and
stepping may not exactly match source; reference the debug/release flag
definitions in the gcc-arm-none-eabi.cmake configuration when updating the
description.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ae82d4be-d917-422b-a448-dab2485829ad
📒 Files selected for processing (13)
Dockerfile.build_firmwareDockerfile.build_sdkcore/src/utility/assert.hppcore/src/utility/stack_allocator.hppfirmware/c_board/CMakeLists.txtfirmware/c_board/bootloader/src/utility/assert.hppfirmware/c_board/cmake/gcc-arm-none-eabi.cmakefirmware/common/cmake/librmcs_firmware.cmakefirmware/rmcs_board/CMakeLists.txtfirmware/rmcs_board/app/CMakeLists.txtfirmware/rmcs_board/bootloader/CMakeLists.txtfirmware/rmcs_board/bootloader/src/utility/assert.hpphost/CMakeLists.txt
Make CI SDK and firmware packaging choose release or debug automatically from the generated project version. Stable numeric versions use release presets with no artifact suffix, while prerelease or dirty versions use debug presets and append -debug to packaged outputs.
Keep debug builds optimized with -O3 and control debug assertions with LIBRMCS_DEBUG_ASSERTS so assertion behavior matches the selected build mode.
本次变更将 CI SDK 与固件打包流程从固定的
release模式,改为根据项目版本自动选择构建模式:release预设,产物保持无后缀命名debug预设,产物统一追加-debug同时将调试断言控制从
NDEBUG迁移到显式的LIBRMCS_DEBUG_ASSERTS,并把该配置贯穿到 SDK、host、rmcs_board 与 c_board 的 CMake/编译定义中。相关断言实现、栈分配器以及固件/bootloader 构建逻辑都随之切换到新的开关。另外,debug 构建保持
-O3优化,并同步调整了相关打包文件名规则,使发布包与调试包命名更清晰一致。