CN109857340A - The storage and read method of file, device and storage medium in NOR FLASH - Google Patents

The storage and read method of file, device and storage medium in NOR FLASH Download PDF

Info

Publication number
CN109857340A
CN109857340A CN201910035218.3A CN201910035218A CN109857340A CN 109857340 A CN109857340 A CN 109857340A CN 201910035218 A CN201910035218 A CN 201910035218A CN 109857340 A CN109857340 A CN 109857340A
Authority
CN
China
Prior art keywords
file
bch
read
stored
content
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
CN201910035218.3A
Other languages
Chinese (zh)
Other versions
CN109857340B (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.)
TP Link Technologies Co Ltd
Original Assignee
TP Link Technologies Co Ltd
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 TP Link Technologies Co Ltd filed Critical TP Link Technologies Co Ltd
Priority to CN201910035218.3A priority Critical patent/CN109857340B/en
Publication of CN109857340A publication Critical patent/CN109857340A/en
Application granted granted Critical
Publication of CN109857340B publication Critical patent/CN109857340B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

The invention discloses a kind of storage of file in NOR FLASH and read methods, it include: when needing the storage file in NOR FLASH, the length information of file to be stored is encoded according to preset first BCH cyclic code, and the content information of the file to be stored is encoded according to preset 2nd BCH cyclic code;The file to be stored is stored according to the file after coding;When needing to read file in NOR FLASH, the length information of file to be read is decoded according to preset 3rd BCH cyclic code, and the content information of the file to be read is decoded according to preset 4th BCH cyclic code;The file to be read according to the file acquisition after decoding.Correspondingly, the invention also discloses a kind of storages of file in NOR FLASH and reading device and computer readable storage medium.The bit flipping problem of NOR FLASH is able to solve using technical solution of the present invention, to improve the reliability of storage and the reading of file in NOR FLASH.

Description

The storage and read method of file, device and storage medium in NOR FLASH
Technical field
The present invention relates to a kind of storage of file in field of data access technology more particularly to NOR FLASH and reading sides Method, device and computer readable storage medium.
Background technique
NOR FLASH is a kind of nonvolatile flash memory technology, and NOR FLASH memory is acknowledged as always more stable Storaging medium, however recent studies have found that, the problem of NOR FLASH equally exists bit flipping, the system of this and chip supplier The access times for making technique and file are related, and current NOR FLASH controller chip, few supporting ECC check, Therefore cause the reliability of storage and the reading of file in NOR FLASH lower.
Summary of the invention
The technical problem to be solved by the embodiment of the invention is that providing the storage and reading of file in a kind of NOR FLASH Method, apparatus and computer readable storage medium are taken, the bit flipping problem of NOR FLASH is able to solve, to improve NOR The reliability of storage and the reading of file in FLASH.
In order to solve the above-mentioned technical problem, the embodiment of the invention provides the storages and reading of file in a kind of NOR FLASH Take method, comprising:
When needing the storage file in NOR FLASH, according to preset first BCH cyclic code to the length of file to be stored Degree information is encoded, and is encoded according to preset 2nd BCH cyclic code to the content information of the file to be stored;
The file to be stored is stored according to the file after coding;
When needing to read file in NOR FLASH, according to preset 3rd BCH cyclic code to the length of file to be read Degree information is decoded, and is decoded according to preset 4th BCH cyclic code to the content information of the file to be read;Its In, the 3rd BCH cyclic code, the 4th BCH cyclic code are respectively to believe in storage the length of the file to be read Breath, content information carry out encoding used cyclic code;
The file to be read according to the file acquisition after decoding.
Further, the method passes through following steps according to the first BCH cyclic code to the file to be stored Length information is encoded:
The header field of X1 byte is added for the file to be stored;Wherein, the preceding x1 byte of the header field is for storing The physical length of the file to be stored, X1 > x1 >=1;
The length information of the file to be stored is encoded according to the first BCH cyclic code, accordingly obtains first BCH code;
First BCH code is stored in the rear X1-x1 byte of the header field.
Further, the method passes through following steps according to the 2nd BCH cyclic code to the file to be stored Content information is encoded:
The content-data of the file to be stored is divided into y1 group content-data according to one group of every Y1 byte;Wherein, The zero padding if less than Y1 byte of y1 group content-data, Y1 >=1, y1 >=1;
Each group of content-data is encoded respectively according to the 2nd BCH cyclic code, it is corresponding to obtain y1 the 2nd BCH Code;
Y1 second BCH codes are stored in the tail portion of the file to be stored according to coded sequence.
Further, the method passes through following steps according to the 3rd BCH cyclic code to the file to be read Length information is decoded:
Read the header field of the preset X2 byte of the file to be read;Wherein, X2 > 1;
The header field is decoded according to the 3rd BCH cyclic code, accordingly obtains the length of the file to be read Information.
Further, the method passes through following steps according to the 4th BCH cyclic code to the file to be read Content information is decoded:
According to the length information of the file to be read by the content-data of the file to be read according to preset Y2 One group of byte is divided into y2 group content-data;Wherein, the zero padding if less than Y2 byte of y2 group content-data, Y2 >=1, y2 >= 1;
Read y2 the second BCH codes of the tail portion of the file to be read;
Each group of content-data and its corresponding second BCH code are spliced, the corresponding y2 group that obtains splices content Data;
Each group of splicing content-data is decoded respectively according to the 4th BCH cyclic code.
In order to solve the above-mentioned technical problem, the embodiment of the invention also provides a kind of storage of file in NOR FLASH and Reading device, comprising:
Document No. module, for being recycled according to preset first BCH when needing the storage file in NOR FLASH Code encodes the length information of file to be stored, and according to preset 2nd BCH cyclic code to the file to be stored Content information is encoded;
File storage module, for storing the file to be stored according to the file after coding;
File decoding module, for being recycled according to preset 3rd BCH when needing to read file in NOR FLASH Code decodes the length information of file to be read, and according to preset 4th BCH cyclic code to the file to be read Content information is decoded;Wherein, the 3rd BCH cyclic code, the 4th BCH cyclic code are respectively in storage to described Length information, the content information of file to be read carry out encoding used cyclic code;And
File read module, for the file to be read according to the file acquisition after decoding.
Further, the document No. module specifically includes:
Header field adding unit, for adding the header field of X1 byte for the file to be stored;Wherein, before the header field X1 byte is used to store the physical length of the file to be stored, X1 > x1 >=1;
Length encoding unit, for being carried out according to length information of the first BCH cyclic code to the file to be stored Coding, it is corresponding to obtain the first BCH code;And
First BCH code storage unit, for first BCH code to be stored in the rear X1-x1 byte of the header field.
Further, the document No. module further include:
First content division unit, for by the content-data of the file to be stored according to the one group of division of every Y1 byte For y1 group content-data;Wherein, the zero padding if less than Y1 byte of y1 group content-data, Y1 >=1, y1 >=1;
Research content unit, for being encoded respectively to each group of content-data according to the 2nd BCH cyclic code, phase Y1 the second BCH codes should be obtained;And
Second BCH code storage unit, it is described wait store for being stored in y1 second BCH codes according to coded sequence The tail portion of file.
The embodiment of the invention also provides a kind of computer readable storage medium, the computer readable storage medium includes The computer program of storage;Wherein, where the computer program controls the computer readable storage medium at runtime Equipment executes the storage of file and read method in NOR FLASH described in any of the above embodiments.
The embodiment of the invention also provides a kind of storage of file in NOR FLASH and reading device, including processor, deposit Reservoir and storage in the memory and are configured as the computer program executed by the processor, and the processor exists The storage of file and read method in NOR FLASH described in any of the above embodiments are realized when executing the computer program.
Compared with prior art, the embodiment of the invention provides a kind of storage of file in NOR FLASH and read method, Device and computer readable storage medium are treated when needing the storage file in NOR FLASH according to the first BCH cyclic code The length information of storage file is encoded, and is encoded according to the 2nd BCH cyclic code to the content information of file to be stored, To store the file to be stored according to the file after coding;When needing to read file in NOR FLASH, according to third BCH cyclic code decodes the length information of file to be read, and according to the 4th BCH cyclic code to the content of file to be read Information is decoded, to be able to solve according to the file to be read of the file acquisition after decoding by manufacturing process and access time The bit flipping problem of NOR FLASH caused by number has NOR FLASH and is automatically repaired ability, to improve NOR FLASH The reliability of storage and the reading of middle file.
Detailed description of the invention
Fig. 1 is a preferred embodiment of the storage of file and read method in a kind of NOR FLASH provided by the invention Flow chart;
Fig. 2 is a preferred embodiment of the storage of file and reading device in a kind of NOR FLASH provided by the invention Structural block diagram;
Fig. 3 is that another of the storage of file and reading device are preferably implemented in a kind of NOR FLASH provided by the invention The structural block diagram of example.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained all without creative efforts Other embodiments shall fall within the protection scope of the present invention.
It is shown in Figure 1, it is that one of the storage of file and read method in a kind of NOR FLASH provided by the invention is excellent The flow chart for selecting embodiment, the method includes the steps S11 to step S14:
Step S11, when needing the storage file in NOR FLASH, storage is treated according to preset first BCH cyclic code The length information of file is encoded, and according to preset 2nd BCH cyclic code to the content information of the file to be stored into Row coding;
Step S12, the file to be stored is stored according to the file after coding;
Step S13, when needing to read file in NOR FLASH, according to preset 3rd BCH cyclic code to be read The length information of file is decoded, and according to preset 4th BCH cyclic code to the content information of the file to be read into Row decoding;Wherein, the 3rd BCH cyclic code, the 4th BCH cyclic code are respectively in storage to the file to be read Length information, content information carries out encoding used cyclic code;
Step S14, the file to be read according to the file acquisition after decoding.
The embodiment of the present invention is broadly divided into storage file coding stage and reads the file decoding stage, specifically, storing The document No. stage obtains the physical length information of file to be stored first, and according to pre-set first BCH cyclic code pair The physical length information of file to be stored is encoded, and then obtains the content data information of file to be stored, and according to preparatory The 2nd BCH cyclic code being arranged encodes the content data information of file to be stored, finally according to the reality of file to be stored The corresponding coding of border length, length information, content-data and the corresponding coding of content information generate corresponding coding file, from And file to be stored is stored according to the coding file;The stage is decoded reading file, obtains file to be read first The corresponding coding of length information, and the length information of file to be read is translated according to pre-set 3rd BCH cyclic code Code, then obtains the corresponding coding of content information of file to be read, and according to pre-set 4th BCH cyclic code to continuing The content information of file is taken to be decoded, the physical length information and content-data of the file to be read finally obtained according to decoding Information is organized into decoding file, to be read out according to the decoding file to file to be read.
It should be understood that above-mentioned 3rd BCH cyclic code and above-mentioned file to be read believe its length in storage coding stage It ceases used cyclic code when being encoded to be consistent, above-mentioned 4th BCH cyclic code and above-mentioned file to be read are compiled in storage The code stage when being encoded to its content information used cyclic code be consistent, made in the decoding stage using coding stage Cyclic code correspondence is decoded, and thereby may be ensured that the correctness of decoding result.
It should be noted that product currently on the market is generally since the memory capacity of NOR FLASH memory is smaller No more than 4GB, therefore the maximum length for defining the file that NOR FLASH can be stored is less than 4GB, the i.e. reality of file to be stored The maximum value of length is 2^32-1 byte.
The storage of file and read method in a kind of NOR FLASH provided by the embodiment of the present invention, to NOR FLASH It is encoded when middle storage file according to length information and content information of the BCH cyclic code to file to be stored, from NOR It is decoded, is passed through according to length information and content information of the BCH cyclic code to file to be read when reading file in FLASH Coding and decoding process are crossed, even if there are bit flipping mistakes for original, can also correct automatically in decoding calculates, decode The file obtained afterwards is the file for passing through bit flipping correction, to solve the NOR as caused by manufacturing process and access times The bit flipping problem of FLASH has NOR FLASH and is automatically repaired ability, and then improves the storage of file in NOR FLASH With the reliability of reading.
In a further advantageous embodiment, the method passes through following steps according to the first BCH cyclic code to described The length information of file to be stored is encoded:
The header field of X1 byte is added for the file to be stored;Wherein, the preceding x1 byte of the header field is for storing The physical length of the file to be stored, X1 > x1 >=1;
The length information of the file to be stored is encoded according to the first BCH cyclic code, accordingly obtains first BCH code;
First BCH code is stored in the rear X1-x1 byte of the header field.
Specifically, in conjunction with above-described embodiment, after the physical length information for obtaining file to be stored, first for wait store File adds the header field of X1 byte, and the actual (tube) length of the file to be stored obtained in the storage of the preceding x1 byte of X1 byte Degree, encodes preceding x1 byte then according to pre-set first BCH cyclic code, generates corresponding first BCH code, and First BCH code is stored in the rear X1-x1 byte of X1 byte;Wherein, the specific value of X1 and x1 can be according to reality Border needs to be configured.
As an improvement of the above scheme, X1=7, x1=4, the first BCH cyclic code are BCH (56,32) cyclic code.
Specifically, the header field of 7 bytes is added for file to be stored, and obtained in the storage of preceding 4 bytes of 7 bytes The physical length of file to be stored, 4 bit-errors, i.e. t=4 can be corrected according to BCH cyclic code by presetting, and have k=4*8= 32, m minimum 6 can be obtained by 2^m-1 >=32, due to r=n-k≤m*t, r=m*t=6*4=24 is chosen, obtains code length n =r+k=24+32=56, to obtain non-origin BCH (56,32) code, i.e. the first BCH cyclic code is BCH (56,32) circulation Code, encodes preceding 4 bytes according to BCH (56,32) cyclic code, generates first BCH code of 3 bytes, and by the first BCH After code is stored in 3 bytes.
It should be noted that above-mentioned design parameter and BCH cyclic code are set as a kind of preferred embodiment, can will calculate The selection of method is adjusted to optimum state, in practical applications, the length of the header field by increasing or reducing addition, corresponding use Other BCH cyclic codes are encoded, and the ways such as slightly poor identical algorithms of service efficiency all belong to the scope of protection of the present invention, this Inventive embodiments are not especially limited.
In another preferred embodiment, the method is by following steps according to the 2nd BCH cyclic code to described The content information of file to be stored is encoded:
The content-data of the file to be stored is divided into y1 group content-data according to one group of every Y1 byte;Wherein, The zero padding if less than Y1 byte of y1 group content-data, Y1 >=1, y1 >=1;
Each group of content-data is encoded respectively according to the 2nd BCH cyclic code, it is corresponding to obtain y1 the 2nd BCH Code;
Y1 second BCH codes are stored in the tail portion of the file to be stored according to coded sequence.
Specifically, in conjunction with above-described embodiment, it, first will be wait store after the content data information for obtaining file to be stored The content-data of file is divided for one group according to every Y1 byte, file to be stored is divided into y1 group content-data, finally One group i.e. y1 group content-data is filled if inadequate Y1 byte with spot patch, then according to pre-set 2nd BCH cyclic code Each group of content-data is encoded respectively, each group of content-data is corresponding to generate second BCH code, corresponding acquisition y1 Second BCH code, and y1 the second BCH codes are stored in the tail portion of file to be stored according to coded sequence.
It should be noted that can be carried out according to the grouping group number of the content-data of file to be stored to y1 group content-data Coding, for example, according to first group, second group, the sequence of y1 group is successively to each group of content-data progress Coding, it is corresponding generate first, second, y1 the second BCH codes, and by first of generation, second It is a, y1 the second BCH codes be sequentially arranged in the tail portion of file to be stored in order.
As an improvement of the above scheme, Y1=512, the 2nd BCH cyclic code are BCH (4148,4096) cyclic code.
Specifically, the content-data of file to be stored is divided according to every one group of 512 bytes, by file to be stored It is divided into y1 group content-data, last group is that y1 group content-data is filled if inadequate 512 bytes with spot patch, according to every 512 byte most multipotencys correct the principle of 4 bit-errors, carry out the matching of the BCH factor, it is known that t=4, and have k=512*8= 4096, m minimum 13 can be obtained by 2^m-1 >=4096, due to r=n-k≤m*t, r=m*t=13*4=52 is chosen, obtains Code length n=r+k=52+4096=4148, to choose BCH (4148,4096) algorithm, i.e. the 2nd BCH cyclic code is BCH (4148,4096) cyclic code encodes each group of content-data according to BCH (4148,4096) cyclic code, each group of content Corresponding the second BCH code for generating 7 bytes of data, it is corresponding to obtain y1 the second BCH codes, and y1 the second BCH codes are pressed The tail portion of file to be stored is stored according to coded sequence.
It should be noted that above-mentioned design parameter and BCH cyclic code are set as a kind of preferred embodiment, can will calculate The selection of method is adjusted to optimum state, in practical applications, can also replace the slightly poor identical algorithms of other efficiency, such as choose 1024 byte+BCH (8304,8192) cyclic codes encode etc., all belong to the scope of protection of the present invention, the embodiment of the present invention It is not especially limited.
In addition, correction accuracy is the bit flipping mistake of every most 4 bits of 512 bytes, the NOR of the overwhelming majority can be covered FLASH application scenarios.
In another preferred embodiment, the method is by following steps according to the 3rd BCH cyclic code to described The length information of file to be read is decoded:
Read the header field of the preset X2 byte of the file to be read;Wherein, X2 > 1;
The header field is decoded according to the 3rd BCH cyclic code, accordingly obtains the length of the file to be read Information.
Specifically, the header field of the pre-set X2 byte of file to be read is read first in conjunction with above-described embodiment, with The corresponding coding of length information for obtaining file to be read, then according to pre-set 3rd BCH cyclic code to X2 byte Header field decoded, to obtain the length information of file to be read.
It should be noted that the byte quantity X2 of the header field of file to be read should be with file to be read in storage coding stage The byte quantity of added header field is consistent.
As an improvement of the above scheme, X2=7, the 3rd BCH cyclic code are BCH (56,32) cyclic code.
Specifically, the header field of pre-set 7 bytes of file to be read is read first, in storage coding stage to it Used cyclic code corresponds to BCH (56,32) cyclic code when length information is encoded, therefore the 3rd BCH cyclic code is BCH (56,32) cyclic code then decodes the header field of file to be read according to BCH (56,32) cyclic code, to obtain to be read The length information of file.
It should be noted that above-mentioned design parameter and BCH cyclic code are set as a kind of preferred embodiment, can will calculate The selection of method is adjusted to optimum state, in practical applications, the length of the header field by increasing or reducing addition, corresponding use Other BCH cyclic codes are decoded, and the ways such as slightly poor identical algorithms of service efficiency all belong to the scope of protection of the present invention, this Inventive embodiments are not especially limited.
In another preferred embodiment, the method is by following steps according to the 4th BCH cyclic code to described The content information of file to be read is decoded:
According to the length information of the file to be read by the content-data of the file to be read according to preset Y2 One group of byte is divided into y2 group content-data;Wherein, the zero padding if less than Y2 byte of y2 group content-data, Y2 >=1, y2 >= 1;
Read y2 the second BCH codes of the tail portion of the file to be read;
Each group of content-data and its corresponding second BCH code are spliced, the corresponding y2 group that obtains splices content Data;
Each group of splicing content-data is decoded respectively according to the 4th BCH cyclic code.
Specifically, the length information of the file to be read obtained first according to decoding will be to be read in conjunction with above-described embodiment The content-data of file is divided for one group according to pre-set Y2 byte, and file to be read is divided into y2 group content number According to last group is that y2 group content-data is filled if inadequate Y2 byte with spot patch, then reads the tail portion of file to be read Y2 the second BCH codes of storage, respectively carry out the second BCH code corresponding to each group of content-data and this group of content-data Splicing, the corresponding y2 group that obtains splices content-data, finally according to pre-set 4th BCH cyclic code respectively to each group of splicing Content-data is decoded, to obtain the content-data of file to be read.
It should be noted that when being grouped to the content-data of file to be read, the corresponding word of each group of content-data Joint number amount should when storing coding stage grouping, used byte quantity be consistent with file to be read.
As an improvement of the above scheme, Y2=512, the 4th BCH cyclic code are BCH (4148,4096) cyclic code.
Specifically, first according to the length information of file to be read by the content-data of file to be read according to presetting One group of 512 bytes divided, file to be read is divided into y2 group content-data, last group be y2 group content number It is filled according to if inadequate Y2 byte with spot patch, then reads y2 the second BCH codes of the tail portion storage of file to be read, respectively will Second BCH code of 7 bytes corresponding to each group of content-data and this group of content-data is spliced, corresponding to obtain y2 group Splice content-data, used cyclic code corresponds to BCH when encoding to its content information storage coding stage (4148,4096) cyclic code, thus the 4th BCH cyclic code be BCH (4148,4096) cyclic code, then according to BCH (4148, 4096) cyclic code respectively decodes each group of splicing content-data, to obtain the content-data of file to be read.
For example, generating 7 words by coding correspondence in the content-data of storage each group of 512 bytes of coding stage The BCH redundant code of section, and be placed on tail of file in order, when being decoded, by i-th group of content-data text [i] and Corresponding i-th of second BCH code bch [i] take out, and bch [i] is then placed on to the tail portion of text [i], thus constitutes i-th The splicing content-data of group 512+7=519, decodes each group of splicing content-data using BCH (4148,4096) algorithm It calculates, so that it may it is after being decoded to be combined into file as a result, the result after each group of decoding is directly arranged in order, be exactly Finally need to read file.
It should be noted that above-mentioned design parameter and BCH cyclic code are set as a kind of preferred embodiment, can will calculate The selection of method is adjusted to optimum state, in practical applications, can also replace the slightly poor identical algorithms of other efficiency, such as choose 1024 byte+BCH (8304,8192) cyclic codes decode etc., all belong to the scope of protection of the present invention, the embodiment of the present invention It is not especially limited.
The embodiment of the invention also provides a kind of storage of file in NOR FLASH and reading devices, can be realized above-mentioned All processes of the storage of file and read method in NOR FLASH described in any embodiment, modules, list in device Member effect and realization technical effect respectively with the storage of file in NOR FLASH described in above-described embodiment and reading side The technical effect of effect and the realization of method corresponds to identical, and which is not described herein again.
It is shown in Figure 2, it is that one of the storage of file and reading device in a kind of NOR FLASH provided by the invention is excellent The structural block diagram of embodiment is selected, described device includes:
Document No. module 11, for being followed according to preset first BCH when needing the storage file in NOR FLASH Ring code encodes the length information of file to be stored, and according to preset 2nd BCH cyclic code to the file to be stored Content information encoded;
File storage module 12, for storing the file to be stored according to the file after coding;
File decoding module 13, for being followed according to preset 3rd BCH when needing to read file in NOR FLASH Ring code decodes the length information of file to be read, and according to preset 4th BCH cyclic code to the file to be read Content information decoded;Wherein, the 3rd BCH cyclic code, the 4th BCH cyclic code are respectively in storage to institute State the length information of file to be read, content information carries out encoding used cyclic code;And
File read module 14, for the file to be read according to the file acquisition after decoding.
Preferably, the document No. module 11 specifically includes:
Header field adding unit, for adding the header field of X1 byte for the file to be stored;Wherein, before the header field X1 byte is used to store the physical length of the file to be stored, X1 > x1 >=1;
Length encoding unit, for being carried out according to length information of the first BCH cyclic code to the file to be stored Coding, it is corresponding to obtain the first BCH code;And
First BCH code storage unit, for first BCH code to be stored in the rear X1-x1 byte of the header field.
Preferably, the document No. module 11 further include:
First content division unit, for by the content-data of the file to be stored according to the one group of division of every Y1 byte For y1 group content-data;Wherein, the zero padding if less than Y1 byte of y1 group content-data, Y1 >=1, y1 >=1;
Research content unit, for being encoded respectively to each group of content-data according to the 2nd BCH cyclic code, phase Y1 the second BCH codes should be obtained;And
Second BCH code storage unit, it is described wait store for being stored in y1 second BCH codes according to coded sequence The tail portion of file.
Preferably, the file decoding module 13 specifically includes:
Header field reading unit, the header field of the preset X2 byte for reading the file to be read;Wherein, X2 > 1; And
Length coding unit, for being decoded according to the 3rd BCH cyclic code to the header field, described in corresponding acquisition The length information of file to be read.
Preferably, the file decoding module 13 further include:
Second division of teaching contents unit, for will be in the file to be read according to the length information of the file to be read Hold data and is divided into y2 group content-data according to one group of preset Y2 byte;Wherein, if y2 group content-data is less than Y2 Byte then zero padding, Y2 >=1, y2 >=1;
Second BCH code reading unit, y2 the second BCH codes of the tail portion for reading the file to be read;
Content concatenation unit, for splicing each group of content-data and its corresponding second BCH code, accordingly It obtains y2 group and splices content-data;And
Content decoding unit, for being translated respectively each group of splicing content-data according to the 4th BCH cyclic code Code.
The embodiment of the invention also provides a kind of computer readable storage medium, the computer readable storage medium includes The computer program of storage;Wherein, where the computer program controls the computer readable storage medium at runtime Equipment executes the storage of file and read method in NOR FLASH described in any of the above-described embodiment.
It is shown in Figure 3 the embodiment of the invention also provides a kind of storage of file in NOR FLASH and reading device, It is the structural frames of another preferred embodiment of the storage and reading device of file in a kind of NOR FLASH provided by the invention Figure, described device include processor 10, memory 20 and are stored in the memory 20 and are configured as by the processing The computer program that device 10 executes, the processor 10 are realized described in any of the above-described embodiment when executing the computer program NOR FLASH in file storage and read method.
Preferably, the computer program can be divided into one or more module/units (such as computer program 1, meter Calculation machine program 2), one or more of module/units are stored in the memory 20, and by The processor 10 executes, to complete the present invention.One or more of module/units, which can be, can complete specific function Series of computation machine program instruction section, the instruction segment is for describing the implementation procedure of the computer program in said device.
The processor 10 can be central processing unit (Central Processing Unit, CPU), can also be Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field- Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic, Discrete hardware components etc., general processor can be microprocessor or the processor 10 is also possible to any conventional place Device is managed, the processor 10 is the control centre of described device, utilizes each portion of various interfaces and connection described device Point.
The memory 20 mainly includes program storage area and data storage area, wherein program storage area can store operation Application program needed for system, at least one function etc., data storage area can store related data etc..In addition, the memory 20 can be high-speed random access memory, can also be nonvolatile memory, such as plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card and flash card (Flash Card) etc., or The memory 20 is also possible to other volatile solid-state parts.
It should be noted that above-mentioned apparatus may include, but be not limited only to, processor, memory, those skilled in the art can To understand, Fig. 3 structural block diagram is only the example of above-mentioned apparatus, the not restriction of structure twin installation, may include than illustrating more More or less component perhaps combines certain components or different components.
To sum up, the storage of file and read method, device and meter in a kind of NOR FLASH provided by the embodiment of the present invention Calculation machine readable storage medium storing program for executing, according to BCH cyclic code to the length of file to be stored when the storage file into NOR FLASH Information and content information are encoded, according to BCH cyclic code to file to be read when reading file from NOR FLASH Length information and content information decoded, by encoding and decoding process, though original there are bit flipping mistake, can also To correct automatically in decoding calculates, the file obtained after decoding is the file for passing through bit flipping correction, to solve As caused by the manufacturing process and access times bit flipping problem of NOR FLASH has NOR FLASH and is automatically repaired energy Power, and then improve the reliability of storage and the reading of file in NOR FLASH.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, without departing from the technical principles of the invention, several improvement and deformations can also be made, these improvement and deformations Also it should be regarded as protection scope of the present invention.

