CN113791936A - Data backup method and device and storage medium - Google Patents

Data backup method and device and storage medium Download PDF

Info

Publication number
CN113791936A
CN113791936A CN202111143584.4A CN202111143584A CN113791936A CN 113791936 A CN113791936 A CN 113791936A CN 202111143584 A CN202111143584 A CN 202111143584A CN 113791936 A CN113791936 A CN 113791936A
Authority
CN
China
Prior art keywords
data
random access
access memory
nonvolatile data
nonvolatile
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111143584.4A
Other languages
Chinese (zh)
Inventor
姜珊
孙忠刚
许凯程
张晓谦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
FAW Group Corp
Original Assignee
FAW Group Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by FAW Group Corp filed Critical FAW Group Corp
Priority to CN202111143584.4A priority Critical patent/CN113791936A/en
Publication of CN113791936A publication Critical patent/CN113791936A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1456Hardware arrangements for backup
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore

Abstract

The application discloses a data backup method, a data backup device and a storage medium, which relate to the technical field of computers, and realize the backup of nonvolatile data by combining a FLASH simulation EEPROM management mechanism and a peripheral EEPROM management mechanism, thereby improving the reliability of nonvolatile data storage. The method comprises the following steps: under the condition that the nonvolatile data are detected to be written, the nonvolatile data are synchronously written into a first random access memory and a second random access memory of the micro control unit; and writing the nonvolatile data in the first random access memory into a FLASH of the micro control unit within the remaining time for executing the periodic task of the system, and writing the nonvolatile data in the second random access memory into an EEPROM of the peripheral of the micro control unit by executing the preset periodic task.

Description

