Method for managing configuration files of embedded devices

By dividing permissions and memory mirroring in the memory, the problems of modem chips being unable to write to memory and AP chips being unable to parse AT commands were solved, and stable management of configuration files and data consistency were achieved in multi-chip systems.

CN122240193APending Publication Date: 2026-06-19ASR MICROELECTRONICS CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ASR MICROELECTRONICS CO LTD
Filing Date
2026-03-17
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In a dual-chip architecture, the modem chip cannot write directly to the memory, and the AP chip cannot parse AT commands, making the configuration file management mechanism unsuitable. Furthermore, the configuration file requirements of each chip are complex, which can easily lead to access conflicts and data inconsistencies.

Method used

The memory is divided into a first partition, where only the Modem chip has the right to initiate write requests, while the AP chip only has the right to initiate read requests. The configuration file generated by the Modem is used to perform memory mirroring and synchronization during the startup phase to ensure data integrity, and differentiated update mechanisms are designed for different stages.

Benefits of technology

It achieves stable management of configuration files in multi-chip systems, avoids access conflicts and data inconsistencies, meets the diverse needs of each chip, and takes into account the needs of mass production calibration, system startup, and operation updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122240193A_ABST
    Figure CN122240193A_ABST
Patent Text Reader

Abstract

This invention provides a method for managing configuration files in embedded devices, relating to the field of embedded system technology and applied to multi-chip systems. A first processor is connected to memory, while a second processor, though not connected to memory, is responsible for calibration. The method includes: dividing the memory into a first partition, a second partition, and a third partition to store a first type of factory calibration file, a second type of general read-only file, and a third type of read-write user file, respectively; setting only the second processor to initiate write requests to the first partition; internally, the second processor is divided into first and second memory regions as memory partition mirrors; adding ADF / CDF identifiers to AT commands to achieve file-oriented identification; and establishing a boot synchronization process to complete data loading verification of the first partition, CDF file comparison and copying, and ADF file synchronization to the third partition. This invention achieves categorized storage, secure isolation, and flexible updates of configuration files, avoiding multi-chip access contention and ensuring the stability and reliability of system operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of embedded systems technology, and more specifically, to a method for managing configuration files of embedded devices. Background Technology

[0002] In embedded systems, especially in wearable devices such as smartwatches, various chips and peripherals typically have their own calibration parameters and configuration data, which are stored in the device's file system in the form of configuration files. For example, during the mass production of smartwatches, calibration tools are needed to calibrate antennas, radio frequency circuits, etc., and the calibration results are permanently saved as configuration files for the device to read and use during operation.

[0003] Early smartwatches used a single-chip solution, where the application processor (AP) and cellular communication module were integrated and ran on the same modem chip. In this architecture, the memory (such as eMMC) was directly and physically connected to the modem chip. Figure 1 As shown, the process of writing mass production calibration files for a single-chip solution includes: after firmware is burned during the mass production stage, the device enters mass production mode by pressing a button, and the USB module and AT command processing module are initialized; the modem chip receives AT commands via USB, parses the commands, and runs the corresponding callback function, directly writing calibration data such as antenna calibration results, IMEI file, DSP calibration file, and audio calibration file into the factory calibration partition of its external memory. This partition is fixed after the device leaves the factory, and neither the burning tool nor FOTA upgrades can modify its contents, ensuring the stability and security of the calibration data.

[0004] However, with the increasing functionality of smart wearable devices, the growing abundance of peripheral chips, and the increasingly stringent requirements for low power consumption, single-chip solutions are gradually failing to meet market demands. To reduce power consumption, a dual-chip solution has emerged, separating the high-power modem chip from the low-power access point (AP) chip. In this architecture, the modem chip only operates during communication periods, entering a low-power sleep state during non-communication periods; the AP chip handles most functional logic and manages peripheral chips such as Wi-Fi / BT / GNSS / Sensorhub. Simultaneously, to optimize overall power consumption, the memory is only physically connected to the AP chip, with the AP chip centrally managing the memory's power consumption mechanism, while the modem chip no longer has a physical path to directly access the memory.

[0005] like Figure 2As shown, the dual-chip solution introduces new hardware limitations: the AP chip connects to and manages the eMMC memory, while the Modem chip is not connected to any memory. This change renders the configuration file management mechanism in the existing single-chip solution inapplicable. Specifically, the calibration process in the mass production stage still needs to be executed by the Modem chip parsing AT commands, and the calibration result data also needs to be generated by the Modem chip, but the Modem chip can no longer directly write to memory; on the other hand, although the AP chip has the ability to read and write memory, it cannot parse AT commands and cannot independently complete the writing of calibration files. In addition, with the increase in the types of peripheral chips, the configuration file requirements of various chips are more complex, including RF calibration files and DSP calibration files required by the Modem chip, audio calibration files and sensor calibration files required by the AP chip, as well as Bluetooth address files and GNSS server information files common to all devices. Allowing each chip to initiate read and write requests at will will lead to memory access contention and data consistency issues.

[0006] Therefore, how to establish a reasonable configuration file management mechanism under dual-chip and multi-chip architectures, which can not only solve the contradiction that modem chips cannot directly write to memory and AP chips cannot parse AT commands, but also meet the diverse needs of each chip for configuration files, avoid access conflicts and data inconsistencies, and be compatible with configuration file usage scenarios at different stages such as mass production calibration, system startup, and operation updates, has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0007] To address the shortcomings of existing technologies, this invention provides a method for managing configuration files for embedded devices.

[0008] According to the present invention, a method for managing configuration files of an embedded device is provided, wherein the scheme is applied to a multi-chip system including a first processor and a second processor, wherein the first processor is connected to a memory and has the permission to read and write the memory, and the second processor does not have a physical connection to directly read and write the memory but is responsible for performing the calibration process, specifically including: At least one first partition is partitioned in the memory, the first partition being dedicated to storing a first type of configuration file generated by the second processor based on the calibration process; Set read and write permissions for the configuration file, wherein only the second processor has the right to initiate write requests to the first partition, and the first processor only has the right to initiate read requests to the first partition; The second processor generates a first type of configuration file in response to the calibration command and initiates a write request to the first processor, the write request containing configuration file data to be written; In response to the write request, the first processor writes the configuration file data to the first partition of the memory.

