CN105404475A - Storage management system and method for small-capacity flash in MCU chip - Google Patents

Storage management system and method for small-capacity flash in MCU chip Download PDF

Info

Publication number
CN105404475A
CN105404475A CN201510931109.1A CN201510931109A CN105404475A CN 105404475 A CN105404475 A CN 105404475A CN 201510931109 A CN201510931109 A CN 201510931109A CN 105404475 A CN105404475 A CN 105404475A
Authority
CN
China
Prior art keywords
page0
block
page1
file
page
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.)
Granted
Application number
CN201510931109.1A
Other languages
Chinese (zh)
Other versions
CN105404475B (en
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.)
AOZE ELECTRONICS Co Ltd WUHAN
Original Assignee
AOZE ELECTRONICS Co Ltd WUHAN
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 AOZE ELECTRONICS Co Ltd WUHAN filed Critical AOZE ELECTRONICS Co Ltd WUHAN
Priority to CN201510931109.1A priority Critical patent/CN105404475B/en
Publication of CN105404475A publication Critical patent/CN105404475A/en
Application granted granted Critical
Publication of CN105404475B publication Critical patent/CN105404475B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provide a storage management system for a small-capacity flash in an MCU chip. The system comprises the following units: a memory structure initial unit, which is used to divide an available flash page into a current page Page 0 and a standby page Page 1, wherein the page 0 and the page 1 are divided into a plurality of Blocks, and each Block is a basic unit of data storage; a storage management system initialization unit, which is used to perform initialization when the storage management is powered on, performing Block writing continuity check and Block usage condition check on the page 0 and the page 1 in sequence, and according to the usage condition, determining a modification processing measure; and a read/write policy execution unit, which is used to execute a read policy or a write policy after storage management system initialization. The present invention also provides a memory management method for the small-capacity flash in the MCU chip.

Description

