CN103336749A - Access method of FLASH parameter of embedded system - Google Patents
Access method of FLASH parameter of embedded system Download PDFInfo
- Publication number
- CN103336749A CN103336749A CN201310216884XA CN201310216884A CN103336749A CN 103336749 A CN103336749 A CN 103336749A CN 201310216884X A CN201310216884X A CN 201310216884XA CN 201310216884 A CN201310216884 A CN 201310216884A CN 103336749 A CN103336749 A CN 103336749A
- Authority
- CN
- China
- Prior art keywords
- parameter
- value
- interface
- driver
- key word
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 36
- 230000004048 modification Effects 0.000 claims abstract description 11
- 238000012986 modification Methods 0.000 claims abstract description 11
- 230000008569 process Effects 0.000 claims description 15
- 238000004364 calculation method Methods 0.000 claims description 6
- 125000004122 cyclic group Chemical group 0.000 claims description 2
- 238000013500 data storage Methods 0.000 abstract description 4
- 238000011423 initialization method Methods 0.000 abstract 1
- 238000005457 optimization Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 7
- 238000004321 preservation Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
Images
Landscapes
- Stored Programmes (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides an access method of a FLASH parameter of an embedded system. The method defines a storage format of the FLASH parameter and provides an initialization method of a drive program and a nominal key parameter reading interface, a whole parameter reading interface, a parameter modification interface and a parameter saving interface of the drive program, wherein the four functional interfaces include. The method conducts optimization and design on the characteristics of data storage of a FLASH chip; an application program can achieve high-performance and high-reliability access operation on the FLASH parameter through the drive program; practical parameter access of the application program of embedded system software is achieved; and the performance and the reliability of the parameter access of the application program are improved greatly.
Description
Technical field
The invention belongs to field of computer technology, specifically refer to embedded system FLASH parameter access method.Described method is optimized and designs at the characteristics of the data storage of FLASH chip, solves the application program of built-in system software in the practical problems of parameter access, significantly promotes the Performance And Reliability of Application Parameters access.
Background technology
At present, embedded system is widely used, at one's side equipment miscellaneous such as mobile phone, flat board, router, set-top box, intelligent television etc., all used embedded system platform, the application program of these embedded systems all be unable to do without the accessing operation to various parameters, is extensive use of FLASH chip-stored data in these embedded systems.Application program in the embedded system can use file system to store data when access parameter, also can use special subregion to store data.
The FLASH sector be the FLASH chip provide wipe minimum unit, be generally 64K, 128K, 256K, the FLASH chip can only become 0 with 1, and can not become 1 with 0 when carrying out write operation, wiping then is with 0 change 1, therefore will write new content, must wipe earlier.Conventional parameter save routine just can be finished preservation with repetitive erasing FLASH, needs a kind of method to reduce and writes and erasing times, improves the performance of parameter access.
Summary of the invention
Technical matters to be solved by this invention is to overcome the deficiencies in the prior art, provides embedded system FLASH parameter access method.Described method is optimized and designs at the characteristics of the data storage of FLASH chip, application program can realize the high-performance of FLASH parameter, the accessing operation of high reliability by driver, solve the application program of built-in system software in the practical problems of parameter access, significantly promote the Performance And Reliability of Application Parameters access.
In order to solve the problems of the technologies described above, the technical solution adopted in the present invention is: embedded system FLASH parameter access method, described method comprise storage format definition, driver initialization and the driver functional interface of FLASH parameter; Detailed process is as follows:
A, the storage format definition of parameter:
Driver uses two sectors of FLASH chip, and each sector is divided into data field and check field two parts in logic; The data field is used for preserving parameter key word and corresponding parameter value, and check field is used for preserving the proof test value of data field;
B, driver initialization flow process; Concrete steps are as follows:
Step B-1 reads the content of preserving parameter sector in the FLASH chip;
Step B-2, effectively CRC32 value and the last CRC32 value of check field of content compare on the calculation data area, if it is identical then think that parameter storage is correct, analytic parameter from the content that reads one by one then, and after the key word calculating hashed value with parameter, jump to the assigned address of hash table, search the parameter key word again, if this parameter key word is existing in hash table, then replace hash table Central Plains parameter value with new parameter value; If this parameter key word then add this parameter value not;
C, the driver functional interface: it provides four interfaces to user program, is respectively and reads nominal key parameter interface, reads whole parameter interfaces, revises the parameter interface and preserve the parameter interface;
C1 reads nominal key parameter interface, and its step is as follows:
C1-1, application program is imported key word into by interface,
C1-2, the hashed value of calculating key word,
C1-3 jumps to the hash table correspondence position that generates in initialization, searches parameter value,
C1-4, return parameters value result gives application program;
C2 reads whole parameter interfaces, and its step is as follows:
C2-1, the hash table of driver traversal,
C2-2, with in the hash table all the parameter value pointers join in the array and go,
C2-3 sorts to the array among the C2-2,
C2-3, after ordering finished, the parameter that array is pointed to copied and returns to user program one by one;
C3 revises the parameter interface, and its step is as follows:
C3-1, application program is imported parameter key word and parameter value thereof into,
C3-2, driver calculating parameter key word hashed value,
C3-3 according to the parameter key word hashed value that C3-2 obtains, searches hash table, if this hashed value list item is arranged in the hash table, then replaces original parameter value with this parameter key word corresponding parameters value; Otherwise, if this hashed value list item not in the hash table then increases new parameter value;
C3-4, revise or add finish after, the parameter value of firm modification or interpolation is labeled as revises, this mark uses by preserving the parameter interface;
C4 preserves the parameter interface, and its concrete steps are as follows:
C4-1, driver will be marked as the parameter value of having revised earlier and travel through from hash table;
C4-2, whether the remaining space in judgment data district enough preserves the parameter value that these are labeled, if it is enough, use CRC32 value and current new CRC32 value of calculation of parameter that is about to modification before revise the data field, write the parameter value of modification in space, remaining data field, write new CRC32 value in remaining check field space; If the space is not enough, then use the interface that all gets parms to obtain whole parameters, calculate whole parameter values this moment and whether take up room greater than the size in space, data field, if greater than, return mistake, otherwise wipe whole sectors, write parameter value and CRC32 value again; Again after writing successfully, driver is labeled the parameter of having revised with all and is labeled as unmodified again.
2. 7/8 of sector storage space is occupied in described data field, and check field occupies 1/8 of sector storage space.
3. described CRC32 value refers to 32 cyclic redundancy check value.
The invention has the beneficial effects as follows: the present invention proposes embedded system FLASH parameter access method, described method has defined the storage format of FLASH parameter, the driver initial method is provided, and four functional interfaces of driver: read nominal key parameter interface, read whole parameter interfaces, revise the parameter interface and preserve the parameter interface.The inventive method is optimized and designs at the characteristics of the data storage of FLASH chip, application program can realize the high-performance of FLASH parameter, the accessing operation of high reliability by driver, solve the application program of built-in system software in the practical problems of parameter access, significantly promote the Performance And Reliability of Application Parameters access.
Description of drawings
Fig. 1 is programming system frame diagram of the present invention.
Fig. 2 is programmed algorithm initialization flowchart of the present invention.
Fig. 3 is that programmed algorithm designated parameter of the present invention is obtained process flow diagram.
Fig. 4 is the whole parameter acquiring process flow diagrams of programmed algorithm of the present invention.
Fig. 5 is programmed algorithm parameter modification process flow diagram of the present invention.
Fig. 6 is that programmed algorithm parameter of the present invention is preserved process flow diagram.
Embodiment
Below in conjunction with accompanying drawing, the embedded system FLASH parameter access method that the present invention is proposed is elaborated:
As shown in Figure 1, programmed algorithm described in the invention is positioned at " parameter access driver " position of total system, the FLASH chip erase that this driver use system provides, read, write incoming interface, provide obtaining of a parameter to application program, revise the interface of preservation.Below with the storage format of FLASH parameter in the process in detail, the concrete grammar of driver initialization and driver functional interface.
The storage format of parameter: driver will use two sectors of FLASH chip, and each sector is divided into data field and check field two parts in logic; Wherein the data field is 7/8 of sector-size, and check field is 1/8, and this ratio can adjust according to parameter field length actual conditions.The data field is used for preserving parameter key word and corresponding parameter value, and check field is used for preserving the proof test value of data field, and the storage organization of its data field is:
“Key1=Value1”0“Key2=Value2”0 ……“KeyN=ValueN”0 FF FF FF …… |
The previous section of data field is that the front portion of each character string is divided into key word with the string format of 0 ending, and the rear portion is divided into key word corresponding parameters value, and it is 16 system data 0xFF that part is not used in the data field.
The form of check field is as follows
CRC32 | CRC32 | …… | CRC32 | 0xFFFFFFFF | 0xFFFFFFFF | …… |
One group of per 4 byte of check field, the CRC32 value of recorded data zone does not use part to be 16 system data 0xFF, and last CRC32 value is the CRC32 proof test value of active data area.
Driver initialization flow process: the initialization flowchart of driver is seen accompanying drawing 2, during program initialization, at first read the content of parameter preservation sector in the FLASH chip, the CRC32 value of effective content and the last CRC32 value of check field compare on the calculation data area then, if it is identical then think that parameter storage is correct, from the content that reads, resolve every parameter then one by one, and after the key word calculating hashed value with parameter, the assigned address of redirect hash table, again key word is searched, if key word is existing, does to replace and handle; If this key word then add this parameter value not.
After the driver initialization finished, driver had a hash memory block, and this hash district has recorded all up-to-date parameter values.
The functional interface algorithm of driver: the functional interface of driver must be just effective after the program initialization stage finishes, it provides four interfaces to user program, is respectively and reads nominal key parameter interface, reads whole parameter interfaces, revises the parameter interface and preserve the parameter interface.
Obtain nominal key parameter interface: driver obtains the flow process of nominal key parameter and sees accompanying drawing 3, after application program is imported key word into by interface, calculate the hashed value of key word earlier, jump to the hash table correspondence position that generates in initialization, and then search, last return parameters result gives application program.
Read whole parameter interfaces: driver reads the process flow diagram of whole parameters and sees accompanying drawing 4.Application program is used when obtaining whole parameter interface, and driver will travel through hash table, whole parameter value pointers in the hash table be joined in the array go, then array is sorted, after ordering finished, the parameter that array is pointed to copies among the result one by one went, and returns to user program.
Revise the parameter interface: driver is revised the process flow diagram of parameter and is seen accompanying drawing 5.After application program was imported key word and corresponding parameters value into, driver calculated earlier the key word hashed value, jumped to the hash table correspondence position then and searched, if find then replace original parameter value, otherwise increased new parameter value.Revise or add finish after, for revising, this mark will be for preservation parameter interface to the parameter tags of firm modification or interpolation.
Preserve the parameter interface: driver is preserved the flow process of parameter and is seen accompanying drawing 6.Driver will be marked as the parameter of having revised earlier and travel through from hash table, calculate remaining space then and whether enough preserve the parameter value that these are labeled, if it is enough, CRC32 value before using and new CRC32 value of calculation of parameter of current modification, write the parameter value of modification in space, remaining data field, write new CRC32 value in remaining check field space; If the space is not enough, then use the interface that all gets parms to obtain whole parameters, calculate whole parameter values this moment and whether take up room greater than the size in space, data field, if greater than, return mistake, otherwise wipe whole sectors, write parameter value and CRC32 value again.Again after writing successfully, driver is labeled the parameter of having revised with all and is labeled as unmodified again.
The backup of stored parameter and automatically recovering: the programmed algorithm of above introduction be driver to the operation of single sector, in the backup that realizes parameter with when recovering automatically, only need when parameter is preserved, do identical writing, erase operation to the alternate sector; When driver initialization flow process, if when being checked through the CRC32 value of one of them sector and data field and not being inconsistent, copy the content of another sector automatically.
By realize above algorithm flow in driver, application program can realize the high-performance to parameter, the accessing operation of high reliability by driver.
Those skilled in the art can associate other advantage and distortion according to above implementation type.So the present invention is not limited to above-mentioned concrete example, it only is to a kind of concrete embodiment of the present invention.In the scope that does not deviate from aim of the present invention, those skilled in the art can be equal to the resulting technical scheme of replacement according to above-mentioned example and should be included within claim scope of the present invention and the equivalency range thereof.
Claims (3)
1. embedded system FLASH parameter access method is characterized in that, described method comprises storage format definition, driver initialization and the driver functional interface of FLASH parameter; Detailed process is as follows:
A, the storage format definition of parameter:
Driver uses two sectors of FLASH chip, and each sector is divided into data field and check field two parts in logic; The data field is used for preserving parameter key word and corresponding parameter value, and check field is used for preserving the proof test value of data field;
B, driver initialization flow process; Concrete steps are as follows:
Step B-1 reads the content of preserving parameter sector in the FLASH chip;
Step B-2, effectively CRC32 value and the last CRC32 value of check field of content compare on the calculation data area, if it is identical then think that parameter storage is correct, analytic parameter from the content that reads one by one then, and after the key word calculating hashed value with parameter, jump to the assigned address of hash table, search the parameter key word again, if this parameter key word is existing in hash table, then replace hash table Central Plains parameter value with new parameter value; If this parameter key word then add this parameter value not;
C, the driver functional interface: it provides four interfaces to user program, is respectively and reads nominal key parameter interface, reads whole parameter interfaces, revises the parameter interface and preserve the parameter interface;
C1 reads nominal key parameter interface, and its step is as follows:
C1-1, application program is imported key word into by interface,
C1-2, the hashed value of calculating key word,
C1-3 jumps to the hash table correspondence position that generates in initialization, searches parameter value,
C1-4, return parameters value result gives application program;
C2 reads whole parameter interfaces, and its step is as follows:
C2-1, the hash table of driver traversal,
C2-2, with in the hash table all the parameter value pointers join in the array and go,
C2-3 sorts to the array among the C2-2,
C2-3, after ordering finished, the parameter that array is pointed to copied and returns to user program one by one;
C3 revises the parameter interface, and its step is as follows:
C3-1, application program is imported parameter key word and parameter value thereof into,
C3-2, driver calculating parameter key word hashed value,
C3-3 according to the parameter key word hashed value that C3-2 obtains, searches hash table, if this hashed value list item is arranged in the hash table, then replaces original parameter value with this parameter key word corresponding parameters value; Otherwise, if this hashed value list item not in the hash table then increases new parameter value;
C3-4, revise or add finish after, the parameter value of firm modification or interpolation is labeled as revises, this mark uses by preserving the parameter interface;
C4 preserves the parameter interface, and its concrete steps are as follows:
C4-1, driver will be marked as the parameter value of having revised earlier and travel through from hash table;
C4-2, whether the remaining space in judgment data district enough preserves the parameter value that these are labeled, if it is enough, use CRC32 value and current new CRC32 value of calculation of parameter that is about to modification before revise the data field, write the parameter value of modification in space, remaining data field, write new CRC32 value in remaining check field space; If the space is not enough, then use the interface that all gets parms to obtain whole parameters, calculate whole parameter values this moment and whether take up room greater than the size in space, data field, if greater than, return mistake, otherwise wipe whole sectors, write parameter value and CRC32 value again; Again after writing successfully, driver is labeled the parameter of having revised with all and is labeled as unmodified again.
2. embedded system FLASH parameter access method as claimed in claim 1 is characterized in that 7/8 of sector storage space is occupied in described data field, and check field occupies 1/8 of sector storage space.
3. embedded system FLASH parameter access method as claimed in claim 1 is characterized in that, described CRC32 value refers to 32 cyclic redundancy check value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310216884.XA CN103336749B (en) | 2013-05-31 | 2013-05-31 | Embedded system FLASH parameter access method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310216884.XA CN103336749B (en) | 2013-05-31 | 2013-05-31 | Embedded system FLASH parameter access method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103336749A true CN103336749A (en) | 2013-10-02 |
CN103336749B CN103336749B (en) | 2016-01-20 |
Family
ID=49244919
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310216884.XA Expired - Fee Related CN103336749B (en) | 2013-05-31 | 2013-05-31 | Embedded system FLASH parameter access method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103336749B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106445722A (en) * | 2016-10-20 | 2017-02-22 | 积成电子股份有限公司 | Method for conducting parameter storage in embedded system based on flash memory |
CN111324488A (en) * | 2020-02-12 | 2020-06-23 | 浙江大华技术股份有限公司 | Program backup processing method and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003208352A (en) * | 2002-01-17 | 2003-07-25 | Fujitsu Ltd | Flash memory enabling restriction of writing frequency and ware levelling |
CN101419571A (en) * | 2008-12-04 | 2009-04-29 | 上海大学 | Method for storing configuration parameter in NOR FLASH based on Hash arithmetic |
CN101436158A (en) * | 2008-12-25 | 2009-05-20 | 中兴通讯股份有限公司 | Parameter management method and system based on embedded type equipment flash memory |
-
2013
- 2013-05-31 CN CN201310216884.XA patent/CN103336749B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003208352A (en) * | 2002-01-17 | 2003-07-25 | Fujitsu Ltd | Flash memory enabling restriction of writing frequency and ware levelling |
CN101419571A (en) * | 2008-12-04 | 2009-04-29 | 上海大学 | Method for storing configuration parameter in NOR FLASH based on Hash arithmetic |
CN101436158A (en) * | 2008-12-25 | 2009-05-20 | 中兴通讯股份有限公司 | Parameter management method and system based on embedded type equipment flash memory |
Non-Patent Citations (1)
Title |
---|
王达等: "Flash存储器测试与修复方法概述", 《第五界中国测试学术会议论文集》, 21 May 2008 (2008-05-21) * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106445722A (en) * | 2016-10-20 | 2017-02-22 | 积成电子股份有限公司 | Method for conducting parameter storage in embedded system based on flash memory |
CN106445722B (en) * | 2016-10-20 | 2019-08-06 | 积成电子股份有限公司 | A kind of method for carrying out parameter storage based on flash memories in embedded system |
CN111324488A (en) * | 2020-02-12 | 2020-06-23 | 浙江大华技术股份有限公司 | Program backup processing method and device |
CN111324488B (en) * | 2020-02-12 | 2023-12-08 | 浙江大华技术股份有限公司 | Program backup processing method and device |
Also Published As
Publication number | Publication date |
---|---|
CN103336749B (en) | 2016-01-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103577121B (en) | A kind of highly reliable linear file access method based on Nand Flash | |
US11599552B2 (en) | Counter-based compaction of key-value store tree data block | |
US11334270B2 (en) | Key-value store using journaling with selective data storage format | |
US8745310B2 (en) | Storage apparatus, computer system, and method for managing storage apparatus | |
US8275928B2 (en) | Memory module and method for performing wear-leveling of memory module using remapping, link, and spare area tables | |
US7165156B1 (en) | Read-write snapshots | |
CN103577574B (en) | High-reliability linear file system based on nand flash | |
CN104657500A (en) | Distributed storage method based on KEY-VALUE KEY VALUE pair | |
US11232028B2 (en) | Error-checking in namespaces on storage devices | |
US20180143886A1 (en) | Method for Rebuilding a Mapping Table of a Solid State Disk | |
US20230078081A1 (en) | B-plus tree access method and apparatus, and computer-readable storage medium | |
WO2018090255A1 (en) | Memory access technique | |
US20190347006A1 (en) | Method of system information programming for a data storage apparatus and a corresponding method of system information re-building | |
CN111007990B (en) | Positioning method for quickly positioning data block references in snapshot system | |
CN101634967A (en) | Block management method for flash memory, storage system and controller | |
CN103309815A (en) | Method and system for increasing available capacity and service life of solid state disc | |
CN107273046A (en) | A kind of data processing method and system based on Solid-state disc array | |
WO2023202394A1 (en) | Partition table creation method and apparatus, data writing method and apparatus for partition table, and data reading method and apparatus for partition table | |
CN103383666A (en) | Method and system for improving cache prefetch data locality and cache assess method | |
CN103336749A (en) | Access method of FLASH parameter of embedded system | |
CN103246615A (en) | Method and device for data management in flash memory device | |
US9329994B2 (en) | Memory system | |
CN111190834B (en) | Data placement method for asymmetric read delay sensing | |
Chen et al. | ZoneLife: How to Utilize Data Lifetime Semantics to Make SSDs Smarter | |
CN103076996B (en) | PCRAM control method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160120 |
|
CF01 | Termination of patent right due to non-payment of annual fee |