Claims (10)

1. the storage of file and read method in a kind of NOR FLASH characterized by comprising
When needing the storage file in NOR FLASH, believed according to length of the preset first BCH cyclic code to file to be stored Breath is encoded, and is encoded according to preset 2nd BCH cyclic code to the content information of the file to be stored;
The file to be stored is stored according to the file after coding;
When needing to read file in NOR FLASH, believed according to length of the preset 3rd BCH cyclic code to file to be read Breath is decoded, and is decoded according to preset 4th BCH cyclic code to the content information of the file to be read;Wherein, The 3rd BCH cyclic code, the 4th BCH cyclic code be respectively in storage to the length information of the file to be read, Content information carries out encoding used cyclic code;
The file to be read according to the file acquisition after decoding.
2. the storage of file and read method in NOR FLASH as described in claim 1, which is characterized in that the method is logical Following steps are crossed to encode the length information of the file to be stored according to the first BCH cyclic code:
The header field of X1 byte is added for the file to be stored;Wherein, the preceding x1 byte of the header field is described for storing The physical length of file to be stored, X1 > x1 >=1;
The length information of the file to be stored is encoded according to the first BCH cyclic code, it is corresponding to obtain the first BCH Code;
First BCH code is stored in the rear X1-x1 byte of the header field.
3. the storage of file and read method in NOR FLASH as claimed in claim 1 or 2, which is characterized in that the method The content information of the file to be stored is encoded according to the 2nd BCH cyclic code by following steps:
The content-data of the file to be stored is divided into y1 group content-data according to one group of every Y1 byte;Wherein, if Less than the Y1 byte then zero padding of y1 group content-data, Y1 >=1, y1 >=1;
Each group of content-data is encoded respectively according to the 2nd BCH cyclic code, it is corresponding to obtain y1 the second BCH codes;
Y1 second BCH codes are stored in the tail portion of the file to be stored according to coded sequence.
4. the storage of file and read method in NOR FLASH as described in claim 1, which is characterized in that the method is logical Following steps are crossed to decode the length information of the file to be read according to the 3rd BCH cyclic code:
Read the header field of the preset X2 byte of the file to be read;Wherein, X2 > 1;
The header field is decoded according to the 3rd BCH cyclic code, accordingly obtains the length information of the file to be read.
5. the storage of file and read method in NOR FLASH as described in claim 1 or 4, which is characterized in that the method The content information of the file to be read is decoded according to the 4th BCH cyclic code by following steps:
According to the length information of the file to be read by the content-data of the file to be read according to preset Y2 byte One group is divided into y2 group content-data;Wherein, the zero padding if less than Y2 byte of y2 group content-data, Y2 >=1, y2 >=1;
Read y2 the second BCH codes of the tail portion of the file to be read;
Each group of content-data and its corresponding second BCH code are spliced, the corresponding y2 group that obtains splices content-data;
Each group of splicing content-data is decoded respectively according to the 4th BCH cyclic code.
6. the storage of file and reading device in a kind of NOR FLASH characterized by comprising
Document No. module is used for when needing the storage file in NOR FLASH, according to preset first BCH cyclic code pair The length information of file to be stored is encoded, and according to preset 2nd BCH cyclic code to the content of the file to be stored Information is encoded;
File storage module, for storing the file to be stored according to the file after coding;
File decoding module is used for when needing to read file in NOR FLASH, according to preset 3rd BCH cyclic code pair The length information of file to be read is decoded, and according to preset 4th BCH cyclic code to the content of the file to be read Information is decoded;Wherein, the 3rd BCH cyclic code, the 4th BCH cyclic code are respectively to continue in storage to described The length information of file, content information is taken to carry out encoding used cyclic code;And
File read module, for the file to be read according to the file acquisition after decoding.
7. the storage of file and reading device in NOR FLASH as claimed in claim 6, which is characterized in that the file is compiled Code module specifically includes:
Header field adding unit, for adding the header field of X1 byte for the file to be stored;Wherein, preceding x1 of the header field Byte is used to store the physical length of the file to be stored, X1 > x1 >=1;
Length encoding unit, for being encoded according to the first BCH cyclic code to the length information of the file to be stored, It is corresponding to obtain the first BCH code;And
First BCH code storage unit, for first BCH code to be stored in the rear X1-x1 byte of the header field.
8. the storage of file and reading device in NOR FLASH as claimed in claims 6 or 7, which is characterized in that the file Coding module further include:
First content division unit, for the content-data of the file to be stored to be divided into y1 for one group according to every Y1 byte Group content-data;Wherein, the zero padding if less than Y1 byte of y1 group content-data, Y1 >=1, y1 >=1;
Research content unit is accordingly obtained for being encoded respectively to each group of content-data according to the 2nd BCH cyclic code Obtain y1 the second BCH codes;And
Second BCH code storage unit, for y1 second BCH codes to be stored in the file to be stored according to coded sequence Tail portion.
9. a kind of computer readable storage medium, which is characterized in that the computer readable storage medium includes the calculating of storage Machine program;Wherein, the equipment where the computer program controls the computer readable storage medium at runtime executes such as The storage of file and read method in the described in any item NOR FLASH of Claims 1 to 5.
10. the storage of file and reading device in a kind of NOR FLASH, which is characterized in that including processor, memory and deposit The computer program executed by the processor is stored up in the memory and is configured as, the processor is executing the meter The storage of file and read method in NOR FLASH as claimed in any one of claims 1 to 5 are realized when calculation machine program.
CN201910035218.3A 2019-01-14 2019-01-14 Method and device for storing and reading files in NOR FLASH and storage medium Expired - Fee Related CN109857340B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910035218.3A CN109857340B (en) 2019-01-14 2019-01-14 Method and device for storing and reading files in NOR FLASH and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910035218.3A CN109857340B (en) 2019-01-14 2019-01-14 Method and device for storing and reading files in NOR FLASH and storage medium

