[go: up one dir, main page]

WO2018040804A1 - Memory block processing method and device, and computer storage medium - Google Patents

Memory block processing method and device, and computer storage medium Download PDF

Info

Publication number
WO2018040804A1
WO2018040804A1 PCT/CN2017/094295 CN2017094295W WO2018040804A1 WO 2018040804 A1 WO2018040804 A1 WO 2018040804A1 CN 2017094295 W CN2017094295 W CN 2017094295W WO 2018040804 A1 WO2018040804 A1 WO 2018040804A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
bad block
block
information
bad
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.)
Ceased
Application number
PCT/CN2017/094295
Other languages
French (fr)
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.)
Sanechips Technology Co Ltd
Original Assignee
Sanechips Technology 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 Sanechips Technology Co Ltd filed Critical Sanechips Technology Co Ltd
Publication of WO2018040804A1 publication Critical patent/WO2018040804A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/0614Improving the reliability of storage systems
    • G06F3/0617Improving the reliability of storage systems in relation to availability
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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]

Definitions

  • the present invention relates to the field of integrated circuit memory, and in particular, to a memory block processing method, apparatus, and computer storage medium.
  • Non-volatile memory such as flash memory
  • the read and write operations are generally based on one address or one block.
  • the erase operation is generally based on one block, that is, the minimum range of erasure is a block, usually Erasing a block at a time erases multiple addresses; thus, when a memory address of a memory has a problem, the common method is to label the block where the address is located, and the bad block management is based on this.
  • An address of the memory may have an unrecoverable read/write error, that is, a bad block; the bad block may be generated during the production process or may be generated during use; if no bad block is generated, if no processing is performed, Then, it will inevitably lead to errors in data and programs; if the chip that has the problem is scrapped, it is very wasteful; therefore, the bad block management function can be used to solve this problem.
  • one of the current processing methods is to reserve one or two redundant blocks in the memory for the bad blocks generated in the production process, and find them during the wafer test (CP, Circuit Probing). Bad blocks that exist in memory, and then will generate block maps of bad blocks when used Into the redundant block.
  • the drawback of this method is that it can only deal with the bad blocks generated in the production process, and can not deal with the bad blocks generated in the use; because the bad blocks are usually tested by the manufacturer, and the test finds bad.
  • the number of blocks cannot be greater than the specified value. For example, if the redundancy block is 2, the number of bad blocks in the chip cannot be greater than 2. If it is larger than the specified value, the chip can only be invalidated.
  • Another processing method is to divide the memory address into two segments, a normal data region, and a segment is the status bit region of the memory.
  • the status bit region is used to store bad block information of the memory, error checking and correction (ECC, Error Correcting Code) information, etc.
  • ECC Error Correcting Code
  • This method uses the comparison of some memory status bits to determine if the current block is a bad block.
  • this method requires that all bad block status information must be read out before erasing the block, otherwise the status information will be erased together with the data area; and if the user has a misoperation, the bad block information will be It no longer exists; therefore, this method has a problem of complicated operation.
  • the embodiments of the present invention are expected to provide a memory block processing method, apparatus, and computer storage medium, which can conveniently perform bad block management during production and use, and improve block management efficiency.
  • An embodiment of the present invention provides a memory block processing method, which divides a storage area of a memory into a data area and a non-volatile storage area.
  • the method further includes:
  • the method further comprises storing the available space size of the memory to the non-volatile storage area.
  • the determining a bad block in the memory comprises: writing preset information into a data area of the memory, reading information in the data area, and reading the read information with the preset The information is compared, and the block corresponding to the address corresponding to the matching result is determined as a bad block; and/or,
  • the information of the data area in the memory is read, and the block of the information corresponding to the information that does not match the preset initial information in the information of the data area is determined as a bad block.
  • the method further comprises mapping the bad block address to a specified location in the memory.
  • mapping the bad block address to the specified location in the memory comprises: mapping the bad block in order from the tail of the data region of the memory.
  • An embodiment of the present invention further provides a memory block processing apparatus, where the apparatus includes: a partitioning module, a block information determining module, and a bad block confirming module;
  • the dividing module is configured to divide a storage area of the memory into a data area and a non-volatile storage area;
  • the block information determining module is configured to determine a bad block in the memory, obtain information corresponding to the bad block, and store the bad block information in the non-volatile storage area;
  • the bad block confirmation module is configured to determine a bad block in the memory according to the bad block information stored in the non-volatile storage area, and block access of the bad block during use of the memory .
  • the block information determining module is further configured to use the memory The size of the space is stored to the non-volatile storage area.
  • the block information determining module is configured to: write preset information into the data area, read information in the data area, and compare the read information with the preset information. , the block corresponding to the address corresponding to the information matching the result is determined as a bad block; and/or,
  • the information of the data area is read, and the block of the information corresponding to the information that does not match the preset initial information in the information of the data area is determined as a bad block.
  • the bad block confirmation module is further configured to: map the bad block address to a specified location.
  • the bad block confirmation module is configured to map the bad blocks in order from the tail of the data area of the memory.
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the memory block processing method according to the embodiment of the invention.
  • the memory block processing method and apparatus and the computer storage medium provided by the embodiments of the present invention divide the storage area of the memory into a data area and a non-volatile storage area; determine a bad block in the memory, and obtain information corresponding to the bad block, Storing bad block information to the non-volatile storage area; determining, during the use of the memory, a bad block in the memory according to the bad block information stored in the non-volatile storage area, and shielding Access to the bad block.
  • the bad block information can be stored in the non-volatile storage area during the use of the memory, so that the memory can be read in subsequent use, and since the bad block information is stored in the non-volatile storage area, it is not easy to be in the data area. Affected during the erasure process, simplifying operations, improving the convenience of block management, and improving block management efficiency.
  • FIG. 1 is a schematic flowchart of a method for processing a memory block according to an embodiment of the present invention
  • FIG. 2 is a schematic structural view of a memory column according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a memory read and write logic according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a working process of a memory controller according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of an overall process of bad block management according to an embodiment of the present invention.
  • the memory block processing method provided by the embodiment of the present invention is as shown in FIG. 1 , and the method includes:
  • the memory includes an internal flash of a chip such as a system on chip (SoC), an external independent flash, and the like; the memory area of the memory may be divided into a data area and a nonvolatile storage area by the memory controller,
  • the non-volatile storage area may specifically be an area using a storage principle of a non-Volatile Random Access Memory (NVR), as shown in FIG. 2; wherein the data area is usually used as a program area, and the program is stored.
  • NVR non-Volatile Random Access Memory
  • Code, non-volatile storage area can be used to store configuration information and bad block information.
  • the data area has N blocks, and the non-volatile storage area has more than one block. The number and size of memory blocks in actual applications may be different.
  • Step 102 Determine a bad block in the memory, obtain information corresponding to the bad block, and store the bad block information into the non-volatile storage area.
  • the bad block information includes: a bad block address or the like.
  • the process of determining the bad block may include: during the memory production process, the manufacturer can detect the memory in the CP stage to see if there is a bad block; during use, the correct configuration can be followed.
  • the flow and timing are programmed to erase the memory. After erasing, each bit should be 1 . If it cannot be read 1 after erasing, it can be determined that there is a bad block. It can also be used for the data area of the memory.
  • Write preset information such as writing all 0s.
  • the size of the available space of the memory is written to the designated area of the nonvolatile storage area, and the write is performed.
  • the size of the available space of the memory into the non-volatile storage area is used to determine whether the remaining memory space of the memory satisfies the requirement during the memory read and write process; specifically, when the memory writes data, the memory may be read first.
  • the size of the available space stored in the non-volatile storage area determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and writes the data when it is determined that the demand is satisfied.
  • a memory has 128 blocks, each block size is 1MByte, a total of 128MByte; if there are 4 bad blocks, the available space of the memory should be 124MByte, and the information of the available space size of 124MByte is written to the nonvolatile Sex storage area for subsequent reading.
  • the bad block information storage process that can be adopted is as follows:
  • a bad block address and a free space size are written to a specified position of the nonvolatile storage area.
  • Step 103 Determine, during the use of the memory, a bad block in the memory according to the bad block information stored in the non-volatile storage area, and block access of the bad block.
  • the memory controller may read the bad block address in the non-volatile storage area after the reset, and temporarily store the bad block address in the register inside the controller of the memory for subsequent use.
  • the bad block comparison is used during the reading and writing process; when the memory access is performed, the block address corresponding to the access address is compared with the bad block address stored in the non-volatile storage area, and if the comparison result is the block corresponding to the access address
  • the address is the same as any of the bad block addresses stored in the non-volatile storage area, determining that the accessed block is a bad block; shielding access to the bad block;
  • the memory controller determines a bad block of the memory, and blocks the bad block to prevent access to the bad block, the method further includes: mapping the bad block address to the other specified one of the memory Position, replacing the bad block with other working blocks; as an example, the bad block address may be sequentially mapped to the tail of the data area of the memory; thus, the redundant block may not be provided inside the bank, When there are no bad blocks, good blocks at the end of the memory can still be used, increasing the utilization of the storage space.
  • the available space size of the memory stored in the non-volatile storage area may be read, and when the memory performs data writing, the non-volatile storage area in the memory may be read first.
  • the size of the available space determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and then writes the data after determining that the demand is satisfied.
  • the operation of accessing the memory is first initiated by the host to which the controller of the memory belongs.
  • the memory controller compares the host-initiated access block address with all bad block addresses stored in the register; if the access block address is not the same as all bad block addresses, block address mapping is not performed for normal data access; if access If the block address is the same as a bad block address, it is considered that the block of the memory currently accessed by the host has a bad block, the corresponding bad block flag is set to bit, indicating that the current block is a bad block, and address mapping is performed; the memory controller is based on the bad block.
  • the flag bit maps the bad block address to the corresponding block at the end of the memory; if the currently mapped block is also a bad block, it is mapped to the block before the currently mapped block until it is mapped to a good block, where the previous point is from the end The direction to the head. In this way, the host can be prevented from accessing the bad block, thereby making the read data incorrect.
  • mapping the bad block is shown in FIG. 4.
  • FIG. 4 there are m bad blocks in the memory, such as Bad Sector 1 to Bad Sector m in FIG. 4, and the mapping block will be a memory.
  • the address is mapped to Sector n. That is, although the host initiates access to the address of Bad Sector1, the actual access is Sector n.
  • the host accesses Bad Sector 2
  • the address is mapped.
  • the same address is mapped to the Sector n-m+1 when accessing the Bad Sector m, thus forming a new access array on the right side of Figure 4.
  • control system of the memory of the embodiment of the present invention may include a host, a memory, and a memory controller; the memory controller may include the following units:
  • Register unit configured to configure the controller itself and the memory, mainly to generate the test_en signal and the nvr_enable signal;
  • the test_en signal is an enable signal when the host performs bad block detection on the memory, and when the test_en signal is 1, it indicates that the bad block detection is performed.
  • the nvr_enable signal is a non-volatile storage area selection signal, and the nvr_enable signal is 1 to enable the non-volatile storage area;
  • Bad block information reading unit automatically pulls the bad_read_en signal high after power-on reset, that is, the number According to the path of the strobe accessing the non-volatile storage area on the selector, the read bad block address request issued by the unit can pass through the data selector, access the non-volatile storage area, read the bad block address, and will be bad.
  • the block address is temporarily stored in the internal register for use by the bad block comparison unit;
  • the bad block number comparison unit is configured to compare the bad block number temporarily stored by the bad block information reading unit with the access address issued by the host, and output a bad block status bit, and the bad block status bit is 1 to indicate that the current access is a bad block.
  • a bad block status bit of 0 indicates that it is not a bad block;
  • the address mapping unit is configured to map the bad block address, and the non-bad block address can directly pass through; according to the bad block status generated by the bad block number comparison unit, it is determined whether to map and map to which block, and the mapped
  • the access request and the access request of the bad block information reading unit perform data selection.
  • Access Selection Unit Configured to select access requests and configuration registers.
  • the process of initiating access from the host to mapping the bad block is as shown in FIG. 6.
  • the operation address initiated by the host is a sector 4, and the host operation address is compared with the bad block number register group by the bad block comparison unit. If it is equal to the bad block number register 1, the bad block status 1 is set to high level, indicating that the current block is a bad block.
  • the bad block state is processed by the address mapping unit to map the address to the sector n-1. This completes the mapping of the address.
  • the overall workflow of the memory processing can be as shown in FIG. 7, and includes the following steps:
  • Step 701 Determine whether to perform bad block detection, if necessary, perform bad block detection and store the bad block information and the available space size into the non-volatile storage area; if not, further determine whether the memory needs to be programmed;
  • Step 702 Determine whether the memory needs to be programmed, if necessary, proceed to step 703; otherwise, perform step 704;
  • Step 703 Determine whether the memory space meets the programming requirement according to the available space in the non-volatile storage area. If not, the memory needs to be replaced or the size of the data to be burned is compressed; if yes, the programming is performed;
  • Step 704 After the programming is completed, performing a power-on reset, the memory controller automatically reads the bad block information, and temporarily stores the bad block address in the non-volatile storage area to the bad block number register, and starts receiving the access request of the host. ;
  • Step 705 Compare the block address to which the access address sent by the host belongs and the bad block address stored in the bad block number register. If yes, go to step 706. Otherwise, go to step 707.
  • Step 706 Perform address mapping on the bad block and access, and end the processing flow.
  • Step 707 Direct access to the block.
  • the embodiment of the present invention further provides a memory block processing apparatus.
  • the apparatus includes: a partitioning module 81, a block information determining module 82, and a bad block confirming module 83;
  • the dividing module 81 is configured to divide a storage area of the memory into a data area and a non-volatile storage area;
  • the block information determining module 82 is configured to determine a bad block in the memory, obtain information corresponding to the bad block, and store the bad block information into the non-volatile storage area;
  • the bad block confirmation module 83 is configured to determine a bad block in the memory according to the bad block information stored in the non-volatile storage area, and block the bad block when the memory is in use access.
  • the memory includes an internal flash of a chip such as a SoC, an external independent flash, and the like; the memory may be divided into a data area and a non-volatile storage area by the memory controller, where the non-volatile storage area may be specifically It is an area that uses the storage principle of the NVR; as shown in FIG. 2; wherein the data area is usually used as a program area, and the program code is stored, and the non-volatile storage area can be used to store configuration information and bad block information.
  • the data area has N blocks, and the non-volatile storage area has more than one block. The number and size of memory blocks in actual applications may be different.
  • the data area and the NVR area are two independent areas, and the two cannot be accessed at the same time. It is necessary to configure which area is enabled by the register. This is a function inherent to the manufacturer's memory, and is not described here; usually, the memory
  • the bad block information includes: a bad block address and the like.
  • the process of determining the bad block may include: during the memory production process, the manufacturer can detect the memory in the CP stage to see if there is a bad block; during use, the correct configuration can be followed.
  • the flow and timing are programmed to erase the memory. After erasing, each bit should be all 1. If it cannot be read all after erasing, it can be determined that there is a bad block; it can also be written to the data area of the memory.
  • the size of the available space of the memory is written to the designated area of the nonvolatile storage area, and the write is performed.
  • the size of the available space of the memory into the non-volatile storage area is used to determine whether the remaining memory space of the memory satisfies the requirement during the memory read and write process; specifically, when the memory writes data, the memory may be read first.
  • the size of the available space stored in the non-volatile storage area determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and writes the data when it is determined that the demand is satisfied.
  • a memory has 128 blocks, each block size is 1MByte, a total of 128MByte; if there are 4 bad blocks, the available space of the memory should be 124MByte, and the information of the available space size of 124MByte is written to the nonvolatile Sex storage area for subsequent reading.
  • the bad block address storage process that can be used here is as follows:
  • a bad block address and a free space size are written to a specified position of the nonvolatile storage area.
  • the controller of the memory may first read the bad block address in the non-volatile storage area after reset, and temporarily store the bad block address in the register inside the controller of the memory.
  • the bad block comparison is used; when the memory access is performed, the block address corresponding to the access address is compared with the bad block address stored in the non-volatile storage area, and if the comparison result is access The block address corresponding to the address is the same as any of the bad block addresses stored in the non-volatile storage area, and then determining that the accessed block is a bad block, shielding access to the bad block;
  • the bad block confirming module 83 is further configured to: map the bad block address to a specified location, The other working block replaces the bad block; as an example, the bad block address may be sequentially mapped to the tail of the data area; thus, the redundant block may not be set inside the bank, and there is no bad block At the end of the memory, good blocks at the end of the memory can still be used, increasing the utilization of storage space.
  • the available space size of the memory stored in the non-volatile storage area may be read, and when the memory performs data writing, the non-volatile storage area in the memory may be read first.
  • the size of the available space determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and then writes the data after determining that the demand is satisfied.
  • the operation of accessing the memory is first initiated by the host to which the memory controller belongs; the memory controller compares the address of the access block initiated by the host with all the bad block addresses stored in the register; if the access block address is different from all bad block addresses , the block address mapping is not performed, normal data access is performed; if the access block address is the same as a bad block address, the block of the memory currently accessed by the host is considered to have a bad block, and the corresponding bad block mark is set to indicate the current
  • the block is a bad block and performs address mapping; the memory controller maps the bad block address to the corresponding block at the end of the memory according to the bad block flag bit; if the currently mapped block is also a bad block, then maps to the current mapped block The block until it is mapped to a good block, here before refers to the direction from the end to the head. In this way, the host can be prevented from accessing the bad block, thereby making the read data incorrect.
  • mapping the bad block is shown in FIG. 4.
  • FIG. 4 there are m bad blocks in the memory, such as Bad Sector 1 to Bad Sector m in FIG. 4, and the mapping block will be m blocks at the end of the memory.
  • Sector n ⁇ Sector n-m+1.
  • the address is mapped to Sector n. That is, although the host initiates access to the address of Bad Sector 1, the actual access is Sector n.
  • the host accesses Bad Sector 2
  • the address is mapped to Sector n-m+1.
  • the new access array on the right side of Figure 4 is formed.
  • the partitioning module 81, the block information determining module 82, and the bad block confirming module 83 may be implemented by a control chip or hardware logic of the memory or the like.
  • the computer executable instruction when executed by the processor, performing: dividing the storage area of the memory into a data area and a non-volatile storage area; determining a bad block in the memory, obtaining information corresponding to the bad block, The bad block information is stored in the non-volatile storage area; during the use of the memory, determining the bad block in the memory according to the bad block information stored in the non-volatile storage area, and shielding the Describe the access of bad blocks.
  • the computer executable instructions when executed by the processor, performing: storing the available space size of the memory to the non-volatile storage area.
  • the computer executable instruction when executed by the processor, executing: writing preset information into a data area of the memory; reading information in the data area, and reading the information and the pre- The information is compared, and the block corresponding to the address corresponding to the matching result is determined as a bad block; and/or, after the memory is erased, the information of the data area in the memory is read, and the information of the data area is The block in which the corresponding address of the information that does not match the preset initial information is determined to be a bad block.
  • mapping the bad block address to a specified location in the memory when executed by the processor, executing: mapping the bad block address to a specified location in the memory.
  • the disclosed method and apparatus may be implemented in other manners.
  • the device embodiments described above are merely illustrative, examples
  • the division of the module is only a logical function division, and the actual implementation may have another division manner, for example, multiple modules or components may be combined, or may be integrated into another system, or some features may be ignored. Or not.
  • the communication connections between the various components shown or discussed may be indirect coupling or communication connections through some interfaces, devices or modules, and may be electrical, mechanical or otherwise.
  • the modules described above as separate components may or may not be physically separated.
  • the components displayed as modules may or may not be physical modules, that is, may be located in one place or distributed to multiple network modules; Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may be separately used as one module, or two or more modules may be integrated into one module;
  • the module can be implemented in the form of hardware or in the form of hardware plus software function modules.
  • the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium includes: a removable storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and the like, which can store program codes.
  • ROM read-only memory
  • the above-described integrated module of the embodiment of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product.
  • the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a mobile storage device, a ROM, a disk, or a light.
  • a medium such as a disk that can store program code.
  • the technical solution of the embodiment of the present invention implements that the bad block information can be stored in the non-volatile storage area during the use of the memory, so that the memory is read in subsequent use, and the bad block information is stored in the non-volatile storage area. It is not easy to be affected in the data area erasing process, which simplifies the operation, improves the convenience of block management, and improves the block management efficiency.

