Data acquisition method and electronic device

By reading non-volatile data into reserved random access memory before hibernation and verifying it after waking up, the system startup delay caused by the slow read speed of non-volatile storage media is solved, achieving fast startup and data reliability.

CN123137573APending Publication Date: 2026-11-20NOBO AUTOMOTIVE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611275738.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-21
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Non-volatile storage media have a slower read speed, which increases the system startup delay after electronic devices are woken up, making it difficult to meet the requirements for fast startup.

Method used

Before the electronic device goes into sleep mode, data is read from non-volatile storage media and stored in a power-retaining random access memory. Upon waking, data integrity is verified and data is retrieved from fast access memory, avoiding repeated access to slow storage media.

Benefits of technology

By reading and verifying data in advance, the data acquisition time after wake-up is shortened, ensuring data integrity and reliability, and improving system startup speed and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137573A_ABST
    Figure CN123137573A_ABST
Patent Text Reader

Abstract

The application provides a data acquisition method and an electronic device, and relates to the technical field of computers. The method comprises the following steps: reading nonvolatile data from a nonvolatile storage medium when it is detected that the electronic device meets a hibernation condition and has not entered a hibernation state; storing the nonvolatile data and first check information generated based on the nonvolatile data into a preset storage area in a reserved random access memory; performing data integrity verification on the data currently stored in the preset storage area to obtain second check information if it is determined that the electronic device is woken up after entering the hibernation state; and acquiring the nonvolatile data from the preset storage area if it is determined that the check passes based on the first check information and the second check information. The present scheme can solve the problem that the system startup delay is increased and it is difficult to meet the fast startup requirement due to the fact that the reading operation is located on the critical path after wake-up and the nonvolatile storage medium has a slow reading speed, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a data acquisition method and electronic device in the field of computer technology. Background Technology

[0002] As electronic devices become increasingly complex, more and more devices need to maintain the integrity of critical data, such as system configuration parameters, user preference settings, and operational status records, even after power loss or entering a low-power sleep state. Non-volatile storage media (such as flash memory and electrically erasable programmable read-only memory, EEPROM) are widely used as persistent data storage carriers in electronic devices due to their data retention after power failure. When an electronic device wakes up from sleep mode, it typically needs to read all the necessary data from its non-volatile storage media for use by various functional modules. This reading process is located on the critical path of system startup, and its time consumption is directly added to the user-perceived startup delay. This problem is particularly prominent in scenarios with strict startup time requirements, such as automotive electronic control units and smart terminals.

[0003] In the prior art, after an electronic device is woken up from a sleep state, it usually first completes the initialization of the basic hardware, then reads all the required data from a non-volatile storage medium, and only after confirming that all data has been read does it continue to execute the initialization of other modules or start application functions.

[0004] The inventors have discovered that the prior art has at least the following problems: Non-volatile storage media have a slow read speed, and the read operation is located on the critical path after wake-up, which directly leads to increased system startup latency. When the data volume is large, the latency can reach tens or even hundreds of milliseconds, making it difficult to meet the needs of fast startup and resulting in a poor user experience. Summary of the Invention

[0005] This application provides a data acquisition method and an electronic device. The data acquisition method can effectively solve the problem that the current system startup delay is increased and it is difficult to meet the fast startup requirements due to the fact that the read operation is located on the critical path after wake-up and the read speed of non-volatile storage media is slow, thereby improving the user experience.

[0006] In a first aspect, this application provides a data acquisition method applied to an electronic device including a reserved random access memory (RRAM) and a non-volatile storage medium, wherein the RRAM is powered on when the electronic device is in a sleep state, the method comprising: If it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state, non-volatile data is read from the non-volatile storage medium; The non-volatile data and the first verification information generated based on the non-volatile data are stored in a preset storage area in the reserved random access memory. The first verification information is used to verify the data integrity of the non-volatile data. If it is determined that the electronic device is woken up after entering the sleep state, then the data currently stored in the preset storage area is verified for data integrity to obtain the second verification information; If the verification is determined to be successful based on the first verification information and the second verification information, the non-volatile data is retrieved from the preset storage area.

[0007] In the above technical solution, by reading non-volatile data from a non-volatile storage medium when the electronic device meets the sleep conditions but has not yet entered sleep mode, the time-consuming read operation that was originally located on the critical path after wake-up is transferred to be executed before sleep, eliminating the blocking time of waiting for data reading after wake-up. By storing the non-volatile data in a reserved random access memory that is powered during sleep, the data is completely preserved during sleep and can be directly retrieved at the speed of random access memory after wake-up, without having to access the slower non-volatile storage medium again. After wake-up, the data integrity of the data currently stored in the preset storage area is verified to obtain the second verification information. After the verification is confirmed to be successful based on the first and second verification information, the non-volatile data is retrieved from the preset storage area. This ensures that the data is not damaged or tampered with while achieving fast reading, shortening the time for data retrieval after wake-up while ensuring data reliability. This effectively solves the problem of increased system startup latency and difficulty in meeting fast startup requirements caused by the read operation being located on the critical path after wake-up and the slow read speed of the non-volatile storage medium, thus improving the user experience.

[0008] In conjunction with the first aspect, in some possible implementations, the first verification information includes a first verification value and a second verification value, wherein the second verification value is the bitwise inverse of the first verification value; the step of determining that the verification has passed based on the first verification information and the second verification information includes: If the second verification information matches the first verification value, and the first verification value is consistent with the value obtained by performing a bitwise inversion operation on the second verification value, then the verification is determined to be successful.

[0009] In the above technical solution, the verification is deemed successful only when the second verification information matches the first verification value and the first verification value is consistent with the value obtained after performing a bitwise inversion operation on the second verification value. This provides dual reliability assurance for the verification result, avoids the possibility of missed or false judgments that may occur with a single verification, and effectively improves the credibility of the data obtained from the preset storage area and the security of system operation.

[0010] In combination with the first aspect and the above implementation methods, in some possible implementation methods, the step of performing data integrity verification on the data currently stored in the preset storage area if it is determined that the electronic device is awakened after entering the sleep state includes: If it is determined that the electronic device is woken up after entering the sleep state, then wake-up source information is obtained, which is used to indicate whether the electronic device is woken up normally or abnormally. If it is determined that the electronic device has been woken up normally based on the wake-up source information, the data integrity of the data currently stored in the preset storage area is verified.

