Data storage flash memory management method and program
Abstract
There is provided a data storage flash memory management method that does not require a management area and can reduce an access load. A data storage flash memory management method for storing k time-varying parameters (k is a positive integer) in a flash memory including j blocks (j is an even number not less than 2) as erase units is configured as follows. The j blocks are divided into two areas which are a primary macroblock and a secondary macroblock, each including j/2 blocks. Each of the primary macroblock and the secondary macroblock is divided into k or more segments each having an equal memory capacity, with one of the macroblocks as an active system and the other as a standby system. The k parameters are one-to-one associated with k segments of the k or more segments, and each parameter is written or read to/from a corresponding segment in an active-system macroblock.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A data storage flash memory management method for storing k varying parameters (k is a positive integer) in a flash memory including j blocks (j is an even number not less than 2) as erase units, the method comprising the steps of:
dividing the j blocks into two areas which are a primary macroblock and a secondary macroblock, each comprising j/2 blocks; dividing each of the primary macroblock and the secondary macroblock into k or more segments each having an equal memory capacity, with one of the macroblocks as an active system and the other as a standby system; one-to-one associating the k parameters with k segments of the k or more segments; and writing or reading each parameter to/from a corresponding segment in an active-system macroblock.
2 . The data storage flash memory management method according to claim 1 , comprising the steps of:
writing an Mth parameter (M is a positive integer not more than k) included in the k parameters from a start address of an Mth segment in the active-system macroblock, with header information added to the Mth parameter; and writing the Mth parameter from a start address of a blank area of the Mth segment at the time of subsequently writing the Mth parameter, wherein the header information includes the number of segments included in each of the primary macroblock and the secondary macroblock and address offset information for calculating a start address of an area where the Mth parameter is to be written next.
3 . The data storage flash memory management method according to claim 1 , comprising the steps of:
when the number of segments included in each of the primary macroblock and the secondary macroblock is equal to or more than k+1, writing all or part of a value of an Mth parameter included in the k parameters to a segment other than first to kth segments in the active-system macroblock if there remains no writable area in an Mth segment to write the Mth parameter to the corresponding Mth segment in the active-system macroblock, wherein address offset information included in header information of the Mth parameter includes information indicating a start address of the writable segment as an area where the Mth parameter is to be written next.
4 . The data storage flash memory management method according to claim 3 , comprising the steps of:
writing the Mth parameter from a start address of the Mth segment in the standby-system macroblock if there remains no unused segment in the active-system macroblock to write the Mth parameter; after the step above, reading the latest values of parameters other than the Mth parameter from the active-system macroblock and writing the latest values to corresponding segments in the standby-system macroblock; after the steps above, erasing data in all areas of the active-system macroblock; and after the steps above, setting the standby-system macroblock to a new active-system macroblock and setting the active-system macroblock to a new standby-system macroblock.
5 . The data storage flash memory management method according to claim 2 , comprising the steps of:
reading the address offset information included in the header information from a top of the active-system macroblock at the time of writing the Mth parameter; repeating a step for calculating a start address of an area where the Mth parameter is next updated and written based on the address offset information and determining whether the area is an area where data is already written or a blank area by reading data in the area, until the blank area is found; and writing the Mth parameter to the found blank area.
6 . The data storage flash memory management method according to claim 2 , comprising the steps of:
reading the address offset information included in the header information from a top of the active-system macroblock at the time of reading the Mth parameter; repeating a step for calculating a start address of an area where the Mth parameter is next updated and written based on the address offset information and determining whether the area is an area where data is already written or a blank area by reading data in the area, until the blank area is found; and reading the Mth parameter written just before the found blank area, as the latest value of the Mth parameter.
7 . The data storage flash memory management method according to claim 2 , wherein the header information further includes segment identification information of a segment where the Mth parameter is written.
8 . The data storage flash memory management method according to claim 7 , wherein a conversion table for associating the segment identification information with an array name used by an application program is stored in the data storage flash memory.
9 . The data storage flash memory management method according to claim 8 , wherein the array name can be associated with the same segment identification information a plurality of times in the conversion table, the association of the array name with the segment identification information is invalidated by an even-numbered association, and the association of the array name with the segment identification information is invalidated by a next odd-numbered association.
10 . A program for repeatedly updating and writing k varying parameters (k is a positive integer) to a flash memory and reading the latest data of the parameters and executed by a processor which can access the flash memory, the program comprising the steps of:
defining a primary macroblock and a secondary macroblock each having the same number of blocks as erase units in the flash memory, with one of the primary and secondary macroblocks as an active system and the other as a standby system; defining k or more segments each having an equal memory capacity in the primary macroblock and defining k or more segments each having an equal memory capacity in the secondary macroblock; one-to-one associating the k parameters with k segments of the k or more segments; executing a write step for writing a parameter to a corresponding segment in an active-system macroblock in the flash memory; and executing a read step for reading the latest value of the parameter from a corresponding segment in the active-system macroblock in the flash memory.
11 . The program according to claim 10 ,
wherein an Mth parameter (M is a positive integer not more than k) included in the k parameters is written in order from a start address of a corresponding Mth segment in the active-system macroblock, with header information added to the Mth parameter, wherein the header information includes the number of segments included in each of the primary macroblock and the secondary macroblock and address offset information indicating an offset to a start of an area where the Mth parameter is to be written next, wherein the write step for writing the Mth parameter comprises a step of reading the address offset information included in the header from the start address of the Mth segment, repeating a step of calculating an address for storing next header information based on the address offset information and reading the next header information, until a blank area where header information is not stored is reached, and writing the Mth parameter with header information to the blank area, and wherein the read step for reading the latest value of the Mth parameter comprises a step of reading the address offset information included in the header from the start address of the Mth segment, repeating a step of calculating an address for storing next header information based on the address offset information and reading the next header information, until a blank area where header information is not stored is reached, and reading the parameter with header information read just before the blank area is reached, as the latest value of the Mth parameter.
12 . The program according to claim 11 , wherein the number of segments included in each of the primary macroblock and the secondary macroblock is equal to or more than k+1, and the write step for writing the Mth parameter comprises a step of writing all or part of a value of the Mth parameter included in the k parameters to a segment other than first to kth segments in the active-system macroblock if there remains no writable area in the Mth segment to write the Mth parameter to the corresponding Mth segment in the active-system macroblock, and
wherein the address offset information included in the header information of the Mth parameter includes information for calculating a start address of the writable segment as an area where the Mth parameter is to be written next.
13 . The program according to claim 12 , comprising the steps of:
writing the Mth parameter from a start address of the Mth segment in the standby-system macroblock if there remains no unused segment in the active-system macroblock to write the Mth parameter; after the step above, reading the latest values of parameters other than the Mth parameter from the active-system macroblock and writing the latest values to corresponding segments in the standby-system macroblock; after the steps above, erasing data in all areas of the active-system macroblock; and after the steps above, setting the standby-system macroblock to a new active-system macroblock and setting the active-system macroblock to a new standby-system macroblock.
14 . The program according to claim 11 , wherein the header information further includes segment identification information of a segment where the Mth parameter is written.
15 . The program according to claim 14 , comprising a step of storing a conversion table for associating the segment identification information with an array name used by an application program in the flash memory.
16 . The program according to claim 15 , comprising a step of allowing association of the array name with the same segment identification information a plurality of times in the conversion table, invalidating the association of the array name with the segment identification information by an even-numbered association, and validating the association of the array name with the segment identification information by a next odd-numbered association.Join the waitlist — get patent alerts
Track US2015113210A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.