[0009] Preferably, the first processor is an application processor (AP), and the second processor is a cellular communication modem (Modem); the method further includes: The second processor is divided into a first memory region and a second memory region. The first memory region is configured as a memory image of the first partition, which is used to load and verify the configuration file in the first partition during the startup phase.

[0010] Preferably, the memory is further divided into a second partition and a third partition; The second partition is used to store a second type of read-only configuration file, which is device-wide and provided for multiple chips managed by the first processor; The third partition is used to store a third type of readable and writable configuration file for multiple chips managed by the first processor and provided by the second processor.

[0011] Preferably, the third partition includes a first subdirectory and a second subdirectory; The first subdirectory is used to store configuration files with a first identifier that are readable by the first processor-side chip; The second subdirectory is used to store configuration files with a second identifier that are readable by the second processor.

[0012] Preferably, the second memory region is configured as a memory image of the second subdirectory in the third partition, for reading and writing the configuration file that can be modified by the second processor during runtime.

[0013] Preferably, the configuration file in the first partition carries the first identifier or the second identifier, which is generated by the second processor in response to the calibration command and added to the corresponding first type of configuration file.

[0014] Preferably, the device startup phase also includes a configuration file synchronization step: The first processor starts the configuration server and establishes communication with the configuration client of the second processor; The second processor sends a request to the first processor to read the first partition through its configuration client, and uses the address of the first memory region of the second processor as a parameter; In response to the request, the configuration server of the first processor reads all first-class configuration files in the first partition and writes the data into the first memory area of ​​the second processor; The second processor verifies the integrity of the data in its first memory region; The second processor sends a request to the first processor to read the second subdirectory in the third partition through its configuration client, and uses the address of the second memory region of the second processor as a parameter; In response to the request, the configuration server of the first processor reads the configuration file of the second subdirectory in the third partition and writes the data into the second memory area of ​​the second processor; The second processor traverses and compares the files with the second identifier in the first memory region and the second memory region. If a file with the same name exists in the first memory region but not in the second memory region, then the file is copied from the first memory region to the second memory region. The first processor requests configuration file data with the first identifier from the second processor through its configuration server; In response to the request, the second processor provides the first processor with configuration file data containing the first identifier in its first memory region; The first processor synchronously writes the received data to the first subdirectory of the third partition.

[0015] Preferably, the first partition includes a first sub-partition and a second sub-partition that serve as backups for each other; the first type of configuration file is synchronously written to the first sub-partition and the second sub-partition for data integrity verification when the device starts up.

[0016] Preferably, the method further includes the step of updating the configuration file during device operation: When the second processor needs to modify user configuration data with the second identifier, it first updates the data to its second memory area, and then sends a write request to the first processor through its configuration client. In response to the write request, the configuration server of the first processor reads the updated data from the second memory region of the second processor and writes it to the corresponding second subdirectory in the third partition of the memory.

[0017] Preferably, the method further includes the step of updating the calibration file when the equipment re-enters the mass production stage: The second processor generates a new first-class configuration file in response to the new calibration command and stores it in its first memory region; The second processor initiates a request to write the first partition to the first processor through its configuration client, and uses the address of the first memory region as a parameter; In response to the request, the configuration server of the first processor reads new configuration file data from the first memory region of the second processor and updates it to the first partition of the memory.

[0018] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention solves the technical contradiction in multi-chip architecture by setting differentiated permission control, which allows only the Modem chip to initiate write requests to the first partition and the AP chip to only initiate read requests, and establishes an indirect write mechanism in which the Modem initiates the request and the AP executes the write. This enables the smooth execution of the mass production calibration process in multi-chip systems. 2. This invention divides the memory into a first partition, a second partition, and a third partition, which respectively store the factory calibration file, the general read-only configuration file, and the read-write user configuration file. This achieves classified and isolated storage of different types of configuration files, avoids mutual interference between configuration files, ensures the stability and security of the factory calibration data, and meets the diverse needs of multiple chips and multiple peripherals for configuration files. 3. This invention overcomes the hardware limitation of the modem chip having no physical memory connection by setting a first memory region and a second memory region inside the modem chip, which serve as the memory image of the first partition and the memory image of the second subdirectory of the third partition, respectively. This enables the modem chip to perform functions such as integrity verification of calibration data, file comparison, and modification of user configuration, while reducing the power consumption caused by frequent access to external memory. 4. This invention adds a key ID number to the AT command and adds an "ADF" or "CDF" identifier to the calibration file in the first partition, indicating that it is for the AP-side chip to read or for the Modem chip to read, respectively. This achieves accurate identification and targeted synchronization of the configuration file, ensuring that the configuration file is accurately delivered to the target chip and avoiding data corruption and access conflicts. 5. This invention designs a multi-chip collaborative boot synchronization process, including a series of steps such as establishing communication between the AP and the Modem, the Modem requesting to read the first partition and verifying its integrity, the Modem requesting to read the user configuration and performing file comparison and copying, and the AP synchronizing the ADF file to the third partition. This achieves automatic initialization and consistency synchronization of the calibration data in the first partition and the user configuration data in the third partition when the system starts up, ensuring that each chip can obtain correct and complete configuration information during operation, while taking into account both the flexibility of user modification permissions and the reliability of configuration files. 6. This invention improves the reliability of calibration data writing by setting the first partition to include a first sub-partition and a second sub-partition that serve as backups for each other. When writing calibration data, the two sub-partitions are updated synchronously, and the Modem chip compares the data integrity of the two sub-partitions to determine the reliable data source during power-on. This effectively prevents data damage or loss caused by unexpected power outages. 7. This invention designs differentiated configuration file update mechanisms for the operation and mass production stages, including: when the Modem modifies CDF data, it initiates a write request through the second memory area and the AP synchronizes it to the third partition; when the AP modifies ADF data, it directly writes it to the third partition; when the device is returned to the factory for recalibration, the Modem initiates a write request through the first memory area and the AP updates it to the first partition. This achieves flexible management of the entire lifecycle of the configuration file, avoids the competition risk caused by concurrent writing of multiple chips, and ensures data consistency and system stability.

[0019] Other beneficial effects of the present invention will be explained in detail through the introduction of specific technical features and technical solutions in specific embodiments. Those skilled in the art should be able to understand the beneficial technical effects brought about by these technical features and technical solutions through the introduction of these technical features and technical solutions. Attached Figure Description

[0020] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 A flowchart illustrating the process of writing mass production calibration files for an existing single chip; Figure 2 A schematic diagram illustrating the various configuration file requirements for dual-chip systems; Figure 3 This diagram illustrates the correspondence between multiple partitions and directories in EMMC and various configuration files. Figure 4 The process of synchronizing configuration files between the AP and MODEM during the startup phase. Detailed Implementation

[0021] The present invention will now be described in detail with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the present invention, but do not limit the invention in any way. It should be noted that those skilled in the art can make several changes and improvements without departing from the concept of the present invention. These all fall within the protection scope of the present invention.

[0022] This invention provides a method for managing configuration files in an embedded device, applied to a multi-chip system including a first processor and a second processor. The first processor is connected to a memory and has read / write permissions to the memory, while the second processor does not have a physical connection to directly read / write the memory but is responsible for performing the calibration process. (Refer to...) Figure 3 As shown, this management method specifically includes: At least one first partition is partitioned in the memory, which is dedicated to storing the first type of configuration file generated by the second processor based on the calibration process; read and write permissions for the configuration file are set, wherein only the second processor has the right to initiate a write request to the first partition, and the first processor only has the right to initiate a read request to the first partition. The second processor generates a first type of configuration file in response to the calibration command and sends a write request to the first processor. The write request contains the configuration file data to be written. In response to the write request, the first processor writes the configuration file data to the first partition of the memory.

[0023] Furthermore, the first processor is an application processor (AP), and the second processor is a cellular communication modem (Modem); the method further includes: The second processor is divided into a first memory region and a second memory region; the first memory region is configured as a memory image of the first partition, which is used to load and verify the configuration file in the first partition during the startup phase.

[0024] The memory is further divided into a second partition and a third partition; the second partition is used to store a second type of read-only configuration file that is universal to the multiple chips managed by the first processor; the third partition is used to store a third type of readable and writable configuration file that is provided to the multiple chips managed by the first processor and the second processor.

[0025] The third partition includes a first subdirectory and a second subdirectory; the first subdirectory is used to store configuration files with a first identifier that are read by the first processor-side chip; the second subdirectory is used to store configuration files with a second identifier that are read by the second processor.

[0026] Configure the second memory region as a memory image of the second subdirectory in the third partition, for reading and writing configuration files that can be modified by the second processor at runtime.

[0027] The configuration file in the first partition contains either a first identifier or a second identifier, which is generated by the second processor in response to a calibration command and added to the corresponding first-class configuration file.

[0028] The device startup phase also includes a configuration file synchronization step: The first processor starts the configuration server and establishes communication with the configuration client of the second processor; The second processor sends a request to the first processor to read the first partition through its configuration client, and uses the address of the second processor's first memory region as a parameter; In response to the request, the configuration server of the first processor reads all the first-class configuration files in the first partition and writes the data into the first memory area of ​​the second processor; The second processor verifies the integrity of the data in its first memory region; The second processor, through its configuration client, sends a request to the first processor to read the second subdirectory in the third partition, and uses the address of the second memory region of the second processor as a parameter; In response to the request, the configuration server of the first processor reads the configuration file of the second subdirectory in the third partition and writes the data into the second memory area of ​​the second processor; The second processor traverses and compares files with the second identifier in the first memory region and the second memory region. If a file with the same name exists in the first memory region but not in the second memory region, the file is copied from the first memory region to the second memory region. The first processor requests configuration file data with a first identifier from the second processor through its configuration server; In response to the request, the second processor provides configuration file data with a first identifier in its first memory region to the first processor; The first processor synchronously writes the received data to the first subdirectory of the third partition.

[0029] The first partition contains a first subpartition and a second subpartition that serve as backups for each other; the first type of configuration file is synchronously written to the first subpartition and the second subpartition for data integrity verification when the device starts up.

[0030] Furthermore, this management method also includes the step of updating the configuration file during equipment operation: When the second processor needs to modify user configuration data with the second identifier, it first updates the data to its second memory area, and then sends a write request to the first processor through its configuration client. In response to a write request, the configuration server of the first processor reads the updated data from the second memory region of the second processor and writes it to the corresponding second subdirectory in the third partition of the memory.

[0031] This management approach also includes the step of updating calibration files when the equipment re-enters the mass production phase: The second processor generates a new first-class configuration file in response to the new calibration command and stores it in its first memory region; The second processor initiates a request to write the first partition to the first processor through its configuration client, and passes the address of the first memory region as a parameter; In response to the request, the configuration server of the first processor reads new configuration file data from the first memory region of the second processor and updates it to the first partition of the memory.

[0032] Reference Figure 3 As shown, specifically, the overall content of this invention is as follows: 1. Classification of configuration files: Based on the attributes and usage scenarios of the configuration files, this invention classifies them into the following three categories: The first type of configuration file: This is the calibration result file generated by the modem chip parsing AT commands and executing the calibration process. This type of file is only written during mass production and contains individual hardware characteristic data for each device (such as IMEI, DSP calibration, RF antenna calibration, audio calibration, etc.). After the device is booted, its contents cannot be modified by software, programming tools, or FOTA upgrades. This first type of configuration file includes calibration files required by the modem chip, as well as calibration files required by other chips managed by the AP (such as Sensorhub, GNSS, etc.).