Landscapes

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

Abstract

A memory block processing method. The method comprises: dividing a storage area of a memory into a data area and a non-volatile storage area (101); determining bad blocks in the memory, obtaining information corresponding to the bad blocks, and storing the bad block information in the non-volatile storage area (102); and when the memory is in use, determining the bad blocks in the memory according to the bad block information stored in the non-volatile storage area and shielding the access to the bad blocks (103). The method improves the management efficiency of memory blocks.

Description

一种存储器块处理方法、装置和计算机存储介质Memory block processing method, device and computer storage medium

相关申请的交叉引用Cross-reference to related applications

本申请基于申请号为201610754612.9、申请日为2016年08月29日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。The present application is based on a Chinese patent application filed on Jan. 29, 2016, filed on-

技术领域Technical field

本发明涉及集成电路存储器领域,尤其涉及一种存储器块处理方法、装置和计算机存储介质。The present invention relates to the field of integrated circuit memory, and in particular, to a memory block processing method, apparatus, and computer storage medium.

背景技术Background technique

非易失性存储器如闪存(Flash)一般是由多个块(Block)组成,读写操作一般基于一个地址或一个块,擦除操作一般基于一个块,即擦除的最小范围是块,通常一次擦除一个块,即擦除多个地址;由此,存储器某个存储地址出现问题的时候,常用方法就是对该地址所在的块进行标注,坏块管理即基于此。Non-volatile memory, such as flash memory, is generally composed of multiple blocks. The read and write operations are generally based on one address or one block. The erase operation is generally based on one block, that is, the minimum range of erasure is a block, usually Erasing a block at a time erases multiple addresses; thus, when a memory address of a memory has a problem, the common method is to label the block where the address is located, and the bad block management is based on this.

