[go: up one dir, main page]

CN118553297A - Bit flip detection method, device, electronic device and medium - Google Patents

Bit flip detection method, device, electronic device and medium Download PDF

Info

Publication number
CN118553297A
CN118553297A CN202410621359.4A CN202410621359A CN118553297A CN 118553297 A CN118553297 A CN 118553297A CN 202410621359 A CN202410621359 A CN 202410621359A CN 118553297 A CN118553297 A CN 118553297A
Authority
CN
China
Prior art keywords
flash memory
test file
file
data
target area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410621359.4A
Other languages
Chinese (zh)
Inventor
程正勇
梁积
钟兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
TP Link Technologies Co Ltd
Original Assignee
TP Link Technologies 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 TP Link Technologies Co Ltd filed Critical TP Link Technologies Co Ltd
Priority to CN202410621359.4A priority Critical patent/CN118553297A/en
Publication of CN118553297A publication Critical patent/CN118553297A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C29/00Checking stores for correct operation ; Subsequent repair; Testing stores during standby or offline operation
    • G11C29/04Detection or location of defective memory elements, e.g. cell constructio details, timing of test signals
    • G11C29/08Functional testing, e.g. testing during refresh, power-on self testing [POST] or distributed testing
    • G11C29/12Built-in arrangements for testing, e.g. built-in self testing [BIST] or interconnection details
    • G11C29/38Response verification devices
    • G11C29/42Response verification devices using error correcting codes [ECC] or parity check
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C29/00Checking stores for correct operation ; Subsequent repair; Testing stores during standby or offline operation
    • G11C29/04Detection or location of defective memory elements, e.g. cell constructio details, timing of test signals
    • G11C29/08Functional testing, e.g. testing during refresh, power-on self testing [POST] or distributed testing

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)

Abstract

本申请适用于设备检测技术领域,提供了位翻转的检测方法、装置、电子设备和介质,该检测方法包括:从闪存中读取第一测试文件和第二测试文件;第一测试文件为ECC检验功能开启的情况下得到,第二测试文件为ECC检验功能关闭的情况下得到;将闪存划分为多个子区;对第一测试文件的目标区域内的文件数据和第二测试文件的目标区域内的文件数据进行对比,得到闪存的位翻转信息;目标区域为多个子区中的任意一个或多个子区。本申请实现了位翻转的检测,支持对闪存内的部分区域进行检测,有助于提高方案的灵活性。

The present application is applicable to the field of equipment detection technology, and provides a bit flip detection method, device, electronic device and medium. The detection method includes: reading a first test file and a second test file from a flash memory; the first test file is obtained when the ECC check function is turned on, and the second test file is obtained when the ECC check function is turned off; the flash memory is divided into multiple sub-areas; the file data in the target area of the first test file is compared with the file data in the target area of the second test file to obtain the bit flip information of the flash memory; the target area is any one or more sub-areas of the multiple sub-areas. The present application realizes the detection of bit flips, supports the detection of partial areas in the flash memory, and helps to improve the flexibility of the solution.

Description

位翻转的检测方法、装置、电子设备和介质Bit flip detection method, device, electronic device and medium

技术领域Technical Field

本申请属于设备检测技术领域,尤其涉及位翻转的检测方法、装置、电子设备和介质。The present application belongs to the field of device detection technology, and in particular, relates to a bit flip detection method, device, electronic device and medium.

背景技术Background Art

目前,所有的闪存器件都受位翻转现象的困扰,所谓位翻转(bit flip)指的是,由于闪存电学特性的局限,在闪存被多次擦写之后,原先闪存中的某个存储位的数据值可能会发生翻转。如果不对闪存进行针对性的调整和改善,那么在使用过程中,会出现很多位翻转错误。当闪存用于存储配置文件和其他敏感信息时,闪存的位翻转现象会导致系统崩溃,因此,需要检测出闪存发生位翻转后的详细情况。At present, all flash memory devices are troubled by the bit flip phenomenon. The so-called bit flip means that due to the limitations of the electrical characteristics of flash memory, after the flash memory is erased and written many times, the data value of a storage bit in the original flash memory may flip. If the flash memory is not adjusted and improved in a targeted manner, many bit flip errors will occur during use. When the flash memory is used to store configuration files and other sensitive information, the bit flip phenomenon of the flash memory will cause the system to crash. Therefore, it is necessary to detect the details of the flash memory after the bit flip occurs.

发明内容Summary of the invention

本申请实施例提供了位翻转的检测方法、装置、电子设备和介质,可以解决位翻转检测问题。The embodiments of the present application provide a bit flip detection method, device, electronic device and medium, which can solve the problem of bit flip detection.

第一方面,本申请实施例提供了一种位翻转的检测方法,包括:In a first aspect, an embodiment of the present application provides a method for detecting a bit flip, comprising:

从所述闪存中读取第一测试文件和第二测试文件;所述第一测试文件为ECC检验功能开启的情况下得到,所述第二测试文件为所述ECC检验功能关闭的情况下得到;Reading a first test file and a second test file from the flash memory; the first test file is obtained when the ECC check function is turned on, and the second test file is obtained when the ECC check function is turned off;

将所述闪存划分为多个子区;Dividing the flash memory into a plurality of sub-areas;

对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比,得到所述闪存的位翻转信息;所述目标区域为所述多个子区中的任意一个或多个子区。The file data in the target area of the first test file is compared with the file data in the target area of the second test file to obtain the bit flip information of the flash memory; the target area is any one or more sub-areas of the multiple sub-areas.

本申请实施例通过ECC的开启和关闭分别从闪存中读取存在位翻转的文件和位翻转被校正后的文件,然后对闪存进行划分得到多个子区,从多个子区中获取目标区域,然后将不同文件在同个目标区域的数据进行对比,最终得到闪存的位翻转信息,从而实现了位翻转的检测,支持对闪存内的部分区域进行检测,有助于提高方案的灵活性。The embodiment of the present application reads files with bit flips and files with corrected bit flips from the flash memory by turning ECC on and off, then divides the flash memory into multiple sub-areas, obtains the target area from the multiple sub-areas, and then compares the data of different files in the same target area, and finally obtains the bit flip information of the flash memory, thereby realizing the detection of bit flips, supporting the detection of partial areas in the flash memory, and helping to improve the flexibility of the solution.

在第一方面的一种可能的实现方式中,所述对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比,得到所述闪存的位翻转信息的步骤包括:In a possible implementation manner of the first aspect, the step of comparing the file data in the target area of the first test file with the file data in the target area of the second test file to obtain the bit flip information of the flash memory includes:

将所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行异或运算,记录数据不一致时的异常位;Performing an XOR operation on the file data in the target area of the first test file and the file data in the target area of the second test file, and recording an abnormal bit when the data are inconsistent;

根据所述目标区域中的异常位个数和异常位地址得到所述闪存的位翻转信息。The bit flip information of the flash memory is obtained according to the number of abnormal bits and the abnormal bit addresses in the target area.

本申请实施例在比较两个文件的数据时使用异或运算的方式进行对比,极大的提高了对比效率。The embodiment of the present application uses an XOR operation to perform comparison when comparing data of two files, which greatly improves the comparison efficiency.

在第一方面的一种可能的实现方式中,所述根据所述目标区域中的异常位个数和所述异常位的地址得到所述闪存的位翻转信息的步骤包括:In a possible implementation manner of the first aspect, the step of obtaining the bit flip information of the flash memory according to the number of abnormal bits in the target area and the addresses of the abnormal bits includes:

当所述目标区域的子区数量为多个时,将所述目标区域中每个子区的所述异常位个数和所述异常位地址确定为所述闪存的位翻转信息;When the number of sub-areas in the target area is multiple, determining the number of abnormal bits and the abnormal bit address of each sub-area in the target area as the bit flip information of the flash memory;

确定异常位个数最多的目标子区,将所述目标子区的起始位地址确定为所述闪存的位翻转信息。A target sub-area having the largest number of abnormal bits is determined, and a starting bit address of the target sub-area is determined as the bit flip information of the flash memory.

本申请实施例可以统计出每个子区里的位翻转信息,从而得到位翻转的布局信息,便于定位,并且本申请实施例对不同子区的位翻转信息进行比较,筛选异常位个数最多的目标子区,便于后续进行针对性的调整和改善。The embodiment of the present application can count the bit flip information in each sub-area, thereby obtaining the layout information of the bit flip, which is convenient for positioning. The embodiment of the present application compares the bit flip information of different sub-areas, and selects the target sub-area with the largest number of abnormal bits, which is convenient for subsequent targeted adjustments and improvements.

在第一方面的一种可能的实现方式中,在所述对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比的步骤之前,所述位翻转的检测方法还包括:In a possible implementation manner of the first aspect, before the step of comparing the file data in the target area of the first test file with the file data in the target area of the second test file, the bit flip detection method further includes:

识别闪存中的坏块,若所述目标区域存在坏块,则从所述闪存中除所述目标区域以外的非目标区域中确定除坏块以外的替换块;Identify bad blocks in the flash memory, and if the target area has bad blocks, determine replacement blocks other than the bad blocks from non-target areas other than the target area in the flash memory;

