-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Modify the Kconfig name of the mtdconfig module #18120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
====================================================================================
|
boards/risc-v/esp32c3-legacy/esp32c3-legacy-devkit/configs/nvcfgdata/defconfig
Outdated
Show resolved
Hide resolved
f8709c2 to
f67b509
Compare
7f1abc1 to
8463e9a
Compare
change filename mtd/mtd_config_fs.c to mtd/mtd_config_nvs.c and optimize the configuration related to mtdconfig Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
The structure of mtd_config in Kconfig has changed. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
…y_path api mtd_config/mtd_config_nvs should all support mtdconfig_register_by_path/mtdconfig_unregister_by_path api Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
For the MTD_CONFIG configuration item in drivers/mtd/Kconfig has changed. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
change nvs module testcase name TESTING_MTD_CONFIG_FAIL_SAFE to CONFIG_TESTING_MTD_CONFIG_NVS Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
8463e9a to
29acffb
Compare
Note: Please adhere to Contributing Guidelines.
Summary
Modify the Kconfig name of the mtdconfig module
MTD_CONFIG_FAIL_SAFE has been renamed to MTD_CONFIG_NVS, and the Kconfig configuration for MTD_CONFIG submodules has been optimized.
If MTD_CONFIG is enabled, mtd_config.c will be used;
if MTD_CONFIG_NVS is enabled, mtd_config_nvs.c will be used;
if neither is enabled, setting MTD_CONFIG_NONE=y.
These changes are made to facilitate the integration of other mtd_config submodules.
All mtd_config submodules should add the mtdconfig_register_by_path and mtdconfig_unregister_by_path APIs. The new mtdconfig_register_by_path and mtdconfig_unregister_by_path APIs allow dynamic registration and unregistration of mtdconfig devices by device path, improving the flexibility of device management.
The device dependencies have been adjusted: if MTD_CONFIG is required, it now needs to be set with ifndef CONFIG_MTD_CONFIG_NONE, etc.
Impact
These changes significantly improve the usability and maintainability of the mtdconfig subsystem. By supporting device registration and unregistration by path, developers can manage devices more dynamically and flexibly, adapting to a wider range of application scenarios.
The improvements to the Kconfig options make the configuration interface more user-friendly and the dependencies more intuitive, which is helpful for future feature expansion and maintenance. Overall, these patches enhance the flexibility, reliability, and user experience of mtdconfig.
Testing
test it by CICT together with apache/nuttx-apps#3371
I have conducted tests with CFGDATA on QEMU, and the test results are in line with expectations.
enabled these configurations.
CONFIG_MTD_CONFIG_NVS=y
CONFIG_SYSTEM_CFGDATA=y
CONFIG_MTD_CONFIG_NAMED=y
register lomtdconfig
dd if=/dev/zero of=/data/nvs.img bs=8192 count=10
lomtd -c 2 /dev/config /data/nvs.img
test pass
goldfish-armv7a-ap> cfgdata print mykey
Error reading config entry 'mykey'
goldfish-armv7a-ap> cfgdata set mykey "myvalue"
goldfish-armv7a-ap>
goldfish-armv7a-ap> cfgdata print mykey
myvalue
goldfish-armv7a-ap> cfgdata all
Name Len Data
mykey 8 myvalue