存储器某个地址可能会出现不可恢复的读写错误,即坏块;这种坏块可能是在生产过程中产生,也有可能是在使用过程中产生;坏块产生后,如果不做任何处理,那么,必然会造成数据和程序的错误;如果对出问题的芯片进行报废处理,则十分浪费;因此,可以采用坏块管理功能解决这个问题。An address of the memory may have an unrecoverable read/write error, that is, a bad block; the bad block may be generated during the production process or may be generated during use; if no bad block is generated, if no processing is performed, Then, it will inevitably lead to errors in data and programs; if the chip that has the problem is scrapped, it is very wasteful; therefore, the bad block management function can be used to solve this problem.

针对坏块的管理,目前的一种处理方法是,针对生产过程中产生的坏块,在存储器中预留出1~2块冗余块,在晶圆测试(CP,Circuit Probing)的时候找到存储器中存在的坏块,然后在使用的时候将产生坏块的块映射 到冗余块中。但这种方法的缺陷是:只可以针对生产过程中产生的坏块进行处理,不可以对使用中产生的坏块进行处理;因为坏块通常是由生产厂家进行测试的,而且测试中发现坏块的数量不可以大于规定值,例如:如果冗余块为2,那么芯片中坏块数量不能大于2,如果大于规定值,只能将芯片作废。可见,这种方案不够灵活,并且一旦出现使用坏块或者生产坏块过多,只能将芯片作废,进而造成浪费。通常,在进行坏块替换的时候,都要求存储空间有若干个冗余块,用来做坏块的备用块,那么,在没有坏块的时候,冗余块不会被用到,这样就造成存储空间的浪费。For the management of bad blocks, one of the current processing methods is to reserve one or two redundant blocks in the memory for the bad blocks generated in the production process, and find them during the wafer test (CP, Circuit Probing). Bad blocks that exist in memory, and then will generate block maps of bad blocks when used Into the redundant block. However, the drawback of this method is that it can only deal with the bad blocks generated in the production process, and can not deal with the bad blocks generated in the use; because the bad blocks are usually tested by the manufacturer, and the test finds bad. The number of blocks cannot be greater than the specified value. For example, if the redundancy block is 2, the number of bad blocks in the chip cannot be greater than 2. If it is larger than the specified value, the chip can only be invalidated. It can be seen that this scheme is not flexible enough, and once the use of bad blocks or excessive production of bad blocks occurs, the chip can only be discarded, resulting in waste. Usually, when performing bad block replacement, the storage space is required to have several redundant blocks, which are used as spare blocks for bad blocks. Then, when there are no bad blocks, the redundant blocks are not used, so A waste of storage space.

另一种处理方法是,将存储器地址分为两段区域,一段正常的数据区域,一段是存储器的状态位区域,状态位区域用来存储存储器的坏块信息、错误检查和纠正(ECC,Error Correcting Code)信息等。这种方法利用一些存储器状态位的对比,来判断当前块是否为坏块。但此种方法要求,在擦除块之前,一定要将所有的坏块状态信息读出来,否则状态信息也会与数据区域一同被擦除;而如果用户一旦出现误操作,那么坏块信息将不复存在;因此,该方法存在操作复杂的问题。Another processing method is to divide the memory address into two segments, a normal data region, and a segment is the status bit region of the memory. The status bit region is used to store bad block information of the memory, error checking and correction (ECC, Error Correcting Code) information, etc. This method uses the comparison of some memory status bits to determine if the current block is a bad block. However, this method requires that all bad block status information must be read out before erasing the block, otherwise the status information will be erased together with the data area; and if the user has a misoperation, the bad block information will be It no longer exists; therefore, this method has a problem of complicated operation.

因此,如何在生产和使用过程中都能便捷地进行坏块管理,提升块管理效率,是亟待解决的问题。Therefore, how to manage bad blocks conveniently in the process of production and use and improve the efficiency of block management is an urgent problem to be solved.

发明内容Summary of the invention

有鉴于此,本发明实施例期望提供一种存储器块处理方法、装置和计算机存储介质,能够在生产和使用过程中都能便捷地进行坏块管理,提升块管理效率。In view of this, the embodiments of the present invention are expected to provide a memory block processing method, apparatus, and computer storage medium, which can conveniently perform bad block management during production and use, and improve block management efficiency.

为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, the technical solution of the present invention is achieved as follows:

本发明实施例提供了一种存储器块处理方法,将存储器的存储区域划分为数据区域和非易失性存储区域;所述方法还包括:An embodiment of the present invention provides a memory block processing method, which divides a storage area of a memory into a data area and a non-volatile storage area. The method further includes:

确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到 所述非易失性存储区域;Determining a bad block in the memory, obtaining information corresponding to the bad block, and storing the bad block information to The nonvolatile storage area;

在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。While the memory is in use, determining a bad block in the memory according to the bad block information stored in the non-volatile storage area, and shielding access of the bad block.

在一实施例中,所述方法还包括:将所述存储器的可用空间大小存储到所述非易失性存储区域。In an embodiment, the method further comprises storing the available space size of the memory to the non-volatile storage area.

在一实施例中,所述确定存储器中的坏块,包括:将预设信息写入所述存储器的数据区域,读取所述数据区域中的信息,将读取的信息与所述预设信息进行对比,将比对结果匹配的信息对应地址所在块确定为坏块;和/或,In an embodiment, the determining a bad block in the memory comprises: writing preset information into a data area of the memory, reading information in the data area, and reading the read information with the preset The information is compared, and the block corresponding to the address corresponding to the matching result is determined as a bad block; and/or,

所述存储器被擦除后读取所述存储器中数据区域的信息,将所述数据区域的信息中与预设初始信息不匹配的信息对应地址所在块确定为坏块。After the memory is erased, the information of the data area in the memory is read, and the block of the information corresponding to the information that does not match the preset initial information in the information of the data area is determined as a bad block.

在一实施例中,所述方法还包括:将所述坏块地址映射到所述存储器中指定位置。In an embodiment, the method further comprises mapping the bad block address to a specified location in the memory.

在一实施例中,所述将坏块地址映射到存储器中指定位置,包括:从所述存储器的数据区域的尾部开始依次映射所述坏块。In an embodiment, the mapping the bad block address to the specified location in the memory comprises: mapping the bad block in order from the tail of the data region of the memory.

本发明实施例还提供了一种存储器块处理装置,所述装置包括:划分模块、块信息确定模块和坏块确认模块;其中,An embodiment of the present invention further provides a memory block processing apparatus, where the apparatus includes: a partitioning module, a block information determining module, and a bad block confirming module;

所述划分模块,配置为将存储器的存储区域划分为数据区域和非易失性存储区域;The dividing module is configured to divide a storage area of the memory into a data area and a non-volatile storage area;

所述块信息确定模块,配置为确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到所述非易失性存储区域;The block information determining module is configured to determine a bad block in the memory, obtain information corresponding to the bad block, and store the bad block information in the non-volatile storage area;

所述坏块确认模块,配置为在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。The bad block confirmation module is configured to determine a bad block in the memory according to the bad block information stored in the non-volatile storage area, and block access of the bad block during use of the memory .

在一实施例中,所述块信息确定模块,还配置为将所述存储器的可用 空间大小存储到所述非易失性存储区域。In an embodiment, the block information determining module is further configured to use the memory The size of the space is stored to the non-volatile storage area.

在一实施例中,所述块信息确定模块,配置为:将预设信息写入所述数据区域,读取所述数据区域中的信息,将读取的信息与所述预设信息进行对比,将比对结果匹配的信息对应地址所在块确定为坏块;和/或,In an embodiment, the block information determining module is configured to: write preset information into the data area, read information in the data area, and compare the read information with the preset information. , the block corresponding to the address corresponding to the information matching the result is determined as a bad block; and/or,

所述存储器被擦除后读取所述数据区域的信息,将所述数据区域的信息中与预设初始信息不匹配的信息对应地址所在块确定为坏块。After the memory is erased, the information of the data area is read, and the block of the information corresponding to the information that does not match the preset initial information in the information of the data area is determined as a bad block.

在一实施例中,所述坏块确认模块,还配置为:将所述坏块地址映射到指定位置。In an embodiment, the bad block confirmation module is further configured to: map the bad block address to a specified location.

在一实施例中,所述坏块确认模块,配置为:从所述存储器的数据区域的尾部开始依次映射所述坏块。In an embodiment, the bad block confirmation module is configured to map the bad blocks in order from the tail of the data area of the memory.

本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例所述的存储器块处理方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the memory block processing method according to the embodiment of the invention.

本发明实施例提供的存储器块处理方法、装置和计算机存储介质,将存储器的存储区域划分为数据区域和非易失性存储区域;确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到所述非易失性存储区域;在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。如此,实现了在存储器处于使用过程中可以将坏块信息存储到非易失性存储区域,以便存储器后续使用中读取,并且由于坏块信息存储在非易失性存储区域,不易在数据区域擦除过程中受影响,简化了操作,提高块管理的便捷性,提升块管理效率。The memory block processing method and apparatus and the computer storage medium provided by the embodiments of the present invention divide the storage area of the memory into a data area and a non-volatile storage area; determine a bad block in the memory, and obtain information corresponding to the bad block, Storing bad block information to the non-volatile storage area; determining, during the use of the memory, a bad block in the memory according to the bad block information stored in the non-volatile storage area, and shielding Access to the bad block. In this way, it is realized that the bad block information can be stored in the non-volatile storage area during the use of the memory, so that the memory can be read in subsequent use, and since the bad block information is stored in the non-volatile storage area, it is not easy to be in the data area. Affected during the erasure process, simplifying operations, improving the convenience of block management, and improving block management efficiency.

附图说明DRAWINGS

图1为本发明实施例存储器块处理方法的流程示意图;1 is a schematic flowchart of a method for processing a memory block according to an embodiment of the present invention;

图2为本发明实施例存储器整列结构示意图; 2 is a schematic structural view of a memory column according to an embodiment of the present invention;

图3为本发明实施例存储器读写逻辑示意图;3 is a schematic diagram of a memory read and write logic according to an embodiment of the present invention;

图4为本发明实施例坏块映射结构示意图;4 is a schematic diagram of a bad block mapping structure according to an embodiment of the present invention;

图5为本发明实施例存储器控制器结构示意图;5 is a schematic structural diagram of a memory controller according to an embodiment of the present invention;

图6为本发明实施例存储器控制器工作流程示意图;6 is a schematic diagram of a working process of a memory controller according to an embodiment of the present invention;

图7为本发明实施例坏块管理整体流程示意图;7 is a schematic diagram of an overall process of bad block management according to an embodiment of the present invention;

图8为本发明实施例存储器块处理装置的组成结构示意图。FIG. 8 is a schematic structural diagram of a memory block processing apparatus according to an embodiment of the present invention.

具体实施方式detailed description

本发明实施例中,将存储器的存储区域划分为数据区域和非易失性存储(NVS,Non-Volatile Storage)区域;确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到非易失性存储区域;存储器使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。In the embodiment of the present invention, the storage area of the memory is divided into a data area and a Non-Volatile Storage (NVS) area; a bad block in the memory is determined, and information corresponding to the bad block is obtained, and the bad block is obtained. The information is stored in the non-volatile storage area; during the use of the memory, the bad block in the memory is determined according to the bad block information stored in the non-volatile storage area, and the access of the bad block is blocked.

下面结合实施例对本发明再作进一步详细的说明。The present invention will be further described in detail below with reference to the embodiments.

本发明实施例提供的存储器块处理方法,如图1所示,所述方法包括:The memory block processing method provided by the embodiment of the present invention is as shown in FIG. 1 , and the method includes:

步骤101:将存储器的存储区域划分为数据区域和非易失性存储区域。Step 101: Divide the storage area of the memory into a data area and a non-volatile storage area.

这里,所述存储器包括片上系统(SoC,System on Chip)等芯片的内部Flash和外部独立Flash等;可以由存储器控制器将存储器的存储区域划分为数据区域和非易失性存储区域,所述非易失性存储区域具体可以是采用非易失性随机访问存储器(NVR,Non-Volatile Random access memory)的存储原理的区域,如图2所示;其中,数据区域通常作为程序区,存放程序代码,非易失性存储区域可以用来存放配置信息和坏块信息。图2中数据区域有N个块,非易失性存储区域有一个以上的块,实际应用中的存储器块数量和大小可能都会不同。Here, the memory includes an internal flash of a chip such as a system on chip (SoC), an external independent flash, and the like; the memory area of the memory may be divided into a data area and a nonvolatile storage area by the memory controller, The non-volatile storage area may specifically be an area using a storage principle of a non-Volatile Random Access Memory (NVR), as shown in FIG. 2; wherein the data area is usually used as a program area, and the program is stored. Code, non-volatile storage area can be used to store configuration information and bad block information. In Figure 2, the data area has N blocks, and the non-volatile storage area has more than one block. The number and size of memory blocks in actual applications may be different.

这里,数据区域和NVR区域为两个独立的区域,二者不能同时访问,需要配置寄存器使能哪个区域,这是生产厂家的存储器固有的功能,在此 不再赘述;通常,存储器接口上会设置非易失性存储区域使能信号,如图3所示,存储器读写逻辑中的nvr_enable,如果nvr_enable=0,则使能数据区域;如果nvr_enable=1,则使能非易失性存储区域;Here, the data area and the NVR area are two independent areas, and the two cannot be accessed at the same time, and it is necessary to configure which area is enabled by the register, which is a function inherent to the manufacturer's memory. No more details; usually, the non-volatile storage area enable signal is set on the memory interface, as shown in Figure 3, nvr_enable in the memory read and write logic, if nvr_enable = 0, the data area is enabled; if nvr_enable=1 , enabling non-volatile storage areas;

步骤102:确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到所述非易失性存储区域。Step 102: Determine a bad block in the memory, obtain information corresponding to the bad block, and store the bad block information into the non-volatile storage area.

这里,所述坏块信息包括:坏块地址等。首先,确定存储器中的坏块;确定坏块的过程可以包括:在存储器生产过程中,生产厂家在CP阶段可以对存储器进行检测,看是否存在坏块;在使用过程中,可以按照正确的配置流程和时序进行编程操作,将存储器擦除,擦除后每个位(bit)应全部为1,如果擦除后不能全部读出1,就可以判定存在坏块;也可以针对存储器的数据区域写入预设信息,如写入全0,如果不能全部读出0,就可以判定存在坏块;将出现读写错误的块确定为坏块,获得坏块对应的地址,将坏块地址写入非易失性存储区域的指定区域。Here, the bad block information includes: a bad block address or the like. First, the bad block in the memory is determined; the process of determining the bad block may include: during the memory production process, the manufacturer can detect the memory in the CP stage to see if there is a bad block; during use, the correct configuration can be followed. The flow and timing are programmed to erase the memory. After erasing, each bit should be 1 . If it cannot be read 1 after erasing, it can be determined that there is a bad block. It can also be used for the data area of the memory. Write preset information, such as writing all 0s. If all 0s cannot be read, it can be determined that there is a bad block; the block with read/write error is determined as a bad block, the address corresponding to the bad block is obtained, and the bad block address is written. Enter a specified area of the non-volatile storage area.

本实施例中,由于坏块的存在,必然使存储器的容量变小,所以要在坏块检测后,将所述存储器的可用空间的大小写入到非易失性存储区域的指定区域,写入非易失性存储区域的所述存储器的可用空间的大小用于在存储器读写过程中判断所述存储器剩余存储空间是否满足需求;具体的,在存储器进行写数据时,可以先读取存储器中所述非易失性存储区域中存储的可用空间的大小,判断存储器的剩余容量是否满足待写数据的容量需求,当判定满足需求后再进行写数据。例如,一个存储器有128个块,每块大小1MByte,总共128MByte;如果有4个坏块存在,则存储器的可用空间应为124MByte,要将可用空间大小为124MByte的信息写入所述非易失性存储区域,供后续读取。In this embodiment, due to the existence of the bad block, the capacity of the memory is inevitably reduced. Therefore, after the bad block detection, the size of the available space of the memory is written to the designated area of the nonvolatile storage area, and the write is performed. The size of the available space of the memory into the non-volatile storage area is used to determine whether the remaining memory space of the memory satisfies the requirement during the memory read and write process; specifically, when the memory writes data, the memory may be read first. The size of the available space stored in the non-volatile storage area determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and writes the data when it is determined that the demand is satisfied. For example, a memory has 128 blocks, each block size is 1MByte, a total of 128MByte; if there are 4 bad blocks, the available space of the memory should be 124MByte, and the information of the available space size of 124MByte is written to the nonvolatile Sex storage area for subsequent reading.

实际应用中,根据图3的存储器读写逻辑,可以采用的坏块信息存储流程如下: In practical applications, according to the memory read and write logic of FIG. 3, the bad block information storage process that can be adopted is as follows:

A:检测存储器是否有坏块,记录所有的坏块对应的地址,同时记录下存储器的可用空间的大小;A: Detect whether the memory has a bad block, record the address corresponding to all the bad blocks, and record the size of the available space of the memory;

B:配置nvr_enable=1,使能非易失性存储区域;B: Configure nvr_enable=1 to enable non-volatile storage area.

C:将坏块地址和可用空间大小写入所述非易失性存储区域的指定位置。C: A bad block address and a free space size are written to a specified position of the nonvolatile storage area.

步骤103:在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。Step 103: Determine, during the use of the memory, a bad block in the memory according to the bad block information stored in the non-volatile storage area, and block access of the bad block.

