New feature#45
Conversation
A parameter value change detection function, par_is_value_changed, protected by the conditional compilation macro PAR_CFG_NVM_EN, has been added. This function is used to determine whether the parameter value has changed. Meanwhile, this function has been integrated into the par_check_table_validy function, and corresponding preprocessing directives for inclusion control have been added.
|
feat(core): Add compile-time initialization for parameter defaults Why to submit this PR
|
feat(core): Add configurable F32 parameter supportWhy to submit this PRCurrently, the F32 type capability in the parameter management module is built - in by default, lacking an independent configuration switch. As a result, it is impossible to trim the support for the F32 type according to product resource constraints or actual requirements. To enhance the configurability and scalability of the module, this PR adds a configurable interface for the F32 type, allowing users to decide whether to enable F32 type support through configuration items while keeping the existing behavior under the default configuration unchanged. What is your solutionThis PR adds a configuration item
The goal of this modification is to add the configurable capability for the F32 type to the parameter module rather than change the default behavior. When the configuration is not modified, the system behavior remains the same as before. Please provide the config and bsp
|
feat(core): Make validation and change callbacks configurableThis PR adds two independently configurable runtime capability settings for
By configuring the macros, you can control whether to enable the runtime validation callback and parameter change callback. The default values are both enabled to maintain the existing default behavior.
|
refactor(API): Replace generic parameter macros with typed wrappersWhy submit this pull request?
|
feat(core): Add raw reset-all API for parameter managerWhy to submit this PR
|
refactor(core): Move parameter ID map checks to compile timeWhy to submit this PR
|
fix(parameters): Correct typed getter/setter error handlingPull/merge request description: (PR description)Why to submit this PR
|
- keep public fast setter names unchanged - restore PAR_CFG_ENABLE_RESET_ALL_RAW fast path in par_set_all_to_default() - return correct status when reset-all uses raw path - collapse validation helpers into metadata/runtime variants - remove redundant outer NULL checks and centralize validation - use bitwise compare for F32 change detection - remove legacy persistant compatibility API - update comments and API docs to match current behavior
fix(API): Correct runtime validation and F32 change detectionSummaryThis PR tightens the parameter module public API behavior and aligns implementation with the intended contract. Main changes:
How to testRecommended verification:
Related issues
Review / Merge checklist
|
- remove #include "par_if_port.c" from the core interface layer - provide weak default implementations in parameters/src/par_if.c - compile port/par_if_port.c as a normal translation unit - guard the RT-Thread port backend with PAR_CFG_IF_PORT_EN
refactor(core): Clarify hook contract and make bitwise fast setters f…SummaryThis PR tightens the public contract around parameter hooks and simplifies bitwise fast setter semantics. What changed
Files changed
How to test
Notes
Related Linear tickets, Github issues, and Community forum postsReview / Merge checklist
|
refactor(core): Unify checked setter flow and fast default restoreSummaryThis PR aligns parameter write semantics across the public setter APIs, default restore path, and NVM restore path. What changed
Behavioral impact
How to test
Related Linear tickets, Github issues, and Community forum postsReview / Merge checklist
|
docs(API): Convert comments to Doxygen format and align with clang-fo…Summary
How to test
Related Linear tickets, Github issues, and Community forum postsReview / Merge checklist
|
refactor(core): Decouple par_nvm from concrete storage backendSummaryIntroduce a pluggable parameter-storage backend for NVM persistence. What changed
How to test
Related Linear tickets, Github issues, and Community forum postsReview / Merge checklist
|
refactor(core): Reorganize parameter manager source tree and sync docsSummaryReorganize the parameters module source tree into layered subdirectories and What changed
WhyThis makes the module structure closer to its actual responsibilities: How to test
Related Linear tickets, Github issues, and Community forum postsReview / Merge checklist
|
fix(core)!: Rework parameter NVM header and CRC serializationSummaryRework parameter NVM persistence metadata handling:
How to test
Important compatibility noteThis PR changes the serialized NVM metadata format and byte-order assumptions. Related issuesReview / Merge checklist
|
fix(core): Stabilize persistent slot mapping for parameter NVMSummaryIntroduce a compile-time persistent slot index for parameter definitions and use that slot mapping in the NVM persistence path. Main changes:
How to test:
Related Linear tickets, Github issues, and Community forum postsReview / Merge checklist
|
feat[NVM]: add selectable persistent record layoutsPR Message(PR description)[ (why to submit this PR)The current parameter persistence path uses one built-in record format, and the backend selection and record-layout selection are not exposed as clear packaged configuration choices.
你的解决方案是什么 (what is your solution)This PR introduces the following changes:
] |
add packaged backend and persisted record-layout selection in Kconfig split layout-specific serialization logic out of par_nvm.c into dedicated implementations include selected record layout in table-id compatibility checks and update related docs
…outs add fixed and grouped payload-only NVM record layouts relax the NVM dependency on runtime parameter IDs and move compatibility checks to stored-prefix based table-id calculation update Kconfig, build selection, persistence flow, and documentation to cover no-ID layouts, prefix append handling, and backend constraints
introduce a configurable NVM write readback verification path for records and headers move layout-specific address, validation, compatibility, and compare logic behind layout ops document the new write verification flow and clarify that ECC handling policy belongs to the business layer
add a portable flash emulated EEPROM backend core for parameter persistence document flash-ee recovery, cache window, and integration constraints
extend par_table.def rows with read_roles/write_roles and add role policy config add role-aware metadata helpers and explicit access capability checks sync package documentation with the updated access and role policy behavior
refactor(core): Abstract parameter manager atomic operations
Why to submit this PR
Currently, the
autogen_parameter_managerinpar.cdirectly depends on<stdatomic.h>and the C11 atomic interfaces, includingatomic_load_explicit,atomic_store_explicit,atomic_fetch_and_explicit, andatomic_fetch_or_explicit.Although this implementation can function properly, it also has several issues:
stdatomic.h.Therefore, this PR is submitted to abstract and encapsulate the atomic operations of the parameter management module, enabling it to support two implementation methods: the C11 backend and the port backend, and reducing the direct dependence of the business code on the underlying atomic implementation details.
What is your solution
This PR mainly makes the following adjustments:
par_atomic.hunderThird_Party/autogen_parameter_manager/parameters/src/as the unified abstract header file for atomic operations in the parameter management module.<stdatomic.h>inpar.cand replace it with includingpar_atomic.h._Atomicto the abstracted type aliases, including:par_atomic_u8_tpar_atomic_i8_tpar_atomic_u16_tpar_atomic_i16_tpar_atomic_u32_tpar_atomic_i32_tpar_atomic_f32_tPAR_ATOMIC_LOADPAR_ATOMIC_STOREPAR_ATOMIC_FETCH_ANDPAR_ATOMIC_FETCH_ORpar_atomic.h:PAR_ATOMIC_BACKEND_C11PAR_ATOMIC_BACKEND_PORTPAR_ATOMIC_BACKEND_C11is used.par_atomic.h:f32__atomic_load/__atomic_store, but migrate this part of the implementation from the business code to the unified abstraction layer to reduce the internal complexity ofpar.c.PAR_ATOMIC_BACKEND_PORTis selected, includepar_atomic_port.hThrough these adjustments, the business logic of the parameter management module is decoupled from the underlying atomic mechanism, the code structure becomes clearer, and better scalability and maintainability are provided for the adaptation of different compilers and platforms.
Provide the config and bsp
BSP:
bsp/stm32/stm32l496 - st - nucleo..config:
action:
feat(parameter): Add parameter value change detection function
A parameter value change detection function, par_is_value_changed, protected by the conditional compilation macro PAR_CFG_NVM_EN, has been added. This function is used to determine whether the parameter value has changed. Meanwhile, this function has been integrated into the par_check_table_validy function, and corresponding preprocessing directives for inclusion control have been added.
perf(core): Optimize parameter ID lookup with hash map
Why to submit this PR
When the current parameter management module searches for parameters by using the
id, it usually needs to traverse the entire parameter configuration table and convert the external parameter ID into the internalpar_num.This linear search method will result in higher search overhead when the number of parameters increases, and it will also affect the access efficiency in the following scenarios:
Furthermore, the current implementation fails to clearly convey the design intention of the parameter ID, the distinction between
par_numandid, and lacks a systematic explanation for the ID lookup mechanism, which makes it difficult for future maintenance and external integration.Therefore, this PR is submitted to add an ID lookup mechanism based on a hash table to the parameter module, and to supplement the relevant design documentation for explanation.
What is your solution?
This PR mainly made the following adjustments:
In
README.md, add a parameter identification design description to clearly distinguish:par_num: Internal parameter index, used for efficient internal access within the firmware;id: External parameter identifier, used for external access via CLI, upper-level machine tools, communication protocols, etc.README.md, including:par.c: -PAR_ID_HASH_GOLDEN_RATIO_32PAR_ID_HASH_MIN_BUCKETSPAR_ID_HASH_BITSPAR_ID_HASH_SIZEpar_id_map_entry_tg_par_id_map[]gb_par_id_map_readypar_hash_id()has been added, which is used to map parameter IDs to fixed bucket indexes;par_build_and_validate_id_map()has been added. During the initialization stage, it performs the following tasks:ID -> par_num;par_check_table_validy():par_init()andpar_deinit():gb_par_id_map_ready = trueafter successful initializationpar_get_num_by_id():par_numusing a hash bucket;Through the above adjustments, the runtime overhead of the parameter module for ID-based lookup has been significantly reduced. This is particularly suitable for scenarios where there are a large number of parameters and they are frequently accessed through external IDs. At the same time, the new implementation maintains the characteristics of simple runtime logic and strong determinacy.
Please provide the verified bsp and config (provide the config and bsp)
Please enter the verified BSP path, for example,
bsp/stm32/stm32l496-st-nucleoPlease fill in the relevant configuration items used for verifying the parameter management module.
Please fill in the link of the CI/Action chain triggered by your own warehouse PR branch.
refactor(core): Convert parameter table to X-Macro definition
Why to submit this PR
Currently, the parameter definitions of
autogen_parameter_managerare scattered across multiple files and templates, resulting in duplicate maintenance issues among parameter enumerations, parameter tables, and template examples.This approach has the following drawbacks:
const void *, and the type information is not clear enough.Therefore, by submitting this PR, the parameter table is restructured into a single-source X-Macro format, and additional compile-time integer range checks and type-checking interfaces are added, thereby enhancing the maintainability, consistency, and readability of the module.
What is your solution?
This PR mainly made the following adjustments:
Add
parameters/src/par_def.has the core header file for parameter definitions:par_table.def;par_num_t;parameters/src/par_def.cas the file for parameter table definition implementation:par_table.def;g_par_table[]uniformly;par_cfg_get_table(),par_cfg_get(), andpar_cfg_get_table_size().parameters/template/par_table.deftmp:template/par_def.ctmptemplate/par_def.htmpConverge the original decentralized definition method to the new single-table-driven method;
par_def.c:min < max,def >= min, anddef <= maxchecks for parameters of typesU8/U16/U32/I8/I16/I32;F32type to avoid issues where some embedded/old GCC toolchains have unstable handling of static floating-point assertions.par.c, retain the runtime range check forF32, while removing the runtime range assertion for integer types to avoid redundant checks;par_check_table_validy()is corrected topar_check_table_validity()par_cfg_twith a named structure: -typedef struct par_cfg_s { ... }It is convenient for forward declaration to be used in conjunction with typed interfaces;
par_cfg.h, change the parameter table access interface fromconst void *to a strongly typed return value: -const par_cfg_t * par_cfg_get_table(void);const par_cfg_t * par_cfg_get(const par_num_t par_num);par.c, simplify the corresponding call synchronously:par_get_config()no longer requires explicit type conversion;PAR_STATIC_ASSERTmacro definition by adding a closing semicolon when expanded, so that the syntax at the calling location becomes more consistent.Through the above adjustments, the parameter definition has been changed from multiple repetitive maintenance to a single factual source of
par_table.def.Parameter enumeration, parameter table initialization, and compile-time verification of integer parameters can all be automatically generated from the same data.
This can significantly reduce maintenance costs and improve the timing of discovering configuration errors as well as the overall consistency of the code.
Please provide the verified bsp and config (provide the config and bsp)
Please enter the verified BSP path, for example,
bsp/stm32/stm32l496-st-nucleoPlease fill in the link of the CI/Action chain triggered by your own warehouse PR branch.
feat(core): Make parameter metadata and ID APIs configurable
Why to submit this PR
The current parameter management module by default always includes metadata such as range, name, unit, desc, id, access, and persist, along with corresponding interfaces.
In scenarios where resources are limited or only the minimum functionality set is required, this can result in unnecessary code size, static data usage, and runtime verification overhead.
Therefore, this PR was submitted to add customizable configurations to the parameter management module, enabling different projects to selectively enable or disable relevant metadata and features as needed.
What is your solution?
This PR adds a set of configurable macros to the parameter module, and based on this, it conditionally compiles and trims the struct fields, auxiliary types, validation logic, runtime hash table, and external APIs.
The main changes are as follows:
par_cfg.h: -PAR_CFG_ENABLE_RANGEPAR_CFG_ENABLE_NAMEPAR_CFG_ENABLE_UNITPAR_CFG_ENABLE_DESCPAR_CFG_ENABLE_IDPAR_CFG_ENABLE_ACCESSPAR_CFG_ENABLE_PERSISTPAR_CFG_ENABLE_DESC_COMMA_CHECKPAR_CFG_NVM_EN = 1, it requiresPAR_CFG_ENABLE_ID = 1PAR_CFG_NVM_EN = 1, it requiresPAR_CFG_ENABLE_PERSIST = 1par.h: -par_range_tOptional fields in
par_cfg_t-par_set_by_id/par_get_by_idpar_get_name/par_get_range/par_get_unit/par_get_descpar_get_access/par_is_persistantpar_get_num_by_id/par_get_id_by_numpar_save_by_idpar.c, perform configuration-based trimming of the relevant implementations:PAR_CFG_ENABLE_IDis enabled.*_fastwrite interfaces directly write data whenPAR_CFG_ENABLE_RANGEis disabled, and no range checks are performed.par_def.c, initialize the fields of the parameter table and perform compile-time checks according to the configuration:RANGEis enabledThis modification can provide better modularity and portability flexibility for the parameter module while maintaining the default behavior unchanged.
Please provide the verified bsp and config (provide the config and bsp)
bsp/stm32/stm32l496-st-nucleo]PAR_CFG_ENABLE_RANGE=0PAR_CFG_ENABLE_ID=0PAR_CFG_ENABLE_NAME=0PAR_CFG_ENABLE_UNIT=0PAR_CFG_ENABLE_DESC=0PAR_CFG_ENABLE_ACCESS=0PAR_CFG_ENABLE_PERSIST=0.configoption you are using.feat(core): Add overridable parameter description validation hook
Why to submit this PR
The current validation logic for the parameter description field is hardcoded directly within the module, and only the comma character is prohibited.
Although this implementation can meet the basic constraints of the CSV/CLI toolchain, it lacks flexibility. The application layer cannot expand or replace the validity rules for the description field according to its own needs.
Furthermore, the current configuration item
PAR_CFG_ENABLE_DESC_COMMA_CHECKhas an overly specific name, which no longer accurately conveys the more general capability of "description validity check".What is your solution?
This PR has changed the parameter description verification mechanism from the fixed "prohibit commas" rule to an extensible description validity verification hook, and has simultaneously updated the relevant documentation explanations.
The main changes are as follows:
par_port_is_desc_valid(),;par_port_is_desc_valid()strchr(desc, ',');PAR_CFG_ENABLE_DESC_COMMA_CHECKPAR_CFG_ENABLE_DESC_CHECKRaise the configuration semantics from "whether to check commas" to "whether to enable description validity check".
4. Update README document
Explain that the runtime verification is now accomplished through
par_port_is_desc_valid();Clarify that the default weak implementation only prohibits
,;Explain that the application can override this interface to customize the description verification strategy;
Synchronously correct the document title hierarchy and configuration item descriptions.
This modification maintains the default compatibility behavior while enhancing the modularity's portability and scalability.
Please provide the verified bsp and config (provide the config and bsp)
BSP:
No specific BSP was involved. The current changes are located in the common module code and documentation of
Third_Party/autogen_parameter_manager/parameters..config:
PAR_CFG_ENABLE_DESCPAR_CFG_ENABLE_DESC_CHECKaction:
Please fill in the CI/Action link corresponding to your personal branch.
refactor(core): Replace dynamic parameter storage with static layout
Why submit this PR
Currently, the parameter management module dynamically allocates runtime storage space for parameters via
mallocduring the initialization phase. Meanwhile, it undertakes responsibilities such as parameter grouping statistics, offset calculation, and storage binding withinpar.c.This implementation has the following issues:
Therefore, this PR is submitted to refactor the parameter storage layout, introduce an independent
layoutabstraction, and use static storage to replace runtime dynamic allocation.What is your solution
The main changes in this PR are as follows:
par_layout.c/par_layout.hto abstract the parameter storage layout capabilities:PAR_CFG_LAYOUT_COMPILE_SCANandPAR_CFG_LAYOUT_SCRIPT.par.c:par_allocate_ram_space().par_bind_storage_layout().malloc.gu32_par_offsetwithpar_layout_get_offset_table():u8/i8,u16/i16,u32/i32/f32are consistent.par_def.h:par_cfg.h:PAR_ALIGNOFabstraction.PAR_CFG_LAYOUT_SOURCEconfiguration item.PAR_CFG_LAYOUT_STATIC_INCLUDEconfiguration item.Overall, this modification decouples the "layout calculation" and "value access" of the parameter module, and changes the runtime dynamic allocation to static grouped storage, improving the determinacy and maintainability in embedded usage scenarios.
Please provide the verified BSP and config
Third_Party/autogen_parameter_manager/parametersgeneral parameter module layer.bsp/stm32/stm32l496 - st - nucleoPAR_CFG_LAYOUT_SOURCE = PAR_CFG_LAYOUT_COMPILE_SCANPAR_CFG_ENABLE_IDPAR_CFG_ENABLE_PERSISTdocs(core): Reorganize parameter module documentation and layout model
Why to submit this PR
There are two types of problems in the current parameter module:
par.c. The responsibilities for parameter grouping statistics, offset generation, and storage binding are highly coupled, which is not conducive to maintenance and expansion.README.md, with excessive content. This is not only unfavorable for the initial access but also inconvenient for developers to search for the architecture, interfaces, and integration methods by topic.Furthermore, the original implementation dynamically allocates the parameter live storage at runtime, which introduces uncertainty in memory usage in embedded scenarios and is not conducive to improving system predictability.
Therefore, this PR is submitted to conduct a structured organization of the parameter module:
What is your solution?
This PR mainly accomplished the following tasks:
New addition: -
src/par_layout.csrc/par_layout.hIt is used to uniformly manage the storage layout of parameters, including:
PAR_CFG_LAYOUT_COMPILE_SCANPAR_CFG_LAYOUT_SCRIPTThis separates the layout responsibilities that were originally scattered in
par.cinto a separate module, thereby reducing the coupling degree.2. Replace runtime dynamic allocation with static grouping storage
In
par.c:par_allocate_ram_space()par_bind_storage_layout()gs_par_u8_storagegs_par_u16_storagegs_par_u32_storageAnd access the parameter values through the offset table returned by the layout layer.
The benefits of doing this are:
malloc;To support the sharing of the same static storage area by different atomic types, this PR has added:
u8/i8,u16/i16,u32/i32,f32;PAR_ALIGNOFabstraction, which is compatible with C11_Alignofand provides fallback implementation.These checks are used to ensure that the type compatibility prerequisite holds true in the static shared storage mode.
In
par_def.h, the compile-time count logic based onpar_table.defhas been added, which is used to generate: -PAR_LAYOUT_COMPILE_COUNT8PAR_LAYOUT_COMPILE_COUNT16PAR_LAYOUT_COMPILE_COUNT32Provide compile-time constant support for layout layers and static storage groups.
5. Add layout-related configuration items
Add the following in
par_cfg.h: -PAR_CFG_LAYOUT_SOURCEPAR_CFG_LAYOUT_STATIC_INCLUDEPAR_CFG_LAYOUT_COMPILE_SCANPAR_CFG_LAYOUT_SCRIPTIt also added corresponding configuration validity checks, enabling the layout source to be switched to runtime scanning or script generation as per project requirements.
6. Reconstruct the README and split the module documentation
Reorganize the originally very long
README.mdinto an entry-type document, while retaining:At the same time, a new independent document has been added: -
docs/getting-started.mddocs/architecture.mddocs/api-reference.mdThis makes it convenient to read by topic:
New addition: -
docs/DeviceParameter_VerificationReport.xlsxThis is used to supplement the verification records related to this parameter module, facilitating subsequent review and archiving of integration verification.
Please provide the verified bsp and config (provide the config and bsp)
BSP:
The current changes are mainly located in the general module layer of
Third_Party/autogen_parameter_manager/parameters.It is recommended to supplement the BSP used in this actual verification, for example: -
bsp/stm32/stm32l496-st-nucleoOr your actual list of target boards
.config:
It is recommended to add the configuration items covered by this verification, with the key points including: -
PAR_CFG_LAYOUT_SOURCE=PAR_CFG_LAYOUT_COMPILE_SCANPAR_CFG_ENABLE_IDPAR_CFG_ENABLE_PERSISTPAR_CFG_NVM_ENAtomic backend related configuration
If the script layout mode has been verified, it is also recommended to list it together: -
PAR_CFG_LAYOUT_SOURCE=PAR_CFG_LAYOUT_SCRIPTaction:
Please provide the link for the action/CI compilation success of the corresponding branch of your personal repository.