CN108255436A - Data access method, access device, home appliance and readable storage medium storing program for executing - Google Patents

Data access method, access device, home appliance and readable storage medium storing program for executing Download PDF

Info

Publication number
CN108255436A
CN108255436A CN201810071353.9A CN201810071353A CN108255436A CN 108255436 A CN108255436 A CN 108255436A CN 201810071353 A CN201810071353 A CN 201810071353A CN 108255436 A CN108255436 A CN 108255436A
Authority
CN
China
Prior art keywords
data
copy
address
written
write
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.)
Pending
Application number
CN201810071353.9A
Other languages
Chinese (zh)
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.)
GD Midea Air Conditioning Equipment Co Ltd
Original Assignee
Guangdong Midea Refrigeration Equipment 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 Guangdong Midea Refrigeration Equipment Co Ltd filed Critical Guangdong Midea Refrigeration Equipment Co Ltd
Priority to CN201810071353.9A priority Critical patent/CN108255436A/en
Publication of CN108255436A publication Critical patent/CN108255436A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0626Reducing size or complexity of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The present invention provides a kind of data access method, access device, home appliance and readable storage medium storing program for executing, wherein, data access method includes:When microcontroller chip performs power-on initialization operation, the logical address of the specified data copy in RAM memory is read, according to preset mapping relations, to determine that logical address corresponds to the physical address in flash storage;The storage region that physical address is directed toward is determined, to determine that storage region middle finger determines the write address of the reading address of the current fresh copy of data copy and/or the copy to be written of specified data copy;It is written into copy write-in Flash according to the current fresh copy read in address reading Flash or according to write address.Pass through technical scheme of the present invention, the interim backup of storage data is not needed to carry out, it is in short supply so as to be widely used in memory source to save the resource of RAM memory, it has not been convenient to divide on the microcontroller (microcontroller chip) on the air-conditioning equipment of a large amount of memory source record Flash memory states.

Description