将所述坏块的数据转存至所述替换块。The data of the bad block is transferred to the replacement block.

本申请可以筛选出闪存中出现的坏块,排除坏块导致的结果异常问题,提高鲁棒性。This application can screen out bad blocks appearing in the flash memory, eliminate abnormal results caused by bad blocks, and improve robustness.

在第一方面的一种可能的实现方式中,所述位翻转的检测方法还包括:In a possible implementation manner of the first aspect, the bit flip detection method further includes:

获取与所述闪存对应的原始测试文件,以及将所述原始测试文件写入所述闪存后从所述闪存中读取的目标测试文件;Acquire an original test file corresponding to the flash memory, and a target test file read from the flash memory after writing the original test file into the flash memory;

对所述原始测试文件的所述目标区域内的文件数据和所述目标测试文件的目标区域内的文件数据进行对比,得到所述闪存的位翻转信息;所述目标测试文件包括所述第一测试文件和所述第二测试文件中的至少一个。The file data in the target area of the original test file is compared with the file data in the target area of the target test file to obtain the bit flip information of the flash memory; the target test file includes at least one of the first test file and the second test file.

本申请实施例可以通过原始测试文件作为判断标准来和从所述闪存中读取的目标测试文件进行比较,在ECC校准能力有限时可以全方位的比较闪存出现位翻转的情况,得到的位翻转信息更加全面准确,另外不仅可以知道闪存哪些位置容易发生位翻转,还能测试出ECC的检验功能大小。The embodiment of the present application can use the original test file as a judgment standard to compare with the target test file read from the flash memory. When the ECC calibration capability is limited, the bit flipping situation of the flash memory can be compared in an all-round way. The obtained bit flipping information is more comprehensive and accurate. In addition, not only can it be known which positions of the flash memory are prone to bit flipping, but also the size of the ECC inspection function can be tested.

在第一方面的一种可能的实现方式中,在所述对所述原始测试文件的所述目标区域内的文件数据和所述目标测试文件的目标区域内的文件数据进行对比的步骤之前,所述位翻转的检测方法还包括:In a possible implementation manner of the first aspect, before the step of comparing the file data in the target area of the original test file with the file data in the target area of the target test file, the bit flip detection method further includes:

获取所述闪存的存储数据量和所述原始测试文件的文件数据量;Acquire the storage data volume of the flash memory and the file data volume of the original test file;

基于所述存储数据量和所述文件数据量计算得到填充数据量;Calculate the filling data amount based on the storage data amount and the file data amount;

根据所述填充数据量向所述原始测试文件填充额外数据。The original test file is filled with additional data according to the amount of filled data.

本申请实施例可以确保原始测试文件和要对比的目标测试文件的数据大小是一致的,避免结果产生差异。The embodiment of the present application can ensure that the data size of the original test file and the target test file to be compared are consistent, thereby avoiding differences in the results.

在第一方面的一种可能的实现方式中,在所述从所述闪存中读取第一测试文件和第二测试文件的步骤之前,所述位翻转的检测方法还包括:In a possible implementation manner of the first aspect, before the step of reading the first test file and the second test file from the flash memory, the bit flip detection method further includes:

对所述闪存进行场景化处理;所述场景化处理包括老化处理、置于温度大于第一温度阈值的物理环境内、置于温度小于第二温度阈值的物理环境内和置于湿度大于湿度阈值的物理环境内中的至少一个。The flash memory is subjected to scenario-based processing; the scenario-based processing includes at least one of aging processing, placing in a physical environment with a temperature greater than a first temperature threshold, placing in a physical environment with a temperature less than a second temperature threshold, and placing in a physical environment with a humidity greater than a humidity threshold.

本申请实施例可以检测闪存在经历不同场景下,可能出现的位翻转情况,使得闪存的位翻转信息更加全面。The embodiments of the present application can detect bit flipping situations that may occur in a flash memory under different scenarios, thereby making the bit flipping information of the flash memory more comprehensive.

在第一方面的一种可能的实现方式中,所述将所述闪存划分为多个子区的步骤包括:In a possible implementation manner of the first aspect, the step of dividing the flash memory into a plurality of sub-areas includes:

根据所述闪存的预设结构信息将所述闪存进行划分,得到多个页;所述预设结构信息表征所述闪存的页数量;Dividing the flash memory according to preset structural information of the flash memory to obtain a plurality of pages; the preset structural information represents the number of pages of the flash memory;

若所述页的大小大于所述子区的预设大小,则根据所述子区的预设大小将所述页划分为多个子区;If the size of the page is larger than the preset size of the sub-area, dividing the page into a plurality of sub-areas according to the preset size of the sub-area;

若所述页的大小小于或等于所述子区的预设大小,则将所述页确定为所述子区,则将所述页确定为所述子区。If the size of the page is smaller than or equal to the preset size of the sub-region, the page is determined as the sub-region.

本申请实施例可以根据闪存的结构信息作为划分标准,不仅使得划分的结果更加合理,而且可以确保两个文件的布局是一致的,避免因为布局不同导致比较结果产生较大的差异。In the embodiment of the present application, the structural information of the flash memory can be used as a division standard, which not only makes the division result more reasonable, but also ensures that the layouts of the two files are consistent, thereby avoiding large differences in comparison results due to different layouts.

第二方面,本申请实施例提供了一种位翻转的检测装置,包括:In a second aspect, an embodiment of the present application provides a bit flip detection device, comprising:

获取模块,用于从所述闪存中读取第一测试文件和第二测试文件;所述第一测试文件为ECC检验功能开启的情况下得到,所述第二测试文件为所述ECC检验功能关闭的情况下得到;An acquisition module, used for reading a first test file and a second test file from the flash memory; the first test file is obtained when the ECC check function is turned on, and the second test file is obtained when the ECC check function is turned off;

划分模块,用于将所述闪存划分为多个子区;A partitioning module, used for partitioning the flash memory into a plurality of sub-areas;

检测模块,用于对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比,得到所述闪存的位翻转信息;所述目标区域为所述多个子区中的任意一个或多个子区。The detection module is used to compare the file data in the target area of the first test file with the file data in the target area of the second test file to obtain the bit flip information of the flash memory; the target area is any one or more sub-areas of the multiple sub-areas.

第三方面,本申请实施例提供了一种电子设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述第一方面中任一项所述的位翻转的检测方法。In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the bit flip detection method described in any one of the first aspects when executing the computer program.

第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面中任一项所述的位翻转的检测方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for detecting a bit flip described in any one of the above-mentioned first aspects is implemented.

第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面中任一项所述的位翻转的检测方法。In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the bit flip detection method described in any one of the above-mentioned first aspects.

可以理解的是,上述第二方面至第五方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

图1是本申请一实施例提供的位翻转的检测方法的流程示意图;FIG1 is a schematic flow chart of a method for detecting a bit flip provided in an embodiment of the present application;

图2是本申请一实施例提供的闪存的结构示意图;FIG2 is a schematic diagram of the structure of a flash memory provided by an embodiment of the present application;

图3是本申请一实施例提供的闪存的存储布局示意图;FIG3 is a schematic diagram of a storage layout of a flash memory provided by an embodiment of the present application;

图4是本申请另一实施例提供的位翻转的检测方法中步骤S12的流程示意图;FIG4 is a schematic flow chart of step S12 in a bit flip detection method provided in another embodiment of the present application;

图5是本申请另一实施例提供的位翻转的检测方法中步骤S13的流程示意图;FIG5 is a schematic flow chart of step S13 in a bit flip detection method provided in another embodiment of the present application;

图6是本申请另一实施例提供的位翻转的检测方法中识别坏块的流程示意图;FIG6 is a schematic diagram of a process for identifying bad blocks in a bit flip detection method provided by another embodiment of the present application;

图7是本申请另一实施例提供的位翻转的检测方法的流程示意图;FIG7 is a schematic flow chart of a method for detecting a bit flip provided in another embodiment of the present application;

图8是本申请另一实施例提供的位翻转的检测方法中填充额外数据的流程示意图;FIG8 is a schematic diagram of a flow chart of filling additional data in a bit flip detection method provided in another embodiment of the present application;

图9是本申请实施例提供的位翻转的检测装置的结构示意图;FIG9 is a schematic diagram of the structure of a bit flip detection device provided in an embodiment of the present application;

图10是本申请实施例提供的电子设备的结构示意图。FIG. 10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and/or combinations thereof.

还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be understood that the term “and/or” used in the specification and appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

图1示出了本申请提供的位翻转的检测方法的示意性流程图,作为示例而非限定,该方法可以包括以下步骤:FIG1 shows a schematic flow chart of a bit flip detection method provided by the present application. As an example but not a limitation, the method may include the following steps:

S11、从闪存中读取第一测试文件和第二测试文件。S11. Read a first test file and a second test file from a flash memory.