[0033] To avoid contention caused by multiple chips concurrently writing to the first type of configuration file, this invention limits the right of only the modem chip to initiate write requests to the first type of configuration file. This is achieved by triggering a modem code response via an AT command, with the modem initiating the write operation. Simultaneously, a key ID number is added to the AT command to add a type label to the generated first type of configuration file: if the ID is "CDF", it indicates that the configuration file is for the modem chip to read; if the ID is "ADF", it indicates that the configuration file is for the AP-side chip to read.

[0034] The second type of configuration file: a general read-only configuration file provided for each chip (not the modem) managed by the AP. This type of file is a binary or text file that is common to all devices (such as audio calibration files, AP UI animation configuration files, Bluetooth address files, GNSS server information files, etc.). It is written to the memory during the firmware burning stage using a burning tool. After the device is started, it is read-only and can only be modified through FOTA upgrades.

[0035] The third type of configuration file: Individual readable and writable configuration files provided for each chip (not the modem) managed by the AP. These files do not exist during the flashing stage; they are automatically generated by the system after device startup or synchronized from the first type of configuration file. Users or applications can modify them at runtime. FOTA upgrades do not modify these files.

[0036] 2. Memory partition structure: To achieve the categorized storage and access management of the aforementioned configuration files, this invention partitions the memory connected to the AP chip, such as... Figure 3 As shown. Besides the BOOT partition, the storage is divided into three main partitions: Partition 1 (Factory Calibration File Partition): This partition stores the first type of configuration files, i.e., the mass production calibration files. It contains two mutually redundant sub-partitions—Sub-Partition 1 and Sub-Partition 2. All first-type configuration files are written simultaneously to both sub-partitions during the write process to prevent data loss due to power failure. Upon device startup, the trusted configuration can be restored by comparing the data integrity of the two sub-partitions.

[0037] The second partition (system partition) is used to store the second type of configuration files. This partition contains a first subdirectory (rd) and a second subdirectory (etc). The first subdirectory stores general read-only binary files required by the AP management chip (such as audio calibration files), and the second subdirectory stores general read-only text files (such as Bluetooth addresses and GNSS server information). The files in this partition are written during the firmware flashing stage and can only be modified during FOTA upgrades; they cannot be written to during software runtime.

[0038] The third partition (user partition): used to store the third type of configuration files. This partition contains a first subdirectory (nvm) and a second subdirectory (cpnvm). The first subdirectory stores read-write configuration files for the AP-side chip, corresponding to copies of the first type of configuration files with the "ADF" identifier synchronized from the AP. The second subdirectory stores read-write configuration files for the Modem chip, corresponding to copies of the first type of configuration files with the "CDF" identifier synchronized from the Modem. The files in the third partition are not generated by burning, but are automatically generated by the code during the system startup phase or copied from the first partition.

[0039] The original calibration file in the first partition is the "original file" written during mass production and cannot be modified during normal device operation. The file with the same name in the third partition is the "copy file," which users can modify through the UI interface. When the device starts up, the system compares the file with the same name in the first and third partitions: if the file does not exist in the third partition, the original file is copied from the first partition to the third partition as the initial copy; if the file already exists, the modified copy in the third partition will be used.

[0040] 3. Internal memory area of ​​the modem chip: Since the modem chip has no physical memory connection, in order to solve its need to read and write configuration files, this invention divides the modem chip into two memory regions: First memory region: Serves as a memory image of the first partition, used to load all first-class configuration files from the first partition during the startup phase and perform integrity checks.

[0041] Second memory area: a memory image of the second subdirectory (cpnvm) of the third partition, used to store CDF type user configuration files that can be read and written by the modem chip at runtime.

[0042] The modem chip communicates with the configuration server on the AP chip via IPC through its internal configuration client, thereby indirectly enabling reading and writing to the memory.

[0043] 4. Configuration file synchronization process during the boot process: The following is combined Figure 4 Describe in detail how the configuration files in the memory are synchronized during the device startup process.

[0044] Step 1: After the first version is burned during the mass production phase, the third partition of the memory (including the nvm and cpnvm subdirectories) is empty. The device is then powered on in mass production mode for the first time.

[0045] Step 2: The AP chip software program starts first, establishes the IPC channel, and starts the configuration server. The configuration server listens for read / write configuration file requests from the modem chip. Subsequently, the AP's configuration server and the modem's configuration client perform a handshake synchronization.

[0046] Step 3: The AP loads the modem chip's firmware into memory and runs it, then waits for the modem to synchronize the configuration data of the first partition. The modem's synchronization process is as follows: The modem allocates its internal first memory region and sends the address of the first memory region as a parameter in a request to read the first partition to the AP's configuration server through the configuration client.

[0047] After receiving the request, the AP configuration server calls the function interface to read the first partition of the AP's storage, reads all the first-class configuration file data in the first partition, writes it into the first memory area of ​​the Modem, and replies to the Modem that the read is complete.

[0048] After receiving the response, the modem checks the integrity of the copy of the first partition in the first memory area. Since the first partition contains two sub-partitions that are backups of each other, the modem compares the data of the two sub-partitions and uses the complete content of the sub-partition as the trusted data for the first partition.

[0049] Next, the Modem allocates its internal second memory region and, by configuring the client, encapsulates the address of the second memory region as a parameter in a request to read the second subdirectory of the third partition (cpnvm) and sends it to the AP.

[0050] The AP configuration server responds to the request, calls the function interface to read the second subdirectory of the third partition of the AP's storage, reads all the configuration file data in that directory, writes it into the second memory area of ​​the Modem, and replies to the Modem that the read is complete.

[0051] At this point, the modem has obtained the configuration file data from the first partition and the second subdirectory of the third partition through IPC communication, and stored them in its first memory area and second memory area, respectively.

[0052] The modem iterates through and compares files with the "CDF" identifier in the first memory region (first partition data) and the second memory region (cpnvm user data). If a CDF file exists in the first memory region but not in the second memory region, the file is copied from the first to the second memory region, thus initializing a user-writable copy of the CDF configuration file using the mass production calibration file. If the file already exists, it is not copied to preserve the user's latest configuration data.

[0053] Subsequently, if the modem rewrites the CDF data in the second memory area due to user behavior during operation, the modem will initiate a write request to the third partition through the configuration client. The AP configuration server will read the data in the second memory area and synchronously write it to the second subdirectory of the third partition of the storage, thus completing the persistence of the CDF type configuration file.

[0054] Step 4: AP Synchronizes ADF Type Configuration Data. To avoid contention, the AP does not have permission to rewrite the first partition, but it has read permission. After Step 3, the Modem has completed the integrity verification of the first partition, and its first memory area stores a trusted copy of the first partition data. Therefore, the AP sends a request to the Modem to obtain the data with the "ADF" identifier in the first type configuration file. The Modem returns the address of the corresponding data in its first memory area, from which the AP reads the ADF file data and synchronously writes it to the first subdirectory (nvm) of the third partition. Synchronization principle: If the ADF file in the first partition does not exist in the nvm directory, a copy is made as the initial user configuration; if it already exists, it is not copied to retain the latest user configuration. Afterwards, when the AP-side chip needs to read ADF type configuration data, it can directly read it from the first subdirectory of the third partition.

[0055] Step 5: If the device is returned to the factory, a new AT calibration command (possibly of ADF or CDF type) is initiated again via UART. The modem first updates the newly generated calibration data to its first memory area, then initiates a write request to the first partition, sending the address of the first memory area as a parameter to the AP configuration server. The AP configuration server reads the new calibration data from the modem's first memory area and updates it to the first partition of the storage.

[0056] Step 6: If the Modem code needs to modify the user configuration data of the CDF class, the Modem first updates the new data to its second memory area, and then sends a request to write to the second subdirectory of the third partition to the AP configuration server. The AP configuration server reads the new user configuration data from the Modem's second memory area and updates it to the second subdirectory (cpnvm) of the third partition of the storage.

[0057] Step 7: If the AP needs to modify the user configuration data of the ADF class, the AP directly updates the new data from its memory to the first subdirectory (nvm) of the third partition of the storage.

[0058] The present invention will now be described in more detail.

[0059] The technical problem this application aims to solve lies in the need for hardware cost savings in multi-chip solutions. There is only one EMMC (Extended Messaging Center), and only one chip can access this EMMC. However, this chip lacks the ability to write calibration data to the EMMC during mass production. Specifically, the modem chip lacks a physical connection to the EMMC, meaning it cannot directly write calibration files. While the AP chip is IoT-connected to the EMMC, it cannot parse AT commands used during mass production, creating a contradiction where calibration can only be performed through the modem. This application proposes a new configuration file solution as follows: Because AT command calibration involves the modem initiating the writing of calibration files, to prevent multiple chips from competing for write access to the Factory partition, it is proposed that only the modem chip must have the permission to trigger write access to the Factory partition; the AP chip only has the right to read the Factory partition. This proposal suggests dividing the EMMC partition connected to the AP into three partitions: a first partition, a second partition, and a third partition. The first partition stores Factory calibration data. The modem has the permission to initiate write access, and the write operation is performed by the configuration server thread on the AP. This application also uses "ADF" and "CDF" identifiers in the files of the first partition to distinguish configuration file types. The "ADF" identifier indicates that data is to be synchronized from the first partition to the first directory nvm of the third partition. The "CDF" identifier indicates that data is to be synchronized from the first partition to the second directory Cpnvm of the third partition. The second partition stores read-only files applicable to various chips on the AP side (excluding the modem, including GNSS, BT, Sensorhub chips, etc.), which are burned into this partition via system firmware files. The third partition stores user-readable and writable configuration files. The first version of the user configuration file in the second directory of the third partition is written synchronously by the Modem. After the Modem completes the integrity verification of the first partition, it initiates data synchronization from the CDF configuration file in the first partition to the CPnvm file in the second directory of the third partition. The AP initiates data synchronization from the ADF configuration file in the first partition to the nvm file in the first directory of the third partition. Through this configuration file management scheme, the watch's multi-chip and multi-peripheral programs can read the correct configuration file and update it normally, solving the problems encountered in dual-chip solutions.

[0060] This application designs configuration files for multiple chips, which are divided into the following categories: The first type of configuration file is the calibration result file generated by the MODEM chip after parsing AT commands and executing the calibration process. This file contains calibration data written to a single machine during mass production. After startup, the contents of the first type of configuration file cannot be modified by software, programming tools, or FOTA upgrades. It is an attribute file written specifically for the individual hardware characteristics. The first type of configuration file can be a calibration file required by the MODEM chip, or it can be a calibration file required by various chips (non-Modem) managed by the AP. Granting write permissions to each chip would lead to contention issues. Therefore, to avoid contention issues caused by each chip being able to initiate rewriting of the first type of configuration file, this application restricts the writing of the first type of configuration file to only be initiated by the MODEM code through an AT command request and a corresponding AT command from the modem chip code.

[0061] This application also adds a key ID number to the AT command to give the first type of configuration file a file type label with read permissions. If the key ID is "CDF", the calibration file generated by AT will have "CDF" as an identifier, indicating that this configuration file is a read-only configuration file for the modem chip. If the key ID is "ADF", the generated calibration file will have "ADF" as an identifier, indicating that this configuration file is a read-only configuration file for the AP.

[0062] The second type of configuration file: a universal read-only configuration file for all chips (excluding the modem) managed by the AP. This type of configuration file provides a storage area for firmware data in both binary and text files, which are universally applicable to all devices. It can be used as firmware data and written to the storage area during the flashing stage using a flashing tool. The file data cannot be rewritten after the device boots up; it is a read-only configuration file.

[0063] The third type of configuration file: This is a readable and writable configuration file for each individual chip (not the modem) managed by the AP. The chip programming process can erase this type of configuration file, but it does not generate a new one. FOTA upgrades cannot modify this type of configuration file. The device code is written to this type of configuration file only during the chip startup phase.

[0064] Based on the above configuration file classification, this application further subdivides the storage area into partitions. The purpose is to allow software to correctly read and write each type of configuration file through partition isolation. The first type of configuration file needs to be set up as a separate partition to prevent data loss during power-off writes, and a dual-partition backup mechanism is provided. During the device's boot phase, the AP chip needs to read files marked with "ADF" from the first type of configuration files, requiring it to traverse the files in the first type of configuration file partition to find all files marked "ADF". During the device's firmware flashing phase, the tool needs to erase all third type configuration files, so the third type of configuration files also requires a separate partition for management.

[0065] Reference Figure 3 As shown, the storage area linked to the AP chip, apart from the BOOT partition, is divided into several partitions according to different configuration file types: the first partition (factory calibration file partition), the second partition (system partition), and the third partition (user partition).

[0066] The first partition is used to store the first type of configuration files, which are factory calibration files. This first partition has two sub-partitions (first sub-partition and second sub-partition), which serve as backups of each other to prevent data loss during power outages when writing calibration data. They can also be used to verify data integrity. See details... Figure 4Step 3. The first type of configuration file (calibration data file) generated by the AT command is synchronously written to both the first and second sub-partitions. The process of writing to and reading from the first partition during software startup is described in this application. Figure 4 Detailed description.

[0067] The second partition (system partition) defined in this application is used to store the second type of configuration files. This application establishes a first subdirectory (rd) and a second subdirectory (etc). The first subdirectory (rd) stores read-only binary files that are required by all chips (non-modem) managed by the AP and are common to all devices, such as audio calibration files. The second subdirectory (etc) stores read-only text files that are required by all chips (non-modem) managed by the AP and are common to all devices, such as configuration files required for the AP's UI animations, Bluetooth address files, and server information files required by the GNSS server. Files in this partition are written to the storage partition in firmware format during the firmware burning stage. Only FOTA upgrades can rewrite the read-only configuration files in the second partition. Software cannot modify the files in the second partition.

[0068] The third partition (user partition) defined in this application is used to store the third type of configuration files. This application establishes a first subdirectory `nvm` and a second subdirectory `cpnvm`. The first subdirectory `nvm` stores the readable and writable configuration files required by the various chips (excluding the modem) managed by the AP. These files contain the identifier "ADF" defined by AT commands. The second subdirectory `cpnvm` stores the readable and writable configuration files required by the modem chip. These files contain the identifier "CDF" defined by AT commands. The configuration files in the third partition are not burned by a programming tool, but are automatically written by the code during the system startup phase. This application defines that during normal power-on, the AP chip's program reads the configuration files in the first partition, finds the calibration file with the identifier "ADF" defined by AT commands, and copies it to the first subdirectory `nvm` of the third partition. The AP code finds the calibration file with the identifier "CDF" defined by AT commands and copies it to the second subdirectory `cpnvm` of the third partition. Detailed processes are described in [link to documentation]. Figure 4 Steps 3 and 4.

[0069] In practical applications, the calibration files in the first partition still require user customization during operation. However, if users corrupt the original configuration files in the first partition, there will be no original configuration files to guarantee stable device operation when factory settings are restored. Therefore, some files in the first and second directories of the third partition are, as defined in this application, copies with the same filename. The original files stored in the first partition can only be modified during the mass production stage; their contents cannot be modified during normal device operation. The copies stored in the third partition are those that users can modify through the UI interface during normal code operation. This division provides clear usage guidelines for the software at each stage. If the device re-enters the mass production stage, new calibration data will be written to the configuration file in the first partition. This application also stipulates that the software must synchronously write to the user configuration file with the same name in the third partition to ensure consistency between the two files. This application stipulates that during device startup, the code must compare the files in the first partition with files with the same name in the third partition. If no file with the same name exists in the third partition, the code must copy the original file from the first partition to the third partition, creating a copy configuration file. If a configuration file with the same filename already exists in the third partition, it means the user has modified the contents of the third partition's configuration file. The software must run according to the user's settings in the third partition's configuration data and will not use the original data from the file in the first partition. This is because the modem does not have hardware-connected storage. All of the above processes require the modem and the access point to communicate through the software protocol defined in this application; see details below. Figure 4 Explanation of each step in the process.

[0070] based on Figure 3 With the EMMC's multi-partition and multi-directory settings, this application allows various configuration files of multiple chips to have their own storage space.

[0071] Chips managed by the AP (non-modem) all read configuration files through the AP.

[0072] The modem chip needs to access user configuration data, but the data stored in the third partition / second subdirectory (cpnvm) can only be accessed by the AP chip because the storage is only connected to the AP chip, and the modem cannot access the storage. Therefore, this application provides a built-in memory area within the modem chip to address the modem's need to access CDF-type configuration files. This application proposes setting this built-in memory area of ​​the modem chip to provide a file system mirror, allowing access to the calibration files required by the modem as files. See details. Figure 4 process.

[0073] Reference Figure 2 and Figure 3 , Figure 2 During the factory calibration phase, the Modem's IMEI file, DSP calibration file, and RF antenna calibration file are written to the first partition by the AP chip as CDF type files, initiated by the Modem, and permanently stored. Similarly, the Sensor calibration file and audio calibration file required by the AP chip are also written to the first partition by the AP chip as ADF type files, initiated by the Modem, and permanently stored. The Bluetooth address file and GNSS configuration file are written to the firmware file using packaging software and then written to the second partition during the flashing phase. The AP chip can directly read the files in the second partition upon startup.

[0074] Figure 4 It describes how the configuration files in the memory are synchronized in conjunction with the boot process.

[0075] Step 1: After burning the first version during the mass production stage, all data in the third partition of the memory is cleared. During the first boot in mass production mode, the first subdirectory nvm and the second subdirectory cpnvm of the third partition are empty.

[0076] Step 2: The AP chip software program starts first, establishes an IPC channel, and starts the AP's configuration server, whose function is to listen for read and write configuration file requests from the MODEM chip. The AP's configuration server and the MODEM's configuration client perform a handshake synchronization. In multi-chip systems, IPC usually refers to Inter-Process Communication, and more broadly, it is often used to refer to the communication mechanism between chips / cores / processing units. This case will not describe the hardware IPC interaction protocol in detail, but only its usage.

[0077] Step 3: The AP loads the MODEM chip's firmware into memory and runs it. The AP waits for the MODEM to complete the synchronization of the configuration data in the first partition. The MODEM data synchronization process includes the MODEM allocating the first memory area inside the chip. The Modem uses the message sending and receiving mechanism of the configuration server in Step 2 to send the address of the MODEM's first memory area as a parameter. The Modem's configuration client puts the Modem's first memory address into a request to read the configuration of the first partition and sends it to the AP's configuration server. After the AP's configuration server reads the Modem's read configuration request and the parameter (the Modem's first memory address), the AP configuration server thread calls the function interface for reading the first partition of the AP's storage area, reads all the AP's first type configuration files into the Modem's first memory address, and replies to the Modem that the configuration file reading is complete.

[0078] The first partition contains two sub-partitions, which serve as backups for each other and are used to verify data integrity. Upon receiving a response, the modem checks the integrity of the copy data of the first partition at the first memory address, using the complete content of the sub-partitions to locate the reliable copy data of the first partition. To prevent multiple chips from competing for write access to the first partition, this application proposes that write permission to the first partition must be triggered exclusively by the modem chip; the access point (AP) chip only has the right to initiate read access to the first partition.

[0079] The modem allocates a second memory region. The modem's configuration client sends the address of the modem's second memory region as a parameter in a configuration request to read the second partition to the AP's configuration server. After the AP's configuration server reads the modem's request and the parameter (the modem's second memory address), the AP configuration server thread calls the function interface of the second subdirectory (cpnvm) of the third partition of the AP's storage, reads the contents of the user-readable and writable configuration files in the second subdirectory of the third partition into the modem's second memory address, and replies to the modem that the file reading is complete.

[0080] The modem received a reply indicating that it had requested the access point (AP) to read files from the memory and obtained the configuration file data from the first and third partitions of the memory via the IPC communication protocol. The modem then iterates through and compares files identified as "CDF" in the first memory region (a copy of the factory calibration file from the first partition in the modem chip's memory) and the second memory region (a copy of the cpnvm file from the second subdirectory of the third partition in the modem chip's memory). If the modem chip's code detects a file with the same name in the first memory region but missing in the second memory region, it copies the file from the first memory region to the second memory region. This effectively creates a new, user-editable copy of the CDF configuration file using the mass-produced calibration file. If the file already exists, the copying process is skipped, maintaining the user's latest CDF configuration data.

[0081] If the modem's second memory area is modified by user actions during operation, resulting in a memory update, the modem's configuration client sends a write request to the access point's configuration server to write to the third partition. Upon receiving the write request, the access point reads the data from the modem's second memory area and synchronously writes it to the second subdirectory (cpnvm) of the third partition, completing the process of synchronously writing the CDF type configuration file from the modem's memory to the configuration file in the second subdirectory of the third partition of the storage device.

[0082] Step 4: AP synchronizes ADF type configuration data.

[0083] To avoid competition, this application restricts the AP to not having permission to rewrite the first partition, but it does have permission to read the first partition. After step 3, the modem has already performed an integrity check on the first partition, and the first memory area in the modem has saved a trustworthy, complete memory copy of the first partition's data. Therefore, the AP can trust the data in the modem's first memory. The AP sends a request to the modem for ADF type data in the first type configuration file. The modem returns a memory address, and the AP reads the data of the first type configuration file marked with "ADF" from the original first partition from memory and synchronizes it to the first directory (nvm) of the third partition (user partition). The synchronization principle is as follows: if a file with the ADF tag defined in the first partition does not exist in the first directory (nvm) of the third partition (user partition), a copy is made and written to the first directory of the third partition. Its purpose is to initialize a user configuration file for the AP with mass production calibration data. If it already exists, it is not copied, maintaining the latest user configuration data. The AP chip needs to read ADF type configuration data again. The AP directly reads it from the first directory of the third partition into the AP's memory.

[0084] Step 5: If the device is returned to the factory and a new AT calibration command is initiated again via UART, which can be an ADF or CDF type calibration command, it will first update the first memory partition inside the modem. Then the modem initiates a write request to the first partition, and sends the address of the first memory partition as a parameter to the AP configuration server. The AP configuration server thread reads the new calibration data from the first memory partition of the modem and updates the first partition of the eMMC.

[0085] Step 6: If the Modem code needs to modify the user configuration data of the CDF class, the Modem first updates the new user configuration data to the second memory area of ​​the Modem memory. It then sends a write request to the AP configuration server to the second partition. The AP configuration server thread reads the new Modem user configuration data from the second memory area and updates it to the second subdirectory cpnvm in the third partition of the storage.

[0086] Step 7: If the AP needs to modify the user configuration data of the ADF class, the AP will update the new user configuration data directly from the AP's memory to the first subdirectory nvm in the third partition of the EMMC.

[0087] This invention provides a method for managing configuration files in embedded devices. It proposes three types of configuration files and divides the memory's file system into a first partition, a second partition, and a third partition for each type. A protocol flow for indirect writing to the first partition by the modem is defined for the mass production calibration stage. To avoid contention among multiple chips, only the modem chip can initiate write requests to the first partition, while the access point (AP) chip only has the right to read from it. Two built-in memory areas within the modem chip are provided to address the modem's need to read and write configuration files. These built-in memory areas are designed to provide a file system mirror, allowing access to the required configuration files by the modem as files. CDF and ADF type labels are defined for the configuration files in the first partition, facilitating each chip to retrieve configuration files as needed.

[0088] In multi-chip solutions, although there are hardware limitations—the modem chip lacks a physical connection to access memory—the partitioning and synchronization mechanisms for configuration files provided in this application, along with the addition of ADF and CDF type tags for configuration file management, allow the modem chip to indirectly synchronize configuration files from memory to modem memory via the AP chip through a protocol that allows clients to request read and write operations. Furthermore, after modifying the configuration file, it can be indirectly written back to memory via the AP chip through the same protocol. This application enables multi-chip systems to run code without contention under various complex configuration requirements.

[0089] Those skilled in the art will understand that, besides implementing the system and its various devices, modules, and units provided by this invention in the form of purely computer-readable program code, the same functions can be achieved entirely through logical programming of the method steps, making the system and its various devices, modules, and units of this invention function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, the system and its various devices, modules, and units provided by this invention can be considered as a hardware component, and the devices, modules, and units included therein for implementing various functions can also be considered as structures within the hardware component; alternatively, the devices, modules, and units for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.

[0090] Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Unless otherwise specified, the embodiments and features described in this application can be arbitrarily combined with each other.

Claims

1. A method for managing configuration files of an embedded device, applied to a multi-chip system including a first processor and a second processor, wherein, The first processor is connected to the memory and has the permission to read and write to the memory, while the second processor does not have a physical connection to directly read and write to the memory but is responsible for performing the calibration process. The feature is that it includes: At least one first partition is partitioned in the memory, the first partition being dedicated to storing a first type of configuration file generated by the second processor based on the calibration process; Set read and write permissions for the configuration file, wherein only the second processor has the right to initiate write requests to the first partition, and the first processor only has the right to initiate read requests to the first partition; The second processor generates a first type of configuration file in response to the calibration command and initiates a write request to the first processor, the write request containing configuration file data to be written; In response to the write request, the first processor writes the configuration file data to the first partition of the memory.

2. The method for managing configuration files of an embedded device according to claim 1, characterized in that, The first processor is an application processor (AP), and the second processor is a cellular communication modem (Modem). The method further includes: The second processor is divided into a first memory region and a second memory region. The first memory region is configured as a memory image of the first partition, which is used to load and verify the configuration file in the first partition during the startup phase.

3. The method for managing configuration files of an embedded device according to claim 2, characterized in that, The memory is further divided into a second partition and a third partition; The second partition is used to store a second type of read-only configuration file, which is device-wide and provided for multiple chips managed by the first processor; The third partition is used to store a third type of readable and writable configuration file for multiple chips managed by the first processor and provided by the second processor.

4. The method for managing configuration files of an embedded device according to claim 3, characterized in that, The third partition includes a first subdirectory and a second subdirectory; The first subdirectory is used to store configuration files with a first identifier that are readable by the first processor-side chip; The second subdirectory is used to store configuration files with a second identifier that are readable by the second processor.

5. The method for managing configuration files of an embedded device according to claim 4, characterized in that, The second memory region is configured as a memory image of the second subdirectory in the third partition, for reading and writing the configuration file that can be modified by the second processor at runtime.

6. The method for managing configuration files of an embedded device according to claim 5, characterized in that, The configuration file in the first partition carries either the first identifier or the second identifier, which is generated by the second processor in response to the calibration command and added to the corresponding first type of configuration file.

7. The method for managing configuration files of an embedded device according to claim 6, characterized in that, The device startup phase also includes a configuration file synchronization step: The first processor starts the configuration server and establishes communication with the configuration client of the second processor; The second processor sends a request to the first processor to read the first partition through its configuration client, and uses the address of the first memory region of the second processor as a parameter; In response to the request, the configuration server of the first processor reads all first-class configuration files in the first partition and writes the data into the first memory area of ​​the second processor; The second processor verifies the integrity of the data in its first memory region; The second processor sends a request to the first processor to read the second subdirectory in the third partition through its configuration client, and uses the address of the second memory region of the second processor as a parameter; In response to the request, the configuration server of the first processor reads the configuration file of the second subdirectory in the third partition and writes the data into the second memory area of ​​the second processor; The second processor traverses and compares the files with the second identifier in the first memory region and the second memory region. If a file with the same name exists in the first memory region but not in the second memory region, then the file is copied from the first memory region to the second memory region. The first processor requests configuration file data with the first identifier from the second processor through its configuration server; In response to the request, the second processor provides the first processor with configuration file data containing the first identifier in its first memory region; The first processor synchronously writes the received data to the first subdirectory of the third partition.

8. The method for managing configuration files of an embedded device according to any one of claims 1-7, characterized in that, The first partition contains a first sub-partition and a second sub-partition that serve as backups for each other; the first type of configuration file is synchronously written to the first sub-partition and the second sub-partition for data integrity verification when the device starts up.

9. The method for managing configuration files of an embedded device according to claim 7, characterized in that, This also includes the step of updating the configuration file during device operation: When the second processor needs to modify user configuration data with the second identifier, it first updates the data to its second memory area, and then sends a write request to the first processor through its configuration client. In response to the write request, the configuration server of the first processor reads the updated data from the second memory region of the second processor and writes it to the corresponding second subdirectory in the third partition of the memory.

10. The method for managing configuration files of an embedded device according to claim 7, characterized in that, This also includes the step of updating calibration files when the equipment re-enters the mass production phase: The second processor generates a new first-class configuration file in response to the new calibration command and stores it in its first memory region; The second processor initiates a request to write the first partition to the first processor through its configuration client, and uses the address of the first memory region as a parameter; In response to the request, the configuration server of the first processor reads new configuration file data from the first memory region of the second processor and updates it to the first partition of the memory.