Data backup method and device and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a data backup method, a data backup device and a storage medium.
Background
An Electronic Control Unit (ECU) may Control the operating state of the vehicle and may also collect driving data generated during driving. These DATA include some DATA (Non Volatile DATA, NV DATA) that have nonvolatile storage requirements. At present, operations such as management and maintenance of NV DATA can be performed by using a Non-Volatile Memory (NVM) management component, and according to the difference of storage media, there are two ways for managing NV DATA, including a management mechanism based on an external Electrically Erasable Programmable Read Only Memory (EEPROM) and a management mechanism based on a FLASH analog EEPROM.
For the management mechanism of the Peripheral EEPROM, a Micro Control Unit (MCU) communicates with an EEPROM Peripheral chip through a Serial Peripheral Interface (SPI), and the SPI between the MCU and the Peripheral may be interfered or interrupted, which may cause failure of stored data. For the management mechanism of FLASH analog EEPROM, if the relevant FLASH operation is interrupted accidentally, it may cause Error Correction Code (ECC) Error, resulting in failure of the whole FLASH block, and causing larger-scale data damage. As can be seen, the existing two management mechanisms for NV DATA have insufficient reliability of storing DATA.
Disclosure of Invention
The application provides a data backup method, a device and a storage medium, which realize the backup of nonvolatile data by combining a FLASH simulation EEPROM management mechanism and a peripheral EEPROM management mechanism, thereby improving the reliability of nonvolatile data storage.
In order to achieve the purpose, the technical scheme is as follows:
in a first aspect, the present application provides a data backup method, including: under the condition that the nonvolatile data are detected to be written, the nonvolatile data are synchronously written into a first random access memory and a second random access memory of the micro control unit; and writing the nonvolatile data in the first random access memory into a FLASH of the micro control unit within the remaining time for executing the periodic task of the system, and writing the nonvolatile data in the second random access memory into an EEPROM of the peripheral of the micro control unit by executing the preset periodic task.
According to the technical scheme, when the fact that the nonvolatile data are written is detected, the nonvolatile data are synchronously written into the two random access memories, and then the nonvolatile data in the two random access memories are written into two different storage media (FLASH and EEPROM). Due to the fact that the possibility that the nonvolatile data written into the two storage media are invalid or damaged at the same time is low, the technical scheme of the application can conduct double backup on the nonvolatile data through the two storage media, and reliability of nonvolatile data storage can be improved. In addition, because the existing management mechanism of the FLASH simulation EEPROM and the management mechanism of the peripheral EEPROM are limited in storage objects and the requirement difference of the writing process is large, the writing processes of the two mechanisms are optimized in the application, and the writing of the management mechanism of the FLASH simulation EEPROM (corresponding to the FLASH for writing the nonvolatile data in the first random access memory into the micro control unit in the application) is realized within the residual time of the execution of the periodic task of the system. And, the writing of the management mechanism of the peripheral EEPROM (corresponding to the writing of the nonvolatile data in the second random access memory into the EEPROM of the peripheral of the micro control unit in the present application) is realized by presetting a periodic task. Therefore, the difference of the writing processes of the two mechanisms can be reduced, so that the double-mechanism writing can be better completed, and the normal operation and power-on and power-off time requirements of the vehicle control ECU can be ensured.
Optionally, in a possible design manner, the data backup method provided by the present application may further include:
reading nonvolatile data in FLASH to a first random access memory, and reading nonvolatile data in an external EEPROM to a second random access memory;
performing consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory;
and reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are determined to be consistent.
Optionally, in another possible design manner, after the "performing the consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory" described above, the method may include:
comparing the time stamps of the non-volatile data in the first random access memory and the non-volatile data in the second random access memory in the event that it is determined that the non-volatile data in the first random access memory and the non-volatile data in the second random access memory are inconsistent;
and reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit according to the sequence of the time stamps.
Optionally, in another possible design manner, before the "performing the consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory", the method may include:
performing validity check on the non-volatile data in the first random access memory and the non-volatile data in the second random access memory;
and determining that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both valid data.
Optionally, in another possible design manner, after the "checking the validity of the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory" is performed, the method may include:
under the condition that the nonvolatile data in the first random access memory are determined to be valid data and the nonvolatile data in the second random access memory are determined to be invalid data, reading the nonvolatile data in the first random access memory to the micro control unit;
or reading the nonvolatile data in the second random access memory to the micro control unit under the condition that the nonvolatile data in the second random access memory is determined to be valid data and the nonvolatile data in the first random access memory is determined to be invalid data.
Optionally, in another possible design manner, after the "checking the validity of the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory" is performed, the method may include:
and reading the preset data to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both determined to be invalid data.
Optionally, in another possible design, the "writing the nonvolatile data in the first random access memory into the FLASH of the micro control unit" may include: writing the nonvolatile data in the first random access memory into the FLASH under the condition of receiving the first feedback information; the first feedback information is used for indicating that the nonvolatile data is written into the FLASH to be completed; the "writing the nonvolatile data in the second random access memory into the EEPROM of the micro control unit peripheral device" may include: under the condition of receiving the second feedback information, writing the nonvolatile data in the second random access memory into the external EEPROM; and the second feedback information is used for indicating that the nonvolatile data is written into the external EEPROM to be completed.
In a second aspect, the present application provides a data backup apparatus, including: the device comprises a detection module and a writing module;
the detection module is used for detecting whether nonvolatile data is written in;
the writing module is used for synchronously writing the nonvolatile data into a first random access memory and a second random access memory of the micro control unit under the condition that the detection module detects that the nonvolatile data is written;
and the writing module is also used for writing the nonvolatile data in the first random access memory into the FLASH of the micro-control unit in the remaining time for executing the periodic task of the system, and writing the nonvolatile data in the second random access memory into the EEPROM of the peripheral of the micro-control unit by executing the preset periodic task.
Optionally, in a possible design, the data backup apparatus provided in the present application may further include: a reading module and a checking module;
the reading module is used for reading the nonvolatile data in the FLASH to the first random access memory and reading the nonvolatile data in the external EEPROM to the second random access memory;
the check module is used for performing consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory;
the reading module is also used for reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are determined to be consistent.
Optionally, in another possible design, the data backup apparatus provided in the present application may further include: a comparison module;
a comparison module for comparing the time stamps of the non-volatile data in the first random access memory and the non-volatile data in the second random access memory if it is determined that the non-volatile data in the first random access memory and the non-volatile data in the second random access memory are not consistent;
and the reading module is also used for reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit according to the sequence of the time stamps.
Optionally, in another possible design, the verification module is further configured to:
performing validity check on the non-volatile data in the first random access memory and the non-volatile data in the second random access memory;
and determining that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both valid data.
Alternatively, in another possible design,
the reading module is also used for reading the nonvolatile data in the first random access memory to the micro control unit under the condition that the nonvolatile data in the first random access memory is determined to be valid data and the nonvolatile data in the second random access memory is determined to be invalid data;
or the reading module is further used for reading the nonvolatile data in the second random access memory to the micro control unit under the condition that the nonvolatile data in the second random access memory is determined to be valid data and the nonvolatile data in the first random access memory is determined to be invalid data.
Alternatively, in another possible design,
the reading module is further used for reading the preset data to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both determined to be invalid data.
Optionally, in another possible design, the writing module is specifically configured to: writing the nonvolatile data in the first random access memory into the FLASH under the condition of receiving the first feedback information; the first feedback information is used for indicating that the nonvolatile data is written into the FLASH to be completed; the write module is further specifically configured to: under the condition of receiving the second feedback information, writing the nonvolatile data in the second random access memory into the external EEPROM; and the second feedback information is used for indicating that the nonvolatile data is written into the external EEPROM to be completed.
In a third aspect, the present application provides a data backup apparatus, including a memory, a processor, a bus, and a communication interface; the memory is used for storing computer execution instructions, and the processor is connected with the memory through a bus; when the data backup apparatus is operating, the processor executes computer-executable instructions stored by the memory to cause the data backup apparatus to perform the data backup method as provided in the first aspect above.
Optionally, the data backup device may be a system-on-chip for implementing data backup. The system-on-chip is configured to support the data backup apparatus to implement the functions referred to in the first aspect, such as receiving, sending or processing data and/or information referred to in the data backup method. The chip system includes a chip and may also include other discrete devices or circuit structures.
In a fourth aspect, the present application provides a computer-readable storage medium having instructions stored therein, which when executed by a computer, cause the computer to perform the data backup method as provided in the first aspect.
In a fifth aspect, the present application provides a computer program product comprising computer instructions which, when run on a computer, cause the computer to perform the data backup method as provided in the first aspect.
It should be noted that all or part of the computer instructions may be stored on the computer readable storage medium. The computer-readable storage medium may be packaged with a processor of the data backup apparatus, or may be packaged separately from the processor of the data backup apparatus, which is not limited in this application.
For the descriptions of the second, third, fourth and fifth aspects in this application, reference may be made to the detailed description of the first aspect; in addition, for the beneficial effects described in the second aspect, the third aspect, the fourth aspect and the fifth aspect, reference may be made to beneficial effect analysis of the first aspect, and details are not repeated here.
In the present application, the names of the data backup apparatuses do not limit the devices or the functional modules themselves, and in actual implementation, the devices or the functional modules may appear by other names. Insofar as the functions of the respective devices or functional modules are similar to those of the present application, they fall within the scope of the claims of the present application and their equivalents.
These and other aspects of the present application will be more readily apparent from the following description.
Drawings
Fig. 1 is a schematic structural diagram of a data backup system according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a data backup method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another data backup method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another data backup method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a data backup device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another data backup device according to an embodiment of the present application.
Detailed Description
The following describes in detail a data backup method, an apparatus, and a storage medium provided in an embodiment of the present application with reference to the accompanying drawings.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone.
The terms "first" and "second" and the like in the description and drawings of the present application are used for distinguishing different objects or for distinguishing different processes for the same object, and are not used for describing a specific order of the objects.
Furthermore, the terms "including" and "having," and any variations thereof, as referred to in the description of the present application, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
In the description of the present application, the meaning of "a plurality" means two or more unless otherwise specified.
The vehicle control ECU can control the running state of the vehicle and can also collect running data generated in the driving process. These DATA contain some NV DATA. At present, an NVM management component can be used to perform operations such as management and maintenance on NV DATA, and according to the difference of storage media, there are two ways for NV DATA management, including a management mechanism based on an external EEPROM and a management mechanism based on a FLASH analog EEPROM.
For the management mechanism of the peripheral EEPROM, the MCU communicates with the EEPROM peripheral chip through the SPI, and the SPI between the MCU and the peripheral can be interfered or interrupted, which may cause the failure of stored data. For the management mechanism of the FLASH analog EEPROM, if the relevant FLASH operation is interrupted accidentally, the ECC of the FLASH may be erroneous, resulting in the failure of the whole FLASH block, and causing larger-scale data damage. As can be seen, the existing two management mechanisms for NV DATA have insufficient reliability of storing DATA.
In view of the problems in the prior art, the embodiments of the present application provide a data backup method, in which dual backup is performed on nonvolatile data through two storage media, so that reliability of nonvolatile data storage can be improved, and write-in through the dual mechanism can be better completed by optimizing storage mechanisms of the two storage media, so as to ensure normal operation and power-on and power-off time requirements of a vehicle control ECU.
The data backup method provided by the embodiment of the application can be applied to a data backup system, and the data backup system can include a data backup device, a first Random Access Memory (RAM), a second RAM, a FLASH and an external EEPROM.
Illustratively, the data backup device may be an NVM management component. Referring to fig. 1, a data backup system may include an NVM management component, a first random access memory, a second random access memory, FLASH, and a peripheral EEPROM. The NVM management component, the first random access memory, the second random access memory, the FLASH and the external EEPROM are different storage media of the same MCU.
As shown in fig. 1, read-write operation can be implemented between the NVM management component and the first random access memory, read-write operation can be implemented between the NVM management component and the second random access memory, read-write operation can be implemented between the first random access memory and the FLASH, and read-write operation can be implemented between the second random access memory and the peripheral EEPROM.
The data backup method provided by the present application is described below with reference to the data backup system shown in fig. 1.
Referring to fig. 2, the data backup method provided in the embodiment of the present application includes S201 to S203:
s201, whether nonvolatile data are written is detected.
Nonvolatile data is data that has nonvolatile storage requirements.
S202, under the condition that the nonvolatile data are detected to be written, the nonvolatile data are synchronously written into a first random access memory and a second random access memory of the micro control unit.
S203, writing the nonvolatile data in the first random access memory into a FLASH of the micro control unit in the remaining time of the system periodic task, and writing the nonvolatile data in the second random access memory into an EEPROM of the peripheral of the micro control unit by executing the preset periodic task.
The system periodic tasks can be some periodic tasks originally owned by the micro control unit. In the case of detecting that the nonvolatile data is written, the nonvolatile data in the first random access memory can be written into the FLASH of the micro control unit by using the remaining time of the periodic task of the system.
For example, if the time interval between the first period and the second period of the system periodic task is 10ms, the time duration required for executing the system periodic task in the first period is 5ms, and the time duration required for executing the system periodic task in the second period is 7 ms. Thus, the nonvolatile data in the first random access memory can be written into the FLASH of the micro control unit within the remaining time length of 5ms in the first period, and the nonvolatile data in the first random access memory can be written into the FLASH of the micro control unit within the remaining time length of 3ms in the second period.
Optionally, in a possible implementation manner, the optimization of the management mechanism of the FLASH analog EEPROM may be implemented by setting the priority of the system periodic task and the FLASH task that writes the nonvolatile data in the first random access memory into the micro control unit. Specifically, the priority of the system periodic task can be determined to be higher than that of the FLASH simulated EEPROM operation task, so that the system periodic task can be preferentially executed according to the high-low sequence of the priority, and the nonvolatile data in the first random access memory is written into the FLASH of the micro control unit within the residual time for executing the system periodic task, thereby ensuring that the original system periodic task is not influenced.
The preset periodic task may be a predetermined periodic task dedicated to performing writing of the nonvolatile data in the second random access memory into the EEPROM of the micro control unit peripheral. The period of the preset periodic task can be determined according to the duration of the busy state of the external EEPROM. For example, if the busy state of the peripheral EEPROM is 4ms, the period of the preset periodic task may be 5 ms. Therefore, the MCU can execute other tasks in the 4ms busy state of the external EEPROM, and after the busy state is released, the MCU can preset periodic tasks to be scheduled again and write the nonvolatile data in the second random access memory into the EEPROM of the external MCU.
Optionally, the data backup method provided in the embodiment of the present application may further include: reading nonvolatile data in FLASH to a first random access memory, and reading nonvolatile data in an external EEPROM to a second random access memory; performing consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory; and reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are determined to be consistent.
Since the nonvolatile data is backed up through the dual mechanism in the embodiment of the application, the consistency check can be performed on the dual-backed-up nonvolatile data firstly in the process of reading the nonvolatile data. If the nonvolatile data in the first random access memory and the second random access memory are consistent, the nonvolatile data stored by the two mechanisms are not damaged, the data updating time is the same, and the nonvolatile data stored by any mechanism can be read.
Optionally, the data backup method provided in the embodiment of the present application may further include: comparing the time stamps of the non-volatile data in the first random access memory and the non-volatile data in the second random access memory in the event that it is determined that the non-volatile data in the first random access memory and the non-volatile data in the second random access memory are inconsistent; and reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit according to the sequence of the time stamps.
The embodiment of the application optimizes the writing processes of the two mechanisms, reduces the difference of the writing processes, but the two writing mechanisms still have slight difference. Thus, there may be a difference between the writing time of the nonvolatile data from the first random access memory to the FLASH and the writing time of the nonvolatile data from the second random access memory to the peripheral EEPROM, and the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory may not be consistent. Therefore, in the embodiment of the application, the time stamps of the nonvolatile data stored in the two mechanisms can be compared, and the nonvolatile data with the newer time stamp can be read to the micro control unit.
Optionally, before performing consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory, the data backup method provided in the embodiment of the present application may further include: performing validity check on the non-volatile data in the first random access memory and the non-volatile data in the second random access memory; and determining that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both valid data.
Since the stored data may be invalid in the process of writing the nonvolatile data in the first random access memory into the FLASH of the micro control unit and the stored data may also be invalid in the process of writing the nonvolatile data in the second random access memory into the EEPROM of the micro control unit, the validity of the double-backed up data may be checked before the consistency check of the double-backed up data.
Optionally, in a possible implementation manner, in a case that it is determined that the nonvolatile data in the first random access memory is valid data and the nonvolatile data in the second random access memory is invalid data, the nonvolatile data in the first random access memory is read to the micro control unit.
Optionally, in another possible implementation manner, in a case that it is determined that the nonvolatile data in the second random access memory is valid data and the nonvolatile data in the first random access memory is invalid data, the nonvolatile data in the second random access memory is read to the micro control unit.
Optionally, in another possible implementation manner, in a case that it is determined that both the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are invalid data, the preset data is read to the micro control unit.
The preset data is manually determined according to requirements in advance.
For example, the vehicle control ECU may control the operating state of the vehicle according to the nonvolatile data, and the nonvolatile data with different values may correspond to different vehicle speeds per hour. In the case where the nonvolatile data of the double backup is invalid data, in order to avoid the vehicle from being forced to stop, the vehicle may be caused to travel according to preset data. The preset data may not be optimal driving data, for example, may correspond to a limp home mode of the vehicle, but may ensure that the vehicle is still in a driving state.
Optionally, in the case of receiving the first feedback information, the nonvolatile data in the first random access memory may be written into the FLASH; the first feedback information is used for indicating that the nonvolatile data is written into the FLASH to be completed; in the case of receiving the second feedback information, the nonvolatile data in the second random access memory can be written into the peripheral EEPROM; and the second feedback information is used for indicating that the nonvolatile data is written into the external EEPROM to be completed.
In summary, in the data backup method provided in the embodiment of the present application, when it is detected that nonvolatile data is written, the nonvolatile data is synchronously written into two random access memories, and then the nonvolatile data in the two random access memories is written into two different storage media (FLASH and EEPROM), respectively. Due to the fact that the possibility that the nonvolatile data written into the two storage media are invalid or damaged at the same time is low, the technical scheme of the application can conduct double backup on the nonvolatile data through the two storage media, and reliability of nonvolatile data storage can be improved. In addition, because the existing management mechanism of the FLASH simulation EEPROM and the management mechanism of the peripheral EEPROM are limited in storage objects and the requirement difference of the writing process is large, the writing processes of the two mechanisms are optimized in the application, and the writing of the management mechanism of the FLASH simulation EEPROM (corresponding to the FLASH for writing the nonvolatile data in the first random access memory into the micro control unit in the application) is realized within the residual time of the execution of the periodic task of the system. And, the writing of the management mechanism of the peripheral EEPROM (corresponding to the writing of the nonvolatile data in the second random access memory into the EEPROM of the peripheral of the micro control unit in the present application) is realized by presetting a periodic task. Therefore, the difference of the writing processes of the two mechanisms can be reduced, so that the double-mechanism writing can be better completed, and the normal operation and power-on and power-off time requirements of the vehicle control ECU can be ensured.
In summary, as shown in fig. 3, an embodiment of the present application further provides a data backup method, including S301 to S306:
s301, when detecting that the nonvolatile data are written, synchronously writing the nonvolatile data into a first random access memory and a second random access memory of the micro control unit.
After step S301, step S302 and step S304 are executed.
S302, writing the nonvolatile data in the first random access memory into a FLASH of the micro control unit in the remaining time of the periodic task of the execution system.
S303, determining that the nonvolatile data is written into the FLASH to be completed.
Step S306 is performed after step S303.
And S304, writing the nonvolatile data in the second random access memory into an EEPROM of the peripheral of the micro control unit by executing a preset periodic task.
S305, determining that the nonvolatile data is written into the external EEPROM to be completed.
S306, determining that the nonvolatile data double backup is completed.
Optionally, as shown in fig. 4, an embodiment of the present application further provides a data backup method, including S401-S4014:
s401, starting and running the micro control unit, and initializing FLASH and EEPROM.
After step S401, step S402 and step S405 are executed.
S402, reading the nonvolatile data in the FLASH to a first random access memory.
S403, determining that the nonvolatile data is read to the first random access memory to be completed.
S404, validity check is carried out on the nonvolatile data in the first random access memory.
After step S404, step S408 is performed.
S405, reading the nonvolatile data in the EEPROM to a second random access memory.
S406, determining that the nonvolatile data is read to the second random access memory to be completed.
And S407, performing validity check on the nonvolatile data in the second random access memory.
S408, judging whether the nonvolatile data in the first random access memory and the second random access memory are both valid data.
Executing step S409 if it is determined that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both valid data; in a case where it is determined that invalid data exists in the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory, step S4012 is performed.
S409, judging whether the nonvolatile data in the first random access memory and the second random access memory are consistent.
In a case where it is determined that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are consistent, executing step S4010; step S4011 is performed in a case where it is determined that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are not consistent.
S4010, reading the nonvolatile data in the first random access memory or the second random access memory to the micro control unit.
And S4011, reading the nonvolatile data with the newer timestamp into the micro control unit.
S4012, judging whether the nonvolatile data in the first random access memory and the second random access memory are both invalid data.
Executing step S4013 if it is determined that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both invalid data; in a case where it is determined that valid data exists in the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory, step S4014 is performed.
S4013, setting the nonvolatile data in the first random access memory and the second random access memory as preset data, and reading the preset data to the micro control unit.
S4014, reading effective data in the nonvolatile data in the first random access memory and the second random access memory to the micro control unit.
It is understood that the EEPROM referred to in the embodiments of the present application is an EEPROM peripheral to the MCU.
As shown in fig. 5, an embodiment of the present application further provides a data backup apparatus, for example, the data backup apparatus may be an NVM management component in the data backup system related to fig. 1 in the foregoing embodiment. The data backup apparatus may include: a detection module 11 and a writing module 12.
The detecting module 11 executes S201 in the above method embodiment, and the writing module 12 executes S202 and S203 in the above method embodiment.
Specifically, the detecting module 11 is configured to detect whether nonvolatile data is written;
the writing module 12 is configured to write the nonvolatile data into the first random access memory and the second random access memory of the micro control unit synchronously when the detection module 11 detects that the nonvolatile data is written in;
the writing module 12 is further configured to write the nonvolatile data in the first random access memory into the FLASH of the micro control unit within the remaining time length of the system periodic task, and write the nonvolatile data in the second random access memory into the EEPROM of the external device of the micro control unit by executing the preset periodic task.
Optionally, in a possible implementation manner, the data backup apparatus provided in the present application may further include: a reading module and a checking module;
the reading module is used for reading the nonvolatile data in the FLASH to the first random access memory and reading the nonvolatile data in the external EEPROM to the second random access memory;
the check module is used for performing consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory;
the reading module is also used for reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are determined to be consistent.
Optionally, in another possible implementation manner, the data backup apparatus provided in the present application may further include: a comparison module;
a comparison module for comparing the time stamps of the non-volatile data in the first random access memory and the non-volatile data in the second random access memory if it is determined that the non-volatile data in the first random access memory and the non-volatile data in the second random access memory are not consistent;
and the reading module is also used for reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit according to the sequence of the time stamps.
Optionally, in another possible implementation manner, the checking module is further configured to:
performing validity check on the non-volatile data in the first random access memory and the non-volatile data in the second random access memory;
and determining that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both valid data.
Alternatively, in another possible implementation,
the reading module is also used for reading the nonvolatile data in the first random access memory to the micro control unit under the condition that the nonvolatile data in the first random access memory is determined to be valid data and the nonvolatile data in the second random access memory is determined to be invalid data;
or the reading module is further used for reading the nonvolatile data in the second random access memory to the micro control unit under the condition that the nonvolatile data in the second random access memory is determined to be valid data and the nonvolatile data in the first random access memory is determined to be invalid data.
Alternatively, in another possible implementation,
the reading module is further used for reading the preset data to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both determined to be invalid data.
Optionally, in another possible implementation manner, the writing module 12 is specifically configured to: writing the nonvolatile data in the first random access memory into the FLASH under the condition of receiving the first feedback information; the first feedback information is used for indicating that the nonvolatile data is written into the FLASH to be completed; the writing module 12 is further specifically configured to: under the condition of receiving the second feedback information, writing the nonvolatile data in the second random access memory into the external EEPROM; and the second feedback information is used for indicating that the nonvolatile data is written into the external EEPROM to be completed.
Optionally, the data backup apparatus may further include a storage module, where the storage module is configured to store program codes of the data backup apparatus.
As shown in fig. 6, the embodiment of the present application further provides a data backup apparatus, which includes a memory 41, a processor 42(42-1 and 42-2), a bus 43, and a communication interface 44; the memory 41 is used for storing computer execution instructions, and the processor 42 is connected with the memory 41 through a bus 43; when the data backup apparatus is operating, the processor 42 executes computer-executable instructions stored in the memory 41 to cause the data backup apparatus to perform the data backup method applied to the MCU as provided in the above embodiments.
In particular implementations, processor 42 may include one or more Central Processing Units (CPUs), such as CPU0 and CPU1 shown in FIG. 6, as one embodiment. And as an example, the data backup device may include a plurality of processors 42, such as processor 42-1 and processor 42-2 shown in fig. 6. Each of the processors 42 may be a single-Core Processor (CPU) or a multi-Core Processor (CPU). Processor 42 may refer herein to one or more devices, circuits, and/or processing cores that process data (e.g., computer program instructions).
The memory 41 may be, but is not limited to, a read-only memory 41 (ROM) or other type of static storage device that can store static information and instructions, a random access memory (ram) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 41 may be self-contained and coupled to the processor 42 via a bus 43. The memory 41 may also be integrated with the processor 42.
In a specific implementation, the memory 41 is used for storing data in the present application and computer-executable instructions corresponding to software programs for executing the present application. The processor 42 may perform various functions of the data backup apparatus by running or executing software programs stored in the memory 41 and calling data stored in the memory 41.
The communication interface 44 is any device, such as a transceiver, for communicating with other devices or communication networks, such as a control system, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), and the like. The communication interface 44 may include a receiving unit implementing a receiving function and a transmitting unit implementing a transmitting function.
The bus 43 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an extended ISA (enhanced industry standard architecture) bus, or the like. The bus 43 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but this is not intended to represent only one bus or type of bus.
For the explanation of the related contents in this embodiment, reference may be made to the above method embodiments, which are not described herein again.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.
The embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the computer executes the instructions, the computer is enabled to execute the data backup method applied to the MCU provided in the foregoing embodiment.
The computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM), a register, a hard disk, an optical fiber, a CD-ROM, an optical storage device, a magnetic storage device, any suitable combination of the foregoing, or any other form of computer readable storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuit (ASIC). In embodiments of the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for data backup, comprising:
under the condition that nonvolatile data are detected to be written, the nonvolatile data are synchronously written into a first random access memory and a second random access memory of a micro control unit;
and writing the nonvolatile data in the first random access memory into a FLASH of the micro control unit within the remaining time for executing the periodic task of the system, and writing the nonvolatile data in the second random access memory into an EEPROM of the peripheral of the micro control unit by executing a preset periodic task.
2. The data backup method of claim 1, wherein the method further comprises:
reading the nonvolatile data in the FLASH to the first random access memory, and reading the nonvolatile data in the EEPROM of the peripheral to the second random access memory;
performing a consistency check on the non-volatile data in the first random access memory and the non-volatile data in the second random access memory;
reading the non-volatile data in the first random access memory or the non-volatile data in the second random access memory to the micro control unit if it is determined that the non-volatile data in the first random access memory and the non-volatile data in the second random access memory are consistent.
3. The data backup method according to claim 2, wherein after the consistency check of the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory, the method further comprises:
comparing timestamps of the non-volatile data in the first random access memory and the non-volatile data in the second random access memory if it is determined that the non-volatile data in the first random access memory and the non-volatile data in the second random access memory are inconsistent;
and reading the nonvolatile data in the first random access memory or the nonvolatile data in the second random access memory to the micro control unit according to the sequence of the timestamps.
4. The data backup method according to claim 2, wherein before the performing the consistency check on the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory, the method further comprises:
verifying the validity of the non-volatile data in the first random access memory and the non-volatile data in the second random access memory;
determining that the non-volatile data in the first random access memory and the non-volatile data in the second random access memory are both valid data.
5. The data backup method according to claim 4, wherein after the validity checking of the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory, the method further comprises:
reading the non-volatile data in the first random access memory to the micro control unit if it is determined that the non-volatile data in the first random access memory is valid data and the non-volatile data in the second random access memory is invalid data;
or, in the case that the nonvolatile data in the second random access memory is determined to be valid data and the nonvolatile data in the first random access memory is determined to be invalid data, reading the nonvolatile data in the second random access memory to the micro control unit.
6. The data backup method according to claim 4, wherein after the validity checking of the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory, the method further comprises:
reading preset data to the micro control unit under the condition that the nonvolatile data in the first random access memory and the nonvolatile data in the second random access memory are both determined to be invalid data.
7. The data backup method according to any one of claims 1 to 6,
the writing of the non-volatile data in the first random access memory to the FLASH of the micro control unit comprises: writing the nonvolatile data in the first random access memory into the FLASH under the condition that first feedback information is received; the first feedback information is used for indicating that the nonvolatile data is written into the FLASH to be completed;
the writing of the non-volatile data in the second random access memory to the EEPROM of the micro control unit peripheral comprises: writing the non-volatile data in the second random access memory into an EEPROM of the peripheral device if second feedback information is received; the second feedback information is used for indicating that the nonvolatile data is written into the EEPROM of the peripheral equipment to be completed.
8. A data backup apparatus, comprising:
the detection module is used for detecting whether nonvolatile data is written in;
the writing module is used for synchronously writing the nonvolatile data into a first random access memory and a second random access memory of the micro control unit under the condition that the detection module detects that the nonvolatile data is written;
the writing module is further configured to write the nonvolatile data in the first random access memory into the FLASH of the micro control unit within a remaining time period for executing a system periodic task, and write the nonvolatile data in the second random access memory into an EEPROM peripheral to the micro control unit by executing a preset periodic task.
9. A data backup device is characterized by comprising a memory, a processor, a bus and a communication interface; the memory is used for storing computer execution instructions, and the processor is connected with the memory through the bus;
when the data backup apparatus is in operation, a processor executes the computer-executable instructions stored by the memory to cause the data backup apparatus to perform the data backup method of any of claims 1-7.
10. A computer-readable storage medium having stored therein instructions, which when executed by a computer, cause the computer to perform a data backup method according to any one of claims 1 to 7.
CN202111143584.4A 2021-09-28 2021-09-28 Data backup method and device and storage medium Pending CN113791936A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111143584.4A CN113791936A (en) 2021-09-28 2021-09-28 Data backup method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111143584.4A CN113791936A (en) 2021-09-28 2021-09-28 Data backup method and device and storage medium