其中,第一测试文件为ECC检验功能开启的情况下得到,第二测试文件为ECC检验功能关闭的情况下得到,ECC检验功能用于对发生位翻转的数据进行校正。The first test file is obtained when the ECC check function is turned on, and the second test file is obtained when the ECC check function is turned off. The ECC check function is used to correct data with bit flipping.

具体地,第一测试文件和第二测试文件均为二进制文件,例如bin文件等。第二测试文件可以表征未校正的的数据,第一测试文件可以表征校正后的数据。Specifically, both the first test file and the second test file are binary files, such as bin files, etc. The second test file may represent uncorrected data, and the first test file may represent corrected data.

具体地,由于闪存(NAND FLASH,快闪存储器)的物理特性使得其数据读写过程中会发生一定几率的错误,所以要有个对应的错误检测和纠正的机制,ECC即可用于数据错误的检测与纠正。对于闪存中的ECC,常见的算法有海明码和BCH,这类算法的实现,可以根据自己的需求,采用对应的软件或者是硬件。Specifically, due to the physical characteristics of NAND FLASH, a certain probability of error will occur during the data reading and writing process, so there must be a corresponding error detection and correction mechanism, and ECC can be used to detect and correct data errors. For ECC in flash memory, common algorithms include Hamming code and BCH. The implementation of such algorithms can use corresponding software or hardware according to your needs.

需要说明的是,ECC通常是默认开启的,ECC校准功能不会将发生位翻转的bit复原回去,只会在读取该闪存时,将校准后的数据返回给读取的用户而已,实际闪存中的值并没有变化,也就是说开启ECC功能,只会使得读取出来的值被校准,实际闪存中发生位翻转的bit位并不会被实际翻转回正常的值。It should be noted that ECC is usually enabled by default. The ECC calibration function will not restore the bit that has been flipped. It will only return the calibrated data to the user when reading the flash memory. The actual value in the flash memory has not changed. In other words, enabling the ECC function will only calibrate the read value, and the bit that has been flipped in the actual flash memory will not be actually flipped back to the normal value.

例如,假设一个闪存中的原始数据为0x1234,然后在闪存中发生了位翻转,此时闪存中的数据为0x1F34,也就是2(0010)翻转成为了F(1111),翻转了3位。此时如果开启闪存的ECC校准功能,在闪存的ECC纠正范围内,那么读取出来的值就为0x1234,如果关闭闪存的ECC校准功能,那么读取闪存得到的值就是0x1F34。For example, suppose the original data in a flash memory is 0x1234, and then a bit flip occurs in the flash memory. At this time, the data in the flash memory is 0x1F34, that is, 2 (0010) flips to F (1111), flipping 3 bits. At this time, if the ECC calibration function of the flash memory is turned on, the value read out is 0x1234 within the ECC correction range of the flash memory. If the ECC calibration function of the flash memory is turned off, the value obtained by reading the flash memory is 0x1F34.

在一种可能的实现方式中,可以通过串口工具,来控制ECC校准功能的打开和关闭,从而进行比较。In a possible implementation, a serial port tool may be used to control the opening and closing of the ECC calibration function, thereby performing a comparison.

S12、将闪存划分为多个子区。S12, dividing the flash memory into a plurality of sub-areas.

需要说明的是,这里并不会影响闪存原有的结构和布局。It should be noted that this will not affect the original structure and layout of the flash memory.

在一种可能的实现方式中,可考虑到ECC校准功能和闪存的运算能力来设定划分的子区大小,例如,ECC一般为每256bytes为一组进行校验,那么可以以256bytes为最小单位,根据闪存的运算能力设定子区为n个256bytes,其中n为大于或等于1的正整数。作为示例而非限定,综合一些常用的闪存,当n为2,即将子区设为512bytes时,检测的效率是比较优的。In a possible implementation, the size of the divided sub-area can be set in consideration of the ECC calibration function and the computing power of the flash memory. For example, ECC generally performs verification in groups of 256 bytes, so 256 bytes can be used as the minimum unit, and the sub-area can be set to n 256 bytes according to the computing power of the flash memory, where n is a positive integer greater than or equal to 1. As an example and not a limitation, based on some commonly used flash memories, when n is 2, that is, the sub-area is set to 512 bytes, the detection efficiency is relatively good.

S13、对第一测试文件的目标区域内的文件数据和第二测试文件的目标区域内的文件数据进行对比,得到闪存的位翻转信息。S13: Compare the file data in the target area of the first test file and the file data in the target area of the second test file to obtain bit flip information of the flash memory.

其中,目标区域为多个子区中的任意一个或多个子区。具体地,可以理解为第二测试文件发生了位翻转,而第一测试文件作为标准答案,对比得到第二测试文件发生位翻转的详细情况,作为闪存的位翻转信息。Specifically, it can be understood that the second test file has a bit flip, and the first test file is used as the standard answer, and the details of the bit flip of the second test file are obtained by comparison as the bit flip information of the flash memory.

本申请实施例通过ECC的开启和关闭分别从闪存中读取存在位翻转的文件和位翻转被校正后的文件,然后对闪存进行划分得到多个子区,从多个子区中获取目标区域,然后将不同文件在同个目标区域的数据进行对比,最终得到闪存的位翻转信息,从而实现了位翻转的检测,支持对闪存内至少部分区域进行检测,有助于提高方案的灵活性。The embodiment of the present application reads files with bit flips and files with corrected bit flips from the flash memory by turning ECC on and off, then divides the flash memory into multiple sub-areas, obtains the target area from the multiple sub-areas, and then compares the data of different files in the same target area, and finally obtains the bit flip information of the flash memory, thereby realizing the detection of bit flips, supporting the detection of at least part of the area in the flash memory, and helping to improve the flexibility of the solution.

在一种可能的实现方式中,响应于数据准备的指令,可以准备多个闪存,获取对应每个闪存的第一测试文件和第二测试文件,从而提前准备多个测试文件并保存。具体地,对文件进行命令,然后按照命名来将文件放入对应的同一级目录下,以便于后续调取需要对比的文件。例如,假设文件为bin文件时,读取的测试文件可以是A_before_ecc.bin、A_after_ecc.bin、B_before_ecc.bin和B_after_ecc.bin等,其中以A开头的文件属于同一块闪存中的文件,可以放在一个目录下,同理B开头的文件也是。In one possible implementation, in response to the instruction of data preparation, multiple flash memories can be prepared, and the first test file and the second test file corresponding to each flash memory can be obtained, so as to prepare and save multiple test files in advance. Specifically, the file is commanded, and then the file is placed in the corresponding directory of the same level according to the naming, so as to facilitate the subsequent retrieval of the files that need to be compared. For example, assuming that the file is a bin file, the test files read can be A_before_ecc.bin, A_after_ecc.bin, B_before_ecc.bin and B_after_ecc.bin, etc., where the files starting with A belong to the same flash memory and can be placed in one directory, and the same is true for files starting with B.

在一种可能的实现方式中,在准备好测试文件后,响应于数据整理的指令,来比较需要对比的两个文件的总数据量是否一致,如果不一致,直接比较的话,会造成偏移位置不对,导致比较结果错误的情况,可以对数据较少的文件补充一些数据,从而确保有效数据区的偏移量是一致的。In one possible implementation, after preparing the test file, in response to the data sorting instruction, the total data volume of the two files to be compared is compared to see if they are consistent. If they are inconsistent, direct comparison will cause incorrect offset positions, resulting in erroneous comparison results. In this case, some data can be supplemented to the file with less data to ensure that the offset of the valid data area is consistent.

在一种可能的实现方式中,响应于划分的指令,对闪存进行划分,得到多个子区。In a possible implementation, in response to a partition instruction, the flash memory is partitioned to obtain a plurality of sub-areas.

在一种可能的实现方式中,参见图2,可以根据闪存的特性,将整个闪存内容按照一定的大小划分成多个块,然后每个块又按照一定的大小划分成页,从而便于寻址和划分区域。In a possible implementation, referring to FIG. 2 , the entire flash memory content may be divided into multiple blocks of a certain size according to the characteristics of the flash memory, and each block may be divided into pages of a certain size, thereby facilitating addressing and area division.

具体地,如图2所示,闪存的存储结构为:一个闪存由许多个block组成,一个block又是有许多个page组成,一个page又是由有效的数据区和spare area区(即OOB区)组成。Specifically, as shown in FIG. 2 , the storage structure of the flash memory is as follows: a flash memory is composed of many blocks, a block is composed of many pages, and a page is composed of a valid data area and a spare area (ie, OOB area).

在一种可能的实现方式中,闪存的一些区域可以忽略,例如存储了一下样机硬件信息,系统运行临时产生的缓存文件等不重要文件的区域,这些区域出现错误不会造成严重问题。为了进一步提高效率,响应于筛选的指令,从多个子区中筛选出部分子区作为目标区域。可选地,如果是检测闪存全部区域,也可以省略这一步,直接将闪存全部的有效数据区域作为目标区域。In a possible implementation, some areas of the flash memory can be ignored, such as areas storing prototype hardware information, cache files temporarily generated by system operation, and other unimportant files. Errors in these areas will not cause serious problems. In order to further improve efficiency, in response to the screening instruction, some sub-areas are screened out from multiple sub-areas as target areas. Optionally, if the entire area of the flash memory is to be detected, this step can also be omitted, and the entire valid data area of the flash memory can be directly used as the target area.

具体地,可以预先了解闪存的布局,了解每个区域起始地址和终止地址,存储的数据类型。作为示例,如图3所示的闪存被划分成了9个区域,可以看出上一个区域的终止地址也是下一个区域的起始地址,因此也可以只了解每个区域的起始地址即可,也能根据闪存总大小来划分闪存的不同区域。以图3为例,假设PARTITION_E、PARTITION_F、PARTITION_G这几个区域的内容存储了程序运行所必须的内容,如果该区域中的内容出现错误,就会出现难以预料的问题。那么对于图3中的闪存,PARTITION_E、PARTITION_F、PARTITION_G这几个区域均为目标区域。Specifically, you can know the layout of the flash memory in advance, understand the starting address and ending address of each area, and the type of data stored. As an example, the flash memory shown in Figure 3 is divided into 9 areas. It can be seen that the ending address of the previous area is also the starting address of the next area. Therefore, you only need to know the starting address of each area, and you can also divide the different areas of the flash memory according to the total size of the flash memory. Taking Figure 3 as an example, assuming that the contents of the PARTITION_E, PARTITION_F, and PARTITION_G areas store the content necessary for the program to run. If there is an error in the content of the area, unpredictable problems will occur. Then for the flash memory in Figure 3, the PARTITION_E, PARTITION_F, and PARTITION_G areas are all target areas.

在一种可能的实现方式中,比对数据时,为了提升效率,可以跳过OOB数据,即本申请的文件数据指的是有效数据区中的数据。In a possible implementation, when comparing data, in order to improve efficiency, OOB data can be skipped, that is, the file data in this application refers to the data in the valid data area.

在一种可能的实现方式中,响应于检测的指令,可先计算在每个子区中的位翻转信息,然后再统计每个子区的位翻转信息得到闪存的位翻转信息。可选地,当目标区域仅为一个子区时,该子区的位翻转信息就是闪存的位翻转信息。In a possible implementation, in response to the detection instruction, the bit flip information in each sub-area may be calculated first, and then the bit flip information of each sub-area may be counted to obtain the bit flip information of the flash memory. Optionally, when the target area is only one sub-area, the bit flip information of the sub-area is the bit flip information of the flash memory.

可选的,参见图4,S12步骤的一种实现方式可以包括:Optionally, referring to FIG. 4 , an implementation of step S12 may include:

S121、根据闪存的预设结构信息将闪存进行划分,得到多个页。S121 . Divide the flash memory according to preset structural information of the flash memory to obtain a plurality of pages.

其中,预设结构信息表征闪存的页数量。根据闪存的存储结构,可以得到闪存的页数量。The preset structure information represents the number of pages of the flash memory. The number of pages of the flash memory can be obtained according to the storage structure of the flash memory.

S122、若页的大小大于子区的预设大小,则根据子区的预设大小将页划分为多个子区。S122: If the size of the page is larger than the preset size of the sub-region, divide the page into a plurality of sub-regions according to the preset size of the sub-region.

S123、若页的大小小于或等于子区的预设大小,则将页确定为子区,则将页确定为子区。S123: If the size of the page is smaller than or equal to the preset size of the sub-area, the page is determined as the sub-area.

作为可选的一种实现方式,将闪存总大小(64M、128M、256M等)、闪存的block大小、page大小、OOB大小按照格式保存。As an optional implementation, the total size of the flash memory (64M, 128M, 256M, etc.), the block size, page size, and OOB size of the flash memory are saved in a format.

例如,当子区的预设大小为512bytes时,如果页的大小是512bytes或256bytes等,就直接按照以一页为单位进行检测;如果页的大小是2048bytes,则将其划分为四个以512bytes为单位的子区。For example, when the preset size of the sub-area is 512 bytes, if the page size is 512 bytes or 256 bytes, etc., detection is performed directly in units of one page; if the page size is 2048 bytes, it is divided into four sub-areas of 512 bytes.

这样做的好处是一方面尽可能确保输出结果的一致性,另一方面不破坏原有的页结构。The advantage of doing this is that on the one hand it ensures the consistency of the output results as much as possible, and on the other hand it does not destroy the original page structure.

本申请实施例可以根据闪存的结构信息作为划分标准,不仅使得划分的结果更加合理,而且可以确保两个文件的布局是一致的,避免因为布局不同导致比较结果产生较大的差异。In the embodiment of the present application, the structural information of the flash memory can be used as a division standard, which not only makes the division result more reasonable, but also ensures that the layouts of the two files are consistent, thereby avoiding large differences in comparison results due to different layouts.

可选的,参见图5,S13步骤的一种实现方式可以包括:Optionally, referring to FIG. 5 , an implementation of step S13 may include:

S131、将第一测试文件的目标区域内的文件数据和第二测试文件的目标区域内的文件数据进行异或运算,记录数据不一致时的异常位。S131 , performing an XOR operation on the file data in the target area of the first test file and the file data in the target area of the second test file, and recording an abnormal bit when the data are inconsistent.

具体地,分别获取第一测试文件的目标区域内的文件数据和第二测试文件的目标区域内的文件数据,再逐位进行异或运算。其中,异或是一种逻辑运算符,其原理为异或运算符的值为真仅当两个运算元中恰有一个的值为真,而另外一个的值为非真。假设当两个数据值相反时设为1,从而1表示位翻转。Specifically, the file data in the target area of the first test file and the file data in the target area of the second test file are obtained respectively, and then an XOR operation is performed bit by bit. Among them, XOR is a logical operator, and its principle is that the value of the XOR operator is true only when exactly one of the two operands is true and the other is false. It is assumed that when the two data values are opposite, it is set to 1, so 1 indicates a bit flip.

例如假设第一数据中的一个地址内容为0xFA=11111010,第二数据中的同样地址内容为0xFC=11111100,那么异或结果就是0xFA^0xFC=00000110,可以看出这里的位翻转个数为2。For example, assuming that the content of an address in the first data is 0xFA=11111010, and the content of the same address in the second data is 0xFC=11111100, then the XOR result is 0xFA^0xFC=00000110. It can be seen that the number of bit flips here is 2.

作为可选的一种实施方式,可以得到第一数据和第二数据的全部异或结果,然后统计出目标区域中出现位翻转的个数,以及每个位翻转的出现地址。As an optional implementation, all XOR results of the first data and the second data may be obtained, and then the number of bit flips occurring in the target area and the occurrence address of each bit flip may be counted.

S132、根据目标区域中的异常位个数和异常位地址得到闪存的位翻转信息。S132. Obtain bit flip information of the flash memory according to the number of abnormal bits and the abnormal bit addresses in the target area.

本申请实施例在比较两个文件的数据时使用异或运算的方式进行对比,异或运算具有快速准确的功能,极大的提高了对比效率。The embodiment of the present application uses an XOR operation to compare the data of two files. The XOR operation has fast and accurate functions, which greatly improves the comparison efficiency.

示例性的,步骤S132包括:当目标区域的子区数量为多个时,将目标区域中每个子区的异常位个数和异常位地址确定为闪存的位翻转信息;确定异常位个数最多的目标子区,将目标子区的起始位地址确定为闪存的位翻转信息。Exemplarily, step S132 includes: when the number of sub-areas in the target area is multiple, determining the number of abnormal bits and the abnormal bit address of each sub-area in the target area as the bit flip information of the flash memory; determining the target sub-area with the largest number of abnormal bits, and determining the starting bit address of the target sub-area as the bit flip information of the flash memory.

举例说明,初始状态下,目标子区的起始位地址为0,在统计每个子区的位翻转个数时,假设有个子区发生了8个位翻转,那么就记录发生了8个位翻转的子区的起始位地址,在后续统计中,又发现另一个子区发生了10个位翻转,那么就修正记录为发生了10个位翻转的子区的起始位地址,直到闪存的目标区域全部检测完成。For example, in the initial state, the starting bit address of the target sub-area is 0. When counting the number of bit flips in each sub-area, assuming that 8 bit flips occur in a sub-area, then the starting bit address of the sub-area with 8 bit flips is recorded. In subsequent statistics, it is found that 10 bit flips occur in another sub-area, then the record is corrected to the starting bit address of the sub-area with 10 bit flips, until all the target areas of the flash memory are detected.

作为示例而非限定,还可以统计出现不同翻转个数的子区数量,总共有多少个子区发生了N个位翻转。举例说明,发生2bytes位翻转的子区个数有10个,发生5bytes位翻转的子区个数有4个,也就是说在检测过程中,有10个子区发生了2个位翻转,有4个子区发生了5个位翻转。这种位翻转信息可能好的了解闪存的位翻转程度分布情况。As an example but not a limitation, the number of sub-areas with different numbers of flips can also be counted, and the total number of sub-areas with N bit flips. For example, there are 10 sub-areas with 2-byte bit flips, and 4 sub-areas with 5-byte bit flips, that is, during the detection process, 10 sub-areas have 2 bit flips, and 4 sub-areas have 5 bit flips. This bit flip information may better understand the distribution of the bit flip degree of the flash memory.

作为可选的一种实施方式,可以将为翻转信息绘制成图表形式,可以更加直观的观察出闪存发生位翻转的情况。As an optional implementation, the flip information may be plotted in a chart form, so that the bit flipping of the flash memory can be observed more intuitively.

本申请实施例可以统计出每个子区里的位翻转信息,从而得到位翻转的布局信息,便于定位,并且本申请实施例对不同子区的位翻转信息进行比较,筛选异常位个数最多的目标子区,便于后续进行针对性的调整和改善。The embodiment of the present application can count the bit flip information in each sub-area, thereby obtaining the layout information of the bit flip, which is convenient for positioning. The embodiment of the present application compares the bit flip information of different sub-areas, and selects the target sub-area with the largest number of abnormal bits, which is convenient for subsequent targeted adjustments and improvements.

在本申请的一些实施方式中,如图6所示,位翻转的检测方法还包括:In some implementations of the present application, as shown in FIG6 , the bit flip detection method further includes:

S124、识别闪存中的坏块,若目标区域存在坏块,则执行步骤S125。S124, identifying bad blocks in the flash memory, and if there are bad blocks in the target area, executing step S125.

其中,坏块是指闪存的某个区域不能进行擦写操作,原本应该写进这个块的数据无法写入,所以从坏块中读取的数据很有可能并不是测试文件的原始数据,如果不识别坏块的话,会对比较结果产生影响,因为不知道对比出来的不一致,是因为位翻转还是坏块导致的。A bad block refers to an area of the flash memory that cannot be erased or written. The data that should have been written to this block cannot be written, so the data read from the bad block is likely not the original data of the test file. If the bad block is not identified, the comparison result will be affected because it is not known whether the inconsistency in the comparison is caused by bit flipping or bad blocks.

S125、从闪存中除目标区域以外的非目标区域中确定除坏块以外的替换块。S125. Determine replacement blocks other than bad blocks from non-target areas other than the target area in the flash memory.

S126、将所述坏块的数据转存至所述替换块。S126: Transfer the data of the bad block to the replacement block.

具体地,如果需要检测的目标区域中存在坏块,那么需要知道原本应该存储在这个坏块中的内容被转存到哪里了,如果是转存到目标区域以外的非目标区域的某个不是坏块的替换块中,就把这个替换快加入目标区域里。Specifically, if there is a bad block in the target area to be detected, then it is necessary to know where the content that should have been stored in the bad block has been transferred to. If it is transferred to a replacement block that is not a bad block in a non-target area outside the target area, then this replacement block is added to the target area.

在一种可能的实现方式中,如果不存在满足条件的替换块,那么就直接跳过这个坏块,也即在目标区域中去掉这个坏块所在区域。In a possible implementation, if there is no replacement block that meets the conditions, then the bad block is directly skipped, that is, the area where the bad block is located is removed from the target area.

本申请实施例可以筛选出闪存中出现的坏块,排除坏块导致的结果异常问题,提高鲁棒性。The embodiments of the present application can screen out bad blocks appearing in a flash memory, eliminate abnormal results caused by the bad blocks, and improve robustness.

在一种可能的实现方式中,步骤S124包括对闪存中每个块的OOB区进行坏块标记的检查,将OOB区存在坏块标记的块确定为坏块。In a possible implementation, step S124 includes checking the bad block mark of the OOB area of each block in the flash memory, and determining the block with the bad block mark in the OOB area as a bad block.

其中,OOB区用于存储除文件数据以外的数据,坏块标记位于OOB区中的预设字段。The OOB area is used to store data other than file data, and the bad block mark is located in a preset field in the OOB area.

作为可选的一种实施方式,通过读取OOB数据中的某个字段识别坏块是一种通用方式。举例说明,对于现在常见的页大小为2K的闪存,坏块标记是块中第一个页的OOB起始位置的第1个字节,而对于页大小是512B甚至256B的闪存,坏块标记是块中第一个页的OOB起始位置的第6个字节。As an optional implementation, it is a common method to identify bad blocks by reading a certain field in the OOB data. For example, for a flash memory with a common page size of 2K, the bad block mark is the first byte of the OOB start position of the first page in the block, while for a flash memory with a page size of 512B or even 256B, the bad block mark is the sixth byte of the OOB start position of the first page in the block.

作为示例而非限定,如果OOB区中的预设字段不是0xFF,就说明是这个块是坏块。相对应的是,所有正常的块,好的块,预设字段的数据都是0xFF的。As an example and not a limitation, if the preset field in the OOB area is not 0xFF, it means that the block is a bad block. Correspondingly, all normal blocks, good blocks, have data in the preset field of 0xFF.

可选的,还可以针对坏块不能被擦除的特性来识别坏块。例如,擦除块中所有数据后,然后检查这个块是否全为0xFF数据;如果不全为0xFF数据,表示这个块擦除不成功,则说明这个块很可能是坏块。Optionally, the bad block can be identified based on the characteristic that the bad block cannot be erased. For example, after erasing all the data in the block, check whether the block is full of 0xFF data; if it is not full of 0xFF data, it means that the block was not successfully erased, and the block is likely to be a bad block.

本申请实施例可以通过块中OOB区的坏块标记来判断坏块,从而只需要获取某些字段的数据即可,不需要检查块中的所有数据。The embodiment of the present application can determine the bad block through the bad block mark in the OOB area of the block, so that only the data of certain fields needs to be obtained, and there is no need to check all the data in the block.

在本申请的一些实施方式中,如图7所示,位翻转的检测方法还包括:In some implementations of the present application, as shown in FIG7 , the bit flip detection method further includes:

S14、获取与闪存对应的原始测试文件,以及将原始测试文件写入闪存后从闪存中读取的目标测试文件。S14, acquiring an original test file corresponding to the flash memory, and a target test file read from the flash memory after writing the original test file into the flash memory.

在闪存的内部测试阶段,准备的数据中可以有烧录到闪存之前的原始测试文件。During the internal testing phase of the flash memory, the prepared data may include the original test file before being burned into the flash memory.

S15、对原始测试文件的目标区域内的文件数据和目标测试文件的目标区域内的文件数据进行对比,得到闪存的位翻转信息;目标测试文件包括第一测试文件和第二测试文件中的至少一个。S15. Compare the file data in the target area of the original test file with the file data in the target area of the target test file to obtain bit flip information of the flash memory; the target test file includes at least one of the first test file and the second test file.

具体地,在内部测试时,可以将原始测试文件与关闭ECC检验功能后读取的第二测试文件进行对比,获取到哪些位置容易发生位翻转等位翻转信息,然后可以将原始测试文件与开启ECC检验功能后读取的第一测试文件进行对比,从而得到ECC校正位翻转的功能效果。Specifically, during internal testing, the original test file can be compared with the second test file read after the ECC check function is turned off to obtain bit flip information such as which positions are prone to bit flips. Then the original test file can be compared with the first test file read after the ECC check function is turned on to obtain the functional effect of ECC correction of bit flips.

在一种可能的实现方式中,可以准备同一批次的多个布局大小相同的闪存,然后将同一份原始测试文件依次烧录到每个闪存中后进行读取,得到多份目标测试文件。通过将原始测试文件分别与每一份目标测试文件进行比对,得到这一批次下的每个闪存的位翻转信息,可以更加全面的了解闪存出现位翻转的情况,比如可以看出哪些子区是经常发生位翻转等等。In a possible implementation, multiple flash memories of the same size and layout can be prepared from the same batch, and then the same original test file can be burned into each flash memory in turn and then read to obtain multiple target test files. By comparing the original test file with each target test file, the bit flip information of each flash memory in this batch can be obtained, so that the bit flip situation of the flash memory can be more comprehensively understood, such as which sub-areas often have bit flips.

作为可选的一种实施方式,可以将每个闪存的位翻转信息以图表形式进行展示。As an optional implementation, the bit flip information of each flash memory may be displayed in a chart form.

本申请实施例可以通过原始测试文件作为判断标准来和从闪存中读取的目标测试文件进行比较,在ECC校准能力有限时可以全方位的比较闪存出现位翻转的情况,得到的位翻转信息更加全面准确,另外不仅可以知道闪存哪些位置容易发生位翻转,还能测试出ECC的检验功能大小。The embodiment of the present application can use the original test file as a judgment standard to compare with the target test file read from the flash memory. When the ECC calibration capability is limited, the bit flipping situation of the flash memory can be compared in an all-round way. The obtained bit flipping information is more comprehensive and accurate. In addition, not only can it be known which positions of the flash memory are prone to bit flipping, but also the size of the ECC inspection function can be tested.

在本申请的一些实施方式中,如图8所示,位翻转的检测方法还包括:In some implementations of the present application, as shown in FIG8 , the bit flip detection method further includes:

