WO2018209733A1 - Serial flash data protection method and device - Google Patents

Serial flash data protection method and device Download PDF

Info

Publication number
WO2018209733A1
WO2018209733A1 PCT/CN2017/086340 CN2017086340W WO2018209733A1 WO 2018209733 A1 WO2018209733 A1 WO 2018209733A1 CN 2017086340 W CN2017086340 W CN 2017086340W WO 2018209733 A1 WO2018209733 A1 WO 2018209733A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
sector
area
mapped
written
Prior art date
Application number
PCT/CN2017/086340
Other languages
French (fr)
Chinese (zh)
Inventor
漆湘明
蒋周金
张友运
赵峰
刘再乐
瞿诗琦
肖箭鑫
陈坤
刘宏军
刘玲
黎健英
熊文龙
贺佐旺
常俊山
吴臣国
Original Assignee
瑞斯康微电子(深圳)有限公司
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 瑞斯康微电子(深圳)有限公司 filed Critical 瑞斯康微电子(深圳)有限公司
Publication of WO2018209733A1 publication Critical patent/WO2018209733A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • G06F12/0882Page mode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/16Protection against loss of memory contents

Definitions

  • the invention relates to a serial flash data protection method and device, belonging to the field of computers.
  • Serial FALSH memory is widely used in microcontroller product development environments due to its simple interface and large capacity. However, its relatively slow read and write speeds lead to a high probability of file loss during the data write operation phase, and even the entire file system crashes.
  • the present invention provides a device for serial flash data protection.
  • the technical solution adopted by the present invention is a serial flash data protection method, which comprises the steps of: dividing a serial flash memory into a buffer area and an actual area based on a logical address; establishing a page mapping between the buffer area and the actual area; The write data is written to the mapped sector of the buffer area by region. When the space of the remaining mapped sectors of the buffer area is insufficient or the data needs to be converted, the data of the mapped sector is written into the actual area, and when the data is written. When, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  • the method further includes the steps of: obtaining an absolute address of an actual area in which data needs to be written, querying whether the absolute address has a corresponding mapped sector in the buffer area, and if not, determining a mapping sector and establishing the mapping area The page mapping of the absolute address; if present, the data of the mapped sector is read and stored in the RAM, which is used to store the data to be written to the actual area.
  • the RAM reads data from the mapped sector in which the data has been written, writes the data to the actual area based on the page mapping, and wipes the buffer when the data writing is completed.
  • the mapped sector corresponding to the area and the page mapping relationship is removed.
  • the RAM reads data from the corresponding mapped sector, writes data to the actual area based on the page mapping, and when the data writing is completed, wipes the mapped sector corresponding to the buffer area and removes the page mapping. relationship.
  • serial flash data protection device which includes the following modules:
  • a dividing module configured to divide the serial flash memory into a buffer area and an actual area based on the logical address; a mapping module, configured to establish a page mapping between the buffer area and the actual area; and a data processing module, configured to write the data to be written area by area
  • the mapped sector into the buffer area when the remaining mapped sectors of the buffer area have insufficient space or the data needs to be converted, the data of the mapped sector is written.
  • the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  • the mapping module is further configured to obtain an absolute address of an actual area in which data needs to be written, and query whether the absolute address has a corresponding mapping sector in the buffer area, and if not, determine a mapping sector and establish and The page mapping of the absolute address; if present, the data of the mapped sector is read and stored in a RAM, and the RAM is used to store data to be written into the actual area.
  • the data processing module is further configured to: when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM reads data from the mapped sector in which the data has been written, and writes the data into the actual area based on the page mapping, When the data writing is completed, the mapping sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  • the data processing module is further configured to: when the sector needs to be converted, the RAM reads data from the corresponding mapped sector, writes the data to the actual area based on the page mapping, and wipes the buffer area when the data writing is completed. Corresponding mapping sectors and tear down the page mapping relationship.
  • the beneficial effects of the present invention are that data is transferred by page mapping by setting a buffer area and an actual area, and data is transferred when a buffer area overflows or a specific data transfer is required, only when the data is completely transferred. Data is cleared to ensure that data can be saved while the power is off.
  • FIG. 1 is a schematic diagram of a serial flash data protection method based on an embodiment of the present invention.
  • a serial flash data protection method as shown in FIG. 1 includes the steps of: dividing a serial flash memory into a buffer area and an actual area based on a logical address; and establishing a page mapping between the buffer area and the actual area. Writing the data to be written to the mapped sector of the buffer area by region. When the space of the remaining mapped sectors of the buffer area is insufficient or the data needs to be converted, the data of the mapped sector is written into the actual area, when the data is When the writing is completed, the mapping sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  • the program is divided into a buffer area and an actual area by using a program (based on logical address division), and the actual area is a space for finally storing data, and the storage area is allocated by the buffer area and the actual area in the form of page storage.
  • Establish a page mapping between the two that is, the correspondence between the page and the page (the mapping record is made into a mapping table, including the sector number, the corresponding physical address and logical address, etc.); and the step of writing the data.
  • One step is that the external data to be written is first stored in the buffer area by page (ie, the mapped sector). Since the setting of the buffer area is program controlled, the usage record of the sector number of the mapped sector can be used.
  • the data is moved according to the page mapping relationship between the mapped sectors, when the data is written.
  • the data of the corresponding mapped sector of the buffer area is wiped and the page mapping relationship is removed.
  • a serial flash data protection method further includes the following steps: acquiring the number of writes required According to the absolute address of the actual area, query whether the absolute address has a corresponding mapped sector in the buffer area, if not, determine a mapping sector and establish a page mapping with the absolute address; if it exists, read The data of the mapped sector is stored in a RAM for storing data to be written into the actual area.
  • mapping table of the page mapping is established by querying, and it can be known whether there is already a set mapping relationship. If it exists, it is not necessary to re-establish the mapping relationship. Transfer data directly through the memory, if not, then determine a mapped sector in the buffer area (may be the part that has not been written data, or the part obtained after wiping); obtain the mapped sector The data is stored in RAM.
  • the RAM reads data from the mapped sector in which the data has been written, and writes the data based on the page mapping.
  • the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  • the RAM reads data from the corresponding mapped sector, and writes data to the actual area based on the page mapping, when the data writing is completed. , wipe the mapping sector corresponding to the buffer area and remove the page mapping relationship.
  • data is transferred from a specific sector, data is read from a specific mapped sector through RAM, and then data is written to a sector corresponding to the actual area based on the relationship of page mapping. / page, when the data is written, the corresponding sector of the buffer area is wiped and the page mapping relationship is removed.
  • a serial flash data protection device includes the following modules:
  • a dividing module configured to divide the serial flash memory into a buffer area and an actual area based on the logical address; a mapping module, configured to establish a page mapping between the buffer area and the actual area; and a data processing module, configured to write the data to be written area by area
  • the mapped sector of the buffer area is written into the actual area when the remaining mapped sectors of the buffer area are insufficient or the data needs to be converted into sectors.
  • the wipe buffer area corresponds to Map the sectors and remove the page mapping relationship.
  • the mapping module is further configured to acquire an absolute address of an actual area in which data needs to be written, and query whether the absolute address has a corresponding mapped sector in the buffer area. If not, determining a mapped sector and establishing a page mapping with the absolute address; if present, reading the data of the mapped sector and storing the RAM, the RAM for storing the actual area to be written The data.
  • the data processing module is further configured to: when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM is from the mapped sector of the written data. Read data based on page mapping The data is written into the actual area. When the data is written, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  • a serial flash data protection apparatus according to Embodiment 2 of the present invention, wherein the data processing module is further configured to: when a sector needs to be converted, the RAM reads data from a corresponding mapped sector, and writes data based on the page mapping. In the actual area, when the data is written, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.