Publications (2)

Publication Number Publication Date
CN109857340A true CN109857340A (en) 2019-06-07
CN109857340B CN109857340B (en) 2022-05-06

Family

ID=66894576

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910035218.3A Expired - Fee Related CN109857340B (en) 2019-01-14 2019-01-14 Method and device for storing and reading files in NOR FLASH and storage medium

Country Status (1)

Country Link
CN (1) CN109857340B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110239094A1 (en) * 2010-03-29 2011-09-29 Kwok Zion S Error correction mechanisms for flash memories
CN102823141A (en) * 2010-03-30 2012-12-12 国际商业机器公司 Two-level bch codes for solid state storage devices
CN104541253A (en) * 2012-09-26 2015-04-22 英特尔公司 Techniques associated with protecting system critical data written to non-volatile memory
CN105100820A (en) * 2015-08-18 2015-11-25 杭州士兰微电子股份有限公司 Digital media file encoding method, decoding method, encoding device and decoding device
CN106658034A (en) * 2016-12-05 2017-05-10 乐视控股(北京)有限公司 File storage and reading method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110239094A1 (en) * 2010-03-29 2011-09-29 Kwok Zion S Error correction mechanisms for flash memories
CN102823141A (en) * 2010-03-30 2012-12-12 国际商业机器公司 Two-level bch codes for solid state storage devices
CN104541253A (en) * 2012-09-26 2015-04-22 英特尔公司 Techniques associated with protecting system critical data written to non-volatile memory
CN105100820A (en) * 2015-08-18 2015-11-25 杭州士兰微电子股份有限公司 Digital media file encoding method, decoding method, encoding device and decoding device
CN106658034A (en) * 2016-12-05 2017-05-10 乐视控股(北京)有限公司 File storage and reading method and device