The storage management system of low capacity flash and method in MCU sheet
Technical field
The present invention relates to low capacity numerical information storing technology field, the storage management system of low capacity flash and method in especially a kind of MCU sheet.
Background technology
Flash memory is a kind of non-volatile (Non-Volatile) internal memory, and under the condition not having electric current supply, also can keep data muchly, its storage characteristics is equivalent to hard disk, and applicable single-chip microprocessor MCU preserves critical data information in emergency situations.
Flash memory generally to carry out erase operation to memory cell paging.The write operation of any flash device can only be carried out in unit that is empty or that wiped, so in most cases, first must perform erasing before carrying out write operation.
But the erasable number of times of flash memory is at 100,000 times ~ about 1,000,000 times, so need the strategy taking abrasion equilibration.When likely frequent is carried out erasable, also need to do delay write.Therefore the memory management policy of prior art cannot improve erasable number of times and the writing speed of flash memory.
Summary of the invention
In view of this, the invention provides a kind of storage management system and the method that can improve low capacity flash in the erasable number of times of flash memory and the MCU sheet of writing speed.
A storage management system of low capacity flash in MCU sheet, it comprises as lower unit:
Storage organization initial cell, for being divided into page Page0 and page Page1 for subsequent use face to face to the operational flash page; Page0 and Page1 is divided into some pieces of Block, and Block is the elementary cell that data store;
Storage management system initialization unit, for carrying out initialization when storage management system powers on, carry out Block to Page0, Page1 successively and write continuity check, Block service condition checks, and determines to revise treatment measures according to service condition;
Read-write strategy execution unit, reads strategy for performing after storage management system initialization is complete or writes strategy.
In MCU sheet of the present invention low capacity flash storage management system in, the data structure that in storage organization initial cell, data store comprises the endnote Footer of filename FileName, file content storage area DataArea and file attribute;
The expansion form of Footer is as follows: comprise, for representing the BlockProp of this Block attribute; For representing the Deled whether presents is deleted; Multiple Block is needed to carry out the mark Idx stored for marking whether; For representing that this Block data field has the DataLenInBlock of how many valid data; The CheckSum of integrality is write for verifying a Block.
In MCU sheet of the present invention low capacity flash storage management system in, described storage management system initialization unit comprises:
After storage management system powers on, continuity check is carried out to Page0, when Page0 stores discontinuous, erasing Page0 and Page1, and terminate; When Page0 storage is continuous print, continuity check is carried out to Page1; When Page1 stores discontinuous, erasing Page0 and Page1, and terminate;
When Page1 storage is continuous print, successively the service condition of Page0, Page1 is checked;
Judge that Page0, Page1 are the need of repairing or all wiping, when needs are all wiped, erasing Page0 and Page1, and terminate; When Page0 and/or Page1 needs to repair, Page0 and/or Page1 is repaired, and terminates; Do not need directly to terminate when repairing at Page0 and Page1.
In MCU sheet of the present invention low capacity flash storage management system in, write strategy in described read-write strategy execution unit and comprise:
The state of storage management system is changed into writing state by idle condition;
Judge whether the effecting surplus space of storage management system meets write request, when not meeting write request, directly terminates;
When meeting write request, judging whether Page0 writes full, when Page0 writes full, carrying out Page switching, and performing the function after Page switching;
When Page0 does not write full, continue to judge whether the blank Block of residue in Page0 enough writes, and when the blank Block of the residue in Page0 enough writes, carries out chasing after writing and terminating in Page0; The blank Block of residue in Page0 writes not, writes 0 and carries out Page0 switching, and perform the function after Page switching in the blank Block of the residue in Page0;
The retrieval starting point of Page1 be set to most end and in Page1, chasing after written document after Page switches;
After writing in files terminating, in Page1, retrieving forward a file, when retrieving the file of damage, continuing retrieval forward until search complete;
When retrieving effective document, judging whether this effective document exists in Page0, when existing, repeating in Page0, to retrieve forward a file after writing in files terminates, when not existing, repeat the retrieval starting point of Page1 be set to most end and chase after written document in Page1.
In MCU sheet of the present invention low capacity flash storage management system in, read strategy in described read-write strategy execution unit and comprise:
Retrieval starting point is set to last Block used of Page0, retrieves a Block forward; Do not have filename to meet retrieval requirement after retrieving whole Block, then report without this file and terminate; Filename do not meet and all Block not yet search complete time, continue forward retrieve a Block;
When retrieving the identical Block of filename, file is verified, in the obstructed out-of-date end of verification; When verification is passed through, if first Block or follow-up Block, then report file damages and terminates, if terminate Block, then jump to forward first Block according to information and read whole file content and length, delete property is not for delete and to terminate, if single Block, then and file reading content and delete property and file size terminate.
The present invention also provides the memory management method of low capacity flash in a kind of MCU sheet, and it comprises the steps:
S1, page Page0 and page Page1 for subsequent use is face to face divided into the operational flash page; Page0 and Page1 is divided into some pieces of Block, and Block is the elementary cell that data store;
S2, carry out initialization when storage management system powers on, carry out Block to Page0, Page1 successively and write continuity check, Block service condition checks, and determines to revise treatment measures according to service condition;
S3, storage management system initialization complete after perform read strategy execution unit or write strategy execution unit.
In MCU sheet of the present invention low capacity flash memory management method in, the data structure that in S1, data store comprises the endnote Footer of filename FileName, file content storage area DataArea and file attribute;
The expansion form of Footer is as follows: comprise, for representing the BlockProp of this Block attribute; For representing the Deled whether presents is deleted; Multiple Block is needed to carry out the mark Idx stored for marking whether; For representing that this Block data field has the DataLenInBlock of how many valid data; The CheckSum of integrality is write for verifying a Block.
In MCU sheet of the present invention low capacity flash memory management method in, described S2 comprises:
After storage management system powers on, continuity check is carried out to Page0, when Page0 stores discontinuous, erasing Page0 and Page1, and terminate; When Page0 storage is continuous print, continuity check is carried out to Page1; When Page1 stores discontinuous, erasing Page0 and Page1, and terminate;
When Page1 storage is continuous print, successively the service condition of Page0, Page1 is checked;
Judge that Page0, Page1 are the need of repairing or all wiping, when needs are all wiped, erasing Page0 and Page1, and terminate; When Page0 and/or Page1 needs to repair, Page0 and/or Page1 is repaired, and terminates; Do not need directly to terminate when repairing at Page0 and Page1.
In MCU sheet of the present invention low capacity flash memory management method in, write strategy in described S3 and comprise:
The state of storage management system is changed into writing state by idle condition;
Judge whether the effecting surplus space of storage management system meets write request, when not meeting write request, directly terminates;
When meeting write request, judging whether Page0 writes full, when Page0 writes full, carrying out Page switching, and performing the function after Page switching;
When Page0 does not write full, continue to judge whether the blank Block of residue in Page0 enough writes, and when the blank Block of the residue in Page0 enough writes, carries out chasing after writing and terminating in Page0; The blank Block of residue in Page0 writes not, writes 0 and carries out Page0 switching, and perform the function after Page switching in the blank Block of the residue in Page0;
The retrieval starting point of Page1 be set to most end and in Page1, chasing after written document after Page switches;
After writing in files terminating, in Page1, retrieving forward a file, when retrieving the file of damage, continuing retrieval forward until search complete;
When retrieving effective document, judging whether this effective document exists in Page0, when existing, repeating in Page0, to retrieve forward a file after writing in files terminates, when not existing, repeat the retrieval starting point of Page1 be set to most end and chase after written document in Page1.
In MCU sheet of the present invention low capacity flash memory management method in, read strategy in described S3 and comprise:
Retrieval starting point is set to last Block used of Page0, retrieves a Block forward; Do not have filename to meet retrieval requirement after retrieving whole Block, then report without this file and terminate; Filename do not meet and all Block not yet search complete time, continue forward retrieve a Block;
When retrieving the identical Block of filename, file is verified, in the obstructed out-of-date end of verification; When verification is passed through, if first Block or follow-up Block, then report file damages and terminates, if terminate Block, then jump to forward first Block according to information and read whole file content and length, delete property is not for delete and to terminate, if single Block, then and file reading content and delete property and file size terminate.
In MCU sheet provided by the invention, the storage management system of low capacity flash and method have following characteristics: 1, be applicable in MCU sheet, have the low capacity Flash storage administration of 2 pages at least; 2, the data of all writes provide all in the form of a file, identify with filename; 3, the quantity of file is dynamic management, can increase at any time, amendment, deletes; 4, the size of each file does not fix requirement, only has ceiling restriction (having relation with concrete configuration); 5 situations about not write for burst power down during write, can screen when next time powers on.The present invention can improve erasable number of times and the writing speed of flash memory.
Accompanying drawing explanation
Fig. 1 is the storage management system structured flowchart of low capacity flash in the MCU sheet that provides of embodiment of the present invention;
Fig. 2 is Flash paging schematic diagram;
Fig. 3 is schematic diagram data in Flash paging;
Fig. 4 is data structure schematic diagram;
Fig. 5 is that Footer launches form schematic diagram;
Fig. 6 repairs to judge signal chart;
Fig. 7 is the memory management method process flow diagram of low capacity flash in the MCU sheet that provides of embodiment of the present invention.
Embodiment
As shown in Figure 1, the storage management system of low capacity flash in a kind of MCU sheet, it comprises as lower unit:
Storage organization initial cell 10, for being divided into page Page0 and page Page1 for subsequent use face to face to the operational flash page; Page0 and Page1 is divided into some pieces of Block, and Block is the elementary cell that data store.
Alternatively, the data structure that in storage organization initial cell 10, data store comprises the endnote Footer of filename FileName, file content storage area DataArea and file attribute.
The expansion form of Footer is as follows: comprise, for representing the BlockProp of this Block attribute; For representing the Deled whether presents is deleted; Multiple Block is needed to carry out the mark Idx stored for marking whether; For representing that this Block data field has the DataLenInBlock of how many valid data; The CheckSum of integrality is write for verifying a Block.
As shown in Figure 2, operable Flash page face is divided into 2 groups, can be understood as 2 large pages, i.e. Page0 and Page1, one is current Page, and one is Page for subsequent use.Again each Page is divided into several Block, Block is the most elementary cell that data store.During each write, after the Block write last time, write new Block.As shown in Figure 3, if all Block of Page0 were written into, then by all in Page0 be that the Block of latest data all transfers to after in another Page1 and writes.
As shown in Figure 4, the data in each Block follow the data structure of Fig. 4.With the filename of 4 bytes (Hex) beginning, terminate with the Footer of 4 bytes, remaining space is data field DataArea.FileName: with 32 of 4 bytes shaping non-zero marks, also can be described as file ID.DataArea: the content storage area of file.Footer: the endnote of file attribute.
The expansion form of Footer is as Fig. 5.The attribute of BlockProp: this Block.00: this Block is single Block, represents that this Block just used by this file; 01: this Block is a first Block, represents that this Documents Comparison is large, needs to use multiple Block to store, and this Block is first Block that this file stores use; 10: this Block is a follow-up Block, represent that this Documents Comparison is large, need to use multiple Block to store, and this Block is the follow-up Block that this file stores use, is which follow-up Block is provided by Idx on earth; 11: this Block is one terminates Block, represent that this Documents Comparison is large, need to use multiple Block to store, and this Block is last Block that this file stores use.
Deled: whether presents is deleted.1: presents is deleted; 0: presents is not deleted.When a file needs deleted time, need again that writing in files name is identical, content is empty, and this attribute is the Block of 1.Deleted to mark current file.
Idx: when a Documents Comparison is large, when needing multiple Block to carry out storing, mark continuous print sequence number with this attribute; This property value of first Block is 0.If this file is smaller, only need a Block to store, then this attribute is 0.
DataLenInBlock: have how many valid data at the data field of this Block.
CheckSum: School Affairs, is used for the integrality of guarantee Block write.If this Block power down in the process write, if School Affairs has all been write into, illustrate to write before power down and completed; Otherwise then do not complete.In Block except this byte the School Affairs of all data.Can use add and, the verification mode such as CRC-8.
1. stores service is necessary for exclusive reference, to ensure, when the file of Block more than stores, can deposit continuously.
2. when Block storage is performed more than one, if find that current Page remaining space stores not, then need the residue Block of Page0 to be all written as after file is called the empty file of 0, write this file, finally perform Page again and exchange.If residue Bolck is not all written as the empty file of filename 0, directly carry out Page to exchange when not completing, power on again after there is power down, then can find when initialization that 2 are not all write full Page, and do not know this exchanges to another Page from which Page, cause repair to carry out.
3. stores service needs to be recorded in the Block used of effective (file is up-to-date) in Page0.This information can indicate after performing Page exchange immediately, the residue Block number in Page after exchange.So, when more than one, Block storage is performed, if find that Page0 remaining space stores not, even and if also store not after carrying out Page exchange immediately, then this refusal writes this file, and reporting errors.
When a retrieval file, from Page0, last Block used moves forward line retrieval.If retrieved, and the verification of School Affairs continuity is all no problem, then report is retrieved successfully; If whole Page does not retrieve, in report without this file; If it is identical to retrieve a filename, but School Affairs continuity check is not passed through, then continue to retrieve forward, the file effective of the same name retrieving a Geju City then report file damages but finds an older record, otherwise report file damages.
Storage management system initialization unit 20, for carrying out initialization when storage management system powers on, carry out Block to Page0, Page1 successively and write continuity check, Block service condition checks, and determines to revise treatment measures according to service condition.
Alternatively, described storage management system initialization unit 20 comprises:
After storage management system powers on, continuity check is carried out to Page0, when Page0 stores discontinuous, erasing Page0 and Page1, and terminate; When Page0 storage is continuous print, continuity check is carried out to Page1; When Page1 stores discontinuous, erasing Page0 and Page1, and terminate;
When Page1 storage is continuous print, successively the service condition of Page0, Page1 is checked;
Judge that Page0, Page1 are the need of repairing or all wiping, when needs are all wiped, erasing Page0 and Page1, and terminate; When Page0 and/or Page1 needs to repair, Page0 and/or Page1 is repaired, and terminates; Do not need directly to terminate when repairing at Page0 and Page1.
As shown in Figure 6, continuity check: new write must write after used Block in last time, namely in Page, the use of Block must be continuous print.If discontinuous, possible Page0 and Page1 is first use, has unexpected gibberish, then 2 Page can be wiped out.
Block service condition checks: add up the Block quantity used in 2 Page respectively.Service condition in each Page may have " expiring ", " less than ", " sky " this situation in three.
Repair and judge: determine whether by tabling look-up to need to repair or directly wipe, also determine which Page is current Page in addition, which is Page for subsequent use (as Fig. 6) simultaneously.Wherein 2 Page be all " less than " or " expiring ", in this, whom situation cannot distinguish is current Page, and correct write operation also there will not be this situation, so all wipe out; One " less than ", one " expiring " may be then that system power failure causes when Page switching does not complete, then need to repair as far as possible, continued Page and switched.
Repair: less than Page from the beginning retrieve first file, that writes that this file causes just changes Page action.If this file is complete, then wipe after reading this file this less than Page after write this file again, then continued Page switch; If retrieve first file damages, illustrate that this file has not all also write with regard to power down, then cannot repair, directly wipe out this less than Page.
Read-write strategy execution unit 30, reads strategy for performing after storage management system initialization is complete or writes strategy.
Alternatively, write strategy in described read-write strategy execution unit 30 to comprise:
The state of storage management system is changed into writing state by idle condition;
Judge whether the effecting surplus space of storage management system meets write request, when not meeting write request, directly terminates;
When meeting write request, judging whether Page0 writes full, when Page0 writes full, carrying out Page switching, and performing the function after Page switching;
When Page0 does not write full, continue to judge whether the blank Block of residue in Page0 enough writes, and when the blank Block of the residue in Page0 enough writes, carries out chasing after writing and terminating in Page0; The blank Block of residue in Page0 writes not, writes 0 and carries out Page0 switching, and perform the function after Page switching in the blank Block of the residue in Page0;
The retrieval starting point of Page1 be set to most end and in Page1, chasing after written document after Page switches;
After writing in files terminating, in Page1, retrieving forward a file, when retrieving the file of damage, continuing retrieval forward until search complete;
When retrieving effective document, judging whether this effective document exists in Page0, when existing, repeating in Page0, to retrieve forward a file after writing in files terminates, when not existing, repeat the retrieval starting point of Page1 be set to most end and chase after written document in Page1.
Alternatively, read strategy in described read-write strategy execution unit 30 to comprise:
Retrieval starting point is set to last Block used of Page0, retrieves a Block forward; Do not have filename to meet retrieval requirement after retrieving whole Block, then report without this file and terminate; Filename do not meet and all Block not yet search complete time, continue forward retrieve a Block;
When retrieving the identical Block of filename, file is verified, in the obstructed out-of-date end of verification; When verification is passed through, if first Block or follow-up Block, then report file damages and terminates, if terminate Block, then jump to forward first Block according to information and read whole file content and length, delete property is not for delete and to terminate, if single Block, then and file reading content and delete property and file size terminate.
As shown in Figure 7, the present invention also provides the memory management method of low capacity flash in a kind of MCU sheet, and it comprises the steps:
S1, page Page0 and page Page1 for subsequent use is face to face divided into the operational flash page; Page0 and Page1 is divided into some pieces of Block, and Block is the elementary cell that data store;
S2, carry out initialization when storage management system powers on, carry out Block to Page0, Page1 successively and write continuity check, Block service condition checks, and determines to revise treatment measures according to service condition;
S3, storage management system initialization complete after perform read strategy execution unit or write strategy execution unit.
In MCU sheet of the present invention low capacity flash memory management method in, the data structure that in S1, data store comprises the endnote Footer of filename FileName, file content storage area DataArea and file attribute;
The expansion form of Footer is as follows: comprise, for representing the BlockProp of this Block attribute; For representing the Deled whether presents is deleted; Multiple Block is needed to carry out the mark Idx stored for marking whether; For representing that this Block data field has the DataLenInBlock of how many valid data; The CheckSum of integrality is write for verifying a Block.
In MCU sheet of the present invention low capacity flash memory management method in, described S2 comprises:
After storage management system powers on, continuity check is carried out to Page0, when Page0 stores discontinuous, erasing Page0 and Page1, and terminate; When Page0 storage is continuous print, continuity check is carried out to Page1; When Page1 stores discontinuous, erasing Page0 and Page1, and terminate;
When Page1 storage is continuous print, successively the service condition of Page0, Page1 is checked;
Judge that Page0, Page1 are the need of repairing or all wiping, when needs are all wiped, erasing Page0 and Page1, and terminate; When Page0 and/or Page1 needs to repair, Page0 and/or Page1 is repaired, and terminates; Do not need directly to terminate when repairing at Page0 and Page1.
In MCU sheet of the present invention low capacity flash memory management method in, write strategy in described S3 and comprise:
The state of storage management system is changed into writing state by idle condition;
Judge whether the effecting surplus space of storage management system meets write request, when not meeting write request, directly terminates;
When meeting write request, judging whether Page0 writes full, when Page0 writes full, carrying out Page switching, and performing the function after Page switching;
When Page0 does not write full, continue to judge whether the blank Block of residue in Page0 enough writes, and when the blank Block of the residue in Page0 enough writes, carries out chasing after writing and terminating in Page0; The blank Block of residue in Page0 writes not, writes 0 and carries out Page0 switching, and perform the function after Page switching in the blank Block of the residue in Page0;
The retrieval starting point of Page1 be set to most end and in Page1, chasing after written document after Page switches;
After writing in files terminating, in Page1, retrieving forward a file, when retrieving the file of damage, continuing retrieval forward until search complete;
When retrieving effective document, judging whether this effective document exists in Page0, when existing, repeating in Page0, to retrieve forward a file after writing in files terminates, when not existing, repeat the retrieval starting point of Page1 be set to most end and chase after written document in Page1.
In MCU sheet of the present invention low capacity flash memory management method in, read strategy in described S3 and comprise:
Retrieval starting point is set to last Block used of Page0, retrieves a Block forward; Do not have filename to meet retrieval requirement after retrieving whole Block, then report without this file and terminate; Filename do not meet and all Block not yet search complete time, continue forward retrieve a Block;
When retrieving the identical Block of filename, file is verified, in the obstructed out-of-date end of verification; When verification is passed through, if first Block or follow-up Block, then report file damages and terminates, if terminate Block, then jump to forward first Block according to information and read whole file content and length, delete property is not for delete and to terminate, if single Block, then and file reading content and delete property and file size terminate.
In MCU sheet provided by the invention, the storage management system of low capacity flash and method have following characteristics: 1, be applicable in MCU sheet, have the low capacity Flash storage administration of 2 pages at least; 2, the data of all writes provide all in the form of a file, identify with filename; 3, the quantity of file is dynamic management, can increase at any time, amendment, deletes; 4, the size of each file does not fix requirement, only has ceiling restriction (having relation with concrete configuration); 5 situations about not write for burst power down during write, can screen when next time powers on.
In this instructions, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar portion mutually see.
Professional can also recognize further, in conjunction with unit and the algorithm steps of each example of embodiment disclosed herein description, can realize with electronic hardware, computer software or the combination of the two, in order to the interchangeability of hardware and software is clearly described, in the above description according to the functional composition and the step that generally describe each example.These functions perform with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.Professional and technical personnel can use distinct methods to realize described function to each specifically should being used for, but this realization should not exceed scope of the present invention.

Claims (10)

1. a storage management system of low capacity flash in MCU sheet, it is characterized in that, it comprises as lower unit:
Storage organization initial cell, for being divided into page Page0 and page Page1 for subsequent use face to face to the operational flash page; Page0 and Page1 is divided into some pieces of Block, and Block is the elementary cell that data store;
Storage management system initialization unit, for carrying out initialization when storage management system powers on, carry out Block to Page0, Page1 successively and write continuity check, Block service condition checks, and determines to revise treatment measures according to service condition;
Read-write strategy execution unit, reads strategy for performing after storage management system initialization is complete or writes strategy.
2. the storage management system of low capacity flash in MCU sheet according to claim 1, it is characterized in that, the data structure that in storage organization initial cell, data store comprises the endnote Footer of filename FileName, file content storage area DataArea and file attribute;
The expansion form of Footer is as follows: comprise, for representing the BlockProp of this Block attribute; For representing the Deled whether presents is deleted; Multiple Block is needed to carry out the mark Idx stored for marking whether; For representing that this Block data field has the DataLenInBlock of how many valid data; The CheckSum of integrality is write for verifying a Block.
3. the storage management system of low capacity flash in MCU sheet according to claim 2, it is characterized in that, described storage management system initialization unit comprises:
After storage management system powers on, continuity check is carried out to Page0, when Page0 stores discontinuous, erasing Page0 and Page1, and terminate; When Page0 storage is continuous print, continuity check is carried out to Page1; When Page1 stores discontinuous, erasing Page0 and Page1, and terminate;
When Page1 storage is continuous print, successively the service condition of Page0, Page1 is checked;
Judge that Page0, Page1 are the need of repairing or all wiping, when needs are all wiped, erasing Page0 and Page1, and terminate; When Page0 and/or Page1 needs to repair, Page0 and/or Page1 is repaired, and terminates; Do not need directly to terminate when repairing at Page0 and Page1.
4. the storage management system of low capacity flash in MCU sheet according to claim 3, is characterized in that, write strategy and comprise in described read-write strategy execution unit:
The state of storage management system is changed into writing state by idle condition;
Judge whether the effecting surplus space of storage management system meets write request, when not meeting write request, directly terminates;
When meeting write request, judging whether Page0 writes full, when Page0 writes full, carrying out Page switching, and performing the function after Page switching;
When Page0 does not write full, continue to judge whether the blank Block of residue in Page0 enough writes, and when the blank Block of the residue in Page0 enough writes, carries out chasing after writing and terminating in Page0; The blank Block of residue in Page0 writes not, writes 0 and carries out Page0 switching, and perform the function after Page switching in the blank Block of the residue in Page0;
The retrieval starting point of Page1 be set to most end and in Page1, chasing after written document after Page switches;
After writing in files terminating, in Page1, retrieving forward a file, when retrieving the file of damage, continuing retrieval forward until search complete;
When retrieving effective document, judging whether this effective document exists in Page0, when existing, repeating in Page0, to retrieve forward a file after writing in files terminates, when not existing, repeat the retrieval starting point of Page1 be set to most end and chase after written document in Page1.
5. the storage management system of low capacity flash in MCU sheet according to claim 4, is characterized in that, read strategy and comprise in described read-write strategy execution unit:
Retrieval starting point is set to last Block used of Page0, retrieves a Block forward; Do not have filename to meet retrieval requirement after retrieving whole Block, then report without this file and terminate; Filename do not meet and all Block not yet search complete time, continue forward retrieve a Block;
When retrieving the identical Block of filename, file is verified, in the obstructed out-of-date end of verification; When verification is passed through, if first Block or follow-up Block, then report file damages and terminates, if terminate Block, then jump to forward first Block according to information and read whole file content and length, delete property is not for delete and to terminate, if single Block, then and file reading content and delete property and file size terminate.
6. a memory management method of low capacity flash in MCU sheet, it is characterized in that, it comprises the steps:
S1, page Page0 and page Page1 for subsequent use is face to face divided into the operational flash page; Page0 and Page1 is divided into some pieces of Block, and Block is the elementary cell that data store;
S2, carry out initialization when storage management system powers on, carry out Block to Page0, Page1 successively and write continuity check, Block service condition checks, and determines to revise treatment measures according to service condition;
S3, storage management system initialization complete after perform read strategy execution unit or write strategy execution unit.
7. the memory management method of low capacity flash in MCU sheet according to claim 6, is characterized in that, the data structure that in S1, data store comprises the endnote Footer of filename FileName, file content storage area DataArea and file attribute;
The expansion form of Footer is as follows: comprise, for representing the BlockProp of this Block attribute; For representing the Deled whether presents is deleted; Multiple Block is needed to carry out the mark Idx stored for marking whether; For representing that this Block data field has the DataLenInBlock of how many valid data; The CheckSum of integrality is write for verifying a Block.
8. the memory management method of low capacity flash in MCU sheet according to claim 7, it is characterized in that, described S2 comprises:
After storage management system powers on, continuity check is carried out to Page0, when Page0 stores discontinuous, erasing Page0 and Page1, and terminate; When Page0 storage is continuous print, continuity check is carried out to Page1; When Page1 stores discontinuous, erasing Page0 and Page1, and terminate;
When Page1 storage is continuous print, successively the service condition of Page0, Page1 is checked;
Judge that Page0, Page1 are the need of repairing or all wiping, when needs are all wiped, erasing Page0 and Page1, and terminate; When Page0 and/or Page1 needs to repair, Page0 and/or Page1 is repaired, and terminates; Do not need directly to terminate when repairing at Page0 and Page1.
9. the memory management method of low capacity flash in MCU sheet according to claim 8, is characterized in that, write strategy and comprise in described S3:
The state of storage management system is changed into writing state by idle condition;
Judge whether the effecting surplus space of storage management system meets write request, when not meeting write request, directly terminates;
When meeting write request, judging whether Page0 writes full, when Page0 writes full, carrying out Page switching, and performing the function after Page switching;
When Page0 does not write full, continue to judge whether the blank Block of residue in Page0 enough writes, and when the blank Block of the residue in Page0 enough writes, carries out chasing after writing and terminating in Page0; The blank Block of residue in Page0 writes not, writes 0 and carries out Page0 switching, and perform the function after Page switching in the blank Block of the residue in Page0;
The retrieval starting point of Page1 be set to most end and in Page1, chasing after written document after Page switches;
After writing in files terminating, in Page1, retrieving forward a file, when retrieving the file of damage, continuing retrieval forward until search complete;
When retrieving effective document, judging whether this effective document exists in Page0, when existing, repeating in Page0, to retrieve forward a file after writing in files terminates, when not existing, repeat the retrieval starting point of Page1 be set to most end and chase after written document in Page1.
10. the memory management method of low capacity flash in MCU sheet according to claim 9, is characterized in that, read strategy and comprise in described S3:
Retrieval starting point is set to last Block used of Page0, retrieves a Block forward; Do not have filename to meet retrieval requirement after retrieving whole Block, then report without this file and terminate; Filename do not meet and all Block not yet search complete time, continue forward retrieve a Block;
When retrieving the identical Block of filename, file is verified, in the obstructed out-of-date end of verification; When verification is passed through, if first Block or follow-up Block, then report file damages and terminates, if terminate Block, then jump to forward first Block according to information and read whole file content and length, delete property is not for delete and to terminate, if single Block, then and file reading content and delete property and file size terminate.
CN201510931109.1A 2015-12-14 2015-12-14 The storage management system and method for low capacity flash in MCU pieces Active CN105404475B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510931109.1A CN105404475B (en) 2015-12-14 2015-12-14 The storage management system and method for low capacity flash in MCU pieces

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510931109.1A CN105404475B (en) 2015-12-14 2015-12-14 The storage management system and method for low capacity flash in MCU pieces

