You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You have signed the CLA already but the status is still pending? Let us recheck it.
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!
为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).
设置需排除的文件/目录(目录请以"/"结尾)
Set files/directories to exclude (directories should end with "/")
将目标分支设置为 \ Set the target branch to:master
设置PR number为 \ Set the PR number to:11378
等待工作流完成 | Wait for the workflow to complete
格式化后的代码将自动推送至你的分支。
The formatted code will be automatically pushed to your branch.
完成后,提交将自动更新至 master 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the master branch automatically, and the related Pull Request will be updated.
如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!
O-O-BOOK
changed the title
custom_fee v0.1
[feat][component] custom_fee v0.1
May 8, 2026
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
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.
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
本 PR 引入并完善了一个新的独立组件
custom_fee。它面向嵌入式场景下“少量 block 化数据需要可靠持久化到 flash”的需求,用来承接配置参数、标定数据、状态快照等非易失数据,而不是让业务层直接处理裸 flash record、掉电恢复、GC 和版本回滚。从设计目标上看,这个组件并不是要替代通用 KV 数据库,而是要解决固定逻辑块持久化场景下,通用方案常见的两个痛点:
FlashDB KVDB一类通用 KV 机制,降低 GC 被动触发、整 sector 扫描、逐条物理记录搬运带来的长尾问题这个组件主要解决以下问题:
如果目标问题是“FlashDB 在固定 block 存储场景下 GC 偏慢、上电读 block 偏慢”,那么这套
custom_fee的设计方向就是针对这两个问题给出专用解法,而不是继续在通用 KV 模型上做局部修补。custom_fee当前的核心机制如下:cur/prev地址和状态,读路径先查 cache,再按地址读 payload,避免反复全盘扫描rollback,也在当前副本异常时保留降级读取机会CKPT_READY阶段提前可读,剩余 tail 再后台补扫到FULL_READYFAST / NORMAL / BULKlane,把高频小数据和低频大数据隔离,减少相互干扰read走同步路径,write/invalidate/rollback走调度队列并由fee_mainfunction()推进,兼顾读延迟确定性和后台擦写调度fee_flash_driver_*接口,上层逻辑不关心底层接的是 RAM mock、QEMU 还是实际 flash/FLS 驱动因此,这个 PR 不只是“加几个测试”或“适配一个 BSP”,而是把
custom_fee作为一个可独立接入、可独立验证、可继续迁移到真实硬件的 FEE 组件完整落地出来。你的解决方案是什么 (what is your solution)
components/custom_fee文档整理到components/custom_fee/doc/,补充README、对外 API、on-flash 格式、checkpoint/cache、启动恢复、调度/GC、配置规则、端口适配和诊断测试说明fee_flash_driver_*驱动抽象;fee_port.c仅保留薄封装,默认提供 weak 的 RAM mock backend,板级工程可通过 strong definition 覆盖为真实 flash/FLS 驱动bsp/qemu-vexpress-a9打开custom_fee组件,使用 RAM mock flash 完成 bring-up 和回归验证fee_test.c,补充custom_fee_test/custom_fee_diag_test场景,覆盖 block 写入、读回、rollback、invalidate、重新初始化恢复read/write/erase/poll的真实访问次数与字节数统计fee_api.h使用 FEE;后续迁移到真实硬件时,仅需按统一接口实现fee_flash_driver_*请提供验证的bsp和config (provide the config and bsp)
bsp/qemu-vexpress-a9CONFIG_COMPONENT_USING_CUSTOM_FEE=yCONFIG_CUSTOM_FEE_MOCK_FLASH_SIZE=0xA0000scons -j8编译通过custom_fee_testcustom_fee_diag_testN/A(本次为本地 QEMU 验证,未提供个人 fork action 链接)]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up