Also Published As

Publication number Publication date
CN109857340B (en) 2022-05-06

Similar Documents

Publication Publication Date Title
CN103392172B (en) Correct the erasing in storage array
US7900118B2 (en) Flash memory system and method for controlling the same
US9128864B2 (en) Memory controller, storage device and error correction method
KR101686980B1 (en) Method of data storage in non-volatile memory
US8949687B2 (en) Memory device and memory system
US20120096328A1 (en) Multi-write endurance and error control coding of non-volatile memories
CN101923902B (en) Method, system and device for error correcting multilevel codes
US20120254686A1 (en) Non-volatile semiconductor memory devices and error correction methods
CN102017425B (en) System and method for performing concatenated error correction
US10447301B2 (en) Optimal LDPC bit flip decision
JP2015507409A (en) Multi-phase ECC encoding using algebraic codes
CN102034547A (en) Memory system and control method for the same
CN101281788A (en) Flash memory system as well as control method thereof
KR20160090054A (en) Flash memory system and operating method thereof
CN110457160A (en) A kind of error correction method and device
CN109785895B (en) ECC device and method for correcting multi-bit errors in NAND Flash
TW201220318A (en) Method for enhancing error correction capability, and associated memory device and controller thereof
CN105007286A (en) Decoding method, decoding device, and cloud storage method and system
CN210110352U (en) ECC device for correcting multi-bit errors in NAND Flash
CN109857340A (en) The storage and read method of file, device and storage medium in NOR FLASH
CN101908378A (en) Controller of flash memory and method of accessing data in the flash memory
US10693498B2 (en) Parity check matrix generator, operating method thereof and error correction circuit using parity check matrix generated by the same
EP4369201A1 (en) Data processing method and apparatus
KR102369313B1 (en) Error correction circuit, operating method thereof and data storage device incuding the same
CN110113058A (en) Coding and decoding method, device, equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20220506

CF01 Termination of patent right due to non-payment of annual fee