Publications (2)

Publication Number Publication Date
CN105404475A true CN105404475A (en) 2016-03-16
CN105404475B CN105404475B (en) 2018-08-21

Family

ID=55469983

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510931109.1A Active CN105404475B (en) 2015-12-14 2015-12-14 The storage management system and method for low capacity flash in MCU pieces

Country Status (1)

Country Link
CN (1) CN105404475B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502839A (en) * 2016-10-27 2017-03-15 武汉奥泽电子有限公司 A kind of storage method and system based on automobile BCMFlash
CN108804024A (en) * 2017-05-02 2018-11-13 慧荣科技股份有限公司 Data storage device and operation method thereof
CN114489493A (en) * 2022-01-07 2022-05-13 广州万协通信息技术有限公司 Implementation method for simulating high-capacity Flash storage by using Mifare card

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080086631A1 (en) * 2000-01-06 2008-04-10 Chow David Q Flash memory controller controlling various flash memory cells
CN102081577A (en) * 2011-01-12 2011-06-01 厦门雅迅网络股份有限公司 Data storage structure of Flash memory and data manipulation mode thereof

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080086631A1 (en) * 2000-01-06 2008-04-10 Chow David Q Flash memory controller controlling various flash memory cells
CN102081577A (en) * 2011-01-12 2011-06-01 厦门雅迅网络股份有限公司 Data storage structure of Flash memory and data manipulation mode thereof

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502839A (en) * 2016-10-27 2017-03-15 武汉奥泽电子有限公司 A kind of storage method and system based on automobile BCMFlash
CN106502839B (en) * 2016-10-27 2020-01-10 武汉奥泽电子有限公司 Storage method and system based on automobile BCM Flash
CN108804024A (en) * 2017-05-02 2018-11-13 慧荣科技股份有限公司 Data storage device and operation method thereof
CN114489493A (en) * 2022-01-07 2022-05-13 广州万协通信息技术有限公司 Implementation method for simulating high-capacity Flash storage by using Mifare card
CN114489493B (en) * 2022-01-07 2023-08-15 广州万协通信息技术有限公司 Implementation method for simulating use of high-capacity Flash storage by Mifare class card