S141、获取闪存的存储数据量和原始测试文件的文件数据量。S141. Obtain the storage data volume of the flash memory and the file data volume of the original test file.

S142、基于存储数据量和文件数据量计算得到填充数据量。S142: Calculate the filling data amount based on the storage data amount and the file data amount.

S145、根据填充数据量向原始测试文件填充额外数据。S145. Fill additional data into the original test file according to the amount of filled data.

其中,填充的额外数据可以是OOB数据,具体地,一般来讲,原始测试文件是不携带OOB数据的,写入到闪存后重新读取所生成的目标测试文件是携带OOB数据的,因此直接比较的话,会造成偏移位置不对,导致比较结果错误的情况。Among them, the additional data filled in can be OOB data. Specifically, generally speaking, the original test file does not carry OOB data. The target test file generated by rereading after being written to the flash memory carries OOB data. Therefore, if compared directly, the offset position will be incorrect, resulting in an erroneous comparison result.

作为示例而非限定,获取闪存的block大小、page大小、OOB大小等数据,计算出一个理论上携带OOB的文件有多大,即闪存大小=总共的block数*一个block中的page数*一个page中的(有效数据区+OOB数据区)。如果提供的原始测试文件大小小于闪存的理论大小,那么就是需要先给原始测试文件填充OOB数据,保证原始测试文件和后续比较的目标测试文件,其OOB的偏移是一致的。As an example but not a limitation, obtain the block size, page size, OOB size and other data of the flash memory, and calculate how large a file carrying OOB is theoretically, that is, flash memory size = total number of blocks * number of pages in a block * (valid data area + OOB data area) in a page. If the size of the original test file provided is smaller than the theoretical size of the flash memory, then it is necessary to fill the original test file with OOB data first to ensure that the OOB offset of the original test file and the target test file for subsequent comparison is consistent.

当然,也可能会存在原始测试文件携带有OOB数据,如果原始测试文件的实际大小满足闪存大小,则继续下一步骤。Of course, there may be an original test file that carries OOB data. If the actual size of the original test file meets the flash memory size, proceed to the next step.

举例说明,将原始测试文件按照闪存的结构信息进行划分,然后计算每一页需要填充的OOB数据。如果闪存理论要求的OOB个数是128bytes,data大小为2048bytes,那么一个page大小为2176,原始测试文件携带了部分的OOB数据,假设携带了64bytes,那么就会发现输入的原始测试文件携带的OOB布局不符合要求。此时需要输入原始测试文件的page实际大小(data+OOB数据),也就是2048+64=2112bytes,与闪存大小相比计算得到原始测试文件需要填充2176-2112=64bytes的OOB数据。For example, the original test file is divided according to the structural information of the flash memory, and then the OOB data that needs to be filled in each page is calculated. If the theoretical OOB number required by the flash memory is 128 bytes, and the data size is 2048 bytes, then the size of a page is 2176. The original test file carries part of the OOB data, assuming it carries 64 bytes, then it will be found that the OOB layout carried by the input original test file does not meet the requirements. At this time, the actual page size of the original test file (data + OOB data) needs to be entered, which is 2048 + 64 = 2112 bytes. Compared with the flash memory size, it is calculated that the original test file needs to be filled with 2176-2112 = 64 bytes of OOB data.

本申请实施例可以确保原始测试文件和要对比的目标测试文件的数据大小是一致的,避免结果产生差异。The embodiment of the present application can ensure that the data size of the original test file and the target test file to be compared are consistent, thereby avoiding differences in the results.

在本申请的一些实施方式中,在步骤S11之前,位翻转的检测方法还包括:对闪存进行场景化处理;场景化处理包括老化处理、置于温度大于第一温度阈值的物理环境内、置于温度小于第二温度阈值的物理环境内和置于湿度大于湿度阈值的物理环境内中的至少一个。In some embodiments of the present application, before step S11, the bit flip detection method also includes: performing scenario processing on the flash memory; the scenario processing includes at least one of aging processing, placing in a physical environment with a temperature greater than a first temperature threshold, placing in a physical environment with a temperature less than a second temperature threshold, and placing in a physical environment with a humidity greater than a humidity threshold.

在一种可能的实现方式中,可以准备同一批次的多个闪存,然后选取一部分闪存作老化处理、一部分闪存置于温度大于第一温度阈值的物理环境内、一部分闪存置于温度小于第二温度阈值的物理环境内、一部分闪存置于湿度大于湿度阈值的物理环境内,当然本申请实施例并不仅限于上述的场景化处理。In one possible implementation, multiple flash memories of the same batch may be prepared, and then a portion of the flash memories may be selected for aging processing, a portion of the flash memories may be placed in a physical environment with a temperature greater than a first temperature threshold, a portion of the flash memories may be placed in a physical environment with a temperature less than a second temperature threshold, and a portion of the flash memories may be placed in a physical environment with a humidity greater than a humidity threshold. Of course, the embodiments of the present application are not limited to the above-mentioned scenario-based processing.

具体地,温度大于第一温度阈值用于表征高温,温度小于第二温度阈值用于表征低温;湿度大于湿度阈值用于表征高湿,可以根据实际需要设定阈值大小。Specifically, a temperature greater than a first temperature threshold is used to characterize high temperature, and a temperature less than a second temperature threshold is used to characterize low temperature; a humidity greater than a humidity threshold is used to characterize high humidity, and the threshold value can be set according to actual needs.

然后将原始测试文件与不同场景下的闪存所读取的测试文件进行对比,可以对比出不同场景下,闪存的位翻转情况。Then, the original test file is compared with the test files read from the flash memory in different scenarios, so as to compare the bit flipping conditions of the flash memory in different scenarios.

在一种可能的实现方式中,还可以针对同一块闪存,获取其在场景化处理前后的测试文件,进而比对出在经历某个场景前后的闪存位翻转情况。In a possible implementation, for the same flash memory, test files before and after scenario processing may be obtained, thereby comparing the flash memory bit flipping conditions before and after a certain scenario.

本申请实施例可以检测闪存在经历不同场景下,可能出现的位翻转情况,使得闪存的位翻转信息更加全面。The embodiments of the present application can detect bit flipping situations that may occur in a flash memory under different scenarios, thereby making the bit flipping information of the flash memory more comprehensive.

应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

对应于上文实施例所述的位翻转的检测方法,图9示出了本申请实施例提供的位翻转的检测装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the bit flip detection method described in the above embodiment, FIG9 shows a structural block diagram of a bit flip detection device provided in an embodiment of the present application. For ease of explanation, only the part related to the embodiment of the present application is shown.

参照图9,该装置包括:Referring to FIG9 , the device comprises:

获取模块21,用于从闪存中读取第一测试文件和第二测试文件;第一测试文件在ECC检验功能开启的情况下得到,第二测试文件在ECC检验功能关闭的情况下得到,ECC检验功能用于对发生位翻转的数据进行校正。The acquisition module 21 is used to read the first test file and the second test file from the flash memory; the first test file is obtained when the ECC check function is turned on, and the second test file is obtained when the ECC check function is turned off. The ECC check function is used to correct the data with bit flipping.

划分模块22,用于将闪存划分为多个子区。The partitioning module 22 is used to partition the flash memory into a plurality of sub-areas.

检测模块23,用于对第一测试文件的目标区域内的文件数据和第二测试文件的目标区域内的文件数据进行对比,得到闪存的位翻转信息;目标区域为多个子区中的任意一个或多个子区。The detection module 23 is used to compare the file data in the target area of the first test file with the file data in the target area of the second test file to obtain the bit flip information of the flash memory; the target area is any one or more sub-areas of the multiple sub-areas.

在一种可能的实现方式中,划分模块22包括:第一划分单元,用于根据闪存的预设结构信息将闪存进行划分,得到多个页;预设结构信息表征闪存的页数量;第二划分单元,用于若页的大小大于子区的预设大小,则根据子区的预设大小将页划分为多个子区;第二确定单元,用于若页的大小小于或等于子区的预设大小,则将页确定为子区。In one possible implementation, the partitioning module 22 includes: a first partitioning unit, used to partition the flash memory according to preset structural information of the flash memory to obtain multiple pages; the preset structural information represents the number of pages of the flash memory; a second partitioning unit, used to divide the page into multiple sub-areas according to the preset size of the sub-area if the size of the page is larger than the preset size of the sub-area; a second determination unit, used to determine the page as a sub-area if the size of the page is less than or equal to the preset size of the sub-area.

在一种可能的实现方式中,检测模块23包括:对比单元,用于将第一测试文件的目标区域内的文件数据和第二测试文件的目标区域内的文件数据进行异或运算,记录数据不一致时的异常位;第一确定单元,用于根据目标区域中的异常位个数和异常位地址得到闪存的位翻转信息。In one possible implementation, the detection module 23 includes: a comparison unit, which is used to perform an XOR operation on the file data in the target area of the first test file and the file data in the target area of the second test file, and record the abnormal bits when the data are inconsistent; a first determination unit, which is used to obtain the bit flip information of the flash memory based on the number of abnormal bits and the abnormal bit addresses in the target area.