Publications (1)

Publication Number Publication Date
CN113791936A true CN113791936A (en) 2021-12-14

Family

ID=79184732

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111143584.4A Pending CN113791936A (en) 2021-09-28 2021-09-28 Data backup method and device and storage medium

Country Status (1)

Country Link
CN (1) CN113791936A (en)

Similar Documents

Publication Publication Date Title
CN107357666B (en) Multi-core parallel system processing method based on hardware protection
CN102760090B (en) Debugging method and computer system
CN105723348A (en) Detection of unauthorized memory modification and access using transactional memory
CN102541469B (en) Method, equipment and system for protecting data in firmware storage system
US8516298B2 (en) Data protection method for damaged memory cells
CN102467440A (en) Internal memory error detection system and method
US20220171855A1 (en) Electronic control device and security verification method for electronic control device
CN115756984A (en) Memory test method, device, equipment and storage medium
CN114385418A (en) Protection method, device, equipment and storage medium for communication equipment
EP2645249A1 (en) Information processing apparatus, and method of controlling information processing apparatus
US7797134B2 (en) System and method for testing a memory with an expansion card using DMA
US20170052850A1 (en) Numerical controller
CN113791936A (en) Data backup method and device and storage medium
US7350109B2 (en) System and method for testing a memory using DMA
CN115576734A (en) Multi-core heterogeneous log storage method and system
US20130318310A1 (en) Processor processing method and processor system
US10922023B2 (en) Method for accessing code SRAM and electronic device
CN113238842A (en) Task execution method and device and storage medium
CN113470725A (en) Method and device for testing dynamic random access memory
CN117369905B (en) Starting method and system of flash memory platform, electronic equipment and storage medium
JP2014182676A (en) Log collection device, arithmetic unit, and log collection method
JP7172155B2 (en) Electronic control device and software generation method
CN113377421B (en) Method, device, equipment and medium for detecting software and hardware version information
CN109683803B (en) Data processing method and device
US20230315302A1 (en) Complete And Fast Protection Against CID Conflict

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination