Search

CN-121996474-A - File-system-free embedded small-capacity storage data security management method and system

CN121996474ACN 121996474 ACN121996474 ACN 121996474ACN-121996474-A

Abstract

A method for managing the safety of embedded small-capacity data without file system includes dividing the physical address region except the first read-write flag of memory into multiple dual-backup data storage regions and multiple-backup data storage regions, writing the storage structure in two backup regions in a dual-backup data storage region when the data is important data, sequentially checking the data in two backup regions for data reading and covering, adding one to the data number flag in the storage structure when the memory is one with the erasing time service life being lower than the threshold value, and selecting the number of the backup region in the multiple-backup data storage region, and reading. The invention solves the problem that the data storage without file system can be abnormally lost and the frequently written data can write the memory bad.

Inventors

  • LI HAO
  • ZHOU YI
  • Liang Ligeng
  • LI BING
  • GAO SHIYOU
  • LI WEI

Assignees

  • 北京四方继保自动化股份有限公司
  • 四方继保(武汉)软件有限公司

Dates

Publication Date
20260508
Application Date
20260224

Claims (10)

  1. 1. The file system-free embedded small-capacity storage data safety management method is characterized by comprising the following steps of The method comprises the steps of setting a storage area of the storage device, taking a physical address arbitrarily designated by the storage device as a storage address of a first read-write mark of the storage device, writing set mark data into the first read-write mark of the storage device, dividing an area corresponding to other physical addresses except the set physical address of the storage device into a plurality of double-backup storage data areas and a plurality of multi-backup storage data areas, wherein the double-backup storage data areas comprise two backup areas, and the multi-backup storage data areas comprise a plurality of backup areas; When the stored data is the set important data, the stored data is packaged into a corresponding storage structure, and the storage structure is written into two backup areas in one double-backup storage data area at the same time; When the stored data in the double-backup stored data area is read, judging whether the first reading is performed according to the first read-write mark of the memory, if so, formatting the stored data, otherwise, sequentially checking the stored data of the two backup areas according to a set sequence, and performing data reading and covering according to a checking result; When the memory is a memory with the erasing times service life being lower than the set quantity threshold value and the stored data is data with the storage frequency being higher than the set frequency threshold value, writing for multiple times, packaging the stored data into a corresponding storage structure when writing each time, adding one to a data number mark in the storage structure when writing each time, and selecting the number of a backup area in the corresponding multiple backup storage data area written according to the data number; when the stored data in the multi-backup stored data area is read, judging whether the first reading is performed according to the first read-write mark of the memory, if so, formatting the stored data, and otherwise, performing the reading according to the data number.
  2. 2. The file system-free embedded small-capacity storage data security management method according to claim 1, wherein: the physical address comprises a page or a sector where a first address is located, a page or a sector where a last address is located, or a page or a sector where any intermediate address is located.
  3. 3. The file system-free embedded small-capacity storage data security management method according to claim 1, wherein: when the stored data is the set important data, the stored data is packaged into a corresponding storage structure, specifically: During writing, firstly performing correctness checking, wherein the correctness checking is to check the data type, the data size and the data range; If the correctness checking is met, checking the stored data entity, wherein the stored data entity checking is CRC cyclic redundancy checking or SUM addition checking, and a stored data entity checking mark is obtained; For the double-backup storage data area, the set storage structure is a storage data entity check mark, a data length, a data version, a storage data entity and a reserved space.
  4. 4. A method of file system free embedded small volume storage data security management as claimed in claim 3, wherein: the writing of the storage structure into two backup areas in a dual-backup storage data area is performed simultaneously, specifically: After the address corresponding to the first backup area of the double-backup storage data area is successfully written, writing the same storage structure into the address corresponding to the second backup area of the same double-backup storage data area; And correspondingly writing into the first backup area and the storage structure of the corresponding address of the first backup area, reporting an alarm event of the memory failure if any writing fails, and reporting alarm information of the storage failure if all writing fails.
  5. 5. The file system-free embedded small-capacity storage data security management method according to claim 4, wherein: The stored data of the two backup areas are checked in turn according to the set sequence, and the data reading and the coverage are carried out according to the checking result, specifically: The storage data written into the address corresponding to the first backup area of the double-backup storage data area is a first parameter corresponding to the double-backup storage data area, and the storage data corresponding to the address of the second backup area is a second parameter corresponding to the double-backup storage data area; Firstly loading a second parameter, checking a check mark of a stored data entity, and recording whether a check result is correct; if the two stored data entity marks are both correct, the first parameter is used to load the first parameter into the memory, and whether the stored data entity marks of the two parameters are consistent is compared, if not, the first parameter is covered by the second parameter and is stored into the corresponding address of the second backup area; if only one part of parameter passes the verification, loading the corresponding parameter into the memory by using the corresponding parameter passing the verification, and covering the parameter passing the verification with the parameter not passing the verification; if both the two checks are not passed, the first parameter is used to load the first parameter into the memory, and report the alarm information of the storage error.
  6. 6. The file system-free embedded small-capacity storage data security management method according to claim 1, wherein: The writing is performed for a plurality of times, and the stored data is packaged into a corresponding storage structure during each writing, specifically: During writing, firstly performing correctness checking, wherein the correctness checking is to check the data type, the data size and the data range; if the correctness check is met, adding one to the data number in the storage structure on the basis of the original data number, and then performing storage data entity check, wherein the storage data entity check is CRC cyclic redundancy check or SUM addition check, so as to obtain a storage data entity check mark; for the multi-backup data storage area, the set storage structure is a data entity check mark, a data length, a data number and a data entity; And if the memory fails to be written, reporting alarm information of the memory failure.
  7. 7. The file system-free embedded small-capacity storage data security management method according to claim 6, wherein: the backup area numbers in the corresponding multi-backup storage data area written in are selected according to the data numbers, specifically: and using the current data number to make the total number of the backup areas in the multi-backup storage data area be the written backup area number in the multi-backup storage data area.
  8. 8. The file system-free embedded small-capacity storage data security management method according to claim 7, wherein: The reading is performed according to the data number, specifically: Circularly loading the storage data of all the written data backup areas of the corresponding multi-backup storage data area, checking the check marks of the storage data entities, comparing the data numbers corresponding to the data with the check result being the check passing, and finding out one storage data with the maximum data number; if the checking result of all the stored data entity checking marks is that the checking is not passed, searching the stored data with the largest corresponding data number in the stored data of the backup area of all the stored data to the memory, and reporting the alarm information of the storage error.
  9. 9. The file system-free embedded small-capacity storage data security management method according to claim 8, wherein: When checking the check mark of the stored data entity, if the check is not passed, repeating the reading for a plurality of times, wherein the time interval of each re-reading is a set time interval, if the check is passed, stopping reading, finally judging that the check is passed, and if the check reaches the set times, the check is always passed, finally judging that the check is not passed.
  10. 10. The file system-free embedded small-capacity storage data security management system based on the method of any one of claims 1-9, comprising a physical address mapping and first-time read-write management module, a dual-backup storage writing module, a dual-backup storage reading module, a multi-backup storage writing module and a multi-backup storage reading module, and being characterized in that: The physical address mapping and first reading and writing management module is used for taking a physical address arbitrarily designated by a memory as a first reading and writing mark storage address of the memory, writing set mark data into the first reading and writing mark of the memory, dividing an area corresponding to other physical addresses except the set physical address of the memory into a plurality of double-backup storage data areas and a plurality of multi-backup storage data areas, wherein the double-backup storage data areas comprise two backup areas, and the multi-backup storage data areas comprise a plurality of backup areas; When the stored data is set important data, the stored data is packaged into a corresponding storage structure, and the storage structure is written into two backup areas in one double-backup storage data area at the same time; The double-backup storage reading module is used for judging whether the first reading is performed according to the first reading and writing mark of the memory when the storage data in the double-backup storage data area is read, if so, formatting the storage data, otherwise, sequentially checking the storage data of the two backup areas according to a set sequence, and performing data reading and covering according to a checking result; When the memory is a memory with the erasing times less than the set quantity threshold value and the stored data is data with the storage frequency higher than the set frequency threshold value, writing for multiple times, packaging the stored data into a corresponding storage structure when writing each time, adding one to a data number mark in the storage structure when writing each time, and selecting the number of a backup area in the corresponding multi-backup storage data area to be written according to the data number; and the multi-backup storage reading module is used for judging whether the storage data is read for the first time according to the first read-write mark of the storage when the storage data in the multi-backup storage data area is read, if so, formatting the storage data, and otherwise, reading according to the data number.