Data access method, access device, home appliance and readable storage medium storing program for executing
Technical field
The present invention relates to memory technology fields, are filled in particular to a kind of data access method, a kind of data access It puts, a kind of home appliance and a kind of computer readable storage medium.
Background technology
For home appliances such as air conditioners, using microcontroller chip (Microcontroller Unit, MCU) control device Operation, and related data is stored in Flash, Flash has following characteristic:
(1) it needs first to wipe to write afterwards, it is impossible to cover legacy data, therefore using new data in order to ensure after erasable failure still having Available data, in the relevant technologies, by the way of two backups of retention data on Flash, first erasable master data, then wipe Write Backup Data;
(2) much larger than write-in granularity the data of 1 byte once can be only written, but primary erasing can wipe in erasing granularity Except the data of entire sector, representative value is 4096 bytes;
For above-mentioned Flash characteristics, there are following defects in use:
(1) only storage much smaller than the data in sector space, can cause the waste in Flash spaces and service life in sector;
(2) it is needed when wiping sector to being backed up on the RAM of MCU without other newer data temporarily, caused A large amount of RAM resources are occupied, for the embedded MCU that the air-conditioning equipment smaller than sector-size with many RAM sizes uses It is impossible.
Invention content
The present invention is directed at least solve one of technical problem present in the prior art or the relevant technologies.
For this purpose, the purpose of the present invention is to provide a kind of data access methods, a kind of data access device, a kind of micro- Control chip and a kind of computer readable storage medium.
To achieve these goals, the technical solution of the first aspect of the present invention provides a kind of data access method, packet It includes:When microcontroller chip performs power-on initialization operation, the logical address of the specified data copy in RAM memory is read, According to preset mapping relations, to determine that logical address corresponds to the physical address in flash storage;Determine that physical address is directed toward Storage region, with determine storage region middle finger determine data copy current fresh copy reading address and/or specified data pair The write address of this copy to be written;According to read address read Flash in current fresh copy or will be to be written according to write address Enter in copy write-in Flash.
In the technical scheme, by power-up initializing, being reflected to the logical address in RAM memory into row address It penetrates, to determine corresponding physical address, to search corresponding storage region in Flash according to physical address, and then determines storage Data copy in region reads address and data copy write address, with according to reading address reading data copy or according to write address Re-write updated data, on the one hand, only need to store logical address in RAM, to determine what is be directed toward according to logical address The reading address of data copy and write address do not need to carry out the interim backup of storage data, save the resource of RAM memory from And it is in short supply to can be widely applied for memory source, it has not been convenient to which the air-conditioning for dividing a large amount of memory source record Flash memory states is set On standby upper microcontroller (microcontroller chip).
Specifically, the address of the specified range on Flash is all mapped as a particular address data, as logically Location, can have multiple sectors in specified range, and multiple copies of specified data are stored in multiple sectors, current by determining The reading address of fresh copy and/or the write address of copy to be written perform reading and write operation with corresponding.
Wherein, address of cache least unit can be page 1.
In the above-mentioned technical solutions, it is preferable that when microcontroller chip performs power-on initialization operation, read RAM storages Before the logical address of specified data copy in device, further include:According to the length of specified data by each fan in storage region Zoning is divided into multiple data areas;According to the write time, specified data copy is sequentially written in the data area in each sector It is interior
In the technical scheme, by the way that each sector is divided into multiple data areas, in each data interval A data copy is stored, there are multiple copies of same data in same time memory, realizes the abundant of sector storage section It utilizes, and when equipment powers on every time can find a available data, even if equipment is in erasable operation critical data process Favorite outer power down, after restarting still can normal operation, effectively improve equipment robustness.
Wherein, specified data can be running configuration data.
Specifically, a storage region can be page 1, and page 1 can have multiple data fields by multiple sectors, each sector Domain, i.e. a sector can store multiple data copies, in each sector, the storage of data copy according to storage time from Stored after going to, i.e., accessing zone more before, the version for storing data is lower.
In any of the above-described technical solution, it is preferable that determine that storage region middle finger determines the current fresh copy of data copy Reading address and/or specified data copy copy to be written write address, specifically include following steps:According to storage region Initial address, multiple data areas sequence is scanned, to determine first specific area of data, in specific area of data With the specified data copy that passes through can be verified;From first specific area of data, detect whether to have multiple continuous Store the data area of data;When detecting with multiple continuous data areas, last position specific area of data is determined, with The address of last position specific area of data is determined as to the reading address of current fresh copy;Detect last position specific area of data it Whether there is writable data area afterwards;When detecting with writable data area, first is scanned writable The address of data area is determined as the write address of copy to be written.
In the technical scheme, by performing the scan operation of storage region according to the initial address of storage region, initially Address corresponds to first data area of first sector, usually can all store data copy, unspoiled in the data copy In the case of, data copy can be by verification, i.e. first data area is first data area, contains verification from first By the regions of data start, whether in (no matter verifying and pass through) in continuous multiple regions containing data, the last one is logical The data of verification are crossed, then can be determined as current fresh copy, after current fresh copy, continues sequential scan, scans Data area of first region that data can be written for the copy to be written of more new version, so as to be written in new edition notebook data In the process, legacy data is no longer directly covered for write operation, but the new version of data is written in region.
Specifically, the scan operation of storage region is performed according to the initial address of storage region, is initially storing shape completely Under state, the data of the first sector storage are the data of oldest version, and the specified data of completely multiple versions have been write in storage region When, then the data of the first sector storage are wiped first, the data of more new version to be written in the first sector, the first sector at this time Versions of data is relatively higher, in scan operation, it is only necessary to operation is scanned to the first sector, to determine to read address and write ground Location.
In any of the above-described technical solution, it is preferable that further include:It, will when detecting without writable data area Specified data copy erasing in write time earliest sector;By data area most preceding in the sector of erasing, it is determined as treating The write address of copy is written.
In the technical scheme, when detecting without writable area, i.e. all data areas after a write operation When being fully written, then need first to wipe the sector for preserving oldest edition data, with the write-in vacating space for newer version, Compared with access plan of the prior art, do not need to frequently perform erasing operation, so as to be conducive to Flash service lifes Extend.
Specifically, sector in front then needs the weight since initial address because read-write region is write when expiring and being wiped free of New write-in at this point, the data area of copy to be written is between new edition notebook data and legacy data, and can be used as interval Region distinguishes the data of new version and the data of legacy version.
In any of the above-described technical solution, it is preferable that it is written into copy write-in Flash according to write address, it is specific to wrap Include following steps:After being written into copy write-in Flash, whether verification, which detects copy to be written and verify, passes through;It is detecting To copy to be written verification not by when, next writable data area is determined, until being verified after copy to be written write-in logical It crosses;When detecting that copy verification to be written passes through, it is written into copy and is determined as current fresh copy, and update specified data The logical address of copy.
In the technical scheme, when performing data write operation, after data copy write-in, whether detection data write-in Whether success, i.e. data copy verification pass through, with verification not by when, then continue to postpone to the latter data area, continue Write operation is performed, and after being written successfully, copy is written into and is determined as current fresh copy and will be next to be written Region is determined as the address in region to be written, so as to fulfill the address update read data, write data, when updating the data, only needs Latest copy is written, just the sector of legacy data is stored in erasing only when specified Flash storage regions all write full, is greatly reduced The erasing times of Flash effectively extend the service life of Flash.
Specifically, the verification operation of data copy can be realized by increasing check code behind data, can also be passed through Hash calculation is realized.
The technical solution of the second aspect of the present invention provides a kind of data access device, including:Reading unit, for When microcontroller chip performs power-on initialization operation, the logical address of the specified data copy in RAM memory is read, with basis Preset mapping relations determine that logical address corresponds to the physical address in flash storage;Determination unit, for determining physics The storage region that address is directed toward is determined the reading address of the current fresh copy of data copy with determining storage region middle finger and/or referred to Determine the write address of the copy to be written of data copy;Read-write cell, for according to the current newest pair read in address reading Flash This is written into according to write address in copy write-in Flash.
In the technical scheme, by power-up initializing, being reflected to the logical address in RAM memory into row address It penetrates, to determine corresponding physical address, to search corresponding storage region in Flash according to physical address, and then determines storage Data copy in region reads address and data copy write address, with according to reading address reading data copy or according to write address Re-write updated data, on the one hand, only need to store logical address in RAM, to determine what is be directed toward according to logical address The reading address of data copy and write address do not need to carry out the interim backup of storage data, save the resource of RAM memory from And it is in short supply to can be widely applied for memory source, it has not been convenient to which the air-conditioning for dividing a large amount of memory source record Flash memory states is set On standby upper microcontroller (microcontroller chip).
Specifically, the address of the specified range on Flash is all mapped as a particular address data, as logically Location, can have multiple sectors in specified range, and multiple copies of specified data are stored in multiple sectors, current by determining The reading address of fresh copy and/or the write address of copy to be written perform reading and write operation with corresponding.
Wherein, address of cache least unit can be page 1.
In the above-mentioned technical solutions, it is preferable that further include:Division unit will store for the length according to specified data Each sector in region is divided into multiple data areas;Writing unit, it is for according to the write time, specified data copy is suitable Sequence is written in the data area in each sector
In the technical scheme, by the way that each sector is divided into multiple data areas, in each data interval A data copy is stored, there are multiple copies of same data in same time memory, realizes the abundant of sector storage section It utilizes, and when equipment powers on every time can find a available data, even if equipment is in erasable operation critical data process Favorite outer power down, after restarting still can normal operation, effectively improve equipment robustness.
Wherein, specified data can be running configuration data.
Specifically, a storage region can be page 1, and page 1 can have multiple data fields by multiple sectors, each sector Domain, i.e. a sector can store multiple data copies, in each sector, the storage of data copy according to storage time from Stored after going to, i.e., accessing zone more before, the version for storing data is lower.
In any of the above-described technical solution, it is preferable that further include:Scanning element, for according to storage region initially Location is scanned multiple data areas sequence, and to determine first specific area of data, having in specific area of data can Verify the specified data copy passed through;Detection unit, for from first specific area of data, detecting whether that there are multiple companies The data area of continuous storage data;Determination unit is additionally operable to:When detecting with multiple continuous data areas, determine most The address of last position specific area of data is determined as the reading address of current fresh copy by position specific area of data afterwards;Detection Unit is additionally operable to:Detect whether last position specific area of data has writable data area later;Determination unit is additionally operable to: When detecting with writable data area, the address of writable data area that first is scanned is determined as pair to be written This write address.
In the technical scheme, by performing the scan operation of storage region according to the initial address of storage region, initially Address corresponds to first data area of first sector, usually can all store data copy, unspoiled in the data copy In the case of, data copy can be by verification, i.e. first data area is first data area, contains verification from first By the regions of data start, whether in (no matter verifying and pass through) in continuous multiple regions containing data, the last one is logical The data of verification are crossed, then can be determined as current fresh copy, after current fresh copy, continues sequential scan, scans Data area of first region that data can be written for the copy to be written of more new version, so as to be written in new edition notebook data In the process, legacy data is no longer directly covered for write operation, but the new version of data is written in region.
Specifically, the scan operation of storage region is performed according to the initial address of storage region, is initially storing shape completely Under state, the data of the first sector storage are the data of oldest version, and the specified data of completely multiple versions have been write in storage region When, then the data of the first sector storage are wiped first, the data of more new version to be written in the first sector, the first sector at this time Versions of data is relatively higher, in scan operation, it is only necessary to operation is scanned to the first sector, to determine to read address and write ground Location.
In any of the above-described technical solution, it is preferable that further include:Unit is wiped, for detecting without writable During data area, the specified data copy erasing in the sector earliest by the write time;Determination unit is additionally operable to:By the fan of erasing Most preceding data area in area is determined as the write address of copy to be written.
In the technical scheme, when detecting without writable area, i.e. all data areas after a write operation When being fully written, then need first to wipe the sector for preserving oldest edition data, with the write-in vacating space for newer version, Compared with access plan of the prior art, do not need to frequently perform erasing operation, so as to be conducive to Flash service lifes Extend.
Specifically, sector in front then needs the weight since initial address because read-write region is write when expiring and being wiped free of New write-in at this point, the data area of copy to be written is between new edition notebook data and legacy data, and can be used as interval Region distinguishes the data of new version and the data of legacy version.
In any of the above-described technical solution, it is preferable that further include:Verification unit, for being written into copy write-in After in Flash, whether verification, which detects copy to be written and verify, passes through;Determination unit is additionally operable to:Detecting copy school to be written Test not by when, next writable data area is determined, until verifying and passing through after copy to be written write-in;Data access device It further includes:Updating unit, for when detecting that copy verification to be written passes through, being written into copy and being determined as current newest pair This, and update the logical address of specified data copy.
In the technical scheme, when performing data write operation, after data copy write-in, whether detection data write-in Whether success, i.e. data copy verification pass through, with verification not by when, then continue to postpone to the latter data area, continue Write operation is performed, and after being written successfully, copy is written into and is determined as current fresh copy and will be next to be written Region is determined as the address in region to be written, so as to fulfill the address update read data, write data, when updating the data, only needs Latest copy is written, just the sector of legacy data is stored in erasing only when specified Flash storage regions all write full, is greatly reduced The erasing times of Flash effectively extend the service life of Flash.
Specifically, the verification operation of data copy can be realized by increasing check code behind data, can also be passed through Hash calculation is realized.
The technical solution of the third aspect of the present invention provides a kind of home appliance, including memory, processor and storage On a memory and the computer program that can run on a processor, processor realize the present invention first when performing computer program The step of data access method for any one that the technical solution of aspect proposes or the technical solution including second aspect of the present invention The data access device of any one of proposition.
The technical solution of the fourth aspect of the present invention provides a kind of computer readable storage medium, is stored thereon with calculating Machine program realizes that the data of any one that first aspect present invention technical solution proposes are deposited when computer program is executed by processor Take method.
The additional aspect and advantage of the present invention will provide in following description section, will partly become from the following description It obtains significantly or is recognized by the practice of the present invention.
Description of the drawings
The above-mentioned and/or additional aspect and advantage of the present invention will become in the description from combination accompanying drawings below to embodiment Significantly and it is readily appreciated that, wherein:
Fig. 1 shows the schematic flow diagram of data access method according to an embodiment of the invention;
Fig. 2 shows the schematic block diagrams of data access device according to an embodiment of the invention;
Fig. 3 shows the schematic diagram of data mapping according to an embodiment of the invention;
Fig. 4 shows the schematic flow diagram of data access method according to another embodiment of the invention;
Fig. 5 shows the schematic flow diagram of data access method according to still a further embodiment;
Fig. 6 shows the schematic block diagram of microcontroller chip according to an embodiment of the invention.
Specific embodiment
It is to better understand the objects, features and advantages of the present invention, below in conjunction with the accompanying drawings and specific real Mode is applied the present invention is further described in detail.It should be noted that in the absence of conflict, the implementation of the application Feature in example and embodiment can be combined with each other.
Many details are elaborated in the following description to facilitate a thorough understanding of the present invention, still, the present invention may be used also To be implemented using other different from other modes described here, therefore, protection scope of the present invention is not by described below Specific embodiment limitation.
Embodiment 1
Fig. 1 shows the schematic flow diagram of data access method according to an embodiment of the invention.
As shown in Figure 1, data access method according to an embodiment of the invention, including:Step 102, in microcontroller When chip performs power-on initialization operation, the logical address of the specified data copy in RAM memory is read, with according to preset Mapping relations determine that logical address corresponds to the physical address in flash storage;Step 104, depositing for physical address direction is determined Storage area domain, to determine that storage region middle finger determines the reading address of the current fresh copy of data copy and/or specified data copy The write address of copy to be written;Step 106, it is incited somebody to action according to the current fresh copy read in address reading Flash or according to write address In copy write-in Flash to be written.
In this embodiment, by the way that in power-up initializing, address of cache is carried out to the logical address in RAM memory, To determine corresponding physical address, to search corresponding storage region in Flash according to physical address, and then storage region is determined In data copy read address and data copy write address, with according to read address reading data copy or according to write address again Updated data are written, on the one hand, only need to store logical address in RAM, with the data for determining to be directed toward according to logical address The reading address of copy and write address do not need to carry out the interim backup of storage data, save the resource of RAM memory so as to It is in short supply to be enough widely used in memory source, it has not been convenient on the air-conditioning equipment for dividing a large amount of memory source record Flash memory states Microcontroller (microcontroller chip) on.
Embodiment 2
As shown in figure 3, in order to correctly access storage unit when ensureing CPU execute instructions, it need to be by patrolling in user program It collects and address of cache is known as by the physical address of machine direct addressin, this process when address conversion is operation, accordingly, The address of specified range on Flash is all mapped as a particular address data as logical address, the memory block of specified range There can be multiple sectors in domain, multiple copies of specified data are stored in multiple sectors (version 1 to version m), by true The reading address of settled preceding fresh copy and/or the write address of copy to be written perform reading and write operation with corresponding.
Wherein, address of cache least unit can be page 1.
In the above embodiment, it is preferable that when microcontroller chip performs power-on initialization operation, RAM memory is read In specified data copy logical address before, further include:According to the length of specified data by each sector in storage region It is divided into multiple data areas;According to the write time, specified data copy is sequentially written in the data area in each sector
In this embodiment, by the way that each sector is divided into multiple data areas, to be deposited in each data interval A data copy is stored up, there are multiple copies of same data in same time memory, realizes the abundant profit in sector storage section With, and when equipment powers on every time can find a available data, even if equipment is during erasable operation critical data Unexpected power down, after restarting still can normal operation, effectively improve equipment robustness.
Wherein, specified data can be running configuration data.
Specifically, a storage region can be page 1, and page 1 can have multiple data fields by multiple sectors, each sector Domain, i.e. a sector can store multiple data copies, in each sector, the storage of data copy according to storage time from Stored after going to, i.e., accessing zone more before, the version for storing data is lower.
In any of the above-described embodiment, it is preferable that determine that storage region middle finger determines the current fresh copy of data copy The write address of the copy to be written of address and/or specified data copy is read, specifically includes following steps:According to storage region Initial address is scanned multiple data areas sequence, to determine first specific area of data, has in specific area of data There is the specified data copy that can be verified and pass through;From first specific area of data, detect whether to have and multiple continuously deposit Store up the data area of data;When detecting with multiple continuous data areas, last position specific area of data is determined, it will The address of last position specific area of data is determined as the reading address of current fresh copy;After detecting last position specific area of data Whether there is writable data area;When detecting with writable data area, writable number that first is scanned It is determined as the write address of copy to be written according to the address in region.
In this embodiment, by performing the scan operation of storage region according to the initial address of storage region, initially Location corresponds to first data area of first sector, data copy usually can be all stored, in the unspoiled feelings of the data copy Under condition, data copy can be by verification, i.e. first data area is first data area, logical containing verification from first The region for the data crossed starts, and whether in (no matter verifying and pass through) in continuous multiple regions containing data, the last one passes through The data of verification can then be determined as current fresh copy, after current fresh copy, continue sequential scan, the scanned Data area of one region that data can be written for the copy to be written of more new version, so as to be written in new edition notebook data Cheng Zhong no longer directly covers legacy data for write operation, but the new version of data is written in region.
Embodiment 3
Specifically, the scan operation of storage region is performed according to the initial address of storage region, is initially storing shape completely Under state, the data of the first sector storage are the data of oldest version, and the specified data of completely multiple versions have been write in storage region When, then the data of the first sector storage are wiped first, the data of more new version to be written in the first sector, the first sector at this time Versions of data is relatively higher, as shown in table 1, in scan operation, it is only necessary to operation is scanned to the first sector, to determine fan Address is read in the address in the region 5 of area A for current fresh copy, and the region 6 of sector A is copy write address to be written.
Table 1
Embodiment 4
Fig. 4, which shows to know clearly, reads the specifically determining step of address and write address.
As shown in figure 4, method for reading data according to another embodiment of the invention, including:Step 402, it determines to deposit The initial address in storage area domain;Step 404, scan operation is performed to the data area in storage region;Step 406, first is determined There are data copy, and the effective data area of data copy;Step 408, determine whether to have from the data area multiple The continuous data area for being stored with data when testing result is "Yes", enters step 410, when testing result is "No", Return to step 404;Step 410, the last one data copy is verified that effective data area is determined as the region of digital independent; Step 412, next region of the data area is determined as to the region of data write-in.
In any of the above-described embodiment, it is preferable that further include:When detecting without writable data area, will write Specified data copy erasing in the earliest sector of the angle of incidence;By data area most preceding in the sector of erasing, it is determined as to be written Enter the write address of copy.
In this embodiment, when detecting without writable area, i.e., all data areas are equal after a write operation When being fully written, then need first to wipe the sector for preserving oldest edition data, with the write-in vacating space for newer version, with Access plan of the prior art is compared, and does not need to frequently perform erasing operation, so as to be conducive to prolonging for Flash service lifes It is long.
Specifically, sector in front then needs the weight since initial address because read-write region is write when expiring and being wiped free of New write-in at this point, the data area of copy to be written is between new edition notebook data and legacy data, and can be used as interval Region distinguishes the data of new version and the data of legacy version.
In any of the above-described embodiment, it is preferable that be written into copy write-in Flash, specifically included according to write address Following steps:After being written into copy write-in Flash, whether verification, which detects copy to be written and verify, passes through;It is detecting Copy to be written verification not by when, determine next writable data area, pass through until being verified after copy to be written write-in; When detecting that copy verification to be written passes through, it is written into copy and is determined as current fresh copy, and update specified data pair This logical address.
In this embodiment, when performing data write operation, data copy write-in after, detection data write-in whether into Work(, i.e. data copy verification whether passes through, with verification not by when, then continue to postpone to the latter data area, continue to hold Row write operation, and after being written successfully is written into copy and is determined as current fresh copy and by next area to be written Domain is determined as the address in region to be written, so as to fulfill the address update read data, write data, when updating the data, it is only necessary to Latest copy is written, just the sector of legacy data is stored in erasing only when specified Flash storage regions all write full, is greatly reduced The erasing times of Flash effectively extend the service life of Flash.
Specifically, the verification operation of data copy can be realized by increasing check code behind data, can also be passed through Hash calculation is realized.
Embodiment 5
Attached drawing 5 shows the detailed process of new data copy write-in.
As shown in figure 5, method for reading data according to still a further embodiment, including:Step 502, it is being written It before newest data copy, detects after data copy write-in, it is full whether all data areas are all write, and is tied in detection When fruit is "Yes", 504 are entered step, when testing result is "No", enters step 506;Step 504, data are written into write Enter corresponding data interval, and enter step 508;Step 506, sector of the erasing with oldest data copy, and enter step 508;Step 508, data to be written are read, to carry out data check;Step 510, whether detection check passes through, in testing result During for "Yes", 512 are entered step, when testing result is "No", enters step 514;Step 512, update is read data and is used Region and the region that uses of write-in data;Step 514, it postpones to next data area, and return to step 502;Step 516, next region of the data area is determined as to the region of data write-in.
Fig. 2 shows the schematic block diagrams of data access device according to an embodiment of the invention.
As shown in Fig. 2, data access device 20 according to an embodiment of the invention, including:Reading unit 202, for When microcontroller chip performs power-on initialization operation, the logical address of the specified data copy in RAM memory is read, with basis Preset mapping relations determine that logical address corresponds to the physical address in flash storage;Determination unit 204, for determining object Manage address be directed toward storage region, with determine storage region middle finger determine data copy current fresh copy reading address and/or The write address of the copy to be written of specified data copy;Read-write cell 206, for current in address reading Flash according to reading Fresh copy is written into according to write address in copy write-in Flash.
In this embodiment, by the way that in power-up initializing, address of cache is carried out to the logical address in RAM memory, To determine corresponding physical address, to search corresponding storage region in Flash according to physical address, and then storage region is determined In data copy read address and data copy write address, with according to read address reading data copy or according to write address again Updated data are written, on the one hand, only need to store logical address in RAM, with the data for determining to be directed toward according to logical address The reading address of copy and write address do not need to carry out the interim backup of storage data, save the resource of RAM memory so as to It is in short supply to be enough widely used in memory source, it has not been convenient on the air-conditioning equipment for dividing a large amount of memory source record Flash memory states Microcontroller (microcontroller chip) on.
Specifically, the address of the specified range on Flash is all mapped as a particular address data, as logically Location, can have multiple sectors in specified range, and multiple copies of specified data are stored in multiple sectors, current by determining The reading address of fresh copy and/or the write address of copy to be written perform reading and write operation with corresponding.
Wherein, address of cache least unit can be page 1.
In the above embodiment, it is preferable that it further includes:Division unit 208 will store for the length according to specified data Each sector in region is divided into multiple data areas;Writing unit 210, for according to the write time, by specified data pair Originally it is sequentially written in the data area in each sector
In this embodiment, by the way that each sector is divided into multiple data areas, to be deposited in each data interval A data copy is stored up, there are multiple copies of same data in same time memory, realizes the abundant profit in sector storage section With, and when equipment powers on every time can find a available data, even if equipment is during erasable operation critical data Unexpected power down, after restarting still can normal operation, effectively improve equipment robustness.
Wherein, specified data can be running configuration data.
Specifically, a storage region can be page 1, and page 1 can have multiple data fields by multiple sectors, each sector Domain, i.e. a sector can store multiple data copies, in each sector, the storage of data copy according to storage time from Stored after going to, i.e., accessing zone more before, the version for storing data is lower.
In any of the above-described embodiment, it is preferable that further include:Scanning element 212, for according to storage region initially Location is scanned multiple data areas sequence, and to determine first specific area of data, having in specific area of data can Verify the specified data copy passed through;Detection unit 214 is more for from first specific area of data, detecting whether to have The data area of a continuous storage data;Determination unit 204 is additionally operable to:It is detecting with multiple continuous data areas When, it determines last position specific area of data, the address of last position specific area of data is determined as to the reading of current fresh copy Address;Detection unit 214 is additionally operable to:Detect whether last position specific area of data has writable data area later;It determines Unit 204 is additionally operable to:When detecting with writable data area, the ground of writable data area that first is scanned Location is determined as the write address of copy to be written.
In this embodiment, by performing the scan operation of storage region according to the initial address of storage region, initially Location corresponds to first data area of first sector, data copy usually can be all stored, in the unspoiled feelings of the data copy Under condition, data copy can be by verification, i.e. first data area is first data area, logical containing verification from first The region for the data crossed starts, and whether in (no matter verifying and pass through) in continuous multiple regions containing data, the last one passes through The data of verification can then be determined as current fresh copy, after current fresh copy, continue sequential scan, the scanned Data area of one region that data can be written for the copy to be written of more new version, so as to be written in new edition notebook data Cheng Zhong no longer directly covers legacy data for write operation, but the new version of data is written in region.
Specifically, the scan operation of storage region is performed according to the initial address of storage region, is initially storing shape completely Under state, the data of the first sector storage are the data of oldest version, and the specified data of completely multiple versions have been write in storage region When, then the data of the first sector storage are wiped first, the data of more new version to be written in the first sector, the first sector at this time Versions of data is relatively higher, in scan operation, it is only necessary to operation is scanned to the first sector, to determine to read address and write ground Location.
In any of the above-described embodiment, it is preferable that further include:Unit 216 is wiped, for detecting without writable During data area, the specified data copy erasing in the sector earliest by the write time;Determination unit 204 is additionally operable to:It will erasing Sector in most preceding data area, be determined as the write address of copy to be written.
In this embodiment, when detecting without writable area, i.e., all data areas are equal after a write operation When being fully written, then need first to wipe the sector for preserving oldest edition data, with the write-in vacating space for newer version, with Access plan of the prior art is compared, and does not need to frequently perform erasing operation, so as to be conducive to prolonging for Flash service lifes It is long.
Specifically, sector in front then needs the weight since initial address because read-write region is write when expiring and being wiped free of New write-in at this point, the data area of copy to be written is between new edition notebook data and legacy data, and can be used as interval Region distinguishes the data of new version and the data of legacy version.
In any of the above-described embodiment, it is preferable that further include:Verification unit 218, for being written into copy write-in After in Flash, whether verification, which detects copy to be written and verify, passes through;Determination unit 204 is additionally operable to:Detecting copy to be written Verification not by when, next writable data area is determined, until verifying and passing through after copy to be written write-in;Data access fills 20 are put to further include:Updating unit 220, for when detecting that copy verification to be written passes through, being written into copy and being determined as working as Preceding fresh copy, and update the logical address of specified data copy.
In this embodiment, when performing data write operation, data copy write-in after, detection data write-in whether into Work(, i.e. data copy verification whether passes through, with verification not by when, then continue to postpone to the latter data area, continue to hold Row write operation, and after being written successfully is written into copy and is determined as current fresh copy and by next area to be written Domain is determined as the address in region to be written, so as to fulfill the address update read data, write data, when updating the data, it is only necessary to Latest copy is written, just the sector of legacy data is stored in erasing only when specified Flash storage regions all write full, is greatly reduced The erasing times of Flash effectively extend the service life of Flash.
Specifically, the verification operation of data copy can be realized by increasing check code behind data, can also be passed through Hash calculation is realized.
Embodiment 6
As shown in fig. 6, a home appliance 60 according to the present invention, including memory 602, processor 604 and is stored in On memory 602 and the computer program that can run on a processor, processor 604 realize the present invention when performing computer program Any of the above-described embodiment propose any one data access method the step of.
Embodiment 7
Computer readable storage medium according to an embodiment of the invention is stored thereon with computer program, calculates The step of the data access method of any one that any of the above-described embodiment of the present invention proposes is realized when machine program is executed by processor Suddenly.
Be described in detail technical scheme of the present invention above in association with attached drawing, the present invention propose a kind of data access method, Data access device, home appliance and computer readable storage medium, by power-up initializing, in RAM memory Logical address carries out address of cache, to determine corresponding physical address, to search corresponding storage in Flash according to physical address Region, and then determine that the data copy in storage region reads address and data copy write address, with according to reading address reading data Copy re-writes updated data according to write address, on the one hand, only needs to store logical address in RAM, be patrolled with basis Reading address and write address that address determines the data copy being directed toward are collected, does not need to carry out the interim backup of storage data, saves The resource of RAM memory is in short supply so as to be widely used in memory source, it has not been convenient to divide a large amount of memory source record Flash On microcontroller (microcontroller chip) on the air-conditioning equipment of memory state.
Step in the method for the present invention can be sequentially adjusted, combined, and deleted according to actual needs.
Unit in apparatus of the present invention can be combined, divided, and deleted according to actual needs.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can It is completed with instructing relevant hardware by program, which can be stored in a computer readable storage medium, storage Medium include read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), programmable read only memory (Programmable Read-only Memory, PROM), erasable programmable is read-only deposits Reservoir (Erasable Programmable Read Only Memory, EPROM), disposable programmable read-only memory (One- Time Programmable Read-Only Memory, OTPROM), the electronics formula of erasing can make carbon copies read-only memory (Electrically-Erasable Programmable Read-Only Memory, EEPROM), CD-ROM (Compact Disc Read-Only Memory, CD-ROM) or other disk storages, magnetic disk storage, magnetic tape storage or can For carrying or storing any other computer-readable medium of data.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, that is made any repaiies Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.

Claims (12)

1. a kind of data access method, suitable for microcontroller chip, the microcontroller chip includes RAM memory, described also to connect It is connected to flash storage, which is characterized in that the data access method includes:
When the microcontroller chip performs power-on initialization operation, specified data copy in the RAM memory is read Logical address, according to preset mapping relations, to determine that the logical address is corresponded in the flash storage physically Location;
The storage region that the physical address is directed toward is determined, to determine to specify the current of data copy described in the storage region The write address of the copy to be written of the reading address of fresh copy and/or the specified data copy;
It is treated according to the current fresh copy read in the address reading Flash or according to the write address by described Copy is written to be written in the Flash.
2. data access method according to claim 1, which is characterized in that described to be powered in microcontroller chip execution During initialization operation, before the logical address for reading specified data copy in the RAM memory, further include:
Each sector in the storage region is divided by multiple data areas according to the length of specified data;
According to the write time, the specified data copy is sequentially written in the data area in each sector.
3. data access method according to claim 2, which is characterized in that described to determine the storage region middle finger fixed number It is specific to wrap according to the write address of the copy to be written of the reading address and/or specified data copy of the current fresh copy of copy Include following steps:
According to the initial address of the storage region, multiple data areas sequence is scanned, to determine first certain number There is the specified data copy that can be verified and pass through according to region, in the specific area of data;
From first specific area of data, detect whether that there is the data area of multiple continuous storage data;
When detecting with multiple continuous data areas, last position specific area of data is determined, it will be described last The address of position specific area of data is determined as the reading address of the current fresh copy;
Detect whether the last position specific area of data has writable data area later;
When detecting with the writable data area, the address of the writable data area that first is scanned It is determined as the write address of the copy to be written.
4. data access method according to claim 3, which is characterized in that further include:
When detecting without the writable data area, the specified data pair in the sector earliest by the write time This erasing;
By the data area most preceding in the sector of erasing, it is determined as the write address of the copy to be written.
5. data access method according to claim 3 or 4, which is characterized in that described according to inciting somebody to action the write address Copy to be written is written in the Flash, specifically includes following steps:
After the copy to be written is written in the Flash, whether verification, which detects the copy to be written and verify, passes through;
Detect the copy to be written verification not by when, next writable data area is determined, until described It verifies and passes through after copy write-in to be written;
When detecting that the copy verification to be written passes through, the copy to be written is determined as the current fresh copy, And update the logical address of the specified data copy.
6. a kind of data access device, suitable for microcontroller chip, the microcontroller chip is deposited including RAM memory with Flash Reservoir, which is characterized in that the data access device includes:
Reading unit, for when the microcontroller chip performs power-on initialization operation, reading the finger in the RAM memory The logical address of data copy is determined, according to preset mapping relations, to determine that the logical address corresponds to the flash storage In physical address;
Determination unit, for determining the storage region of the physical address direction, to determine to specify described in the storage region The write address of the copy to be written of the reading address of the current fresh copy of data copy and/or the specified data copy;
Read-write cell is write for the current fresh copy in the reading address reading Flash or according to described The copy to be written is written in the Flash for address.
7. data access device according to claim 6, which is characterized in that further include:
Division unit, for each sector in the storage region to be divided into multiple data fields according to the length of specified data Domain;
Writing unit, for according to the write time, the specified data copy is sequentially written in each sector described in In data area.
8. data access device according to claim 7, which is characterized in that further include:
Scanning element for the initial address according to the storage region, is scanned multiple data areas sequence, to determine First specific area of data has the specified data copy that can be verified and pass through in the specific area of data;
Detection unit, for from first specific area of data, detecting whether that there are multiple continuous storage data Data area;
The determination unit is additionally operable to:When detecting with multiple continuous data areas, last position certain number is determined According to region, the address of the last position specific area of data is determined as to the reading address of the current fresh copy;
The detection unit is additionally operable to:Detect whether the last position specific area of data has writable data area later;
The determination unit is additionally operable to:When detecting with the writable data area, by first scan described in The address of writable data area is determined as the write address of the copy to be written.
9. data access device according to claim 8, which is characterized in that further include:
Unit is wiped, for when detecting without the writable data area, in the sector earliest by the write time The specified data copy erasing;
The determination unit is additionally operable to:By the data area most preceding in the sector of erasing, it is determined as described to be written The write address of copy.
10. data access device according to claim 8 or claim 9, which is characterized in that further include:
Verification unit, for after the copy to be written is written in the Flash, verification, which detects the copy to be written, to be No verification passes through;
The determination unit is additionally operable to:Detect the copy to be written verification not by when, determine next described writeable Enter data area, pass through until being verified after the copy write-in to be written;
The data access device further includes:
Updating unit, for when detecting that the copy verification to be written passes through, the copy to be written being determined as described Current fresh copy, and update the logical address of the specified data copy.
11. a kind of home appliance, which is characterized in that the home appliance includes processor, and the processor is used to perform storage The step of data access method as described in any one of claim 1 to 5 is realized during the computer program stored in device.
12. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of data access method as described in any one of claim 1 to 5 is realized when being executed by processor.
CN201810071353.9A 2018-01-25 2018-01-25 Data access method, access device, home appliance and readable storage medium storing program for executing Pending CN108255436A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810071353.9A CN108255436A (en) 2018-01-25 2018-01-25 Data access method, access device, home appliance and readable storage medium storing program for executing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810071353.9A CN108255436A (en) 2018-01-25 2018-01-25 Data access method, access device, home appliance and readable storage medium storing program for executing

Publications (1)

Publication Number Publication Date
CN108255436A true CN108255436A (en) 2018-07-06

Family

ID=62742663

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810071353.9A Pending CN108255436A (en) 2018-01-25 2018-01-25 Data access method, access device, home appliance and readable storage medium storing program for executing

Country Status (1)

Country Link
CN (1) CN108255436A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189493A (en) * 2018-07-23 2019-01-11 广州视源电子科技股份有限公司 Application configuration method and apparatus, equipment, computer readable storage medium
WO2020062931A1 (en) * 2018-09-28 2020-04-02 华为技术有限公司 Method for configuring data, and computing device
CN111258498A (en) * 2019-12-06 2020-06-09 浙江零跑科技有限公司 FLASH memory management method
CN112596808A (en) * 2020-12-16 2021-04-02 微网智控(北京)科技有限公司 Parameter storage mechanism of embedded system
CN114281239A (en) * 2020-09-28 2022-04-05 华为云计算技术有限公司 Mirror image file writing method and device
CN116719581A (en) * 2023-07-11 2023-09-08 沐曦集成电路(上海)有限公司 Chip multi-instance module initializing system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127004A (en) * 2007-09-24 2008-02-20 中兴通讯股份有限公司 System and method for accessing data on flash memory
CN102043721A (en) * 2010-05-12 2011-05-04 中颖电子股份有限公司 Memory management method for flash memory
CN102063379A (en) * 2010-12-28 2011-05-18 天津市亚安科技电子有限公司 Data storage method of FLASH memory
CN103198019A (en) * 2011-10-24 2013-07-10 三星电子株式会社 File system and control method thereof
CN104750619A (en) * 2013-12-26 2015-07-01 慧荣科技股份有限公司 Data storage device and flash memory control method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127004A (en) * 2007-09-24 2008-02-20 中兴通讯股份有限公司 System and method for accessing data on flash memory
CN102043721A (en) * 2010-05-12 2011-05-04 中颖电子股份有限公司 Memory management method for flash memory
CN102063379A (en) * 2010-12-28 2011-05-18 天津市亚安科技电子有限公司 Data storage method of FLASH memory
CN103198019A (en) * 2011-10-24 2013-07-10 三星电子株式会社 File system and control method thereof
CN104750619A (en) * 2013-12-26 2015-07-01 慧荣科技股份有限公司 Data storage device and flash memory control method

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189493A (en) * 2018-07-23 2019-01-11 广州视源电子科技股份有限公司 Application configuration method and apparatus, equipment, computer readable storage medium
WO2020062931A1 (en) * 2018-09-28 2020-04-02 华为技术有限公司 Method for configuring data, and computing device
CN111258498A (en) * 2019-12-06 2020-06-09 浙江零跑科技有限公司 FLASH memory management method
CN111258498B (en) * 2019-12-06 2023-08-22 浙江零跑科技股份有限公司 FLASH memory management method
CN114281239A (en) * 2020-09-28 2022-04-05 华为云计算技术有限公司 Mirror image file writing method and device
CN112596808A (en) * 2020-12-16 2021-04-02 微网智控(北京)科技有限公司 Parameter storage mechanism of embedded system
CN116719581A (en) * 2023-07-11 2023-09-08 沐曦集成电路(上海)有限公司 Chip multi-instance module initializing system
CN116719581B (en) * 2023-07-11 2024-02-02 沐曦集成电路(上海)有限公司 Chip multi-instance module initializing system

Similar Documents

Publication Publication Date Title
CN108255436A (en) Data access method, access device, home appliance and readable storage medium storing program for executing
JP5696118B2 (en) Weave sequence counter for non-volatile memory systems
US8135901B2 (en) Solid state memory (SSM), computer system including an SSM, and method of operating an SSM
US6970890B1 (en) Method and apparatus for data recovery
US10909030B2 (en) Enhanced trim command support for solid state drives
TWI297893B (en) Method and apparatus for managing an erase count block
US8239618B2 (en) System and method for emulating preconditioning of solid-state device
JP4371771B2 (en) Power management block used in non-volatile memory system
KR101900760B1 (en) Handling unclean shutdowns for a system having non-volatile memory
US8122193B2 (en) Storage device and user device including the same
CN111752487B (en) Data recovery method and device and solid state disk
US8370602B2 (en) Method for memory space management
US20050108491A1 (en) Method for testing flash memory power loss recovery
US20100023675A1 (en) Wear leveling method, and storage system and controller using the same
US20100169556A1 (en) Nonvolatile storage device, information recording system, and information recording method
WO2008026466A1 (en) File system
JPH06274409A (en) Batch erasure-type nonvolatile memory
GB2256735A (en) Non-volatile disk cache.
US9798673B2 (en) Paging enablement of storage translation metadata
US11747979B2 (en) Electronic device, computer system, and control method
US20090172269A1 (en) Nonvolatile memory device and associated data merge method
US20170017405A1 (en) Systems and methods for improving flash-oriented file system garbage collection
CN115269451B (en) Flash memory garbage collection method, device and readable storage medium
US20170017406A1 (en) Systems and methods for improving flash-oriented file system garbage collection
CN115373608A (en) Data storage method and device

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20180706

RJ01 Rejection of invention patent application after publication