[0011] In conjunction with the first aspect and the above implementation methods, in some possible implementations, the data acquisition method further includes: If it is determined based on the wake-up source information that the electronic device was abnormally woken up, non-volatile data is read from the non-volatile storage medium.

[0012] In the above technical solution, data integrity verification is performed only under normal wake-up conditions, and abnormal wake-up directly rolls back to non-volatile storage media to read data. This avoids the time overhead caused by invalid verification in scenarios where the data itself is untrustworthy, and further improves the system's recovery efficiency in abnormal scenarios.

[0013] In conjunction with the first aspect and the above implementation methods, in some possible implementations, the step of reading non-volatile data from the non-volatile storage medium when it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state includes: When it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state, a pre-configured first data list is obtained, the first data list containing first identification information corresponding to at least a portion of the non-volatile data; The step of obtaining the non-volatile data from the preset storage area includes: Retrieve at least a portion of the non-volatile data corresponding to the first identification information from the preset storage area.

[0014] In the above technical solution, by acquiring a pre-configured first data list, the system can selectively read some data from the non-volatile storage medium before hibernation, rather than all data, according to the pre-configured list. This avoids the additional time overhead caused by fully reading all non-volatile data before hibernation. Furthermore, the configurability of the list decouples the data selection logic from the core process, facilitating flexible adjustment of the data range to be backed up according to actual needs. By acquiring at least a portion of the non-volatile data corresponding to the first identification information from a preset storage area after wake-up, the system avoids rereading data from the slower-reading non-volatile storage medium. Instead, it directly obtains the required data from the reserved random access memory (RAM) that remains powered during hibernation and has a fast read speed, significantly reducing the time spent acquiring data after wake-up.

[0015] In conjunction with the first aspect and the above implementation methods, in some possible implementations, the data acquisition method further includes: Retrieve newly added non-volatile data; If it is determined that the frequency of write operations on the newly added non-volatile data is greater than a set frequency threshold, then the identification information corresponding to the newly added non-volatile data is added to the first data list.

[0016] In the above technical solution, by acquiring newly added non-volatile data and adding its identification information to the first data list when it is determined that the frequency of its write operation is greater than a set frequency threshold, the first data list can be adaptively updated according to the write activity of the data block, ensuring that important data that is frequently written can be dynamically included in the pre-stored range before hibernation without manual intervention, thereby improving the system maintenance efficiency while ensuring the integrity of data backup.

[0017] In conjunction with the first aspect and the above implementation methods, in some possible implementations, the data acquisition method further includes: Obtain a pre-configured second data list, which contains second identification information corresponding to the non-volatile data to be verified; Based on the second identification information, the corresponding non-volatile data to be verified is read from the non-volatile storage medium; Redundancy verification is performed based on the non-volatile data to be verified and the non-volatile data obtained from the preset storage area; If the redundancy check fails, a check failure message will be output.

[0018] In the above technical solution, by acquiring a pre-configured second data list, the system can selectively perform redundancy checks on the data blocks identified in the list after waking up, instead of performing a full secondary read of all data blocks. This ensures the security of critical data while minimizing additional time overhead. By reading the corresponding non-volatile data to be checked from the non-volatile storage medium based on the second identification information, and performing redundancy checks based on the non-volatile data to be checked and the non-volatile data obtained from the preset storage area, the system can use two independent data acquisition paths to cross-validate the same data. This effectively avoids the risk of erroneous data being used by upper-layer applications due to rare hardware failures or data disturbances from a single data source during sleep, significantly improving the reliability and functional security of data acquisition. By outputting a verification failure message in the event of a redundancy check failure, the system can promptly report data anomalies to external parties or upper-layer software, triggering corresponding fault handling or security operation measures, further ensuring the safe operation of electronic devices under abnormal conditions.

[0019] In conjunction with the first aspect and the above implementation methods, in some possible implementations, the data acquisition method further includes: Retrieve newly added non-volatile data; If it is determined that the newly added non-volatile data is non-volatile data related to functional safety, then the identification information corresponding to the newly added non-volatile data is added to the second data list.

[0020] In the above technical solution, the second data list can adaptively include newly added functional safety-critical data blocks, ensuring that any newly introduced safety-related data can undergo redundant verification after wake-up, thereby ensuring the functional safety of the system; at the same time, since non-functional safety-related data blocks will not be added to this list, unnecessary redundant verification operations are avoided from affecting the wake-up speed.

[0021] In conjunction with the first aspect and the above implementation methods, in some possible implementations, the data acquisition method further includes: If it is determined that the verification failed based on the first verification information and the second verification information, then the non-volatile data is obtained from the non-volatile storage medium.

[0022] In the above technical solution, by obtaining non-volatile data from non-volatile storage medium when the verification fails, the system can still obtain data from the original storage medium through the rollback mechanism even if the data in the preset storage area is damaged and unusable due to hibernation. This ensures the integrity and reliability of data acquisition even when the fast read path fails, and avoids system startup failure or abnormal operation due to data unavailability.

[0023] Secondly, this application provides a data acquisition device applied to an electronic device including a reserved random access memory (RAM) and a non-volatile storage medium, wherein the RAM remains powered when the electronic device is in a sleep state. The data acquisition device includes: A reading module is used to read non-volatile data from the non-volatile storage medium when it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state; The storage module is used to store the non-volatile data and the first verification information generated based on the non-volatile data in a preset storage area in the reserved random access memory. The first verification information is used to verify the data integrity of the non-volatile data. The verification module is configured to, if it is determined that the electronic device is awakened after entering the sleep state, perform data integrity verification on the data currently stored in the preset storage area to obtain second verification information; and, The acquisition module is used to acquire the non-volatile data from the preset storage area if the verification is determined to be successful based on the first verification information and the second verification information.

[0024] In conjunction with the second aspect, in some possible implementations, the first verification information includes a first verification value and a second verification value. The acquisition module is specifically used to: determine that the verification is successful if the second verification information matches the first verification value and the first verification value is consistent with the value obtained after performing a bitwise inversion operation on the second verification value.

[0025] In conjunction with the second aspect and the above implementation methods, in some possible implementations, the verification module is specifically used for: if it is determined that the electronic device is woken up after entering the sleep state, then acquiring wake-up source information, the wake-up source information being used to indicate whether the electronic device was woken up normally or abnormally; if it is determined based on the wake-up source information that the electronic device was woken up normally, then performing data integrity verification on the data currently stored in the preset storage area; and if it is determined based on the wake-up source information that the electronic device was woken up abnormally, then reading non-volatile data from the non-volatile storage medium.

