A method and system for synchronizing boot data in a dual-system configuration based on serial communication

By employing TLV structure encoding and incremental synchronization mechanism on the UART serial communication link between the Android system and the RTOS system, the problem of data silos between the two systems is solved, and bidirectional full synchronization during the boot phase and consistent data updates during operation are achieved.

CN123068337APending Publication Date: 2026-11-10SICHUAN COOSEA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611221564.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

In existing technologies, there is a lack of a structured bidirectional full synchronization mechanism for user data between Android systems and RTOS systems based on UART serial communication links. This makes it difficult to achieve data consistency synchronization during the boot process, and existing synchronization schemes are not suitable for bare UART links and continuous data updates during operation.

Method used

By establishing a UART serial communication link during the system startup phase, the structured user data is encoded using a TLV structure and divided into four phases: handshake, synchronization start, data block transmission, synchronization end, and overall completion. Combined with CRC check and timeout retransmission mechanisms, bidirectional full synchronization is achieved, and data consistency is maintained during operation through an incremental synchronization mechanism.

Benefits of technology

It achieves bidirectional full-scale structured user data synchronization between the Android system and the RTOS system, solves the data silo problem, improves data compatibility and reliability, ensures data consistency after booting, and continuously updates data during operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123068337A_ABST
    Figure CN123068337A_ABST
Patent Text Reader

Abstract

This invention discloses a dual-system boot data synchronization method, system, electronic device, and computer-readable storage medium based on serial communication. The method is applied between a first processor running an Android system and a second processor running an RTOS system. During the system boot-up phase, a UART serial communication link is established, and a bidirectional full synchronization process is initiated, including a handshake phase, a synchronization start phase, a data block transmission phase, a synchronization end phase, and an overall completion phase. Structured user data, including at least contacts, SMS messages, and call logs, is encapsulated into synchronization data frames, and each record field is encoded using a TLV structure. Simultaneously, an incremental synchronization mechanism during runtime ensures continuous data updates. This invention enables bidirectional full synchronization of structured user data between the two systems during the boot phase and maintains continuous data updates from the Android side to the RTOS side during runtime through incremental updates. It is suitable for data sharing and collaborative operation of heterogeneous dual-system electronic devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of dual-system data communication technology, and in particular to a dual-system power-on data synchronization method and system based on serial communication. Background Technology

[0002] With the continuous diversification of mobile terminal product forms, dual-system electronic devices employing the collaborative operation of the Android system and a Real-Time Operating System (RTOS) are becoming increasingly widely used, such as rugged outdoor terminals, industry-specific terminals, dual-screen terminals, and cordless devices. Typically, the Android system handles the application ecosystem and complex business processing, providing structured user data management functions such as contacts, SMS messages, and call logs; the RTOS, on the other hand, features fast startup speed, high real-time performance, low resource consumption, and stable operation, making it suitable for communication control, low-power operation, and real-time business processing. Therefore, the dual-system collaborative architecture has become an important technical solution for some electronic devices.

[0003] In existing dual-system architectures, the Android system and RTOS typically run on different processors, exchanging data via serial communication interfaces such as Universal Asynchronous Receiver / Transmitter (UART). Because the two systems employ different software architectures and data storage methods, structured user data such as contacts, SMS messages, and call logs in the Android system are usually managed by databases such as ContactsProvider, TelephonyProvider, and CallLogProvider, while the RTOS uses local storage for data management. This creates data silos between the two systems, meaning users on the RTOS cannot directly access their Android data such as contacts, SMS messages, and call logs.

[0004] In existing technologies, some data synchronization solutions rely primarily on internet synchronization protocols or network communication mechanisms. These solutions typically require an IP network environment and are difficult to apply directly to bare-link communication scenarios based on UART serial interfaces. Furthermore, existing dual-system communication solutions often focus on one-way synchronization or transmission of event messages such as call reminders and SMS notifications, primarily targeting instantaneous notifications. They lack bidirectional full-data synchronization mechanisms for structured user data such as contacts, SMS messages, and call logs. Additionally, for the data synchronization needs of dual-system devices during the boot-up phase, existing general file transfer protocols are primarily designed for general data file transfers. They lack field organization methods for structured user data and a synchronization process design suitable for quickly achieving data consistency between the two systems during boot, making it difficult to meet the requirement of achieving data consistency synchronization before the dual-system devices enter normal operation.

[0005] Therefore, how to achieve bidirectional full synchronization of structured user data between the Android system and the RTOS system based on the UART serial communication link during the system boot-up phase, while also taking into account the continuous data updates during operation, has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0006] In view of the shortcomings of the prior art, the purpose of this invention is to provide a dual-system boot data synchronization method and system based on serial communication, so as to realize structured user data synchronization between Android system and RTOS system based on UART serial communication link, so that the dual systems can complete bidirectional full synchronization during the boot-up phase and realize continuous data update during operation, thereby solving the problems of data silos between dual systems, the inability of existing synchronization schemes to be applied to bare UART links, the lack of a structured user data bidirectional full synchronization mechanism, and the difficulty in completing dual-system data consistency synchronization during the boot-up phase.

[0007] To achieve the above objectives, the technical solution of the present invention is as follows: This invention provides a dual-system boot data synchronization method based on serial communication, applied to an electronic device comprising a first processor and a second processor physically connected via a Universal Asynchronous Receiver / Transmitter (UART) serial interface, wherein the first processor runs the Android system and the second processor runs a Real-Time Operating System (RTOS), the method comprising: During the system startup phase, after the first processor and the second processor establish a communication link through the UART, they synchronously enter a bidirectional full synchronization process. The bidirectional full synchronization process includes a handshake phase, a synchronization start phase, a data block transmission phase, a synchronization end phase, and an overall completion phase. During the data block transmission phase, the first processor and the second processor respectively read the structured user data stored locally, encapsulate the structured user data into a synchronization data frame, and send it to the other end; the structured user data includes at least contacts, SMS messages, and call logs; The payload of the synchronization data frame uses a Type-Length-Value (TLV) structure to encode each record field in the structured user data.

[0008] In one embodiment, the synchronization data frame sequentially includes a frame header field, a length field, a sequence number field, a type field, a command field, a payload field using the TLV structure, a CRC16 field, and a frame tail field.

[0009] In one embodiment, during the data block transmission phase: The receiving end verifies the CRC16 field of the received synchronization data frame; If the verification fails, the receiving end discards the synchronization data frame and does not return an acknowledgment; After sending a synchronization data frame, the sending end starts a timeout timer. If no response with the corresponding sequence number is received within the timeout period, the corresponding synchronization data frame is retransmitted based on the sequence number.

[0010] In one embodiment, in the TLV structure, the Type field identifies the data field attribute, the Length field identifies the data field byte length, and the Value field carries the data field content.

[0011] In one embodiment, during the handshake phase, the first processor and the second processor exchange protocol version information and synchronization capability information. During the synchronization start phase, either party, as the sender, sends a synchronization request frame to the other party containing the total number of data entries to be synchronized and the estimated total number of bytes. The other party, as the receiver, returns an acknowledgment frame after completing synchronization preparation. Both parties can complete the above request and acknowledgment processes respectively.

[0012] In one embodiment, during the synchronization termination phase, the sending end sends a synchronization termination marker frame; During the overall completion phase, after confirming that all data has been sent on their own end, that the synchronization end marker frame has been received, and that the data on the other end has been written locally, the first processor and the second processor send each other a write completion confirmation message. After both parties receive the write completion confirmation from the other party, they open access to the structured user data.

[0013] In one embodiment, the method further includes a runtime incremental synchronization step following the overall completion phase: The Android system registers a ContentObserver listener to monitor data changes in ContactsProvider, TelephonyProvider, and CallLogProvider; When the structured user data is detected to have been added, deleted, or modified, the first processor extracts the changed data record, encapsulates it into an incremental synchronization frame, and sends it to the second processor via the UART. The second processor then completes the addition, update, or deletion of the corresponding data.

[0014] Another aspect of the present invention provides a dual-system power-on data synchronization system based on serial communication, comprising: The Android subsystem runs on the first processor and includes a data reading module, a protocol serialization module, a UART driver module, a protocol parsing module, and a local data writing module. The RTOS subsystem, running on the second processor, includes a UART receiving module, a protocol parsing module, a local data writing module, a data reading module, and a protocol serialization module. The Android subsystem and the RTOS subsystem are physically connected via a Universal Asynchronous Receiver / Transmitter (UART) serial interface. The Android subsystem and the RTOS subsystem are configured to collaboratively execute the dual-system boot data synchronization method based on serial communication as described in any one of claims 1 to 7 during the system boot-up phase.

[0015] Another aspect of the present invention provides an electronic device, comprising: The first processor runs the Android system; The second processor runs a real-time operating system (RTOS). And a Universal Asynchronous Receiver / Transmitter (UART) interface connecting the first processor and the second processor; The first processor and the second processor are configured to execute the dual-system boot data synchronization method based on serial communication as described in any of the preceding claims.

[0016] In another aspect, the present invention provides a computer-readable storage medium having stored thereon computer program instructions, which, when executed by a processor, implement the steps in the dual-system boot data synchronization method based on serial communication as described in any of the preceding claims.

[0017] In summary, this invention provides a dual-system boot data synchronization method, system, electronic device, and computer-readable storage medium based on serial communication. By establishing a communication link based on a UART serial interface between a first processor running an Android system and a second processor running an RTOS system, and synchronously entering a bidirectional full synchronization process during the system boot-up phase, the invention employs a TLV structure to encode each record field in the structured user data and synchronously transmits structured user data, including at least contacts, SMS messages, and call logs. Combined with an incremental synchronization mechanism during runtime, this achieves bidirectional full consistency of structured user data between the two systems during the boot phase, as well as incremental continuous updates from the Android side to the RTOS side during operation, providing a reliable data synchronization solution for heterogeneous dual-system electronic devices.

[0018] Compared with the prior art, the present invention has at least the following beneficial effects: (1) This invention establishes a communication link based on a UART serial interface between a first processor running the Android system and a second processor running the RTOS system, and synchronously enters a bidirectional full synchronization process during the system boot-up phase, realizing bidirectional synchronization of structured user data such as contacts, SMS messages, and call logs between the two systems. This effectively solves the data silo problem commonly found in existing dual-system electronic devices, avoids inconsistencies between the two systems after boot-up, and enables the two systems to present a consistent view of user data after boot-up, thus improving the data sharing capability of heterogeneous dual systems.

[0019] (2) This invention constructs a synchronization mechanism suitable for structured user data transmission for UART serial communication links, and uses a TLV structure to uniformly encode each record field in the user data. This encoding method enables different systems to organize, parse and transmit data in the same format, which not only improves the compatibility of structured data between Android system and RTOS system, but also facilitates the addition of fields or the expansion of new data types, thus improving the scalability of the synchronization scheme.

[0020] (3) This invention divides the data synchronization process into a handshake phase, a synchronization start phase, a data block transmission phase, a synchronization end phase, and an overall completion phase, and provides a synchronization data frame, CRC check, and timeout retransmission mechanism. Through unified process control and error detection / recovery methods, it effectively addresses transmission anomalies such as data loss and data errors that may occur in UART serial communication, improves the reliability of the synchronization process, and reduces the risk of synchronization failure due to transmission anomalies.

[0021] (4) Based on the completion of bidirectional full synchronization during the boot-up phase, this invention further combines the incremental synchronization mechanism during the runtime phase. The Android side monitors the addition, deletion, and changes of structured user data and synchronizes them to the RTOS side, so that the dual systems can continue to maintain the consistency of structured user data after entering normal operation. It takes into account both the bidirectional full synchronization during the boot-up phase and the incremental synchronization requirements from the Android side to the RTOS side during the runtime phase, forming a data synchronization mechanism that covers the entire process of system boot-up and operation, and providing continuous and stable data synchronization capabilities for heterogeneous dual-system electronic devices. Attached Figure Description

[0022] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 A schematic diagram of the overall architecture of a dual-system boot data synchronization system based on serial communication provided by the present invention; Figure 2 This invention provides a flowchart of a dual-system power-on data synchronization system based on serial communication, illustrating bidirectional full synchronization during power-on. Figure 3 A schematic diagram of the synchronization data frame structure of a dual-system power-on data synchronization system based on serial communication provided by the present invention; Figure 4 A schematic diagram of a dual-system power-on data synchronization system based on serial communication provided by the present invention, which combines power-on synchronization and runtime synchronization; Figure 5 This invention provides a structured user data synchronization relationship diagram for a dual-system boot data synchronization system based on serial communication. Detailed Implementation

[0023] To make the objectives, technical solutions, and effects of this invention clearer and more explicit, the invention is further described in detail below. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. The embodiments of the invention are described below with reference to the accompanying drawings.

[0024] Please see Figure 1One embodiment of the present invention provides a dual-system boot data synchronization method based on serial communication. This method is applied to an electronic device including a first processor 101 and a second processor 201. The first processor 101 runs the Android system, and the second processor 201 runs a real-time operating system (RTOS). The first processor 101 and the second processor 201 establish a serial communication connection through a Universal Asynchronous Receiver / Transmitter (UART) interface 105. The first processor 101 is capable of performing application management, data management, and protocol encapsulation functions within the Android system, while the second processor 201 is capable of performing real-time communication control, local data management, and business processing functions. Both have independent data storage spaces and data management mechanisms.

[0025] In this embodiment, the Android subsystem 100 where the first processor 101 resides includes a data reading module 102, a protocol serialization module 103, a UART driver module 104, a protocol parsing module, and a local data writing module. Specifically, the data reading module 102 reads structured user data stored in the Android system; the protocol serialization module 103 encapsulates the read data into a synchronization data frame 300 according to a preset synchronization protocol; the UART driver module 104 controls the synchronization data frame 300 to be sent to the second processor 201 via the UART interface 105; the protocol parsing module parses the synchronization data frame from the RTOS side; and the local data writing module writes the data from the RTOS side into the corresponding storage on the Android side.

[0026] The RTOS subsystem 200, where the second processor 201 resides, includes a UART receiving module 202, a protocol parsing module 203, a local data writing module 204, a data reading module, and a protocol serialization module. Specifically, the UART receiving module 202 receives synchronization data frames 300 sent from the first processor 101; the protocol parsing module 203 parses the data fields in the synchronization data frames 300 and recovers the corresponding structured user data; the local data writing module 204 writes the parsed data to the corresponding data storage areas on the RTOS side, including a contact database 205, an SMS database 206, and a call log database 207; the data reading module reads the structured user data stored locally on the RTOS side; and the protocol serialization module encapsulates the RTOS-side data into synchronization data frames and sends them to the Android side. Accordingly, both sides possess complete data reading, serialization, receiving, parsing, and writing capabilities, thereby achieving bidirectional data synchronization.

[0027] In this embodiment, the structured user data includes at least contacts, SMS messages, and call logs. Contact data may include fields such as contact identifier, name, phone number, email address, and remarks; SMS data may include fields such as sender, recipient, SMS content, sending time, receiving time, and SMS status; call logs may include fields such as call recipient, call type, call start time, call duration, and call status. Those skilled in the art will understand that, without altering the synchronization mechanism of this invention, the structured user data may also include calendar events, memos, favorites, device configuration parameters, or other data with fixed field structures; this invention does not limit such data.

[0028] Please continue reading. Figure 1 During the power-on process of the electronic device, the first processor 101 and the second processor 201 first initialize the UART interface 105 and establish a communication link. After the communication link is established, the two parties do not directly enter data transmission, but instead synchronously enter a bidirectional full synchronization process 500. The bidirectional full synchronization process 500 includes a handshake phase 501, a synchronization start phase 502, a data block transmission phase 503, a synchronization end phase 504, and an overall completion phase 505, with each phase executed in a preset order. Specifically, the handshake phase 501 is used to confirm that both parties have synchronization capabilities and establish a unified protocol context; the synchronization start phase 502 is used to complete the synchronization task initialization; the data block transmission phase 503 is used to perform bidirectional transmission of structured user data; the synchronization end phase 504 is used to indicate that the data transmission of the current synchronization task is complete; and the overall completion phase 505 is used to confirm that the data synchronization of both parties has ended, and after confirming the synchronization status, access to the corresponding data is opened.

[0029] Specifically, in the overall completion phase 505, the first processor 101 and the second processor 201 respectively confirm the following synchronization status: all synchronization data on their respective ends has been sent; all synchronization data from the other end has been received; and the received data has been parsed according to the protocol and written to the corresponding local data storage area. After confirmation, both parties send each other write completion confirmation messages. When both parties receive the write completion confirmation from the other party, the synchronization status is confirmed, and access to structured user data such as contacts, SMS messages, and call logs is granted.

[0030] Because Android and RTOS systems employ different software architectures and data organization methods, directly transmitting database files, storage images, or memory data not only makes it difficult to guarantee data compatibility between different systems but is also susceptible to differences in database versions, storage formats, and system implementations. Therefore, this embodiment does not directly synchronize database files. Instead, during the data block transmission phase 503, the first processor 101 and the second processor 201 respectively read locally stored structured user data, organize it by record, and then encapsulate it into a unified format synchronization data frame 300 before sending it to the other end. This allows both parties to exchange only the field content of the structured user data without relying on the underlying database structure for consistency, thereby improving data adaptability between different systems and providing a unified data organization foundation for subsequently adding data fields or expanding new structured data types.

[0031] Please see Figure 2 In this embodiment, after the first processor 101 and the second processor 201 complete the initialization of the UART interface 105 and establish a communication link, both sides synchronously enter the bidirectional full synchronization process 500. Unlike the data transmission method in existing dual-system devices where one side actively sends and the other side passively receives, in this embodiment, both the first processor 101 and the second processor 201 participate in the entire synchronization process as synchronous senders and receivers. That is, both sides can read the locally stored structured user data and send synchronization data to the other side, while simultaneously receiving and writing synchronization data from the other side, thereby completing bidirectional full synchronization.

[0032] Specifically, the bidirectional full synchronization process 500 includes a handshake phase 501, a synchronization start phase 502, a data block transmission phase 503, a synchronization end phase 504, and an overall completion phase 505. Each phase is executed in a preset order, and the next phase begins after the previous phase is completed, so as to ensure that both parties are always in a consistent synchronization state and avoid data loss, duplicate writing, or synchronization anomalies caused by inconsistent execution timing.

[0033] During the handshake phase 501, the first processor 101 and the second processor 201 first exchange protocol version information and synchronization capability information. The protocol version information identifies the data synchronization protocol versions currently supported by both parties, while the synchronization capability information identifies the data types, protocol characteristics, and synchronization modes supported by each. If the protocol versions of both parties are identical or compatible, the subsequent synchronization process continues. If there are differences in the protocol versions, a mutually supported protocol version can be selected for data synchronization according to a preset compatibility strategy, thereby ensuring that data interaction can still be completed between different software versions.

[0034] After the handshake is completed, the synchronization begins at stage 502. Either party can generate a synchronization request frame as the sender, carrying the total number of data entries to be synchronized and the estimated total number of bytes, and send it to the receiver via UART interface 105. Upon receiving the synchronization request frame, the receiver parses the relevant information in the synchronization request and completes synchronization preparation, including establishing the current synchronization session, initializing the receive buffer, preparing the target data storage space, and initializing synchronization status information. It then returns a synchronization acknowledgment frame to the sender. When the sender receives the synchronization acknowledgment frame, it indicates that both parties have completed synchronization preparation, and the data block transmission stage begins at stage 503.

[0035] In the data block transmission phase 503, the first processor 101 and the second processor 201 respectively read the locally stored structured user data and organize the data to be sent according to the record granularity. Preferably, each contact record, each SMS record, or each call record is organized as an independent data record, and then encapsulated into a synchronization data frame 300 by the protocol serialization module 103 before being sent to the other end, instead of directly transmitting the database file or the entire storage content. Since the data storage methods, database versions, and data organization forms within different operating systems may differ, this embodiment adopts a method of using data records as the basic synchronization unit, synchronizing only the record content of the structured user data, so that both the sending end and the receiving end can complete data exchange according to a unified data protocol without maintaining the consistency of the underlying database structure, thereby improving the data compatibility between the two systems. The TLV encoding method can organize data content by field, allowing different fields to be described independently according to type information and length information. Even if fields are added later or some fields are missing, the other end can still complete the identification and parsing based on the field type, improving the protocol's adaptability to different versions of data structures. The TLV structure features variable field length and flexible field order, enabling it to support messages containing data elements of different types and lengths, and facilitating the receiving end to parse field content item by item according to type.

[0036] Please continue reading. Figure 2 During the synchronization process, the first processor 101 and the second processor 201 can maintain their respective data transmission and data reception states. Once one end completes the transmission of the current data record, it can continue to receive data from the other end without waiting for all data to be transmitted. This achieves a data interaction mode of synchronous transmission and reception between the two ends, enabling the data synchronization process during the power-on phase to fully utilize the communication timing of the UART serial link, improve the continuity of bidirectional data synchronization, and ensure that both ends eventually complete the synchronization of all their structured user data, providing a consistent synchronization basis for the subsequent synchronization end phase 504 and overall completion phase 505.

[0037] Please see Figure 3In this embodiment, to ensure that data between the two systems can be transmitted according to a unified protocol, the data sent in the data block transmission phase 503 is encapsulated as a synchronization data frame 300. The synchronization data frame 300 sequentially includes a frame header field 301, a length field 302, a sequence number field 303, a type field 304, a command field 305, a payload field 306, a CRC16 field 307, and a frame tail field 308. Specifically, the frame header field 301 and the frame tail field 308 are used to identify data frame boundaries; the length field 302 indicates the effective data length of the current synchronization data frame 300; the sequence number field 303 identifies the transmission order of the current data block, enabling the receiving end to manage the order and the sending end to control retransmission; the type field 304 identifies the data category corresponding to the current synchronization data frame 300; the command field 305 identifies the protocol command corresponding to the current synchronization operation; the payload field 306 carries the actual synchronized structured user data; and the CRC16 field 307 performs integrity verification on the synchronization data frame 300.

[0038] Please continue reading. Figure 3 The payload field 306 is organized using a Type-Length-Value (TLV) structure 400. Specifically, each TLV structure 400 includes a Type field 401, a Length field 402, and a Value field 403. The Type field 401 identifies the attribute type of the corresponding data field, the Length field 402 identifies the data length occupied by the current field, and the Value field 403 stores the data content of the corresponding field.

[0039] For example, when synchronizing contact data, contact names, phone numbers, email addresses, and notes can be organized as independent TLV structures 400; when synchronizing SMS data, sender numbers, recipient numbers, SMS content, sending time, and SMS status can each correspond to different Type fields 401; when synchronizing call records, call recipients, call types, call start time, and call duration can also be organized as corresponding TLV structures 400. The receiving end identifies the meaning of the fields based on the Type field 401, determines the field length based on the Length field 402, and then reads the actual data content from the Value field 403, thereby restoring the complete data record without relying on the consistency of the underlying database table structures of both parties.

[0040] After adopting the above TLV organization method, each record field can be encoded as an independent data unit. When some fields are missing, field lengths change, or new fields are added later, the extension can be completed simply by adding the corresponding Type field 401 and carrying the corresponding Value field 403. The receiving end can parse the supported fields normally, and for fields that are not yet supported, it can skip the corresponding data content and continue parsing the subsequent fields based on the Length field 402. Therefore, different software versions can still maintain protocol compatibility without adjusting the existing data frame structure, improving the adaptability of the synchronization protocol to different version systems and different types of structured user data. TLV encoding realizes field-level organization through type identification and length description. It is a commonly used scalable data representation method in communication protocols, which can support variable-length fields and backward-compatible data parsing.

[0041] Please continue reading. Figure 3 After sending the synchronization data frame 300, the receiving end first performs an integrity check on the entire synchronization data frame 300 based on the CRC16 field 307. When the CRC16 check result is correct, the protocol parsing module 203 continues to parse the TLV structure 400 in the payload field 306 and writes the parsed data into the corresponding data storage area; when the CRC16 check fails, it is considered that the current synchronization data frame 300 has experienced a transmission abnormality during UART transmission, and the receiving end directly discards the current synchronization data frame 300 without returning the corresponding acknowledgment information, and does not perform a write operation on the abnormal data, thereby preventing erroneous data from entering the local data storage.

[0042] Meanwhile, after sending each synchronization data frame 300, the sending end starts a timeout timer and records the sequence number field 303 corresponding to the current synchronization data frame 300. When the sending end receives the corresponding sequence number acknowledgment information from the receiving end within a preset time, it considers the current data block transmission complete and continues to send the next synchronization data frame 300; if the corresponding sequence number acknowledgment information is not received after the timeout, the sending end retransmits the corresponding data frame according to the sequence number field 303, without needing to retransmit the data block that has already been acknowledged. Through the cooperation of sequence number identification, CRC16 check, and timeout retransmission mechanism, data errors caused by serial communication noise, link interference, or transient anomalies can be detected in a timely manner during the synchronization process, and retransmission is performed for abnormal data blocks without restarting the entire synchronization process. This ensures that the bidirectional full synchronization process can be completed continuously and reliably, improving the data synchronization reliability of the UART serial communication link. CRC check combined with sequence number acknowledgment and retransmission is a common reliable transmission mechanism in serial communication, which can effectively detect data errors and support recovery after anomalies.

[0043] For further embodiments, please refer to [link / reference]. Figure 2After completing the data block transmission phase 503, the bidirectional full synchronization process 500 enters the synchronization termination phase 504. When the sending end confirms that all structured user data to be synchronized has been sent, it generates a synchronization termination marker frame and sends it to the receiving end via the UART interface 105. The synchronization termination marker frame indicates that the sending end no longer has any data records to be sent, but it does not indicate that the entire synchronization process has ended. After receiving the synchronization termination marker frame, the receiving end maintains the current synchronization state to complete the reception and processing of the remaining data and returns the corresponding confirmation information to the sending end.

[0044] In this embodiment, since both the first processor 101 and the second processor 201 can act as data transmitters, either processor may complete its data transmission before the other. To prevent one party from prematurely exiting the synchronization process and causing the other party to be unable to receive remaining data, this embodiment distinguishes between the synchronization end stage 504 and the overall completion stage 505. The synchronization end stage 504 only indicates that the current processor has completed its data transmission; the overall completion stage 505 requires both parties to complete their data transmission, and only after receiving, parsing, and writing all synchronization data from the other party is the bidirectional full synchronization considered truly complete.

[0045] Specifically, in the overall completion phase 505, the first processor 101 and the second processor 201 respectively confirm the following synchronization status: all synchronization data on their respective ends has been sent; all synchronization data from the other end has been received; and the received data has been parsed according to the protocol and written to the corresponding local data storage area. After confirmation, both parties send each other write completion confirmation messages. When both parties receive the write completion confirmation from the other party, the synchronization status is confirmed, and access to structured user data such as contacts, SMS messages, and call logs is opened. This setting ensures that the data stored on both sides remains consistent before the system provides normal data access, avoiding situations such as missing contacts, inconsistent SMS counts, or incomplete call logs caused by accessing data before synchronization is complete.

[0046] Please see Figure 4 After completing the overall completion phase 505, this embodiment further enters the runtime incremental synchronization phase 600. Unlike the bidirectional full synchronization used in the boot phase, the runtime phase mainly performs incremental synchronization to the RTOS side for the parts of the structured user data on the Android side that have changed, without having to synchronize all data again, thereby reducing the data transmission volume of the UART link and improving the data synchronization efficiency of the runtime phase.

[0047] Specifically, in the Android system, the first processor 101 registers a ContentObserver listener 601 to continuously monitor data changes in ContactsProvider 602, TelephonyProvider 603, and CallLogProvider 604. When a contact, SMS message, or call record is added, deleted, or modified, the ContentObserver listener 601 receives the corresponding data change notification and submits the changed data record to the data reading module 102.

[0048] The data reading module 102 extracts the corresponding data record based on the data change content, and the protocol serialization module 103 encapsulates the data record into an incremental synchronization frame 605, which is then sent to the second processor 201 via the UART driver module 104. After receiving the incremental synchronization frame 605, the second processor 201 completes the reception through the UART receiving module 202, and the protocol parsing module 203 parses the data fields carried within it. Based on the parsing results, the local data writing module 204 performs add, update, or delete operations on the corresponding contact database 205, SMS database 206, or call log database 207, thereby ensuring that the data on the RTOS side remains consistent with that on the Android side.

[0049] It should be understood that incremental synchronization during operation and bidirectional full synchronization during startup correspond to different synchronization scenarios. The startup phase is used to establish initial data consistency between the two systems; the operation phase only synchronizes changed data records to continuously maintain the consistency of data between the two systems. By combining full synchronization with incremental synchronization, on the one hand, it avoids increasing the serial link load by re-performing full synchronization every time the device changes data; on the other hand, it ensures that the two systems maintain the consistency of structured user data throughout the entire operation process, forming a data synchronization mechanism covering the entire process of system startup and normal operation. Incremental synchronization combined with an event listening mechanism can avoid repeatedly transmitting unchanged data, synchronizing only changed data. This is a common optimization approach in mobile system data synchronization, helping to reduce communication overhead and maintain data consistency.

[0050] In further embodiments, please refer to... Figures 1 to 4 To further illustrate the data synchronization process of this invention, the following example demonstrates the process of synchronizing contact data. Those skilled in the art will understand that SMS data, call log data, and other structured user data with fixed field structures can all be synchronized using the same method for data interaction; this invention does not limit such synchronization.

[0051] For example, after the electronic device is powered on, the first processor 101 and the second processor 201 initialize the UART interface 105 and establish a communication link, and then synchronously enter the bidirectional full synchronization process 500. First, in the handshake phase 501, the two parties exchange protocol version information and synchronization capability information; in the synchronization start phase 502, either party can send a synchronization request frame as the sender, and both parties can complete the synchronization request and confirmation process respectively, and complete the establishment of the synchronization session and data synchronization preparation. After both parties return synchronization confirmation information, the data block transmission phase 503 begins.

[0052] Taking the synchronization of contact data from the first processor 101 to the second processor 201 as an example, the data reading module 102 first reads a contact record stored in the Android system and extracts fields such as contact name, phone number, email address, and remarks. The protocol serialization module 103 generates a synchronization data frame 300 according to a preset protocol and encodes each of the above fields using a TLV structure 400. Different fields correspond to different Type fields 401, the field content length is written to the Length field 402, and the actual field content is written to the Value field 403. Then, all TLV structures are encapsulated into the payload field 306 according to a preset format, ultimately forming a complete synchronization data frame 300, which is then sent to the second processor 201 via the UART driver module 104.

[0053] After the second processor 201 receives the synchronization data frame 300, the UART receiving module 202 first completes data reception, and then performs integrity verification on the synchronization data frame 300 according to the CRC16 field 307. When the verification result is correct, the protocol parsing module 203 determines the current data type according to the type field 304 and command field 305 in the synchronization data frame 300, and further parses each TLV structure 400 in the payload field 306, identifies the corresponding data field according to each Type field 401, reads the data content of the corresponding length according to the Length field 402, restores the field information in the contact record, and then the local data writing module 204 writes the restored contact record into the contact database 205; if the CRC16 verification fails, the current synchronization data frame 300 is discarded, and the system waits for the sending end to retransmit the corresponding synchronization data frame according to the corresponding sequence number field 303.

[0054] Once contact data synchronization is complete, SMS data and call log data can continue to be synchronized using the same data organization method. The sending end generates synchronization data frames 300 one by one according to the data records, and the receiving end parses and writes them one by one until all data to be synchronized is transmitted. Because this embodiment uses data records as the synchronization unit, rather than directly transmitting database files, the Android system and the RTOS system can still exchange data according to a unified data protocol even if they use different data storage methods, database organization forms, or internal implementation structures, thereby avoiding the impact of differences in underlying data structures on data synchronization.

[0055] After the device enters normal operation, when ContactsProvider602, TelephonyProvider603, or CallLogProvider604 in the Android system detects the addition, deletion, or modification of contacts, SMS messages, or call records, the ContentObserver listener601 generates the corresponding data change event. The first processor101 only extracts the changed data records and generates an incremental synchronization frame605, which is sent to the second processor201. The second processor201 determines the corresponding data operation type based on the command field305 in the incremental synchronization frame605 and performs the add, update, or delete operation, keeping the data on the RTOS side consistent with that on the Android side without having to re-perform a bidirectional full synchronization.

[0056] It should be noted that this embodiment uses contacts, SMS messages, and call logs as structured user data for illustration, and is only used to explain the data synchronization process of the present invention, and does not constitute a limitation on the scope of protection of the present invention. In other embodiments, as long as the data to be synchronized can be organized into data records with field structures, the synchronization data frame 300 and TLV structure 400 described in the present invention can be used for organization, and data synchronization can be completed by combining the handshake phase 501, synchronization start phase 502, data block transmission phase 503, synchronization end phase 504, overall completion phase 505, and runtime incremental synchronization mechanism. Therefore, without departing from the concept of the present invention, equivalent substitutions or modifications made to the synchronization data type, data field content, TLV field definition, synchronization command type, or specific software implementation should all fall within the scope of protection of the present invention. TLV, as a type-length-value encoding method, supports organizing variable-length data in units of fields and can maintain good protocol compatibility when adding fields, and is therefore suitable for the synchronization organization method of structured user data described in the present invention.

[0057] In another embodiment, the payload field 306 in the synchronization data frame 300 can carry not only one structured user data record, but also multiple structured user data records can be combined and encapsulated and sent uniformly according to the communication bandwidth, buffer capacity, or synchronization data scale of the UART interface 105; or, when the data volume of a single structured user data record exceeds the carrying capacity of a single synchronization data frame 300, the data record can be divided into multiple data blocks and encapsulated in multiple synchronization data frames 300 respectively, and sequential transmission and reassembly can be completed according to the sequence number field 303. This invention does not limit the number of data records carried by a single synchronization data frame 300 or the method of data block division.

[0058] Furthermore, during the protocol parsing process, when the protocol parsing module 203 identifies that the data field corresponding to the Type field 401 in the current TLV structure 400 is a data field already supported by the system, it reads the data content of the corresponding length according to the Length field 402 and restores the corresponding data field according to the Value field 403. When it identifies that the data field corresponding to the current Type field 401 is a data field not yet supported, it can directly skip the data content corresponding to the current field according to the Length field 402 and continue parsing subsequent TLV structures 400 without interrupting the parsing process of the entire synchronization data frame 300. Since each TLV structure 400 has an independent field type and field length description, even if new data fields are added or new structured user data types are extended, the data parsing process of the existing protocol can still remain unaffected, improving the data protocol compatibility and scalability between different software versions. TLV encoding, through explicit Type and Length fields, enables the receiving end to locate and skip unknown fields according to the length, and is therefore widely used in communication scenarios that support protocol extensions and backward compatibility.

[0059] Furthermore, the structured user data described in this invention is not limited to contacts, SMS messages, and call logs. In other embodiments, it may also include calendar events, memos, user configuration parameters, device configuration parameters, application configuration data, favorites information, speed dial information, blacklist information, and other data with fixed field structures. This invention uses a unified synchronization data frame 300 and TLV structure 400 to organize the above-mentioned structured user data. Data organization and parsing can be completed simply by configuring the corresponding Type field 401 according to different data types, without changing the overall synchronization process 500.

[0060] Furthermore, in addition to the UART interface 105, the data communication interface between the first processor 101 and the second processor 201 in other embodiments of the present invention can also employ a data communication interface with serial data transmission capability and capable of supporting the synchronization protocol of the present invention to achieve the same data synchronization process; alternatively, when the Android system and the RTOS system run on different hardware platforms but can establish corresponding communication links, the synchronization process described in the present invention can also be used to complete the structured user data synchronization. The communication interface and processor hardware configuration described in the present invention do not constitute a limitation on the technical solution of the present invention.

[0061] It should be understood that the present invention has been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the embodiments described above. Equivalent substitutions or modifications made by those skilled in the art to the synchronization process, synchronization data frame structure, TLV field definition, data organization method, communication interface form, and software implementation method described in the present invention without departing from the concept of the present invention should all fall within the protection scope of the present invention.

Claims

1. A dual-system power-on data synchronization method based on serial communication, characterized in that, An electronic device comprising a first processor and a second processor physically connected via a Universal Asynchronous Receiver / Transmitter (UART) serial interface, the first processor running the Android system and the second processor running a Real-Time Operating System (RTOS), the method comprising: During the system startup phase, after the first processor and the second processor establish a communication link through the UART, they synchronously enter a bidirectional full synchronization process. The bidirectional full synchronization process includes a handshake phase, a synchronization start phase, a data block transmission phase, a synchronization end phase, and an overall completion phase. During the data block transmission phase, the first processor and the second processor respectively read the structured user data stored locally, encapsulate the structured user data into a synchronization data frame, and send it to the other end; the structured user data includes at least contacts, SMS messages, and call logs; The payload of the synchronization data frame uses a Type-Length-Value (TLV) structure to encode each record field in the structured user data.

2. The method according to claim 1, characterized in that, The synchronization data frame includes, in sequence, a frame header field, a length field, a sequence number field, a type field, a command field, a payload field using the TLV structure, a CRC16 field, and a frame tail field.

3. The method according to claim 2, characterized in that, During the data block transmission phase: The receiving end verifies the CRC16 field of the received synchronization data frame; If the verification fails, the receiving end discards the synchronization data frame and does not return an acknowledgment; After sending a synchronization data frame, the sending end starts a timeout timer. If no response with the corresponding sequence number is received within the timeout period, the corresponding synchronization data frame is retransmitted based on the sequence number.

4. The method according to claim 1, characterized in that, In the TLV structure, the Type field identifies the data field attribute, the Length field identifies the data field length in bytes, and the Value field carries the data field content.

5. The method according to claim 1, characterized in that, During the handshake phase, the first processor and the second processor exchange protocol version information and synchronization capability information. During the synchronization start phase, either party, as the sender, sends a synchronization request frame to the other party containing the total number of data entries to be synchronized and the estimated total number of bytes. The other party, as the receiver, returns an acknowledgment frame after completing the synchronization preparation. Both parties may complete the above request and confirmation process separately.

6. The method according to claim 1, characterized in that, During the synchronization termination phase, the sending end sends a synchronization termination marker frame; During the overall completion phase, after confirming that all data has been sent on their own end, that the synchronization end marker frame has been received, and that the data on the other end has been written locally, the first processor and the second processor send each other a write completion confirmation message. After both parties receive the write completion confirmation from the other party, they open access to the structured user data.

7. The method according to claim 1, characterized in that, The method also includes a runtime incremental synchronization step following the overall completion phase: The Android system registers a ContentObserver listener to monitor data changes in ContactsProvider, TelephonyProvider, and CallLogProvider; When the structured user data is detected to have been added, deleted, or modified, the first processor extracts the changed data record, encapsulates it into an incremental synchronization frame, and sends it to the second processor via the UART. The second processor then completes the addition, update, or deletion of the corresponding data.

8. A dual-system power-on data synchronization system based on serial communication, characterized in that, include: The Android subsystem runs on the first processor and includes a data reading module, a protocol serialization module, a UART driver module, a protocol parsing module, and a local data writing module. The RTOS subsystem, running on the second processor, includes a UART receiving module, a protocol parsing module, a local data writing module, a data reading module, and a protocol serialization module. The Android subsystem and the RTOS subsystem are physically connected via a Universal Asynchronous Receiver / Transmitter (UART) serial interface. The Android subsystem and the RTOS subsystem are configured to collaboratively execute the dual-system boot data synchronization method based on serial communication as described in any one of claims 1 to 7 during the system boot-up phase.

9. An electronic device, characterized in that, include: The first processor runs the Android system; The second processor runs a real-time operating system (RTOS). And a Universal Asynchronous Receiver / Transmitter (UART) interface connecting the first processor and the second processor; The first processor and the second processor are configured to perform a dual-system boot data synchronization method based on serial communication as described in any one of claims 1 to 7.

10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the steps in the dual-system boot data synchronization method based on serial communication as described in any one of claims 1 to 7.