在一种可能的实现方式中,第一确定单元包括:第一确定子单元,用于当目标区域的子区数量为多个时,将目标区域中每个子区的异常位个数和异常位地址确定为闪存的位翻转信息;第二确定子单元,用于确定异常位个数最多的目标子区,将目标子区的起始位地址确定为闪存的位翻转信息。In one possible implementation, the first determination unit includes: a first determination sub-unit, which is used to determine the number of abnormal bits and the abnormal bit address of each sub-area in the target area as the bit flip information of the flash memory when the number of sub-areas in the target area is multiple; and a second determination sub-unit, which is used to determine the target sub-area with the largest number of abnormal bits, and determine the starting bit address of the target sub-area as the bit flip information of the flash memory.

在一种可能的实现方式中,位翻转的检测装置还包括:识别模块,用于识别闪存中的坏块,若目标区域存在坏块,则调用搜索模块和转存模块;搜索模块,用于从闪存中除目标区域以外的非目标区域中确定除坏块以外的替换块;转存模块,用于将坏块的数据转存至所述替换区域。In one possible implementation, the bit flip detection device also includes: an identification module, which is used to identify bad blocks in the flash memory. If there are bad blocks in the target area, a search module and a transfer module are called; the search module is used to determine replacement blocks other than bad blocks from non-target areas other than the target area in the flash memory; and the transfer module is used to transfer the data of the bad blocks to the replacement area.

在一种可能的实现方式中,识别单元用于对闪存中每个块的OOB区进行坏块标记的检查,将OOB区存在坏块标记的块确定为坏块;其中,OOB区用于存储除文件数据以外的数据,坏块标记位于OOB区中的预设字段。In one possible implementation, the identification unit is used to check the bad block mark of the OOB area of each block in the flash memory, and determine the block with the bad block mark in the OOB area as a bad block; wherein the OOB area is used to store data other than file data, and the bad block mark is located in a preset field in the OOB area.

在一种可能的实现方式中,位翻转的检测装置还包括:第二获取模块,用于获取与闪存对应的原始测试文件,以及将原始测试文件写入闪存后从闪存中读取的目标测试文件;第二检测模块,用于对原始测试文件的目标区域内的文件数据和目标测试文件的目标区域内的文件数据进行对比,得到闪存的位翻转信息;目标测试文件包括第一测试文件和第二测试文件中的至少一个。In a possible implementation, the bit flip detection device also includes: a second acquisition module, used to acquire an original test file corresponding to the flash memory, and a target test file read from the flash memory after writing the original test file to the flash memory; a second detection module, used to compare the file data in the target area of the original test file with the file data in the target area of the target test file to obtain the bit flip information of the flash memory; the target test file includes at least one of the first test file and the second test file.

在一种可能的实现方式中,位翻转的检测装置还包括:第三获取模块,用于获取闪存的存储数据量和原始测试文件的文件数据量;计算模块,用于基于存储数据量和文件数据量计算得到填充数据量;填充模块,用于根据填充数据量向原始测试文件填充额外数据。In one possible implementation, the bit flip detection device also includes: a third acquisition module, used to obtain the storage data volume of the flash memory and the file data volume of the original test file; a calculation module, used to calculate the filling data volume based on the storage data volume and the file data volume; and a filling module, used to fill additional data into the original test file according to the filling data volume.

在一种可能的实现方式中,位翻转的检测装置还包括:处理模块,用于对闪存进行场景化处理;场景化处理包括老化处理、置于温度大于第一温度阈值的物理环境内、置于温度小于第二温度阈值的物理环境内和置于湿度大于湿度阈值的物理环境内中的至少一个。In one possible implementation, the bit flip detection device also includes: a processing module for performing scenario-based processing on the flash memory; the scenario-based processing includes at least one of aging processing, placing in a physical environment with a temperature greater than a first temperature threshold, placing in a physical environment with a temperature less than a second temperature threshold, and placing in a physical environment with a humidity greater than a humidity threshold.

需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information interaction, execution process, etc. between the above-mentioned devices/units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

本申请实施例还提供了一种电子设备,该网络设备包括:至少一个处理器、存储器以及存储在所述存储器中并可在所述至少一个处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述任意各个方法实施例中的步骤。An embodiment of the present application also provides an electronic device, which network device includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above-mentioned method embodiments when executing the computer program.

如图10所示的电子设备30仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。The electronic device 30 shown in FIG. 10 is merely an example and should not limit the functions and scope of use of the embodiments of the present invention.

电子设备30可以以通用计算设备的形式表现,例如其可以为服务器设备。电子设备30的组件可以包括但不限于:上述至少一个处理器31、上述至少一个存储器32、连接不同装置组件(包括存储器32和处理器31)的总线33。The electronic device 30 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different device components (including the memory 32 and the processor 31).

总线33包括数据总线、地址总线和控制总线。The bus 33 includes a data bus, an address bus, and a control bus.

存储器32可以包括易失性存储器,例如随机存取存储器(RAM)321和高速缓存存储器322,还可以进一步包括只读存储器(ROM)323。The memory 32 may include a volatile memory, such as a random access memory (RAM) 321 and a cache memory 322 , and may further include a read only memory (ROM) 323 .

存储器32还可以包括具有一组(至少一个)程序模块324的程序工具325,这样的程序模块324包括但不限于:操作装置、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。The memory 32 may also include a program tool 325 having a set (at least one) of program modules 324, such program modules 324 including but not limited to: operating means, one or more applications, other program modules and program data, each of which or some combination may include the implementation of a network environment.

处理器31通过运行存储在存储器32中的计算机程序,从而执行各种功能应用以及数据处理,例如上述实施例的数据关联方法。The processor 31 executes various functional applications and data processing, such as the data association method of the above embodiment, by running the computer program stored in the memory 32 .

电子设备30也可以与一个或多个外部设备34通信。这种通信可以通过输入/输出(I/O)接口35进行。并且,模型生成的设备30还可以通过网络适配器36与一个或者多个网络通信。如图10所示,网络适配器36通过总线33与模型生成的设备30的其它模块通信。应当明白,尽管图10未标示,可以结合模型生成的设备30使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID(磁盘阵列)装置、磁带驱动器以及数据备份存储装置等。The electronic device 30 may also communicate with one or more external devices 34. Such communication may be performed via an input/output (I/O) interface 35. Furthermore, the model-generated device 30 may also communicate with one or more networks via a network adapter 36. As shown in FIG. 10 , the network adapter 36 communicates with other modules of the model-generated device 30 via a bus 33. It should be understood that, although not shown in FIG. 10 , other hardware and/or software modules may be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (RAID) devices, tape drives, and data backup storage devices.

应当注意,尽管在上文详细描述中提及了电子设备的若干单元/模块或子单元/模块,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本发明的实施方式,上文描述的两个或更多单元/模块的特征和功能可以在一个单元/模块中具体化。反之,上文描述的一个单元/模块的特征和功能可以进一步划分为由多个单元/模块来具体化。It should be noted that although several units/modules or sub-units/modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units/modules described above can be embodied in one unit/module. Conversely, the features and functions of one unit/module described above can be further divided into multiple units/modules to be embodied.

本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

其中,可读存储介质可以采用的更具体可以包括但不限于:便携式盘、硬盘、随机存取存储器、只读存储器、可擦拭可编程只读存储器、光存储器件、磁存储器件或上述的任意合适的组合。The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,RandomAccess Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, USB flash drive, mobile hard disk, disk or optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in the present application, it should be understood that the disclosed devices/network equipment and methods can be implemented in other ways. For example, the device/network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims (11)