Abstract

Disclosed are a serial flash data protection method and device, and the method comprises: dividing a serial flash into a cache area and an actual area on the basis of a logical address; establishing page mapping between the cache area and the actual area; writing, in an area by area manner, data to be written to a mapped sector of the cache area, and if there is insufficient space in remaining mapping sectors of the cache area or sector transfer is required for data, writing data in the mapped sector to the actual area, and when data writing is completed, wiping the mapped sector corresponding to the cache area and removing the page mapping relationship. The device is used to execute the corresponding method; by setting up the cache area and the actual area and performing data transfer by means of page mapping, data transfer is performed if there is a cache area overflow or specific data is required to be transferred; data erasure is only performed after data is completely transferred, ensuring data preservation in a power outage scenario.

Description

一种串行闪存数据保护方法和装置Serial flash data protection method and device 技术领域Technical field
本发明涉及一种串行闪存数据保护方法和装置,属于计算机领域。The invention relates to a serial flash data protection method and device, belonging to the field of computers.
背景技术Background technique
串行FALSH存储器因接口简单、容量巨大,广泛应用于单片机产品开发环境。但其读写速度相对缓慢的特点,导致其在进行数据写入操作阶段,意外发生掉电情况时会极高概率出现文件丢失,甚至导致整个文件系统崩溃现象。Serial FALSH memory is widely used in microcontroller product development environments due to its simple interface and large capacity. However, its relatively slow read and write speeds lead to a high probability of file loss during the data write operation phase, and even the entire file system crashes.
现有阶段解决此问题的方法通常有两种:一、在硬件方面进行弥补,比如掉电保护电路等策略;此方法很大程度上解决了意外掉电带来数据丢失的问题,但涉及的技术环节过多,并且同样需要软件方面配合,因此无法100%保证其可靠性。最大不足就是保护电路会极大地提升了产品开发成本(硬件成本)。There are usually two ways to solve this problem in the existing stage: First, make up for the hardware, such as power-down protection circuit and other strategies; this method largely solves the problem of data loss caused by accidental power failure, but it involves There are too many technical links, and the software also needs to cooperate, so it is impossible to guarantee its reliability 100%. The biggest shortcoming is that the protection circuit will greatly increase the product development cost (hardware cost).
发明内容Summary of the invention
为了解决上述问题,本发明通过提供一种串行闪存数据保护方法好装置。In order to solve the above problems, the present invention provides a device for serial flash data protection.
本发明采用的技术方案一方面为一种串行闪存数据保护方法,包括以下步骤:基于逻辑地址划分串行闪存为缓存区和实际区;建立缓存区与实际区之间的页面映射;将待写入数据逐区写入缓存区的映射扇区,当缓存区的剩余的映射扇区的空间不足或者数据需要转换扇区时,将映射扇区的数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。The technical solution adopted by the present invention is a serial flash data protection method, which comprises the steps of: dividing a serial flash memory into a buffer area and an actual area based on a logical address; establishing a page mapping between the buffer area and the actual area; The write data is written to the mapped sector of the buffer area by region. When the space of the remaining mapped sectors of the buffer area is insufficient or the data needs to be converted, the data of the mapped sector is written into the actual area, and when the data is written. When, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
优选地,还包括以下步骤:获取需要写入数据的实际区的绝对地址,查询该绝对地址是否在缓存区存在对应的映射扇区,如果不存在,则确定一个映射扇区并建立与所述绝对地址的页面映射;如果存在,则读取该映射扇区的数据并存入RAM,所述RAM用于存储待写入实际区的数据。Preferably, the method further includes the steps of: obtaining an absolute address of an actual area in which data needs to be written, querying whether the absolute address has a corresponding mapped sector in the buffer area, and if not, determining a mapping sector and establishing the mapping area The page mapping of the absolute address; if present, the data of the mapped sector is read and stored in the RAM, which is used to store the data to be written to the actual area.
优选地,当缓存区的剩余的映射扇区的空间不足时,RAM从已写入数据的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。Preferably, when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM reads data from the mapped sector in which the data has been written, writes the data to the actual area based on the page mapping, and wipes the buffer when the data writing is completed. The mapped sector corresponding to the area and the page mapping relationship is removed.
优选地,当需要转换扇区时,RAM从对应的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。Preferably, when a sector needs to be converted, the RAM reads data from the corresponding mapped sector, writes data to the actual area based on the page mapping, and when the data writing is completed, wipes the mapped sector corresponding to the buffer area and removes the page mapping. relationship.
本发明采用的技术方案另一方面为一种串行闪存数据保护装置,包括以下模块:Another aspect of the technical solution adopted by the present invention is a serial flash data protection device, which includes the following modules:
划分模块,用于基于逻辑地址划分串行闪存为缓存区和实际区;映射模块,用于建立缓存区与实际区之间的页面映射;数据处理模块,用于将待写入数据逐区写入缓存区的映射扇区,当缓存区的剩余的映射扇区的空间不足或者数据需要转换扇区时,将映射扇区的数据写 入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。a dividing module, configured to divide the serial flash memory into a buffer area and an actual area based on the logical address; a mapping module, configured to establish a page mapping between the buffer area and the actual area; and a data processing module, configured to write the data to be written area by area The mapped sector into the buffer area, when the remaining mapped sectors of the buffer area have insufficient space or the data needs to be converted, the data of the mapped sector is written. In the actual area, when the data is written, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
优选地,所述映射模块还用于获取需要写入数据的实际区的绝对地址,查询该绝对地址是否在缓存区存在对应的映射扇区,如果不存在,则确定一个映射扇区并建立与所述绝对地址的页面映射;如果存在,则读取该映射扇区的数据并存入RAM,所述RAM用于存储待写入实际区的数据。Preferably, the mapping module is further configured to obtain an absolute address of an actual area in which data needs to be written, and query whether the absolute address has a corresponding mapping sector in the buffer area, and if not, determine a mapping sector and establish and The page mapping of the absolute address; if present, the data of the mapped sector is read and stored in a RAM, and the RAM is used to store data to be written into the actual area.
优选地,所述数据处理模块,还用于当缓存区的剩余的映射扇区的空间不足时,RAM从已写入数据的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。Preferably, the data processing module is further configured to: when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM reads data from the mapped sector in which the data has been written, and writes the data into the actual area based on the page mapping, When the data writing is completed, the mapping sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
优选地,所述数据处理模块,还用于当需要转换扇区时,RAM从对应的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。Preferably, the data processing module is further configured to: when the sector needs to be converted, the RAM reads data from the corresponding mapped sector, writes the data to the actual area based on the page mapping, and wipes the buffer area when the data writing is completed. Corresponding mapping sectors and tear down the page mapping relationship.
本发明的有益效果为通过设定缓存区和实际区,通过页映射进行数据之间的转移,当缓存区溢出或者需要特定的数据转移的时候进行数据的转移,只有当数据被完整的转移之后才进行数据的清除,能够确保数据在断电的情况下仍能进行数据的保存。The beneficial effects of the present invention are that data is transferred by page mapping by setting a buffer area and an actual area, and data is transferred when a buffer area overflows or a specific data transfer is required, only when the data is completely transferred. Data is cleared to ensure that data can be saved while the power is off.
附图说明DRAWINGS
图1所示为基于本发明实施例的一种串行闪存数据保护方法的示意图。FIG. 1 is a schematic diagram of a serial flash data protection method based on an embodiment of the present invention.
具体实施方式detailed description
以下结合实施例对本发明进行说明。The invention will now be described in connection with the examples.
基于发明的实施例1,如图1所示一种串行闪存数据保护方法,包括以下步骤:基于逻辑地址划分串行闪存为缓存区和实际区;建立缓存区与实际区之间的页面映射;将待写入数据逐区写入缓存区的映射扇区,当缓存区的剩余的映射扇区的空间不足或者数据需要转换扇区时,将映射扇区的数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。According to Embodiment 1 of the invention, a serial flash data protection method as shown in FIG. 1 includes the steps of: dividing a serial flash memory into a buffer area and an actual area based on a logical address; and establishing a page mapping between the buffer area and the actual area. Writing the data to be written to the mapped sector of the buffer area by region. When the space of the remaining mapped sectors of the buffer area is insufficient or the data needs to be converted, the data of the mapped sector is written into the actual area, when the data is When the writing is completed, the mapping sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
使用程序(基于逻辑地址划分)将闪存划分为缓存区和实际区,所述实际区是最终用来存储数据的空间,通过页式存储的形式将缓存区和实际区进行存储单元的分配,通过建立两者之间的页面映射,即页与页之间对应(同时将映射的记录做成映射表,包括扇区号,对应的物理地址和逻辑地址等信息);而数据写入的步骤,第一步是外部的待写入数据首先会被按页(即映射扇区)存入缓存区,由于缓存区的设定是有程序控制的,因此根据映射扇区的扇区号的使用记录就可以知道扇区的使用情况,当缓存区没有多余的映射扇区或者需要将缓存区的数据存入实际区的时候,根据映射扇区之间的页面映射关系,进行数据的移动,当数据写入完成的时候,擦拭缓存区的对应的映射扇区的数据并拆除页面映射关系。The program is divided into a buffer area and an actual area by using a program (based on logical address division), and the actual area is a space for finally storing data, and the storage area is allocated by the buffer area and the actual area in the form of page storage. Establish a page mapping between the two, that is, the correspondence between the page and the page (the mapping record is made into a mapping table, including the sector number, the corresponding physical address and logical address, etc.); and the step of writing the data, One step is that the external data to be written is first stored in the buffer area by page (ie, the mapped sector). Since the setting of the buffer area is program controlled, the usage record of the sector number of the mapped sector can be used. Knowing the use of the sector, when there is no redundant mapped sector in the buffer area or when the data of the buffer area needs to be stored in the actual area, the data is moved according to the page mapping relationship between the mapped sectors, when the data is written. Upon completion, the data of the corresponding mapped sector of the buffer area is wiped and the page mapping relationship is removed.
基于发明的实施例1的一种串行闪存数据保护方法,还包括以下步骤:获取需要写入数 据的实际区的绝对地址,查询该绝对地址是否在缓存区存在对应的映射扇区,如果不存在,则确定一个映射扇区并建立与所述绝对地址的页面映射;如果存在,则读取该映射扇区的数据并存入RAM,所述RAM用于存储待写入实际区的数据。A serial flash data protection method according to Embodiment 1 of the invention further includes the following steps: acquiring the number of writes required According to the absolute address of the actual area, query whether the absolute address has a corresponding mapped sector in the buffer area, if not, determine a mapping sector and establish a page mapping with the absolute address; if it exists, read The data of the mapped sector is stored in a RAM for storing data to be written into the actual area.
当数据需要写入实际区的某个绝对地址时,通过查询建立页面映射的映射表,可以知道是否已经有设定好的映射关系,如果存在的话,就不用重新进行映射关系的建立,就可以直接通过内存进行数据的转移,如果不存在的话,那么在缓存区内确定一个映射扇区(可以是本来没有写入数据的部分,也可以是经过擦拭后获得的部分);获取该映射扇区的数据并存入RAM。When the data needs to be written to an absolute address of the actual area, the mapping table of the page mapping is established by querying, and it can be known whether there is already a set mapping relationship. If it exists, it is not necessary to re-establish the mapping relationship. Transfer data directly through the memory, if not, then determine a mapped sector in the buffer area (may be the part that has not been written data, or the part obtained after wiping); obtain the mapped sector The data is stored in RAM.
基于发明的实施例1的一种串行闪存数据保护方法,当缓存区的剩余的映射扇区的空间不足时,RAM从已写入数据的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。According to a serial flash data protection method of Embodiment 1 of the invention, when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM reads data from the mapped sector in which the data has been written, and writes the data based on the page mapping. In the actual area, when the data is written, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
通过数据写入或者擦拭记录,很容易知道闪存空间的使用情况,当缓存区的剩余的映射扇区(即没有存储有数据的扇区)数量或者扇区空间不足的时候,获取已写入数据的扇区的资料,选择其中的若干扇区进行数据转移(可以随机选择扇区或者按照数据写入时间的顺序选最老的扇区),当数据写入完成的时候,则擦拭缓存区的对应的扇区并拆除页面映射关系。It is easy to know the usage of the flash space by data writing or wiping the record. When the remaining mapped sectors of the buffer area (that is, the sectors without data are stored) or the sector space is insufficient, the written data is acquired. The data of the sector, select several of the sectors for data transfer (the sector can be randomly selected or the oldest sector in the order of data write time), when the data is written, the buffer is wiped Corresponding sectors and remove page mapping relationships.
基于发明的实施例1的一种串行闪存数据保护方法,当需要转换扇区时,RAM从对应的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。According to a serial flash data protection method of Embodiment 1 of the invention, when a sector needs to be converted, the RAM reads data from the corresponding mapped sector, and writes data to the actual area based on the page mapping, when the data writing is completed. , wipe the mapping sector corresponding to the buffer area and remove the page mapping relationship.
由于需要将特定的数据进行转移,因此,会从特定的扇区进行数据的转移,通过RAM从特定的映射扇区读取数据,然后基于页面映射的关系将数据写入实际区对应的扇区/页,当数据写入完成的时候,则擦拭缓存区的对应的扇区并拆除页面映射关系。Since specific data needs to be transferred, data is transferred from a specific sector, data is read from a specific mapped sector through RAM, and then data is written to a sector corresponding to the actual area based on the relationship of page mapping. / page, when the data is written, the corresponding sector of the buffer area is wiped and the page mapping relationship is removed.
基于本发明的实施例2,一种串行闪存数据保护装置,包括以下模块:According to Embodiment 2 of the present invention, a serial flash data protection device includes the following modules:
划分模块,用于基于逻辑地址划分串行闪存为缓存区和实际区;映射模块,用于建立缓存区与实际区之间的页面映射;数据处理模块,用于将待写入数据逐区写入缓存区的映射扇区,当缓存区的剩余的映射扇区的空间不足或者数据需要转换扇区时,将映射扇区的数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。a dividing module, configured to divide the serial flash memory into a buffer area and an actual area based on the logical address; a mapping module, configured to establish a page mapping between the buffer area and the actual area; and a data processing module, configured to write the data to be written area by area The mapped sector of the buffer area is written into the actual area when the remaining mapped sectors of the buffer area are insufficient or the data needs to be converted into sectors. When the data is written, the wipe buffer area corresponds to Map the sectors and remove the page mapping relationship.
基于本发明的实施例2的一种串行闪存数据保护装置,所述映射模块还用于获取需要写入数据的实际区的绝对地址,查询该绝对地址是否在缓存区存在对应的映射扇区,如果不存在,则确定一个映射扇区并建立与所述绝对地址的页面映射;如果存在,则读取该映射扇区的数据并存入RAM,所述RAM用于存储待写入实际区的数据。According to a serial flash data protection device of Embodiment 2 of the present invention, the mapping module is further configured to acquire an absolute address of an actual area in which data needs to be written, and query whether the absolute address has a corresponding mapped sector in the buffer area. If not, determining a mapped sector and establishing a page mapping with the absolute address; if present, reading the data of the mapped sector and storing the RAM, the RAM for storing the actual area to be written The data.
基于本发明的实施例2的一种串行闪存数据保护装置,所述数据处理模块,还用于当缓存区的剩余的映射扇区的空间不足时,RAM从已写入数据的映射扇区读取数据,基于页面映 射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。According to a serial flash data protection device of Embodiment 2 of the present invention, the data processing module is further configured to: when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM is from the mapped sector of the written data. Read data based on page mapping The data is written into the actual area. When the data is written, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
基于本发明的实施例2的一种串行闪存数据保护装置,所述数据处理模块,还用于当需要转换扇区时,RAM从对应的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。A serial flash data protection apparatus according to Embodiment 2 of the present invention, wherein the data processing module is further configured to: when a sector needs to be converted, the RAM reads data from a corresponding mapped sector, and writes data based on the page mapping. In the actual area, when the data is written, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
以上所述,只是本发明的较佳实施例而已,本发明并不局限于上述实施方式,只要其以相同的手段达到本发明的技术效果,都应属于本发明的保护范围。在本发明的保护范围内其技术方案和/或实施方式可以有各种不同的修改和变化。 The above is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiment, and as long as it achieves the technical effects of the present invention by the same means, it should fall within the scope of protection of the present invention. Various modifications and changes may be made to the technical solutions and/or embodiments within the scope of the invention.