[0026] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, the reading module is specifically used to: when it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state, obtain a pre-configured first data list, the first data list containing first identification information corresponding to at least a portion of the non-volatile data; obtaining the non-volatile data from the preset storage area includes: obtaining the at least a portion of the non-volatile data corresponding to the first identification information from the preset storage area.

[0027] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, the acquisition module is further configured to: acquire newly added non-volatile data; if it is determined that the write operation frequency of the newly added non-volatile data is greater than a set frequency threshold, then add the identification information corresponding to the newly added non-volatile data to the first data list. Additionally, it acquires a pre-configured second data list, the second data list containing second identification information corresponding to the non-volatile data to be verified; based on the second identification information, reads the corresponding non-volatile data to be verified from the non-volatile storage medium; performs redundancy verification based on the non-volatile data to be verified and the non-volatile data acquired from the preset storage area; if the redundancy verification fails, outputs a verification failure message. Furthermore, it acquires newly added non-volatile data; if it is determined that the newly added non-volatile data is non-volatile data related to functional safety, then add the identification information corresponding to the newly added non-volatile data to the second data list.

[0028] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, the acquisition module is further configured to: if it is determined that the verification has failed based on the first verification information and the second verification information, then acquire the non-volatile data from the non-volatile storage medium.

[0029] Thirdly, this application provides an electronic device, the electronic device comprising: Memory, used to store executable program code; and, A processor is configured to call and run the executable program code from the memory, causing the electronic device to perform the method of the first aspect or any possible implementation thereof.

[0030] Fourthly, this application provides a computer program product comprising: computer program code, which, when run on a computer, causes the computer to execute the data acquisition method in the first aspect or any possible implementation thereof.

[0031] Fifthly, this application provides a computer-readable storage medium storing computer program code that, when executed on a computer, causes the computer to perform the data acquisition method described in the first aspect or any possible implementation thereof. Attached Figure Description

[0032] Figure 1 This is a flowchart of one implementation of the data acquisition method provided in this application; Figure 2This is a flowchart of reading non-volatile data from a non-volatile storage medium provided in an embodiment of this application; Figure 3 This is a flowchart of another implementation of the data acquisition method provided in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of the data acquisition device provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0033] The technical solutions in this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0034] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0035] As electronic devices become increasingly complex, more and more devices need to maintain the integrity of critical data, such as system configuration parameters, user preference settings, and operational status records, even after power loss or entering a low-power sleep state. Non-volatile storage media (such as Flash memory and Electrically Erasable Programmable Read-Only Memory (EEPROM)) are widely used as persistent data storage carriers in electronic devices due to their data retention after power failure. When an electronic device wakes up from sleep mode, it typically needs to read all the necessary data from its non-volatile storage media for use by various functional modules. This reading process is located on the critical path of system startup, and its time consumption is directly added to the user-perceived startup delay. This problem is particularly prominent in scenarios with strict startup time requirements, such as in-vehicle electronic control units and smart terminals.

[0036] Taking the Electronic Control Unit (ECU) as an example, mainstream automotive ECU software development widely adopts the Automotive Open System Architecture (AUTOSAR) standard. Within this standard framework, Non-Volatile Memory (NvM) is a core component of the storage protocol stack in the basic software, primarily responsible for managing data that needs to be stored in non-volatile storage media. The AUTOSAR storage protocol stack typically includes, from top to bottom, an NvM module, a Flash EEPROM Emulation (FEE) module or an EEPROM Abstraction (EA) module, and a Flash Driver (FLS) module. Upper-layer application modules access non-volatile data through the unified interface of the NvM module, while the NvM module interacts with the underlying FLS driver through the FEE / EA module, ultimately enabling data read and write operations on physical storage media (such as on-chip flash memory or external EEPROM chips). It should be noted that the data read and write operations of the NvM module are asynchronous. That is, the application layer only initiates a request when calling the read and write interface. The actual data transmission is scheduled and executed in the background by the main function of the NvM module. It is necessary to continuously call the main functions of the NvM module, the FEE module / EA module and the FLS driver module to drive the operation to complete.

[0037] In existing technologies, after an electronic device is awakened from hibernation, it typically first completes the initialization of basic hardware, then reads all the necessary data from non-volatile storage media, and only after confirming that all data has been read successfully does it continue to execute the initialization of other modules or start application functions. Specifically, in the AUTOSAR architecture of an automotive ECU, this approach typically manifests as follows: after the system wakes from deep hibernation and completes basic driver initialization, it calls the standard interface function NvM_ReadAll of the NvM module to initiate the reading task of all data blocks. Subsequently, the system enters a waiting loop, continuously calling the main functions of the NvM module, the FEE module / EA module, and the FLS driver module until all data blocks have been read from the physical storage media and passed integrity verification. Only then does the system exit the waiting state and continue to execute the initialization of other modules or start application functions. Here, "system" refers to the software system running on the electronic device hardware, including the operating system kernel, basic software modules, and application programs.

[0038] However, existing technologies suffer from at least the following problems: the read speed of non-volatile storage media is slow, and the read operation is located on the critical path after wake-up, directly leading to increased system startup latency. Especially under the AUTOSAR architecture, data reading requires processing through multiple protocol stacks including the NvM module, FEE / EA module, and FLS driver module. When the data volume is large, the latency can reach tens or even hundreds of milliseconds, making it difficult to meet the requirements for fast startup and resulting in a poor user experience. Therefore, to solve the above problems, embodiments of this application provide a data acquisition method.

[0039] Figure 1 This is a flowchart illustrating a data acquisition method provided in an embodiment of this application. The method is applied to an electronic device including a reserved random access memory (RAM) and a non-volatile storage medium, wherein the RAM maintains power supply when the electronic device is in a sleep state. Figure 1 As shown, the data acquisition method includes the following steps: Step 101: If the electronic device meets the sleep conditions but has not yet entered sleep mode, read non-volatile data from the non-volatile storage medium.

[0040] Step 102: Store the non-volatile data and the first verification information generated based on the non-volatile data in a preset storage area in the reserved random access memory. The first verification information is used to verify the data integrity of the non-volatile data.

[0041] Step 103: If it is determined that the electronic device is woken up after entering a sleep state, the data integrity of the data currently stored in the preset storage area is verified to obtain the second verification information.

[0042] Step 104: If the verification is successful based on the first verification information and the second verification information, then non-volatile data is retrieved from the preset storage area.