Also Published As

Publication number Publication date
CN105404475B (en) 2018-08-21

Similar Documents

Publication Publication Date Title
US10318181B2 (en) System, method, and computer program product for increasing spare space in memory to extend a lifetime of the memory
CN102081577B (en) Data storage structure of Flash memory and data manipulation mode thereof
US20120284587A1 (en) Super-Endurance Solid-State Drive with Endurance Translation Layer (ETL) and Diversion of Temp Files for Reduced Flash Wear
EP3306477B1 (en) Storage device and block storage method based on the storage device
CN107391774B (en) The rubbish recovering method of log file system based on data de-duplication
CN101515276B (en) Method for write operation of file data, and recovery method and recovery system for file data
TWI645404B (en) Data storage device and control method for non-volatile memory
US20030093610A1 (en) Algorithm of flash memory capable of quickly building table and preventing improper operation and control system thereof
CN101446921B (en) Dynamic storage method of Flash memory
CN107239526B (en) File system implementation method, defragmentation method and operation position positioning method
CN102662856B (en) A kind of solid state hard disc and access method thereof
TW201437807A (en) Method of recording mapping information method, and memory controller and memory storage apparatus using the same
CN109496292B (en) Disk management method, disk management device and electronic equipment
CN108628542B (en) File merging method and controller
CN115292266B (en) High-reliability log storage method based on memory
TW201606503A (en) Data management method, memory control circuit unit and memory storage apparatus
CN105404475A (en) Storage management system and method for small-capacity flash in MCU chip
CN103593301B (en) Bad block management method and system
US20100005229A1 (en) Flash memory apparatus and method for securing a flash memory from data damage
CN108664208A (en) File appending write operation method based on FLASH memory and device
CN106371950A (en) Method and device for achieving RAID level conversion
CN115509466B (en) Data management method and device, electronic equipment and storage medium
CN102737716B (en) Memorizer memory devices, Memory Controller and method for writing data
EP2267725A1 (en) Memory device for managing the recovery of a non volatile memory
CN105353979A (en) Eblock link structure for SSD internal data file system, management system and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant