Firmware self-regeneration method in intelligent memory deviceTechnical field
The present invention relates to firmwares in memory to repair field.
Background technology
Firmware is a software, it is therefore an objective to manipulate intelligent memory device(Predominantly flash memory)It is various in main control chipVarious kinds function.The firmware of first loading, influences whether whole device can normal operation after power activation.Due to flash memoryAll be that can only read memory device in chip, so formal firmware can be placed in flash memory, therefore flash memory preserve data canIt is extremely important by property.But promoted with person's manufacturing process, more advanced technique, flash memory can generate the bit of mistake when operating, leadCause error in data.Flash memory as shown in Figure 1 is formed by multiple pieces, and each block is composed of multiple pages, and each page is by multiple sectorsIt is composed.It after firmware is written into Hash memory pages, is frequently read, causes the corrupted data in flash memory.
In the past in order to protect firmware, multiple firmwares can be write in flash memory, to prevent firmware data from damaging.When write-in is excessiveFirmware backup when, influence whether flash memory usage amount, and when these firmwares all damage, whole device can not start.
The content of the invention
It is an object of the invention to provide a kind of firmware self-regeneration methods in intelligent memory device, can correct mistakeFirmware makes it recover normal data by mistake.
Realizing the technical solution of above-mentioned purpose is:
Firmware is write in intelligent memory device two not by a kind of firmware self-regeneration method in intelligent memory deviceIn same block, the location information of other side is remembered mutually, when wherein side's corrupted data, utilizes the correct firmware repair data of dataThe firmware of mistake.
Preferably, including:
Step S1 is searched and is checked first part of firmware, and error in data or while not searching enter step S2, enter when data are correctStep S3;
Step S2 is searched and is checked second part of firmware, error in data or starts failure when not searching, and step is entered when data are correctRapid S4;
Step S3 checks second part of firmware, and when error in data enters step S4, normal operation when data are correct;
Step S4 when the error in data of first part of firmware or when not searching, passes through the position of first part of firmware in second part of firmwareConfidence ceases, and the data message of second part of firmware is stored in the storage of first part of firmware by the memory block for first part of firmware of storage of erasingIn block, then normal operation;
When the error in data of second part of firmware, by the location information of second part of firmware in first part of firmware, storage of erasingThe data message of first part of firmware is stored in the memory block of second part of firmware, then normal operation by the memory block of two parts of firmwares.
Preferably, intelligent memory device is set to flash memory.
The beneficial effects of the invention are as follows:The present invention is by the way that firmware is write in two different blocks, when a wherein number formulary evidenceDamage utilizes the service life of the firmware of the correct firmware repair data mistake of data, thereby increase product.It is compared with traditional approach,It only needs to back up protection and obdurability that a small amount of firmware data may achieve firmware.
Description of the drawings
Fig. 1 is the structure chart of flash memory;
Fig. 2 is the flow chart of the firmware self-regeneration method of the present invention.
Specific embodiment
The present invention will be further described with reference to the accompanying drawings.
Firmware self-regeneration method in the intelligent memory device of the present invention, intelligent memory device is write by firmwareIn in two different blocks, remember the location information of other side mutually, when wherein side's corrupted data, utilize the correct firmware of dataThe firmware of repair data mistake.Intelligent memory device is preferably flash memory.
Specifically, referring to Fig. 2, firmware self-regeneration method comprises the following steps:
Step S1 is searched and is checked first part of firmware, and error in data or while not searching enter step S2, enter when data are correctStep S3.
Step S2 is searched and is checked second part of firmware, error in data or starts failure when not searching, when data are correct intoEnter step S4.
Step S3 checks second part of firmware, and when error in data enters step S4, normal operation when data are correct.
Step S4 when the error in data of first part of firmware or when not searching, passes through first part of firmware in second part of firmwareLocation information, the data message of second part of firmware is stored in first part of firmware by the memory block for first part of firmware of storage of erasingIn memory block, then normal operation.
When the error in data of second part of firmware, by the location information of second part of firmware in first part of firmware, erase and depositThe memory block of second part of firmware is put, the data message of first part of firmware is stored in the memory block of second part of firmware, then normallyOperation.
After reparation, next time during electric power starting, it is possible to find first part of firmware data.Utilize the method twoFirmware data self-regeneration thereby increases the service life of product.
Above example is used for illustrative purposes only rather than limitation of the present invention, the technology people in relation to technical fieldMember, without departing from the spirit and scope of the present invention, can also make various conversion or modification, therefore all equivalentTechnical solution should also belong to scope of the invention, should be limited by each claim.