[0043] It should be noted that electronic devices include at least a processor, Retention RAM (RRAM), and non-volatile storage media (such as Flash memory, Electrically Erasable Programmable Read-Only Memory, etc.). The processor is the core of the electronic device's computation and control, executing program instructions to perform data processing and read / write control. This processor can be a Microcontroller Unit (MCU), a Central Processing Unit (CPU), etc. Non-volatile storage media are persistent data storage carriers used to store data that needs to remain intact after power failure or sleep mode (such as system configuration parameters, user preference settings, and operating status records). Its characteristic is that data is not lost after power failure, but its read speed is relatively slow. Retention RAM is a special type of RAM that remains powered even when the electronic device enters sleep mode; therefore, the data stored in it is not lost when the device enters sleep mode. Furthermore, the read / write speed of Retention RAM is the same as ordinary RAM, much faster than non-volatile storage media, thus providing the hardware foundation for rapid data retrieval after wake-up.

[0044] In practical applications, the electronic device is initially assumed to be in operation. If the device meets the sleep conditions but has not yet entered sleep mode, non-volatile data is read from the non-volatile storage medium. "The electronic device meets the sleep conditions" means that the operating system or basic software module running on the electronic device, such as the Basic Software Mode Manager (BSWM), continuously monitors the system's operating status. When it detects no communication activity, no active task execution, or no user interaction events, it determines that the electronic device has met the prerequisites for entering a low-power sleep state. "Not yet in sleep mode" refers to a time window between detecting the sleep conditions and actually cutting off or shutting down power to modules other than the reserved random access memory. During this time window, the electronic device remains in normal operation; the processor can still execute instructions, and the storage controller can still access the non-volatile storage medium. "Reading non-volatile data from a non-volatile storage medium" refers to the processor issuing a read command to a non-volatile storage medium (such as on-chip data flash memory DFlash, external EEPROM chip, etc.) through the storage controller, and reading all the required data stored therein into the processor's internal cache or a designated storage area. It should be noted that, in this embodiment, the read operation targets all data stored in the non-volatile storage medium that needs to be used after the device wakes up, and not just a portion of the data.

[0045] Subsequently, the non-volatile data read from the non-volatile storage medium, along with the first verification information generated based on this data, will be stored in a preset storage area in RRAM. This preset storage area refers to a dedicated storage space pre-allocated in reserved random access memory for storing the aforementioned non-volatile data and its verification information. This preset storage area may be pre-allocated in reserved random access memory during the development phase through a link description file (.ld file).

[0046] Furthermore, the preset storage region can be further divided into a start marker segment and an end marker segment. The start marker segment marks the beginning of the data segment, and the end marker segment marks the end of the data segment, enabling the system to quickly locate the boundaries of the data segment after wake-up. Additionally, during the development phase of the electronic device, a memory mapping redefinition (memmap) mechanism can be used to forcibly allocate all random access memory image data of the non-volatile memory management module to the data segment of the preset storage region. Thus, when new non-volatile data blocks are added subsequently, the RAM image data of the new data block is automatically placed in the data segment during compilation, eliminating the need to manually modify the address allocation in the linker descriptor file or recalculate the storage location, thereby simplifying subsequent maintenance.

[0047] Additionally, it should be noted that this preset storage area can be further divided into multiple functional sub-segments. For example, the data segment stores the non-volatile data itself, the checksum segment stores the check value in the first check information, and the checksum inversion segment stores the bitwise inversion of the check value. The first check information is a check value calculated based on the read non-volatile data using a set algorithm (e.g., a cyclic redundancy check algorithm). Its purpose is to verify the data's integrity after subsequent wake-up. "Data integrity verification" refers to determining whether the data has been damaged or altered during sleep by comparing the check information stored before hibernation with the check information recalculated after wake-up. Specifically, the first check information includes a first check value and a second check value, where the second check value is the bitwise inversion of the first check value. If the second check information matches the first check value, and the first check value is consistent with the value obtained after performing a bitwise inversion operation on the second check value, then the verification is considered successful; otherwise, the verification is considered unsuccessful, and the non-volatile data is retrieved from the non-volatile storage medium.

[0048] In practice, the Cyclic Redundancy Check (CRC) algorithm can be used to calculate a checksum value for all non-volatile data stored in the data segment of the preset storage area. This checksum value is the first check value. Then, a bitwise NOT operation is performed on this first check value, that is, each bit of the binary digits of the first check value is reversed (0 becomes 1, 1 becomes 0), to obtain the second check value. For example, suppose the first check value (CRC checksum) calculated based on the non-volatile data is 0x1234ABCD (32-bit hexadecimal). After converting it to binary and performing a bitwise NOT operation, the second check value 0xEDCB5432 is obtained. At this point, the first check value 0x1234ABCD is stored in the checksum segment of the preset storage area, and the second check value 0xEDCB5432 is stored in the checksum NOT segment of the preset storage area.

[0049] After an electronic device enters sleep mode, if it is woken up, it first acquires wake-up source information. This wake-up source information indicates whether the electronic device was woken up normally or abnormally. "Normal wake-up" refers to the electronic device being woken up from deep sleep by an externally triggered event (such as a Controller Area Network (CAN) message, input / output (IO) interrupt, timer timeout, etc.). "Abnormal wake-up" refers to the electronic device being woken up due to power-on reset, watchdog reset, software reset, or external pin reset. It should be noted that the microcontroller unit of the electronic device is equipped with a wake-up source register. The electronic device acquires wake-up source information by reading the value of this register. Then, based on the register value and a preset mapping relationship, it determines whether the wake-up source information indicates a normal or abnormal wake-up. This preset mapping relationship defines the wake-up type corresponding to different register values. For example, when the read register value is the first preset value, the wake-up is determined to be normal; when the read register value is the second preset value, the wake-up is determined to be abnormal.

[0050] If the wake-up source information indicates that the electronic device was abnormally woken up, it means that this wake-up was not a complete hibernation, i.e., it resumed during the wake-up cycle. The data stored in the preset storage area of ​​the Retained Random Access Memory (RRAM) may have been lost or corrupted during the last power outage or reset. In this case, the data stored in the preset storage area should not be used; instead, all non-volatile data should be reread from the non-volatile storage medium to ensure data correctness and reliability. If the wake-up source information indicates that the electronic device was normally woken up, it means that the electronic device underwent a complete hibernation. The Retained Random Access Memory (RRAM) was continuously powered during hibernation, and the data stored in its preset storage area should theoretically remain intact. Therefore, data integrity verification can continue to be performed on the data currently stored in the preset storage area to obtain the second verification information.

