Summary of the invention
The technical problem to be solved in the present invention is, drawbacks described above for prior art, memory bad block processing method and the mobile terminal of a kind of mobile terminal are provided, it is easily discriminated out bad block is on power down nonvolatile memory or power down volatile memory, bad block can be shielded in time, it is not easy that the situation that failure is opened in file storage occurs, provides users with the convenient.
It is as follows that the present invention solves the technical scheme that technical problem used:
A kind of memory bad block processing method of mobile terminal, wherein, including:
A, when some application program is opened, obtains this and applies the address in power down nonvolatile memory and size, and copies this application program and run to power down volatile memory, records this application program address in power down volatile memory and size simultaneously;
, when this application program opens failure, then there is bad block in explanation power down nonvolatile memory or power down volatile memory in B;And this application program is copied to operation in other address in power down volatile memory again, if this application is opened successfully, illustrate power down volatile memory exists bad block, if failure is opened in this application, illustrate power down nonvolatile memory exists bad block;
C, according to the conclusion of above-mentioned steps B, it is judged that the address of the bad block in power down nonvolatile memory or power down volatile memory is also recorded.
The memory bad block processing method of described mobile terminal, wherein, described power down nonvolatile memory includes that FLASH, EEPROM, described power down volatile memory include DRAM, SDRAM.
The memory bad block processing method of described mobile terminal, wherein, described step A specifically includes:
A1, when in the terminal select open one application time, mobile terminal central processing unit obtains this application place initial address FLASHAddr and size FLASHLen in FLASH;
A2, this application program is copied to from power down nonvolatile memory FLASH in power down volatile memory RAM and run, and record initial address RAMAddr and size RAMLen running this application in RAM.
The memory bad block processing method of described mobile terminal, wherein, described step B specifically includes:
If B1 application program opens failure, then it is assumed that be that the position depositing this application in FLASH has in bad block or RAM the position running the application of this use to have bad block;
This application is copied to from FLASH in the other address of RAM and runs by B2, central processing unit again;
If B3 application program is successfully opened, judge RAM exists bad block, if application program still opens failure, judge FLASH exists bad block.
The memory bad block processing method of described mobile terminal, wherein, described step C specifically includes:
If C1 detects bad block in FLASH, the most successively FLASHAddr is started the region that size is FLASHLen and all writes 0xFF operation, be then successively read, if it is not 0xFF which position reads out, illustrate that this address is bad block;
C2, the most successively FLASHAddr is started the region that size is FLASHLen all write 0x00 operation, be then successively read, if it is not 0x00 which position reads out, illustrate that this address is bad block;
C3, the address of bad block in above-mentioned electricity nonvolatile memory or power down volatile memory is recorded and preserves.
A kind of mobile terminal, wherein, including:
Memory read/write module, for when some application program is opened, obtain this and apply the address in power down nonvolatile memory and size, and copy this application program and run to power down volatile memory, record this application program address in power down volatile memory and size simultaneously;
, for opening failure when this application program, then there is bad block in explanation power down nonvolatile memory or power down volatile memory in bad block judging treatmenting module;And this application program is copied to operation in other address in power down volatile memory again, if this application is opened successfully, illustrate power down volatile memory exists bad block, if failure is opened in this application, illustrate power down nonvolatile memory exists bad block;
Bad block logging modle, for judging the address of the bad block in power down nonvolatile memory or power down volatile memory and recording.
Described mobile terminal, wherein, described power down nonvolatile memory includes that FLASH, EEPROM, described power down volatile memory include DRAM, SDRAM.
The memory bad block processing method of mobile terminal provided by the present invention and system, owing to have employed when some application program is opened, obtain this and apply the address in power down nonvolatile memory and size, then copy this application program to run to power down volatile memory, record this application program address in power down volatile memory and size simultaneously;If this application program opens failure, then there is bad block in explanation power down nonvolatile memory or power down volatile memory;The most again this application program is copied in power down volatile memory and other address is run, if this application is opened successfully, illustrate power down volatile memory exists bad block, if failure is opened in this application, illustrating to there is bad block in power down nonvolatile memory, it makes mobile terminal add New function: can distinguish bad block is on power down nonvolatile memory or power down volatile memory;Bad block can be shielded in time, it is to avoid occur that the situation of failure is opened in file storage, provide users with the convenient.
Detailed description of the invention
For making the purpose of the present invention, technical scheme and advantage clearer, clear and definite, the present invention is described in more detail for the embodiment that develops simultaneously referring to the drawings.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Refer to the flow chart of preferred embodiment that Fig. 1, Fig. 1 are the memory bad block processing methods of mobile terminal of the present invention.As it is shown in figure 1, the memory bad block processing method of described mobile terminal includes:
Step S100, when some application program is opened, obtain this and apply the address in power down nonvolatile memory and size, and copy this application program and run to power down volatile memory, record this application program address in power down volatile memory and size simultaneously.
Wherein, power down nonvolatile memory mainly includes that FLASH, EEPROM etc., power down volatile memory mainly include DRAM, SDRAM etc..
, when this application program opens failure, then there is bad block in explanation power down nonvolatile memory or power down volatile memory in step S200;And this application program is copied to operation in other address in power down volatile memory again, if this application is opened successfully, illustrate power down volatile memory exists bad block, if failure is opened in this application, illustrate power down nonvolatile memory exists bad block.
Step S300, according to the conclusion of above-mentioned steps S200, it is judged that the address of the bad block in power down nonvolatile memory or power down volatile memory is also recorded.
Visible, the present invention can judge rapidly when application program is opened unsuccessfully to cause due to the bad block in power down volatile memory, or the bad block in power down nonvolatile memory causes;And to the address of the bad block in memory and record.Utilize the present invention can find the bad block in memory early and these bad blocks are noted down, so, bad block can be shielded in time, it is to avoid occur that the situation of failure is opened in file storage, provide users with the convenient during mobile terminal routine use.
Hereinafter the method for the present invention is described in further details by the Application Example concrete by:
The memory bad block processing method of a kind of mobile terminal that this concrete Application Example is provided, as shown in Figure 2, Figure 3, Figure 4, specifically includes following steps:
Step S1, the operational order of reception user open application program, trigger mobile terminal central processing unit and obtain this application place initial address FLASHAddr and size FLASHLen in power down nonvolatile memory is such as FLASH;This application program is copied to from power down nonvolatile memory such as FLASH in power down volatile memory such as RAM and run, and record initial address RAMAddr and size RAMLen running this application program in RAM, perform step S2 afterwards.
Step S2, judge whether this application program opens failure?If this application program opens failure, then perform step S3, otherwise perform step S7.
This application is copied to from FLASH in the other address in RAM and runs by step S3, central processing unit again, performs step S4 afterwards.
Step S4, judge whether this application program is opened successfully?If this application program is opened successfully, then perform step S5, otherwise perform step S6.
There is bad block in step S5, RAM, performs step S8 afterwards.
There is bad block in step S6, FLASH, performs step S17 afterwards.
Step S7, do not deal with.
Step S8, temporary variable n, and zero setting are set, perform step S9 afterwards;
Step S9, judge that n, whether less than RAMLen (running the size of this application program in RAM), if it is performs step S10, otherwise performs step S16;
Step S10, the address RAMAddr+n of RAM is write 0xFF, perform step S11 afterwards;Wherein, RAMAddr runs the initial address of this application program in being RAM.
Step S11, from RAM, read the value in the RAMAddr+n of address, and judge whether this value is 0xFF, if it is perform step S13, otherwise perform step S12;
Step S12, record address ram RAMAddr+n are bad block, perform step S15 afterwards;
Step S13, the address RAMAddr+n of RAM300 is write 0x00, perform step S14 afterwards;
Step S14, from RAM300, read the value in the RAMAddr+n of address, and judge whether this value is 0x00, if it is perform step S15, otherwise perform step S12;
Step S15, n=n+1, perform step S9 afterwards.
Bad block in step S16, RAM records complete.
Step S17, temporary variable n, and zero setting are set, perform step S18 afterwards;
Step S18, judge that n, whether less than FLASHLen, if it is performs step S19, otherwise performs step S25;Wherein, the size that FLASHLen accounts in being this application place FLASH.
Step S19, the address FLASHAddr+n of FLASH is write 0xFF, perform step S20 afterwards;Wherein, the initial address during FLASHAddr is this application place FLASH.
Step S20, from FLASH200, read the value in the FLASHAddr+n of address, and judge whether this value is 0xFF, if it is perform step S22, otherwise perform step S21;
Step S21, record FLASH200 address FLASHAddr+n are bad block, perform step S24 afterwards;
Step S22, the address FLASHAddr+n of FLASH200 is write 0x00, perform step S23 afterwards;
Step S23, from FLASH200, read the value in the FLASHAddr+n of address, and judge whether this value is 0x00, if it is perform step S24, otherwise perform step S21;
Step S24, n=n+1, perform step S9 afterwards;
Bad block in step S25, FLASH records complete.
Therefore, the above embodiment of the present invention provides the memory bad block processing method of a kind of mobile terminal, it is easily discriminated out bad block is on power down nonvolatile memory or power down volatile memory, bad block can be shielded in time, it is not easy that the situation that failure is opened in file storage occurs, provides users with the convenient.
Based on above-described embodiment, present invention also offers a kind of mobile terminal, as it is shown in figure 5, mobile terminal described in the present embodiment includes central processing unit 100, FLASH 200, RAM 300, central processing unit 100 is connected with FLASH 200 and RAM 300 respectively.
Central processing unit 100 includes memory read/write module 110, bad block judging treatmenting module 111, bad block logging modle 120;
Memory read/write module 110, Bai Cheng is when some application program is opened, obtain this and apply the address in power down nonvolatile memory and size, and copy this application program and run to power down volatile memory, record this application program address in power down volatile memory and size simultaneously;Specifically as described in above-mentioned steps.
, for opening failure when this application program, then there is bad block in explanation power down nonvolatile memory or power down volatile memory in bad block judging treatmenting module 111;And this application program is copied to operation in other address in power down volatile memory again, if this application is opened successfully, illustrate power down volatile memory exists bad block, if failure is opened in this application, illustrate power down nonvolatile memory exists bad block;Specifically as described in above-mentioned steps.
Bad block logging modle 120, for judging the address of the bad block in power down nonvolatile memory or power down volatile memory and recording;Specifically as described in above-mentioned steps.
In the mobile terminal of the present embodiment, when user selects to open an application in the terminal, mobile terminal central processing unit 100 obtains this application place initial address FLASHAddr and size FLASHLen in FLASH 200, this application program is copied to power down volatile memory such as RAM 300 from power down nonvolatile memory such as FLASH 200 and runs, and record initial address RAMAddr and size RAMLen running this application in RAM300.If application program opens failure, it may be possible to there is bad block the position that depositing the position of this application in FLASH200 has bad block or be likely to be in RAM 300 to run the application of this use.This application is copied to from FLASH 200 in the other address of RAM300 and runs by central processing unit 100 again, if application program is successfully opened, there is bad block in RAM300, if application program still opens failure, there is bad block in FLASH200.
Then, the detection of bad block record are completed, specific as follows:
If above procedure detects in FLASH200 have bad block, the most successively FLASHAddr is started the region that size is FLASHLen and all writes 0xFF operation, be then successively read, if it is not 0xFF which position reads out, illustrate that this address is bad block;The most successively FLASHAddr is started the region that size is FLASHLen and all writes 0x00 operation, be then successively read, if it is not 0x00 which position reads out, illustrate that this address is bad block;To the bad block record in the FLASH200 being detected above in bad block logging modle 120.Can also, FLASHAddr starts each address in the region that size is FLASHLen successively write 0xFF and read again, write 0x00 and read again, if twice reading is respectively 0xFF, 0x00 then this address is not bad block, and otherwise this address is bad block and records in block bad logging modle 120.
If above procedure detects in RAM300 have bad block, the most successively RAMAddr is started the region that size is RAMLen and all writes 0xFF operation, be then successively read, if it is not 0xFF which position reads out, illustrate that this address is bad block;The most successively RAMAddr is started the region that size is RAMLen and all writes 0x00 operation, be then successively read, if it is not 0x00 which position reads out, illustrate that this address is bad block;To the bad block record in the RAM300 being detected above in bad block logging modle 120.Can also, RAMAddr starts each address in the region that size is RAMLen successively write 0xFF and read again, write 0x00 and read again, if twice reading is respectively 0xFF, 0x00 then this address is not bad block, and otherwise this address is bad block and records in block bad logging modle 120.
In sum, the memory bad block processing method of mobile terminal provided by the present invention and system, owing to have employed when some application program is opened, obtain this and apply the address in power down nonvolatile memory and size, then copy this application program to run to power down volatile memory, record this application program address in power down volatile memory and size simultaneously;If this application program opens failure, then there is bad block in explanation power down nonvolatile memory or power down volatile memory;The most again this application program is copied in power down volatile memory and other address is run, if this application is opened successfully, illustrate power down volatile memory exists bad block, if failure is opened in this application, illustrating to there is bad block in power down nonvolatile memory, it makes mobile terminal add New function: can distinguish bad block is on power down nonvolatile memory or power down volatile memory;Bad block can be shielded in time, it is to avoid occur that the situation of failure is opened in file storage, provide users with the convenient.
It should be appreciated that the application of the present invention is not limited to above-mentioned citing, for those of ordinary skills, can be improved according to the above description or convert, all these modifications and variations all should belong to the protection domain of claims of the present invention.