Description

File-system-free embedded small-capacity storage data security management method and system Technical Field The invention belongs to the technical field of storage without a file system, and particularly relates to a method and a system for safely managing embedded small-capacity storage data without a file system. Background The embedded small-capacity memory without file system generally comprises an electrically erasable programmable read-only memory EEPROM, a ferroelectric memory FRAM, a FLASH memory FLASH, a nonvolatile random access memory NVRAM and the like, and the memories generally have smaller capacity, are designed along with the embedded system, do not have bus interfaces of universal storage media, do not support expansion, and need to design the storage content or file access rule in the embedded system. For traditional small embedded system products, the loading of the file system requires more hardware resources. Most of terminal products or sensor product hardware cannot support embedded software to use a file system, so that data storage of the products is generally stored in a manner of directly designating physical addresses and storing contents, and expandable capacity is provided for a certain type of designated data to be stored in a manner of designating physical addresses by reserving part of memories. CN105243071 proposes a retrievable file access method applicable to a file-free system "provides a retrievable file access method based on a file-free system. The patent uses a chain storage structure with a buffer memory, each data block is provided with a header with a fixed format for pointing to the previous data block, a fixed header with file detailed information is stored at the initial address of a memory, when an external computer needs to read data in an embedded device, the embedded system sends the data from the initial address of the memory to the external computer, and when the data is returned, all the data in the embedded memory can be returned to the external computer, and then all files or a certain designated file can be restored according to the file detailed information in the fixed header. However, the method still uses a file system and a file management model per se, dispersedly stores files in different physical addresses of a memory according to expansibility requirements, and reads and writes the files through a data table and a chained memory structure, so that the resource requirement is still higher, more memory space is required to record file header information and chained memory information, and the method is not suitable for small-capacity storage. CN119862157 proposes a file resource access method, device and medium of a file system-free platform, which allocates memory space to store file resources and file list areas respectively, manages file resources and file list areas by using PC folders, and formats read file data into a C-language array with a proper length for transmission. The storage medium comprises NAND flash memory, NOR flash memory and flash memory. But it is mainly directed to various types of flash memories and uses the file system of a PC for file resource generation and file list management, and is not applicable to a small embedded system nor a small storage medium. Disclosure of Invention In order to solve the defects existing in the prior art, the invention provides a safety management method for embedded small-capacity storage data without a file system, which is mainly applicable to the situation that a microcontroller is provided with a small-sized embedded memory, such as EEPROM, FRAM, FLASH, NVRAM and the like, and is used for the small-sized embedded system, so that the memory resource is saved, the embedded system overhead is saved, the problem that data in the prior art is not backed up is solved, and the problem that frequently written data possibly write the memory bad is solved. The invention adopts the following technical scheme. The first aspect of the present invention proposes a file system-free embedded small-capacity storage data security management method, comprising: The method comprises the steps of setting a storage area of the storage device, taking a physical address arbitrarily designated by the storage device as a storage address of a first read-write mark of the storage device, writing set mark data into the first read-write mark of the storage device, dividing an area corresponding to other physical addresses except the set physical address of the storage device into a plurality of double-backup storage data areas and a plurality of multi-backup storage data areas, wherein the double-backup storage data areas comprise two backup areas, and the multi-backup storage data areas comprise a plurality of backup areas; When the stored data is the set important data, the stored data is packaged into a corresponding storage structure, and the storage structure is written into two backup areas in one double-ba