[0051] Specifically, data integrity verification can be performed on the data currently stored in the preset storage area. Using the same algorithm as the first verification information generated before hibernation, the verification information for the data currently stored in the preset storage area is recalculated to obtain second verification information. This second verification information is a temporarily generated comparison benchmark used to compare with the first verification information stored before hibernation to determine whether the data has been corrupted or altered during hibernation. Specifically, the following dual verification can be performed: First verification: Recalculate the checksum of the data currently stored in the preset storage area to obtain the second verification information (i.e., the CRC checksum calculated in real time after wake-up). Compare the second verification information with the first verification value. If the two are consistent, the first verification passes, indicating that the non-volatile data stored in the preset storage area has not been damaged or changed during hibernation.

[0052] Second verification: Read the second check value stored in the checksum inversion segment of the preset storage area, perform a bitwise inversion operation on it, and compare the result with the first check value. If they match, the second verification passes, indicating that the verification information itself (i.e., the first check value and the second check value) has not been invalidated during storage due to bit flipping or other reasons.

[0053] If both of the above checks pass, the verification is considered successful, and non-volatile data is retrieved from the preset storage area for system use. It should be noted that in practical applications, if either of the two checks fails, the verification is considered unsuccessful, the data currently stored in the preset storage area is discarded, and the system reverts to rereading all data from the non-volatile storage medium. By retrieving non-volatile data from the non-volatile storage medium when verification fails, the system can still retrieve data from the original storage medium even if the data in the preset storage area becomes corrupted during hibernation. This ensures the integrity and reliability of data retrieval even when the fast read path fails, preventing system startup failure or operational anomalies due to data unavailability.

[0054] It's important to note that the rollback to rereading all data from non-volatile storage differs from the aforementioned rollback due to an abnormal wake-up. An abnormal wake-up rollback is initiated by a hardware reset causing low data reliability in a preset storage area, leading to its abandonment. Conversely, a verification failure rollback is initiated by a failure to verify the data at the verification level, resulting in its passive abandonment. The former determines data unreliability based on wake-up source information, while the latter discovers data corruption based on data integrity verification. Both ensure the system avoids using unreliable data, thereby guaranteeing system stability and functional security.

[0055] By requiring that the second verification information matches the first verification value and that the first verification value is consistent with the value obtained by performing a bitwise inversion operation on the second verification value before a verification is considered successful, the verification result has dual reliability protection. This avoids the possibility of missed or false judgments that may occur with a single verification, effectively improving the credibility of data obtained from the preset storage area and the security of system operation. At the same time, by performing the above verification only under normal wake-up conditions (abnormal wake-up directly rolls back to non-volatile storage media to read data), the time overhead caused by invalid verification in scenarios where the data itself is no longer trustworthy is avoided, further improving the system's recovery efficiency in abnormal scenarios.

[0056] To make it easier to understand, the above process will be illustrated with an example below: Taking an automotive ECU as an example, the ECU's linker description file defines the starting address of reserved random access memory (e.g., rram_start = 0xFEF00000), and after offsetting a predetermined amount (e.g., 0x80) from this starting address, a 16KB contiguous address space is allocated as a preset storage area. This preset storage area is further divided into: a data segment (.NVMShadow), a checksum segment (.NVMShadowChecksum), and a checksum inversion segment (.NVMShadowChecksumRev). The data segment (.NVMShadow) is used to store all the data of the 30 NVM data blocks read from the flash memory; the checksum segment is used to store the first checksum calculated based on the above data; and the checksum inversion segment is used to store the bitwise inversion of the first checksum.

[0057] During this process, the electronic device performs cyclic redundancy check calculation on all the data stored in the data segment to obtain the first check value (e.g., CRC checksum 0x1234ABCD), and writes the first check value into the checksum segment. At the same time, the bitwise inverse of the first check value (i.e., the second check value, such as 0xEDCB5432) is written into the checksum inverse segment.

[0058] After the electronic device is woken up, the system recalculates the CRC of the currently stored data in the preset storage area, obtaining the second checksum 0x1234ABCD. Then, double verification is performed. First check: 0x1234ABCD (second check information) matches 0x1234ABCD (first check value), pass.

[0059] Second check: The system reads the second check value 0xEDCB5432, performs a bitwise inversion operation, and obtains 0x1234ABCD, which is consistent with the first check value 0x1234ABCD, so it passes.

[0060] At this point, both checks pass, and the system retrieves non-volatile data from the preset storage area, quickly completing the startup process. Conversely, if either check fails, the system reverts to rereading data from the non-volatile storage medium. "Retrieving non-volatile data from the preset storage area" means that after successful checks, each functional module of the system directly reads the required data from the preset storage area reserved for random access memory (RAM) for subsequent system initialization and function operation. Because the read speed of reserved RAM is much faster than that of non-volatile storage media (such as flash memory or EEPROM), this step is executed extremely quickly, significantly reducing the data retrieval time after wake-up.

[0061] Based on the above, the data acquisition method provided in this application, by reading non-volatile data from a non-volatile storage medium when the electronic device meets the sleep conditions but has not yet entered sleep mode, is equivalent to transferring the time-consuming read operation, which was originally located on the critical path after wake-up, to be executed before sleep, eliminating the blocking time of waiting for data reading after wake-up. By storing the non-volatile data in a reserved random access memory that is powered during sleep, the data is completely preserved during sleep and can be directly acquired at the speed of random access memory after wake-up, without having to access the non-volatile storage medium with a slower read speed again. After wake-up, the data integrity of the data currently stored in the preset storage area is verified to obtain the second verification information. After determining that the verification is passed based on the first and second verification information, the non-volatile data is acquired from the preset storage area. This ensures that the data is not damaged or tampered with while achieving fast reading, shortening the time of acquiring data after wake-up while ensuring data reliability. This effectively solves the problem of increased system startup latency and difficulty in meeting fast startup requirements caused by the read operation being located on the critical path after wake-up and the slow read speed of the non-volatile storage medium, thus improving the user experience.

[0062] Figure 2 A flowchart for reading non-volatile data from a non-volatile storage medium is provided as an embodiment of this application, such as... Figure 2 As shown, when the electronic device is detected to meet the sleep conditions but has not yet entered sleep mode, reading non-volatile data from the non-volatile storage medium includes the following steps: Step 201: When it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state, a pre-configured first data list is obtained. The first data list contains first identification information corresponding to at least some of the non-volatile data.

[0063] Step 202: Obtain at least a portion of the non-volatile data corresponding to the first identification information from the preset storage area.

[0064] In practical applications, a "pre-configured first data list" refers to a data list pre-configured by developers based on system requirements during the development or maintenance phase of an electronic device. This data list records the identification information of non-volatile data blocks that need to be backed up before hibernation. This identification information is used to uniquely identify each non-volatile data block stored in the electronic device (for example, each data block can correspond to a data block number, which the system can use to uniquely index the corresponding data block). In other words, this first data list is pre-configured, and during the operation of the electronic device, the system can directly obtain this list without dynamically generating or temporarily determining the range of data to be backed up.

[0065] It should be noted that the acquisition of the first data list and the reading of data based on this list are triggered by the BSWM module executing a custom pre-sleep action when the electronic device meets the sleep conditions. Specifically, after detecting that the system meets the sleep conditions, the BSWM module enters a state of waiting for NVM to complete reading, and in this waiting state, it repeatedly executes the data reading function. In each loop, the system obtains a data block identifier from the first data list, calls the standard read interface of the non-volatile memory management module to initiate the reading task of the data block, and drives the data to be read from the physical storage medium by repeatedly calling the main function of the non-volatile memory management module, the main function of the FEE module / EA module, and the main function of the flash memory driver module; after each data block is read, the reading status of the data block is checked through the status query interface of the non-volatile memory management module. When all data blocks in the first data list have been read, the loop exits. After all data blocks have been read, the checksum of all data stored in the preset storage area is recalculated, and the checksum information stored in the checksum segment and the checksum inversion segment is updated to ensure that the checksum information stored before sleep matches the data content.

[0066] In order to minimize the impact of pre-sleep data reading on system power-down time, the system can call the operating system service to set a timer to shorten the scheduling cycle of the main functions of the non-volatile memory management module, the FEE / EA module, and the flash drive module, thereby improving the speed of pre-sleep data reading and ensuring that all backup operations are completed within the predetermined time.

[0067] After the electronic device completes the aforementioned pre-sleep backup operation and enters sleep mode, and is subsequently woken up and completes data integrity verification, the system accesses a preset storage area in the reserved random access memory. Since each identifier in the first data list uniquely corresponds to a data block, the system can locate and read the corresponding data block content from the preset storage area based on these identifiers. It should be understood that the correspondence between the identifier and the data block is established when storing data before sleep mode; that is, when reading data from the non-volatile storage medium before sleep mode, the system stores the corresponding data block in the corresponding location in the preset storage area according to the identifier in the first data list.

[0068] By acquiring a pre-configured first data list, the system can selectively read a portion of the data from the non-volatile storage medium before hibernation, avoiding the additional time overhead caused by a full read of all non-volatile data before hibernation. Furthermore, the configurability of the list decouples the data selection logic from the core process, allowing for flexible adjustment of the data range to be backed up according to actual needs. After waking up, by retrieving at least a portion of the non-volatile data corresponding to the first identification information from a preset storage area, the system avoids rereading data from the slower-reading non-volatile storage medium. Instead, it directly retrieves the required data from the retained random access memory (RAM), which remains powered during hibernation and has a fast read speed, significantly reducing the time spent retrieving data after wake-up.

[0069] Furthermore, in this embodiment, the first data list is not static but dynamically maintained based on the usage of newly added data blocks. Specifically, when a new non-volatile data block is added to the system, the system obtains information about the new non-volatile data block and monitors the frequency of its write operations. If it is determined that the frequency of write operations on the new non-volatile data block is greater than a set frequency threshold (e.g., the number of writes per second exceeds a predetermined number), the identification information corresponding to the new non-volatile data block is added to the first data list. Through this mechanism, the first data list can adaptively include data blocks that are frequently written to during system operation, ensuring that important data requiring real-time updates is included in the backup scope before hibernation, while avoiding the inclusion of data blocks with very few writes in the backup list, thus increasing unnecessary pre-hibernation operation overhead. The set frequency threshold can be configured by developers according to specific application scenarios and system performance requirements, and is not limited here.

[0070] By acquiring newly added non-volatile data and adding its identification information to the first data list when the frequency of its write operations exceeds a set frequency threshold, the first data list can be adaptively updated according to the write activity of data blocks. This ensures that frequently written important data can be dynamically included in the pre-stored range before hibernation without manual intervention, thereby improving system maintenance efficiency while ensuring the integrity of data backup.

[0071] Figure 3 A flowchart illustrating another data acquisition method provided in an embodiment of this application. For example... Figure 3 As shown, the data acquisition method includes the following steps: Step 301: If the electronic device meets the sleep conditions but has not yet entered the sleep state, read non-volatile data from the non-volatile storage medium.

[0072] Step 302: Store the non-volatile data and the first verification information generated based on the non-volatile data in a preset storage area in the reserved random access memory. The first verification information is used to verify the data integrity of the non-volatile data.

[0073] Step 303: If it is determined that the electronic device is woken up after entering a sleep state, the data integrity of the data currently stored in the preset storage area is verified to obtain the second verification information.

[0074] Step 304: If the verification is successful based on the first verification information and the second verification information, then non-volatile data is retrieved from the preset storage area.

[0075] Step 305: Obtain a pre-configured second data list, which contains the second identification information corresponding to the non-volatile data to be verified.

[0076] Step 306: Based on the second identification information, read the corresponding non-volatile data to be verified from the non-volatile storage medium.

[0077] Step 307: Perform redundancy verification based on the non-volatile data to be verified and the non-volatile data obtained from the preset storage area.

[0078] Step 308: If the redundancy check fails, output a check failure message.

[0079] For the specific execution process of steps 301-304, please refer to the above embodiments, which will not be repeated here.

[0080] For steps 305-308, the "second data list" refers to a data list pre-configured by developers based on functional safety requirements during the development or maintenance phase of the electronic device. This list records the identification information of non-volatile data blocks that require redundancy verification. Unlike the first data list (used to determine which data to back up before hibernation), the second data list is used to determine the data blocks that need to be reread from the non-volatile storage medium and compared with data in a preset storage area after wake-up. These data blocks are considered critical to the system, such as functional safety-critical data (i.e., errors in this data may affect the safety of the electronic device).

[0081] It should be noted that the number of data blocks in the second data list is usually much smaller than that in the first data list. Since the amount of data in the second data list directly affects the wake-up phase time, the configuration should follow the principle of "only listing the most important data in the system." Generally, new data blocks do not need to have corresponding identifiers added to this table. The second and first data lists can partially overlap (i.e., some data blocks appear in both lists simultaneously) or not overlap at all, depending on the system's functional safety and performance requirements.

[0082] After obtaining the second data list, the system reads the corresponding non-volatile data blocks to be verified one by one from the non-volatile storage medium according to the second identifier information in the list. Unlike the read operation before hibernation, the read operation at this time occurs after wake-up and only targets a small number of data blocks listed in the second data list, not all data blocks. For ease of understanding, let's take the vehicle ECU under the AUTOSAR architecture as an example: For each data block identifier in the second data list (nvm_read_wakeup_table), the system calls the standard read interface of the NVM module (e.g., NvM_ReadBlock) to initiate the read task of that data block. Then, it calls the NVM module main function (NvM_MainFunction), the FEE module main function (Fee_MainFunction) or the EA module main function (Ea_MainFunction), and the FLS driver module main function (Fls_MainFunction) in a loop to drive the data block to be read completely from the physical storage medium.

[0083] Next, the data to be verified is read from the non-volatile storage medium and compared with the corresponding data obtained from the preset storage area to verify whether they are consistent. "Redundancy verification" refers to cross-verifying the content of the same data block using two independent data acquisition paths (one from the preset storage area and the other from the non-volatile storage medium). Because the two paths are independent in terms of physical storage medium, read channel, and data processing flow, the risk of erroneous data going undetected due to a single data source failure can be effectively avoided.

[0084] In practice, the system reads the contents of each data block from the non-volatile storage medium and compares it byte-by-byte with the corresponding mirror data in the preset storage area. If the comparison results match, the system continues processing the next data block; if the comparison results do not match, it indicates that the data block stored in the preset storage area may be corrupted or abnormal. At this time, the system outputs a verification failure message. That is, the system reports the redundancy verification failure to the outside world or upper-layer software through predetermined methods (such as setting an error status flag, recording diagnostic fault codes, sending error notifications to upper-layer applications, illuminating fault indicator lights, etc.) so that further processing measures can be taken, such as entering a safe operating mode or triggering a fault recovery process.

[0085] It should be noted that the failure of redundancy verification differs from the anomaly represented by the failure of the comparison between the first and second verification information mentioned above: the former indicates that the data itself is inconsistent after being read from two independent paths, while the latter indicates that the data was corrupted during dormancy or that the verification information itself became invalid. These two verification mechanisms safeguard data security from different dimensions and complement each other.

[0086] By acquiring a pre-configured second data list, the system can perform redundancy checks on the identified data blocks in the list after waking up, instead of performing a full secondary read of all data blocks. This ensures the security of critical data while minimizing additional time overhead. By reading the corresponding non-volatile data to be checked from non-volatile storage media based on the second identification information, and performing redundancy checks based on the non-volatile data to be checked and the non-volatile data obtained from the preset storage area, the system can use two independent data acquisition paths to cross-validate the same data. This effectively avoids the risk of erroneous data being used by upper-layer applications due to rare hardware failures or data disturbances from a single data source during sleep, significantly improving the reliability and functional security of data acquisition. By outputting a verification failure message in the event of a redundancy check failure, the system can promptly report data anomalies to external parties or upper-layer software, triggering corresponding fault handling or security measures, further ensuring the safe operation of electronic devices under abnormal conditions.

[0087] It should be noted that for other non-volatile data not listed in the second data list, the system skips the operation of rereading from the non-volatile storage medium and directly uses the non-volatile data obtained from the preset storage area as the data source required for system startup and application operation. Since this data has passed the integrity verification of the aforementioned first and second verification information, it can be used directly without performing additional redundant verification, thereby minimizing the total time spent on data acquisition after wake-up while ensuring data security.

[0088] Furthermore, in this embodiment, the second data list is not static but dynamically maintained based on the functional safety attributes of newly added data blocks. Specifically, when a new non-volatile data block is added to the system, the system obtains information about the new non-volatile data block and determines whether it belongs to functional safety-related non-volatile data (i.e., data errors may affect the operational safety of the carrier on which the electronic device resides). If so, the identification information corresponding to the new non-volatile data block is added to the second data list. Through this mechanism, the second data list can adaptively include newly added functional safety-critical data blocks, ensuring that any newly introduced safety-related data can undergo redundancy verification after wake-up, thereby guaranteeing the functional safety of the system; at the same time, since non-functional safety-related data blocks are not added to this list, unnecessary redundant verification operations are avoided from affecting the wake-up speed.

[0089] Based on the above, to further demonstrate the technical effects of the embodiments of this application, comparative tests were conducted in a real-world engineering environment with approximately 30 non-volatile data blocks configured. Without the method of this application, reading all data from the non-volatile storage medium after waking from hibernation takes approximately 52 milliseconds; while with the method of this application, pre-storing data in reserved random access memory before hibernation and directly retrieving data from reserved random access memory after successful verification upon wake-up takes approximately 4.6 milliseconds. It is evident that the method of this application can reduce the data retrieval time after wake-up to less than one-tenth of the original time, significantly improving system startup speed.

[0090] Figure 4 This is a schematic diagram of a data acquisition device provided in an embodiment of this application. The data acquisition device is applied to an electronic device including a reserved random access memory (RAM) and a non-volatile storage medium. The RAM maintains power supply when the electronic device is in a sleep state, such as... Figure 4 As shown, the data acquisition device includes: a reading module 41, a storage module 42, a verification module 43, and an acquisition module 44.

[0091] The reading module 41 is used to read non-volatile data from a non-volatile storage medium when it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state.

[0092] The storage module 42 is used to store non-volatile data and first verification information generated based on the non-volatile data into a preset storage area in the reserved random access memory. The first verification information is used to verify the data integrity of the non-volatile data.

[0093] The verification module 43 is used to verify the data integrity of the data currently stored in the preset storage area if it is determined that the electronic device has entered a sleep state and is then woken up, in order to obtain the second verification information.

[0094] The acquisition module 44 is used to acquire non-volatile data from a preset storage area if the verification is determined to be successful based on the first verification information and the second verification information.

[0095] In one possible implementation, the first verification information includes a first verification value and a second verification value. The acquisition module 44 is specifically used to: if the second verification information matches the first verification value, and the first verification value is consistent with the value obtained after performing a bitwise inversion operation on the second verification value, then the verification is determined to be successful.

[0096] In one possible implementation, the verification module 43 is specifically used to: if it is determined that the electronic device is woken up after entering a sleep state, acquire wake-up source information, which indicates whether the electronic device is woken up normally or abnormally; if it is determined that the electronic device is woken up normally based on the wake-up source information, perform data integrity verification on the data currently stored in a preset storage area; and if it is determined that the electronic device is woken up abnormally based on the wake-up source information, read non-volatile data from a non-volatile storage medium.

[0097] In one possible implementation, the reading module 41 is specifically used to: when it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state, obtain a pre-configured first data list, the first data list containing first identification information corresponding to at least a portion of the non-volatile data; obtain non-volatile data from a preset storage area, including: obtaining at least a portion of the non-volatile data corresponding to the first identification information from the preset storage area.

[0098] In one possible implementation, the acquisition module 44 is further configured to: acquire newly added non-volatile data; if it is determined that the frequency of write operations on the newly added non-volatile data is greater than a set frequency threshold, then add the identification information corresponding to the newly added non-volatile data to a first data list. Additionally, it acquires a pre-configured second data list, which contains second identification information corresponding to the non-volatile data to be verified; based on the second identification information, it reads the corresponding non-volatile data to be verified from the non-volatile storage medium; performs redundancy verification based on the non-volatile data to be verified and the non-volatile data acquired from a preset storage area; and outputs a verification failure message if the redundancy verification fails. Furthermore, it acquires newly added non-volatile data; if it is determined that the newly added non-volatile data is non-volatile data related to functional safety, then add the identification information corresponding to the newly added non-volatile data to the second data list.

[0099] In one possible implementation, the acquisition module 44 is further configured to: if it is determined that the verification has failed based on the first verification information and the second verification information, then acquire non-volatile data from the non-volatile storage medium.

[0100] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0101] This application also provides an electronic device. Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0102] Typically, electronic device 500 includes one or more processors 501 and one or more memories 502.

[0103] Processor 501 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 501 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 501 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 501 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 501 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0104] Memory 502 may include one or more computer-readable storage media, which may be non-transitory. Memory 502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in memory 502 are used to store at least one computer program, which is executed by processor 501 to implement the method provided in the method embodiments of this application.

[0105] Those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on the electronic device 500, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0106] In addition, the apparatus provided in the embodiments of this application may specifically be a chip, component or module. The chip may include a connected processor and a memory. The memory is used to store instructions. When the processor calls and executes the instructions, the chip can execute the data acquisition method provided in the above embodiments.

[0107] This application also provides a computer-readable storage medium storing computer program code. When the computer program code is run on a computer, the computer executes the aforementioned method steps to implement the data acquisition method provided in the above embodiments.

[0108] This application also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the data acquisition method provided in the above embodiments.

[0109] In this application, the apparatus, computer-readable storage medium, computer program product or chip provided in the embodiments are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0110] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0111] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0112] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data acquisition method, characterized in that, A data acquisition method is applied to an electronic device comprising reserved random access memory (RRAM) and non-volatile storage media, wherein the RRAM is powered while the electronic device is in a sleep state. If it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state, non-volatile data is read from the non-volatile storage medium; The non-volatile data and the first verification information generated based on the non-volatile data are stored in a preset storage area in the reserved random access memory. The first verification information is used to verify the data integrity of the non-volatile data. If it is determined that the electronic device is woken up after entering the sleep state, then the data integrity of the data currently stored in the preset storage area is verified to obtain the second verification information; If the verification is determined to be successful based on the first verification information and the second verification information, the non-volatile data is retrieved from the preset storage area.

2. The data acquisition method according to claim 1, characterized in that, The first verification information includes a first verification value and a second verification value, wherein the second verification value is the bitwise inverse of the first verification value; the step of determining that the verification has passed based on the first verification information and the second verification information includes: If the second verification information matches the first verification value, and the first verification value is consistent with the value obtained by performing a bitwise inversion operation on the second verification value, then the verification is determined to be successful.

3. The data acquisition method according to claim 1, characterized in that, If it is determined that the electronic device is awakened after entering the sleep state, then data integrity verification is performed on the data currently stored in the preset storage area, including: If it is determined that the electronic device is woken up after entering the sleep state, then wake-up source information is obtained, which is used to indicate whether the electronic device is woken up normally or abnormally. If it is determined that the electronic device has been woken up normally based on the wake-up source information, the data integrity of the data currently stored in the preset storage area is verified.

4. The data acquisition method according to claim 3, characterized in that, The data acquisition method further includes: If it is determined based on the wake-up source information that the electronic device was abnormally woken up, non-volatile data is read from the non-volatile storage medium.

5. The data acquisition method according to claim 1, characterized in that, The step of reading non-volatile data from the non-volatile storage medium when it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state includes: When it is detected that the electronic device meets the sleep conditions but has not yet entered the sleep state, a pre-configured first data list is obtained, the first data list containing first identification information corresponding to at least a portion of the non-volatile data; The step of obtaining the non-volatile data from the preset storage area includes: Retrieve at least a portion of the non-volatile data corresponding to the first identification information from the preset storage area.

6. The data acquisition method according to claim 5, characterized in that, The data acquisition method further includes: Retrieve newly added non-volatile data; If it is determined that the frequency of write operations on the newly added non-volatile data is greater than a set frequency threshold, then the identification information corresponding to the newly added non-volatile data is added to the first data list.

7. The data acquisition method according to claim 1, characterized in that, The data acquisition method further includes: Obtain a pre-configured second data list, which contains second identification information corresponding to the non-volatile data to be verified; Based on the second identification information, the corresponding non-volatile data to be verified is read from the non-volatile storage medium; Redundancy verification is performed based on the non-volatile data to be verified and the non-volatile data obtained from the preset storage area; If the redundancy check fails, a check failure message will be output.

8. The data acquisition method according to claim 7, characterized in that, The data acquisition method further includes: Retrieve newly added non-volatile data; If it is determined that the newly added non-volatile data is non-volatile data related to functional safety, then the identification information corresponding to the newly added non-volatile data is added to the second data list.

9. The data acquisition method according to any one of claims 1-8, characterized in that, The data acquisition method further includes: If it is determined that the verification failed based on the first verification information and the second verification information, then the non-volatile data is obtained from the non-volatile storage medium.

10. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable program code; and, A processor is configured to call and run the executable program code from the memory, causing the electronic device to perform the data acquisition method as described in any one of claims 1 to 9.