这里,在存储器正常使用的过程中,存储器控制器可以在复位后先读取非易失性存储区域中的坏块地址,并将坏块地址暂存在存储器的控制器内部的寄存器中,供后续读写过程中进行坏块比较使用;在进行存储器访问时,将访问地址对应的块地址与所述非易失性存储区域中存储的坏块地址进行比较,若比较结果为访问地址对应的块地址与所述非易失性存储区域中存储的坏块地址中的任一坏块地址相同,则确定访问的块为坏块;屏蔽对所述坏块的访问;Here, during normal use of the memory, the memory controller may read the bad block address in the non-volatile storage area after the reset, and temporarily store the bad block address in the register inside the controller of the memory for subsequent use. The bad block comparison is used during the reading and writing process; when the memory access is performed, the block address corresponding to the access address is compared with the bad block address stored in the non-volatile storage area, and if the comparison result is the block corresponding to the access address The address is the same as any of the bad block addresses stored in the non-volatile storage area, determining that the accessed block is a bad block; shielding access to the bad block;

作为一种实施方式,存储器控制器确定存储器的坏块,对所述坏块进行屏蔽,防止访问坏块后,所述方法还包括:可以将所述坏块地址映射到所述存储器其他指定的位置,用其它工作正常的块替代所述坏块;作为一种示例,可以将所述坏块地址依次映射到存储器的数据区域的尾部;如此,可以使存储体内部不必设置冗余块,在不存在坏块时,存储器末尾的好块仍然也可以被用到,加大了存储空间的利用率。As an implementation manner, the memory controller determines a bad block of the memory, and blocks the bad block to prevent access to the bad block, the method further includes: mapping the bad block address to the other specified one of the memory Position, replacing the bad block with other working blocks; as an example, the bad block address may be sequentially mapped to the tail of the data area of the memory; thus, the redundant block may not be provided inside the bank, When there are no bad blocks, good blocks at the end of the memory can still be used, increasing the utilization of the storage space.

作为一种实施方式,可以读取在非易失性存储区域中存储的所述存储器的可用空间大小,在存储器进行写数据时,可以先读取存储器中所述非易失性存储区域中存储的可用空间的大小,判断存储器的剩余容量是否满足待写数据的容量需求,当判定满足需求后再再进行写数据。As an implementation manner, the available space size of the memory stored in the non-volatile storage area may be read, and when the memory performs data writing, the non-volatile storage area in the memory may be read first. The size of the available space determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and then writes the data after determining that the demand is satisfied.

实际应用中,首先由存储器的控制器所属的主机发起访问存储器的操 作;存储器控制器对比主机发起的访问块地址与所有保存在寄存器里的坏块地址;如果访问块地址与所有坏块地址不相同,则不进行块地址映射,进行正常的数据访问;如果访问块地址与某个坏块地址相同,则认为主机当前访问的存储器的块存在坏块,将对应的坏块标记位置位,表示当前块是坏块,并且进行地址映射;存储器控制器根据坏块标记位将坏块地址映射到存储器末尾相应的块;如果当前被映射的块也是坏块,那就再映射到当前被映射块之前的块,直到映射到好块为止,这里之前是指从末尾向头的方向。这样,可以防止主机访问到坏块,从而使读出的数据错误。In practical applications, the operation of accessing the memory is first initiated by the host to which the controller of the memory belongs. The memory controller compares the host-initiated access block address with all bad block addresses stored in the register; if the access block address is not the same as all bad block addresses, block address mapping is not performed for normal data access; if access If the block address is the same as a bad block address, it is considered that the block of the memory currently accessed by the host has a bad block, the corresponding bad block flag is set to bit, indicating that the current block is a bad block, and address mapping is performed; the memory controller is based on the bad block. The flag bit maps the bad block address to the corresponding block at the end of the memory; if the currently mapped block is also a bad block, it is mapped to the block before the currently mapped block until it is mapped to a good block, where the previous point is from the end The direction to the head. In this way, the host can be prevented from accessing the bad block, thereby making the read data incorrect.

其中,对坏块进行映射具体结构如图4所示,图4中,存储器中有m个坏块,如图4中的坏扇区(Bad Sector)1~Bad Sector m,映射块会是存储器末尾的m个块扇区(Sector)n~Sector n-m+1。当主机访问Bad Sector 1的时候,将地址映射到Sector n上,即主机虽然发起访问的地址是Bad Sector1的地址,但实际访问的是Sector n,当主机访问Bad Sector 2的时候,将地址映射到Sector n-1上,同理当访问Bad Sector m的时候将地址映射到Sector n-m+1上,从而形成图4右侧的新的访问阵列。The specific structure of mapping the bad block is shown in FIG. 4. In FIG. 4, there are m bad blocks in the memory, such as Bad Sector 1 to Bad Sector m in FIG. 4, and the mapping block will be a memory. The last m blocks (Sector) n to Sector n-m+1. When the host accesses Bad Sector 1, the address is mapped to Sector n. That is, although the host initiates access to the address of Bad Sector1, the actual access is Sector n. When the host accesses Bad Sector 2, the address is mapped. On the Sector n-1, the same address is mapped to the Sector n-m+1 when accessing the Bad Sector m, thus forming a new access array on the right side of Figure 4.

下面结合具体示例对本发明实施例产生的积极效果作进一步详细的描述。The positive effects produced by the embodiments of the present invention are further described in detail below with reference to specific examples.

如图5所述,本发明实施例的存储器的控制系统可包括主机、存储器和存储器控制器;存储器控制器可包括以下单元:As illustrated in FIG. 5, the control system of the memory of the embodiment of the present invention may include a host, a memory, and a memory controller; the memory controller may include the following units:

寄存器单元:配置为对控制器自身和存储器进行配置,主要是产生test_en信号和nvr_enable信号;test_en信号是主机对存储器进行坏块检测时的使能信号,test_en信号为1时表示进行坏块检测使能;nvr_enable信号是非易失性存储区域选择信号,nvr_enable信号为1表示使能非易失性存储区域;Register unit: configured to configure the controller itself and the memory, mainly to generate the test_en signal and the nvr_enable signal; the test_en signal is an enable signal when the host performs bad block detection on the memory, and when the test_en signal is 1, it indicates that the bad block detection is performed. The nvr_enable signal is a non-volatile storage area selection signal, and the nvr_enable signal is 1 to enable the non-volatile storage area;

坏块信息读取单元:上电复位后自动将bad_read_en信号拉高,即在数 据选择器上选通访问非易失性存储区域的路径,使本单元发出的读坏块地址请求可以穿过数据选择器,访问非易失性存储区域,读取坏块地址,并将坏块地址暂存在内部的寄存器中,供坏块比较单元使用;Bad block information reading unit: automatically pulls the bad_read_en signal high after power-on reset, that is, the number According to the path of the strobe accessing the non-volatile storage area on the selector, the read bad block address request issued by the unit can pass through the data selector, access the non-volatile storage area, read the bad block address, and will be bad. The block address is temporarily stored in the internal register for use by the bad block comparison unit;

坏块号比较单元:配置为根据坏块信息读取单元暂存的坏块号和主机发出的访问地址进行对比,输出坏块状态位,坏块状态位为1表示当前访问的是坏块,坏块状态位为0表示不是坏块;The bad block number comparison unit is configured to compare the bad block number temporarily stored by the bad block information reading unit with the access address issued by the host, and output a bad block status bit, and the bad block status bit is 1 to indicate that the current access is a bad block. A bad block status bit of 0 indicates that it is not a bad block;

地址映射单元:配置为对坏块地址进行映射,非坏块地址可以直接穿过;根据坏块号比较单元产生的坏块状态,判断是否进行映射和映射到哪一个块,并将映射后的访问请求与坏块信息读取单元的访问请求进行数据选择,在坏块信息读取阶段bad_read_en=1,映射后的访问请求不会穿过数据选择器,坏块信息读取阶段结束后,bad_read_en=0,则映射后的访问请求可以穿过数据选择器访问存储器;The address mapping unit is configured to map the bad block address, and the non-bad block address can directly pass through; according to the bad block status generated by the bad block number comparison unit, it is determined whether to map and map to which block, and the mapped The access request and the access request of the bad block information reading unit perform data selection. In the bad block information reading stage bad_read_en=1, the mapped access request does not pass through the data selector, and the bad block information reading stage ends, bad_read_en =0, the mapped access request can access the memory through the data selector;

访问选择单元:配置为对访问请求和配置寄存器进行选择。Access Selection Unit: Configured to select access requests and configuration registers.

基于上述单元,访问请求的工作流程包括:如果test_en=1,这种情况发生在检测坏块的阶段,那么使主机访问不经过地址映射,直接访问存储器;如果test_en=0&bad_read_en=1,这发生在坏块信息读取阶段,坏块信息读取单元发出的访问请求会穿过数据选择器,访问存储器;如果test_en=0&bad_read_en=0,这发生在正常的主机访问阶段,主机的访问请求会经过地址映射单元,穿过数据选择器访问存储器;Based on the above unit, the workflow of the access request includes: if test_en=1, this happens in the stage of detecting the bad block, then the host accesses the memory directly without address mapping; if test_en=0&bad_read_en=1, this happens in In the bad block information reading phase, the access request issued by the bad block information reading unit passes through the data selector to access the memory; if test_en=0&bad_read_en=0, this occurs during the normal host access phase, and the host's access request passes the address. a mapping unit that accesses the memory through the data selector;

配置寄存器的过程包括:如果bad_read_en=1,这发生在坏块信息读取阶段,此阶段要访问非易失性存储区域,所以会将nvr_enable强制为1;如果bad_read_en=0,这发生在正常的主机访问阶段,寄存器单元配置的nvr_enable信号会穿过数据选择器,配置存储器;以上所述,仅为本发明的最佳实施例而已,并非用于限定本发明的保护范围,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护 范围之内;The process of configuring the registers includes: if bad_read_en=1, this happens during the bad block information read phase, which accesses the non-volatile memory area, so nvr_enable is forced to 1; if bad_read_en=0, this happens in normal During the host access phase, the nvr_enable signal of the register unit configuration passes through the data selector, and the memory is configured; the above is only the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles shall be included in the protection of the present invention. Within the scope;

从主机发起访问到对坏块进行映射的过程如图6所示,主机发起访问的操作地址是扇区(Sector)4,通过坏块比较单元将主机操作地址与坏块号寄存器组进行比较,与坏块号寄存器1相等,则坏块状态1被置为高电平,表示当前访问的是坏块。坏块状态经过地址映射单元的处理,将地址映射到扇区(Sector)n-1。这样就完成了地址的映射。The process of initiating access from the host to mapping the bad block is as shown in FIG. 6. The operation address initiated by the host is a sector 4, and the host operation address is compared with the bad block number register group by the bad block comparison unit. If it is equal to the bad block number register 1, the bad block status 1 is set to high level, indicating that the current block is a bad block. The bad block state is processed by the address mapping unit to map the address to the sector n-1. This completes the mapping of the address.

基于上述单元,存储器处理的整体工作流程可以如图7所示,包括以下步骤:Based on the above unit, the overall workflow of the memory processing can be as shown in FIG. 7, and includes the following steps:

步骤701:判断是否进行坏块检测,如果需要,则进行坏块检测并将坏块信息和可用空间大小存储到非易失性存储区域;如果不需要,则进一步判断存储器是否需要烧写;Step 701: Determine whether to perform bad block detection, if necessary, perform bad block detection and store the bad block information and the available space size into the non-volatile storage area; if not, further determine whether the memory needs to be programmed;

步骤702:判断存储器是否需要烧写,如果需要进入步骤703;否则,执行步骤704;Step 702: Determine whether the memory needs to be programmed, if necessary, proceed to step 703; otherwise, perform step 704;

步骤703:根据非易失性存储区域中的可用空间大小判断存储器空间是否满足烧写需求,如果不满足,则需要更换存储器或者压缩待烧写的数据大小;如果满足,则进行烧写;Step 703: Determine whether the memory space meets the programming requirement according to the available space in the non-volatile storage area. If not, the memory needs to be replaced or the size of the data to be burned is compressed; if yes, the programming is performed;

步骤704:烧写完后,进行上电复位,存储器控制器自动读取坏块信息,并将非易失性存储区域中的坏块地址暂存到坏块号寄存器,开始接收主机的访问请求;Step 704: After the programming is completed, performing a power-on reset, the memory controller automatically reads the bad block information, and temporarily stores the bad block address in the non-volatile storage area to the bad block number register, and starts receiving the access request of the host. ;

步骤705:比较主机发送的访问地址所属的块地址和坏块号寄存器中存储的坏块地址是否一致,如果一致,则执行步骤706,否则执行步骤707;Step 705: Compare the block address to which the access address sent by the host belongs and the bad block address stored in the bad block number register. If yes, go to step 706. Otherwise, go to step 707.

步骤706:对坏块进行地址映射后访问,结束本次处理流程;Step 706: Perform address mapping on the bad block and access, and end the processing flow.

步骤707:直接访问块。Step 707: Direct access to the block.

本发明实施例还提供了一种存储器块处理装置,如图8所示,所述装置包括:划分模块81、块信息确定模块82和坏块确认模块83;其中, The embodiment of the present invention further provides a memory block processing apparatus. As shown in FIG. 8, the apparatus includes: a partitioning module 81, a block information determining module 82, and a bad block confirming module 83;

所述划分模块81,配置为将存储器的存储区域划分为数据区域和非易失性存储区域;The dividing module 81 is configured to divide a storage area of the memory into a data area and a non-volatile storage area;

所述块信息确定模块82,配置为确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到所述非易失性存储区域;The block information determining module 82 is configured to determine a bad block in the memory, obtain information corresponding to the bad block, and store the bad block information into the non-volatile storage area;

所述坏块确认模块83,用于在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。The bad block confirmation module 83 is configured to determine a bad block in the memory according to the bad block information stored in the non-volatile storage area, and block the bad block when the memory is in use access.

本实施例中,所述存储器包括SoC等芯片的内部Flash和外部独立Flash等;可以由存储器控制器将存储器分为数据区域和非易失性存储区域,所述非易失性存储区域具体可以是采用NVR的存储原理的区域;如图2所示;其中数据区域通常作为程序区,存放程序代码,非易失性存储区域可以用来存放配置信息和坏块信息。图2中数据区域有N个块,非易失性存储区域有一个以上的块,实际应用中的存储器块数量和大小可能都会不同。In this embodiment, the memory includes an internal flash of a chip such as a SoC, an external independent flash, and the like; the memory may be divided into a data area and a non-volatile storage area by the memory controller, where the non-volatile storage area may be specifically It is an area that uses the storage principle of the NVR; as shown in FIG. 2; wherein the data area is usually used as a program area, and the program code is stored, and the non-volatile storage area can be used to store configuration information and bad block information. In Figure 2, the data area has N blocks, and the non-volatile storage area has more than one block. The number and size of memory blocks in actual applications may be different.

本实施例中,数据区域和NVR区域为两个独立的区域,二者不能同时访问,需要配置寄存器使能哪个区域,这是生产厂家的存储器固有的功能,在此不再赘述;通常,存储器接口上会设置非易失性存储区域使能信号,如图3所示,存储器读写逻辑中的nvr_enable,如果nvr_enable=0,则使能数据区域;如果nvr_enable=1,则使能非易失性存储区域。In this embodiment, the data area and the NVR area are two independent areas, and the two cannot be accessed at the same time. It is necessary to configure which area is enabled by the register. This is a function inherent to the manufacturer's memory, and is not described here; usually, the memory The non-volatile storage area enable signal is set on the interface. As shown in Figure 3, the memory reads and writes the nvr_enable in the logic. If nvr_enable=0, the data area is enabled. If nvr_enable=1, the non-volatile is enabled. Sex storage area.

本实施例中,所述坏块信息包括:坏块地址等。首先,确定存储器中的坏块;确定坏块的过程可以包括:在存储器生产过程中,生产厂家在CP阶段可以对存储器进行检测,看是否存在坏块;在使用过程中,可以按照正确的配置流程和时序进行编程操作,将存储器擦除,擦除后每个bit应全部为1,如果擦除后不能全部读出1,就可以判定存在坏块;也可以针对存储器的数据区域写入预设信息,如写入全0,如果不能全部读出0,就可以判定存在坏块;将出现读写错误的块确定为坏块,获得坏块对应的地址, 将坏块地址写入非易失性存储区域的指定区域。In this embodiment, the bad block information includes: a bad block address and the like. First, the bad block in the memory is determined; the process of determining the bad block may include: during the memory production process, the manufacturer can detect the memory in the CP stage to see if there is a bad block; during use, the correct configuration can be followed. The flow and timing are programmed to erase the memory. After erasing, each bit should be all 1. If it cannot be read all after erasing, it can be determined that there is a bad block; it can also be written to the data area of the memory. Set the information, such as writing all 0s, if not all 0 can be read, it can be determined that there is a bad block; the block with read and write errors is determined as a bad block, and the address corresponding to the bad block is obtained. The bad block address is written to a specified area of the nonvolatile storage area.

本实施例中,由于坏块的存在,必然使存储器的容量变小,所以要在坏块检测后,将所述存储器的可用空间的大小写入到非易失性存储区域的指定区域,写入非易失性存储区域的所述存储器的可用空间的大小用于在存储器读写过程中判断所述存储器剩余存储空间是否满足需求;具体的,在存储器进行写数据时,可以先读取存储器中所述非易失性存储区域中存储的可用空间的大小,判断存储器的剩余容量是否满足待写数据的容量需求,当判定满足需求后再进行写数据。例如,一个存储器有128个块,每块大小1MByte,总共128MByte;如果有4个坏块存在,则存储器的可用空间应为124MByte,要将可用空间大小为124MByte的信息写入所述非易失性存储区域,供后续读取。In this embodiment, due to the existence of the bad block, the capacity of the memory is inevitably reduced. Therefore, after the bad block detection, the size of the available space of the memory is written to the designated area of the nonvolatile storage area, and the write is performed. The size of the available space of the memory into the non-volatile storage area is used to determine whether the remaining memory space of the memory satisfies the requirement during the memory read and write process; specifically, when the memory writes data, the memory may be read first. The size of the available space stored in the non-volatile storage area determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and writes the data when it is determined that the demand is satisfied. For example, a memory has 128 blocks, each block size is 1MByte, a total of 128MByte; if there are 4 bad blocks, the available space of the memory should be 124MByte, and the information of the available space size of 124MByte is written to the nonvolatile Sex storage area for subsequent reading.

实际应用中,根据图3的存储器读写逻辑,可以此采用的坏块地址存储流程如下:In practical applications, according to the memory read and write logic of FIG. 3, the bad block address storage process that can be used here is as follows:

A:检测存储器是否有坏块,记录所有的坏块对应的地址,同时记录下存储器的可用空间的大小;A: Detect whether the memory has a bad block, record the address corresponding to all the bad blocks, and record the size of the available space of the memory;

B:配置nvr_enable=1,使能非易失性存储区域;B: Configure nvr_enable=1 to enable non-volatile storage area.

C:将坏块地址和可用空间大小写入所述非易失性存储区域的指定位置。C: A bad block address and a free space size are written to a specified position of the nonvolatile storage area.

本实施例中,在存储器正常使用的过程中,存储器的控制器可以在复位后先读取非易失性存储区域中的坏块地址,并将坏块地址暂存在存储器的控制器内部的寄存器中,供后续读写过程中进行坏块比较使用;在进行存储器访问时,将访问地址对应的块地址与所述非易失性存储区域中存储的坏块地址进行比较,若比较结果为访问地址对应的块地址与所述非易失性存储区域中存储的坏块地址中的任一坏块地址相同,则确定访问的块为坏块,屏蔽对所述坏块的访问; In this embodiment, during normal use of the memory, the controller of the memory may first read the bad block address in the non-volatile storage area after reset, and temporarily store the bad block address in the register inside the controller of the memory. In the subsequent read and write process, the bad block comparison is used; when the memory access is performed, the block address corresponding to the access address is compared with the bad block address stored in the non-volatile storage area, and if the comparison result is access The block address corresponding to the address is the same as any of the bad block addresses stored in the non-volatile storage area, and then determining that the accessed block is a bad block, shielding access to the bad block;

作为一种实施方式,在确定存储器的坏块、对所述坏块进行屏蔽,防止访问坏块后,所述坏块确认模块83还配置为:将所述坏块地址映射到指定位置,用其它工作正常的块替代所述坏块;作为一种示例,可以将所述坏块地址依次映射到的数据区域的尾部;如此,可以使存储体内部不必设置冗余块,在不存在坏块时,存储器末尾的好块仍然也可以被用到,加大了存储空间的利用率。As an embodiment, after determining a bad block of the memory, shielding the bad block, and preventing access to the bad block, the bad block confirming module 83 is further configured to: map the bad block address to a specified location, The other working block replaces the bad block; as an example, the bad block address may be sequentially mapped to the tail of the data area; thus, the redundant block may not be set inside the bank, and there is no bad block At the end of the memory, good blocks at the end of the memory can still be used, increasing the utilization of storage space.

作为一种实施方式,可以读取在非易失性存储区域中存储的所述存储器的可用空间大小,在存储器进行写数据时,可以先读取存储器中所述非易失性存储区域中存储的可用空间的大小,判断存储器的剩余容量是否满足待写数据的容量需求,当判定满足需求后再再进行写数据。As an implementation manner, the available space size of the memory stored in the non-volatile storage area may be read, and when the memory performs data writing, the non-volatile storage area in the memory may be read first. The size of the available space determines whether the remaining capacity of the memory satisfies the capacity requirement of the data to be written, and then writes the data after determining that the demand is satisfied.

实际应用中,首先由存储器控制器所属的主机发起访问存储器的操作;存储器控制器对比主机发起的访问块地址与所有保存在寄存器里的坏块地址;如果访问块地址与所有坏块地址不相同,则不进行块地址映射,进行正常的数据访问;如果访问块地址与某个坏块地址相同,则认为主机当前访问的存储器的块存在坏块,将对应的坏块标记位置位,表示当前块是坏块,并且进行地址映射;存储器控制器根据坏块标记位将坏块地址映射到存储器末尾相应的块;如果当前被映射的块也是坏块,那就再映射到当前被映射块之前的块,直到映射到好块为止,这里之前是指从末尾向头的方向。这样,可以防止主机访问到坏块,从而使读出的数据错误。In practical applications, the operation of accessing the memory is first initiated by the host to which the memory controller belongs; the memory controller compares the address of the access block initiated by the host with all the bad block addresses stored in the register; if the access block address is different from all bad block addresses , the block address mapping is not performed, normal data access is performed; if the access block address is the same as a bad block address, the block of the memory currently accessed by the host is considered to have a bad block, and the corresponding bad block mark is set to indicate the current The block is a bad block and performs address mapping; the memory controller maps the bad block address to the corresponding block at the end of the memory according to the bad block flag bit; if the currently mapped block is also a bad block, then maps to the current mapped block The block until it is mapped to a good block, here before refers to the direction from the end to the head. In this way, the host can be prevented from accessing the bad block, thereby making the read data incorrect.

其中,对坏块进行映射具体结构如图4所示,图4中,存储器中有m个坏块,如图4中的Bad Sector 1~Bad Sector m,映射块会是存储器末尾的m个块Sector n~Sector n-m+1。当主机访问Bad Sector 1的时候,将地址映射到Sector n上,即主机虽然发起访问的地址是Bad Sector 1的地址,但实际访问的是Sector n,当主机访问Bad Sector 2的时候,将地址映射到Sector n-1上,同理当访问Bad Sector m的时候将地址映射到Sector n-m+1上,从 而形成图4右侧的新的访问阵列。The specific structure of mapping the bad block is shown in FIG. 4. In FIG. 4, there are m bad blocks in the memory, such as Bad Sector 1 to Bad Sector m in FIG. 4, and the mapping block will be m blocks at the end of the memory. Sector n~Sector n-m+1. When the host accesses Bad Sector 1, the address is mapped to Sector n. That is, although the host initiates access to the address of Bad Sector 1, the actual access is Sector n. When the host accesses Bad Sector 2, the address is addressed. Map to Sector n-1. Similarly, when accessing Bad Sector m, the address is mapped to Sector n-m+1. The new access array on the right side of Figure 4 is formed.

在实际应用中,所述划分模块81、块信息确定模块82和坏块确认模块83可以由存储器的控制芯片或硬件逻辑等实现。In practical applications, the partitioning module 81, the block information determining module 82, and the bad block confirming module 83 may be implemented by a control chip or hardware logic of the memory or the like.

本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例所述的存储器块处理方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the memory block processing method according to the embodiment of the invention.

具体的,该计算机可执行指令被处理器运行时,执行:将存储器的存储区域划分为数据区域和非易失性存储区域;确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到所述非易失性存储区域;在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。Specifically, when the computer executable instruction is executed by the processor, performing: dividing the storage area of the memory into a data area and a non-volatile storage area; determining a bad block in the memory, obtaining information corresponding to the bad block, The bad block information is stored in the non-volatile storage area; during the use of the memory, determining the bad block in the memory according to the bad block information stored in the non-volatile storage area, and shielding the Describe the access of bad blocks.

作为一种实施方式,该计算机可执行指令被处理器运行时,执行:将所述存储器的可用空间大小存储到所述非易失性存储区域。As an embodiment, when the computer executable instructions are executed by the processor, performing: storing the available space size of the memory to the non-volatile storage area.

本实施例中,该计算机可执行指令被处理器运行时,执行:将预设信息写入所述存储器的数据区域;读取所述数据区域中的信息,将读取的信息与所述预设信息进行对比,将比对结果匹配的信息对应地址所在块确定为坏块;和/或,所述存储器被擦除后读取所述存储器中数据区域的信息,将所述数据区域的信息中与预设初始信息不匹配的信息对应地址所在块确定为坏块。In this embodiment, when the computer executable instruction is executed by the processor, executing: writing preset information into a data area of the memory; reading information in the data area, and reading the information and the pre- The information is compared, and the block corresponding to the address corresponding to the matching result is determined as a bad block; and/or, after the memory is erased, the information of the data area in the memory is read, and the information of the data area is The block in which the corresponding address of the information that does not match the preset initial information is determined to be a bad block.

作为一种实施方式,该计算机可执行指令被处理器运行时,执行:将所述坏块地址映射到所述存储器中指定位置。As an embodiment, when the computer executable instructions are executed by the processor, executing: mapping the bad block address to a specified location in the memory.

作为一种实施方式,该计算机可执行指令被处理器运行时,执行:从所述存储器的数据区域的尾部开始依次映射所述坏块。As an embodiment, when the computer executable instructions are executed by the processor, performing: mapping the bad blocks in order from the tail of the data region of the memory.

在本发明所提供的几个实施例中,应该理解到,所揭露的方法及装置,可以通过其他的方式实现。以上所描述的装置实施例仅仅是示意性的,例 如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个模块或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的通信连接可以是通过一些接口,设备或模块的间接耦合或通信连接,可以是电性的、机械的或其他形式的。In the several embodiments provided by the present invention, it should be understood that the disclosed method and apparatus may be implemented in other manners. The device embodiments described above are merely illustrative, examples For example, the division of the module is only a logical function division, and the actual implementation may have another division manner, for example, multiple modules or components may be combined, or may be integrated into another system, or some features may be ignored. Or not. In addition, the communication connections between the various components shown or discussed may be indirect coupling or communication connections through some interfaces, devices or modules, and may be electrical, mechanical or otherwise.

上述作为分离部件说明的模块可以是、或也可以不是物理上分开的,作为模块显示的部件可以是、或也可以不是物理模块,即可以位于一个地方,也可以分布到多个网络模块上;可以根据实际的需要选择其中的部分或全部模块来实现本实施例方案的目的。The modules described above as separate components may or may not be physically separated. The components displayed as modules may or may not be physical modules, that is, may be located in one place or distributed to multiple network modules; Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.

另外,在本发明各实施例中的各功能模块可以全部集成在一个处理模块中,也可以是各模块分别单独作为一个模块,也可以两个或两个以上模块集成在一个模块中;上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may be separately used as one module, or two or more modules may be integrated into one module; The module can be implemented in the form of hardware or in the form of hardware plus software function modules.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。It will be understood by those skilled in the art that all or part of the steps of implementing the foregoing method embodiments may be performed by hardware related to program instructions. The foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium includes: a removable storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and the like, which can store program codes.

或者,本发明实施例上述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光 盘等各种可以存储程序代码的介质。Alternatively, the above-described integrated module of the embodiment of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions. A computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a mobile storage device, a ROM, a disk, or a light. A medium such as a disk that can store program code.

本发明实施例中记载的存储器切换方法、装置只以上述实施例为例,但不仅限于此,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。The memory switching method and apparatus described in the embodiments of the present invention are only exemplified by the foregoing embodiments, but are not limited thereto, and those skilled in the art should understand that the technical solutions described in the foregoing embodiments may still be modified. Equivalent replacement of some or all of the technical features may be made without departing from the scope of the technical solutions of the embodiments of the present invention.

以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.

工业实用性Industrial applicability

本发明实施例的技术方案实现了在存储器处于使用过程中可以将坏块信息存储到非易失性存储区域,以便存储器后续使用中读取,并且由于坏块信息存储在非易失性存储区域,不易在数据区域擦除过程中受影响,简化了操作,提高块管理的便捷性,提升块管理效率。 The technical solution of the embodiment of the present invention implements that the bad block information can be stored in the non-volatile storage area during the use of the memory, so that the memory is read in subsequent use, and the bad block information is stored in the non-volatile storage area. It is not easy to be affected in the data area erasing process, which simplifies the operation, improves the convenience of block management, and improves the block management efficiency.

Claims (11)

一种存储器块处理方法,将存储器的存储区域划分为数据区域和非易失性存储区域;所述方法还包括:A memory block processing method, which divides a storage area of a memory into a data area and a non-volatile storage area; the method further includes: 确定存储器中的坏块,获得所述坏块对应的信息,将坏块信息存储到所述非易失性存储区域;Determining a bad block in the memory, obtaining information corresponding to the bad block, and storing the bad block information in the non-volatile storage area; 在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。While the memory is in use, determining a bad block in the memory according to the bad block information stored in the non-volatile storage area, and shielding access of the bad block. 根据权利要求1所述的方法,其中,所述方法还包括:将所述存储器的可用空间大小存储到所述非易失性存储区域。The method of claim 1, wherein the method further comprises storing the available space size of the memory to the non-volatile storage area. 根据权利要求1所述的方法,其中,所述确定存储器中的坏块,包括:将预设信息写入所述存储器的数据区域;读取所述数据区域中的信息,将读取的信息与所述预设信息进行对比,将比对结果匹配的信息对应地址所在块确定为坏块;和/或,The method of claim 1, wherein said determining a bad block in the memory comprises: writing preset information to a data area of said memory; reading information in said data area, reading the information Comparing with the preset information, determining, as a bad block, a block corresponding to the address corresponding to the information matching the comparison result; and/or, 所述存储器被擦除后读取所述存储器中数据区域的信息,将所述数据区域的信息中与预设初始信息不匹配的信息对应地址所在块确定为坏块。After the memory is erased, the information of the data area in the memory is read, and the block of the information corresponding to the information that does not match the preset initial information in the information of the data area is determined as a bad block. 根据权利要求1至3任一项所述的方法,其中,所述方法还包括:将所述坏块地址映射到所述存储器中指定位置。The method of any of claims 1 to 3, wherein the method further comprises mapping the bad block address to a specified location in the memory. 根据权利要求4所述的方法,其中,所述将坏块地址映射到存储器中指定位置,包括:从所述存储器的数据区域的尾部开始依次映射所述坏块。The method of claim 4 wherein said mapping said bad block address to a specified location in memory comprises mapping said bad block in order from a tail of said data region of said memory. 一种存储器块处理装置,所述装置包括:划分模块、块信息确定模块和坏块确认模块;其中,A memory block processing device, the device comprising: a partitioning module, a block information determining module, and a bad block confirming module; wherein 所述划分模块,配置为将存储器的存储区域划分为数据区域和非易失性存储区域;The dividing module is configured to divide a storage area of the memory into a data area and a non-volatile storage area; 所述块信息确定模块,配置为确定存储器中的坏块,获得所述坏块对 应的信息,将坏块信息存储到所述非易失性存储区域;The block information determining module is configured to determine a bad block in the memory to obtain the bad block pair Information that stores bad block information to the non-volatile storage area; 所述坏块确认模块,配置为在所述存储器处于使用过程中,根据所述非易失性存储区域存储的所述坏块信息,确定存储器中的坏块,并屏蔽所述坏块的访问。The bad block confirmation module is configured to determine a bad block in the memory according to the bad block information stored in the non-volatile storage area, and block access of the bad block during use of the memory . 根据权利要求6所述的装置,其中,所述块信息确定模块,还配置为将所述存储器的可用空间大小存储到所述非易失性存储区域。The apparatus of claim 6, wherein the block information determining module is further configured to store a free space size of the memory to the non-volatile storage area. 根据权利要求6所述的装置,其中,所述块信息确定模块,配置为:将预设信息写入所述数据区域,读取所述数据区域中的信息,将读取的信息与所述预设信息进行对比,将比对结果匹配的信息对应地址所在块确定为坏块;和/或,The apparatus according to claim 6, wherein the block information determining module is configured to: write preset information into the data area, read information in the data area, and read the read information The preset information is compared, and the block corresponding to the address corresponding to the matching result is determined as a bad block; and/or, 所述存储器被擦除后读取所述数据区域的信息,将所述数据区域的信息中与预设初始信息不匹配的信息对应地址所在块确定为坏块。After the memory is erased, the information of the data area is read, and the block of the information corresponding to the information that does not match the preset initial information in the information of the data area is determined as a bad block. 根据权利要求6至8任一项所述的装置,其中,所述坏块确认模块,还配置为:将所述坏块地址映射到指定位置。The apparatus of any one of claims 6 to 8, wherein the bad block confirmation module is further configured to map the bad block address to a specified location. 根据权利要求9所述的装置,其中,所述坏块确认模块,配置为:从所述数据区域的尾部开始依次映射所述坏块。The apparatus of claim 9, wherein the bad block confirmation module is configured to map the bad blocks in order from a tail of the data area. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1至5任一项所述的存储器块处理方法。 A computer storage medium having stored therein computer executable instructions for performing the memory block processing method of any one of claims 1 to 5.
PCT/CN2017/094295 2016-08-29 2017-07-25 Memory block processing method and device, and computer storage medium Ceased WO2018040804A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610754612.9A CN107783723A (en) 2016-08-29 2016-08-29 A kind of memory block treating method and apparatus
CN201610754612.9 2016-08-29

Publications (1)

Publication Number Publication Date
WO2018040804A1 true WO2018040804A1 (en) 2018-03-08

Family

ID=61299961

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/094295 Ceased WO2018040804A1 (en) 2016-08-29 2017-07-25 Memory block processing method and device, and computer storage medium

Country Status (2)

Country Link
CN (1) CN107783723A (en)
WO (1) WO2018040804A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114911719A (en) * 2022-05-10 2022-08-16 南京英锐创电子科技有限公司 Memory data access method and device and computer equipment
CN116264096A (en) * 2022-12-28 2023-06-16 深圳市芯睿视科技有限公司 A bad block detection method, computer program product and electronic equipment

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113253934B (en) * 2021-05-28 2024-07-19 深圳市汇春科技股份有限公司 Flash bad block processing method and device, computer equipment and readable storage medium
CN115171756B (en) * 2022-07-21 2025-10-17 安徽华米信息科技有限公司 Data access method and device of terminal equipment, electronic equipment and storage medium
CN119271133A (en) * 2024-09-23 2025-01-07 成都佰维存储科技有限公司 Storage space allocation method, device and solid state hard disk

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030167372A1 (en) * 2002-03-04 2003-09-04 Samsung Electronics Co., Ltd. Semiconductor memory device with a flexible redundancy scheme
CN101131870A (en) * 2006-08-24 2008-02-27 三星电子株式会社 Flash memory device including block information block and method of operating the flash memory device
CN103778065A (en) * 2012-10-25 2014-05-07 北京兆易创新科技股份有限公司 Flash memory and bad block managing method thereof
CN104461750A (en) * 2013-09-25 2015-03-25 北京兆易创新科技股份有限公司 Method and device for accessing NAND flash

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944065B (en) * 2010-08-24 2012-07-04 苏州国芯科技有限公司 Flash memory bad block shielding method based on section
CN103544112B (en) * 2013-10-17 2016-08-17 Tcl通讯(宁波)有限公司 The memory bad block processing method of a kind of mobile terminal and mobile terminal
CN104317753B (en) * 2014-10-21 2017-09-22 中国科学院上海微系统与信息技术研究所 Storage device and its data read-write method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030167372A1 (en) * 2002-03-04 2003-09-04 Samsung Electronics Co., Ltd. Semiconductor memory device with a flexible redundancy scheme
CN101131870A (en) * 2006-08-24 2008-02-27 三星电子株式会社 Flash memory device including block information block and method of operating the flash memory device
CN103778065A (en) * 2012-10-25 2014-05-07 北京兆易创新科技股份有限公司 Flash memory and bad block managing method thereof
CN104461750A (en) * 2013-09-25 2015-03-25 北京兆易创新科技股份有限公司 Method and device for accessing NAND flash

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114911719A (en) * 2022-05-10 2022-08-16 南京英锐创电子科技有限公司 Memory data access method and device and computer equipment
CN116264096A (en) * 2022-12-28 2023-06-16 深圳市芯睿视科技有限公司 A bad block detection method, computer program product and electronic equipment

Also Published As

Publication number Publication date
CN107783723A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
US10860247B2 (en) Data writing method and storage controller
US20250199725A1 (en) Memory system and information processing system
US9176865B2 (en) Data writing method, memory controller, and memory storage device
US11288019B2 (en) Memory management method and storage controller
TWI551991B (en) Method and system for memory management and memory storage device thereof
US8392797B2 (en) Error correcting controller, flash memory chip system, and error correcting method thereof
US20100180145A1 (en) Data accessing method for flash memory, and storage system and controller system thereof
JP2004118407A (en) Nonvolatile semiconductor storage device
WO2018040804A1 (en) Memory block processing method and device, and computer storage medium
TWI584291B (en) Memory management method, memory control circuit unit and memory storage device
TW201709069A (en) Data protecting method, memory control circuit unit and memory storage apparatus
CN102541469A (en) Method, equipment and system for protecting data in firmware storage system
US20090259796A1 (en) Data writing method for non-volatile memory and storage system and controller using the same
CN106814968B (en) Memory management method and system and memory storage device thereof
US9367390B2 (en) Memory controlling method, memory storage device and memory controlling circuit unit
US8607123B2 (en) Control circuit capable of identifying error data in flash memory and storage system and method thereof
TW202008166A (en) Memory management method and storage controller
JP2000011677A (en) Flash memory system
TWI712052B (en) Memory management method, storage controller and storage device
TWI651650B (en) Memory management method and storage controller using the same
TWI616807B (en) Data writing method and storage controller
US20130019142A1 (en) Memory storage device, memory controller thereof, and method for programming data thereof
TWI814501B (en) Mapping table re-building method, memory storage device and memory control circuit unit
CN114822664B (en) Risk assessment method based on data priority, storage device and control circuit
CN108108118B (en) Data writing method and storage controller

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17845106

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17845106

Country of ref document: EP

Kind code of ref document: A1