Claims (8)

  1. 一种串行闪存数据保护方法,其特征在于,包括以下步骤:A serial flash data protection method, comprising the steps of:
    基于逻辑地址划分串行闪存为缓存区和实际区;The serial flash memory is divided into a buffer area and an actual area based on the logical address;
    建立缓存区与实际区之间的页面映射;Establish a page mapping between the buffer area and the actual area;
    将待写入数据逐区写入缓存区的映射扇区,当缓存区的剩余的映射扇区的空间不足或者数据需要转换扇区时,将映射扇区的数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。Write the data to be written to the mapped sector of the buffer area by region. When the space of the remaining mapped sectors in the buffer area is insufficient or the data needs to be converted, the data of the mapped sector is written into the actual area, when the data is written. When the input is complete, wipe the mapping sector corresponding to the buffer area and remove the page mapping relationship.
  2. 根据权利要求1所述的一种串行闪存数据保护方法,其特征在于,还包括以下步骤:A serial flash data protection method according to claim 1, further comprising the steps of:
    获取需要写入数据的实际区的绝对地址,查询该绝对地址是否在缓存区存在对应的映射扇区,如果不存在,则确定一个映射扇区并建立与所述绝对地址的页面映射;Obtaining an absolute address of the actual area where the data needs to be written, querying whether the absolute address has a corresponding mapped sector in the buffer area, and if not, determining a mapping sector and establishing a page mapping with the absolute address;
    如果存在,则读取该映射扇区的数据并存入RAM,所述RAM用于存储待写入实际区的数据。If present, the data of the mapped sector is read and stored in RAM, which is used to store data to be written to the actual area.
  3. 根据权利要求2所述的一种串行闪存数据保护方法,其特征在于,当缓存区的剩余的映射扇区的空间不足时,RAM从已写入数据的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。A serial flash data protection method according to claim 2, wherein when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM reads data from the mapped sectors of the written data, based on the page. The mapping writes the data to the actual area. When the data is written, the mapping sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  4. 根据权利要求2所述的一种串行闪存数据保护方法,其特征在于,当需要转换扇区时,RAM从对应的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。A serial flash data protection method according to claim 2, wherein when a sector needs to be converted, the RAM reads data from the corresponding mapped sector, and writes the data to the actual area based on the page mapping, when the data When the writing is completed, the mapping sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  5. 一种串行闪存数据保护装置,其特征在于,包括以下模块:A serial flash data protection device, comprising the following modules:
    划分模块,用于基于逻辑地址划分串行闪存为缓存区和实际区;a dividing module, configured to divide the serial flash memory into a buffer area and an actual area based on the logical address;
    映射模块,用于建立缓存区与实际区之间的页面映射;a mapping module, configured to establish a page mapping between the buffer area and the actual area;
    数据处理模块,用于将待写入数据逐区写入缓存区的映射扇区,当缓存区的剩余的映射扇区的空间不足或者数据需要转换扇区时,将映射扇区的数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。a data processing module, configured to write the data to be written into the mapped sector of the buffer area by region, and write the data of the mapped sector when the space of the remaining mapped sectors of the buffer area is insufficient or the data needs to be converted into a sector. In the actual area, when the data is written, the mapped sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  6. 根据权利要求5所述的一种串行闪存数据保护装置,其特征在于,所述映射模块还用于获取需要写入数据的实际区的绝对地址,查询该绝对地址是否在缓存区存在对应的映射扇区,如果不存在,则确定一个映射扇区并建立与所述绝对地址的页面映射;The serial flash data protection device according to claim 5, wherein the mapping module is further configured to acquire an absolute address of an actual area in which data needs to be written, and query whether the absolute address has a corresponding area in the buffer area. Mapping a sector, if not present, determining a mapped sector and establishing a page mapping with the absolute address;
    如果存在,则读取该映射扇区的数据并存入RAM,所述RAM用于存储待写入实际区的数据。If present, the data of the mapped sector is read and stored in RAM, which is used to store data to be written to the actual area.
  7. 根据权利要求6所述的一种串行闪存数据保护装置,其特征在于,所述数据处理模块,还用于当缓存区的剩余的映射扇区的空间不足时,RAM从已写入数据的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。The serial flash data protection device according to claim 6, wherein the data processing module is further configured to: when the space of the remaining mapped sectors of the buffer area is insufficient, the RAM is written from the data. The mapping sector reads data, and the data is written into the actual area based on the page mapping. When the data writing is completed, the mapping sector corresponding to the buffer area is wiped and the page mapping relationship is removed.
  8. 根据权利要求6所述的一种串行闪存数据保护装置,其特征在于,所述数据处理模块, 还用于当需要转换扇区时,RAM从对应的映射扇区读取数据,基于页面映射将数据写入实际区,当数据写入完成时,擦拭缓存区对应的映射扇区并拆除页面映射关系。 A serial flash data protection device according to claim 6, wherein said data processing module, Also used when the sector needs to be converted, the RAM reads data from the corresponding mapped sector, writes the data to the actual area based on the page mapping, and when the data is written, wipes the mapped sector corresponding to the buffer area and tears down the page mapping. relationship.
PCT/CN2017/086340 2017-05-19 2017-05-27 Serial flash data protection method and device WO2018209733A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710359509.9 2017-05-19
CN201710359509.9A CN107273309A (en) 2017-05-19 2017-05-19 A kind of serial flash data guard method and device

Publications (1)

Publication Number Publication Date
WO2018209733A1 true WO2018209733A1 (en) 2018-11-22

Family

ID=60064773

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/086340 WO2018209733A1 (en) 2017-05-19 2017-05-27 Serial flash data protection method and device

Country Status (2)

Country Link
CN (1) CN107273309A (en)
WO (1) WO2018209733A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101030167A (en) * 2007-01-17 2007-09-05 忆正存储技术(深圳)有限公司 Flash-memory zone block management
CN101046803A (en) * 2006-03-28 2007-10-03 大唐移动通信设备有限公司 Safety management method and device of file system
CN102306124A (en) * 2011-08-01 2012-01-04 深圳市文鼎创数据科技有限公司 Method for implementing hardware driver layer of Nand Flash chip
CN102841851A (en) * 2012-07-19 2012-12-26 深圳市江波龙电子有限公司 Flash memory management method and flash memory device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539891B (en) * 2008-03-17 2012-12-05 锐迪科微电子(上海)有限公司 Embedded type flash memory, storage system and method for power fail safeguard of data
CN102591748A (en) * 2011-12-29 2012-07-18 记忆科技(深圳)有限公司 Solid state disc and power failure protection method and system thereof
CN103049394A (en) * 2012-11-30 2013-04-17 记忆科技(深圳)有限公司 Method and system for data caching of solid state disk
CN103093157A (en) * 2013-01-25 2013-05-08 浪潮电子信息产业股份有限公司 Method of permanent protection of cache data of serial attached scsi (SAS) redundant array of independent disks (RAID) card
CN103269361A (en) * 2013-05-03 2013-08-28 北京理工大学 File delivery device and file design method for deep space communication

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101046803A (en) * 2006-03-28 2007-10-03 大唐移动通信设备有限公司 Safety management method and device of file system
CN101030167A (en) * 2007-01-17 2007-09-05 忆正存储技术(深圳)有限公司 Flash-memory zone block management
CN102306124A (en) * 2011-08-01 2012-01-04 深圳市文鼎创数据科技有限公司 Method for implementing hardware driver layer of Nand Flash chip
CN102841851A (en) * 2012-07-19 2012-12-26 深圳市江波龙电子有限公司 Flash memory management method and flash memory device

Also Published As

Publication number Publication date
CN107273309A (en) 2017-10-20

Similar Documents

Publication Publication Date Title
AU2015371849B2 (en) Data reading method and apparatus
US9256384B2 (en) Method and system for reducing write latency in a data storage system by using a command-push model
US10467044B2 (en) Transaction processing method and apparatus, and computer system
US11960749B2 (en) Data migration method, host, and solid state disk
KR20170118594A (en) Validity tracking for garbage collection
US10754785B2 (en) Checkpointing for DRAM-less SSD
KR20120063829A (en) Method of data processing for non-volatile memory
CN104699417A (en) Data storage device and data access method thereof
US20170185354A1 (en) Techniques for a Write Transaction at a Storage Device
CN109144422A (en) A kind of data writing method of solid state hard disk, device, equipment and storage medium
CN106469119B (en) Data writing caching method and device based on NVDIMM
TW202026891A (en) Method and computer program product for performing data writes into a flash memory
US11366596B2 (en) Data storage device and data access method for quickly loading boot data
EP3496356A1 (en) Atomic cross-media writes on storage devices
WO2018209733A1 (en) Serial flash data protection method and device
CN115576867A (en) Extended address space for memory devices
CN114610654A (en) Solid-state storage device and method for writing data into solid-state storage device
WO2018094958A1 (en) Data processing method, device and system
TW202242664A (en) Method of performing garbage collection with partial clean operation and related controller and storage system
CN109032522B (en) Data reading method of solid state disk and solid state disk
CN109062503B (en) Method and device for improving read retry efficiency after SSD is powered off and computer equipment
CN108536619B (en) Method and device for rapidly recovering FTL table
TWI633434B (en) Method, system, and computer readable medium for managing solid state drive
TWI616755B (en) Storage device and associated data mapping method
CN116860182B (en) Method for reading and writing FTL full mapping table on host RAM by CXL protocol

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: 17910148

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: 17910148

Country of ref document: EP

Kind code of ref document: A1