1.一种位翻转的检测方法,其特征在于,包括:1. A method for detecting bit flipping, comprising: 从闪存中读取第一测试文件和第二测试文件;所述第一测试文件为ECC检验功能开启的情况下得到,所述第二测试文件为所述ECC检验功能关闭的情况下得到;Reading a first test file and a second test file from a flash memory; the first test file is obtained when an ECC check function is turned on, and the second test file is obtained when the ECC check function is turned off; 将所述闪存划分为多个子区;Dividing the flash memory into a plurality of sub-areas; 对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比,得到所述闪存的位翻转信息;所述目标区域为所述多个子区中的任意一个或多个子区。The file data in the target area of the first test file is compared with the file data in the target area of the second test file to obtain the bit flip information of the flash memory; the target area is any one or more sub-areas of the multiple sub-areas. 2.如权利要求1所述的位翻转的检测方法,其特征在于,所述对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比,得到所述闪存的位翻转信息的步骤包括:2. The bit flip detection method according to claim 1, wherein the step of comparing the file data in the target area of the first test file with the file data in the target area of the second test file to obtain the bit flip information of the flash memory comprises: 将所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行异或运算,记录数据不一致时的异常位;Performing an XOR operation on the file data in the target area of the first test file and the file data in the target area of the second test file, and recording an abnormal bit when the data are inconsistent; 根据所述目标区域中的异常位个数和异常位地址得到所述闪存的位翻转信息。The bit flip information of the flash memory is obtained according to the number of abnormal bits and the abnormal bit addresses in the target area. 3.如权利要求2所述的位翻转的检测方法,其特征在于,所述根据所述目标区域中的异常位个数和所述异常位的地址得到所述闪存的位翻转信息的步骤包括:3. The bit flip detection method according to claim 2, wherein the step of obtaining the bit flip information of the flash memory according to the number of abnormal bits in the target area and the address of the abnormal bit comprises: 当所述目标区域的子区数量为多个时,将所述目标区域中每个子区的所述异常位个数和所述异常位地址确定为所述闪存的位翻转信息;When the number of sub-areas in the target area is multiple, determining the number of abnormal bits and the abnormal bit address of each sub-area in the target area as the bit flip information of the flash memory; 确定异常位个数最多的目标子区,将所述目标子区的起始位地址确定为所述闪存的位翻转信息。A target sub-area having the largest number of abnormal bits is determined, and a starting bit address of the target sub-area is determined as the bit flip information of the flash memory. 4.如权利要求1所述的位翻转的检测方法,其特征在于,在所述对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比的步骤之前,所述位翻转的检测方法还包括:4. The bit flip detection method according to claim 1, characterized in that before the step of comparing the file data in the target area of the first test file with the file data in the target area of the second test file, the bit flip detection method further comprises: 识别闪存中的坏块,若所述目标区域存在坏块,则从所述闪存中除所述目标区域以外的非目标区域中确定除坏块以外的替换块;Identify bad blocks in the flash memory, and if the target area has bad blocks, determine replacement blocks other than the bad blocks from non-target areas other than the target area in the flash memory; 将所述坏块的数据转存至所述替换块。The data of the bad block is transferred to the replacement block. 5.如权利要求1所述的位翻转的检测方法,其特征在于,所述位翻转的检测方法还包括:5. The bit flip detection method according to claim 1, characterized in that the bit flip detection method further comprises: 获取与所述闪存对应的原始测试文件,以及将所述原始测试文件写入所述闪存后从所述闪存中读取的目标测试文件;Acquire an original test file corresponding to the flash memory, and a target test file read from the flash memory after writing the original test file into the flash memory; 对所述原始测试文件的所述目标区域内的文件数据和所述目标测试文件的所述目标区域的文件数据进行对比,得到所述闪存的位翻转信息;所述目标测试文件包括所述第一测试文件和所述第二测试文件中的至少一个。The file data in the target area of the original test file is compared with the file data in the target area of the target test file to obtain the bit flip information of the flash memory; the target test file includes at least one of the first test file and the second test file. 6.如权利要求5所述的位翻转的检测方法,其特征在于,在对所述原始测试文件的所述目标区域内的文件数据和所述目标测试文件的所述目标区域的文件数据进行对比的步骤之前,所述位翻转的检测方法还包括:6. The bit flip detection method according to claim 5, characterized in that before the step of comparing the file data in the target area of the original test file with the file data in the target area of the target test file, the bit flip detection method further comprises: 获取所述闪存的存储数据量和所述原始测试文件的文件数据量;Acquire the storage data volume of the flash memory and the file data volume of the original test file; 基于所述存储数据量和所述文件数据量计算得到填充数据量;Calculate the filling data amount based on the storage data amount and the file data amount; 根据所述填充数据量向所述原始测试文件填充额外数据。The original test file is filled with additional data according to the amount of filled data. 7.如权利要求1所述的位翻转的检测方法,其特征在于,在所述从所述闪存中读取第一测试文件和第二测试文件的步骤之前,所述位翻转的检测方法还包括:7. The bit flip detection method according to claim 1, characterized in that before the step of reading the first test file and the second test file from the flash memory, the bit flip detection method further comprises: 对所述闪存进行场景化处理;所述场景化处理包括老化处理、置于温度大于第一温度阈值的物理环境内、置于温度小于第二温度阈值的物理环境内和置于湿度大于湿度阈值的物理环境内中的至少一个。The flash memory is subjected to scenario-based processing; the scenario-based processing includes at least one of aging processing, placing in a physical environment with a temperature greater than a first temperature threshold, placing in a physical environment with a temperature less than a second temperature threshold, and placing in a physical environment with a humidity greater than a humidity threshold. 8.如权利要求1所述的位翻转的检测方法,其特征在于,所述将所述闪存划分为多个子区的步骤包括:8. The bit flip detection method according to claim 1, wherein the step of dividing the flash memory into a plurality of sub-areas comprises: 根据所述闪存的预设结构信息将所述闪存进行划分,得到多个页;所述预设结构信息表征所述闪存的页数量;Dividing the flash memory according to preset structural information of the flash memory to obtain a plurality of pages; the preset structural information represents the number of pages of the flash memory; 若所述页的大小大于所述子区的预设大小,则根据所述子区的预设大小将所述页划分为多个子区;If the size of the page is larger than the preset size of the sub-area, dividing the page into a plurality of sub-areas according to the preset size of the sub-area; 若所述页的大小小于或等于所述子区的预设大小,则将所述页确定为所述子区。If the size of the page is smaller than or equal to the preset size of the sub-region, the page is determined as the sub-region. 9.一种位翻转的检测装置,其特征在于,包括:9. A bit flip detection device, comprising: 获取模块,用于从闪存中读取第一测试文件和第二测试文件;所述第一测试文件在ECC检验功能开启的情况下得到,所述第二测试文件在所述ECC检验功能关闭的情况下得到,所述ECC检验功能用于对发生位翻转的数据进行校正;An acquisition module, used for reading a first test file and a second test file from a flash memory; the first test file is obtained when an ECC check function is turned on, and the second test file is obtained when the ECC check function is turned off, and the ECC check function is used for correcting data with bit flipping; 划分模块,用于将所述闪存划分为多个子区;A partitioning module, used for partitioning the flash memory into a plurality of sub-areas; 检测模块,用于对所述第一测试文件的目标区域内的文件数据和所述第二测试文件的所述目标区域内的文件数据进行对比,得到所述闪存的位翻转信息;所述目标区域为所述多个子区中的任意一个或多个子区。A detection module is used to compare the file data in the target area of the first test file with the file data in the target area of the second test file to obtain the bit flip information of the flash memory; the target area is any one or more sub-areas of the multiple sub-areas. 10.一种电子设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至8任一项所述的位翻转的检测方法。10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the bit flip detection method according to any one of claims 1 to 8 when executing the computer program. 11.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至8任一项所述的位翻转的检测方法。11. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the bit flip detection method according to any one of claims 1 to 8.
CN202410621359.4A 2024-05-17 2024-05-17 Bit flip detection method, device, electronic device and medium Pending CN118553297A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410621359.4A CN118553297A (en) 2024-05-17 2024-05-17 Bit flip detection method, device, electronic device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410621359.4A CN118553297A (en) 2024-05-17 2024-05-17 Bit flip detection method, device, electronic device and medium

Publications (1)

Publication Number Publication Date
CN118553297A true CN118553297A (en) 2024-08-27

Family

ID=92443341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410621359.4A Pending CN118553297A (en) 2024-05-17 2024-05-17 Bit flip detection method, device, electronic device and medium

Country Status (1)

Country Link
CN (1) CN118553297A (en)

Similar Documents

Publication Publication Date Title
US7971112B2 (en) Memory diagnosis method
US8122319B2 (en) Page-based failure management for flash memory
TWI480733B (en) Data writing mehod, and memory controller and memory storage device using the same
US5513344A (en) Method of testing cache memories used for an information processing apparatus
US7512864B2 (en) System and method of accessing non-volatile computer memory
KR20100091227A (en) Method and system for storage of data in non-volatile media
US8301942B2 (en) Managing possibly logically bad blocks in storage devices
CN101377748B (en) Method for verifying read-write function of storage device
TWI459393B (en) Data writing method for a non-volatile memory module, memory controller and memory storage apparatus
US12026126B2 (en) Markers for hash code calculations on occupied portions of data blocks
CN113778822A (en) Error correction capability test method and device, readable storage medium and electronic equipment
CN111159055A (en) Method and apparatus for performing access control between a host device and a memory device
US20090125753A1 (en) Handling of data storage within a flash media device
US20090164869A1 (en) Memory architecture and configuration method thereof
TWI616807B (en) Data writing method and storage controller
CN114924923A (en) Method, system, equipment and medium for verifying correctness of hard disk write-in point
CN114968841A (en) Flash memory storage method, device, computer equipment and storage medium for information
CN118553297A (en) Bit flip detection method, device, electronic device and medium
US11592996B2 (en) Online error recovery
CN114267402B (en) Bad storage unit testing method, device, equipment and storage medium of flash memory
JPH10302485A (en) Information processing device having flash memory
WO2018040804A1 (en) Memory block processing method and device, and computer storage medium
US7313648B2 (en) Corruption tolerant method and system for deploying and modifying data in flash memory
CN118819428B (en) Disk parameter management method, device, electronic device and storage medium
CN110321073B (en) Data storage method, device and equipment of flash memory

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination