CN102609331A - File format of loading code in NAND flash - Google Patents

File format of loading code in NAND flash Download PDF

Info

Publication number
CN102609331A
CN102609331A CN 201210017254 CN201210017254A CN102609331A CN 102609331 A CN102609331 A CN 102609331A CN 201210017254 CN201210017254 CN 201210017254 CN 201210017254 A CN201210017254 A CN 201210017254A CN 102609331 A CN102609331 A CN 102609331A
Authority
CN
Grant status
Application
Patent type
Prior art keywords
data
code
nand flash
flash memory
file
Prior art date
Application number
CN 201210017254
Other languages
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

Links

Abstract

The invention provides a file format of a loading code in NAND flash. The file format of the loading code is characterized by comprising a file identifier, a file identifier start mark, a plurality of data sections, a file data end mark and a file data check code. Compared with the prior art, the file format has the advantages that by the aid of the loading code in the specific format, whether a read loading code is correct and complete or not is detected by checking data of the read loading code, accuracy of the data is ensured in the process of accessing the loading code in the NAND flash, and an implementation method is simple and practicable.

Description

NAND闪存的装载代码的文件格式 NAND flash loader code file format

技术领域 FIELD

[0001] 本发明涉及SoC从NAND闪存启动技术,尤其涉及一种新的NAND闪存的装载代码的文件格式。 [0001] The present invention relates to technology SoC start from NAND flash memory, particularly to a new NAND flash loader code file format.

背景技术 Background technique

[0002] 随着嵌入式系统的日趋复杂,实际项目对大容量数据存储的需求越来越紧迫。 [0002] With the increasing complexity of embedded systems, the actual project demand for large-capacity data storage is more and more urgent. 当前嵌入式设备低功耗、小体积以及低成本的要求也致使硬盘无法得到广泛的应用,而大容量闪存设备恰是为了满足当前这一需求而迅速发展起来。 The current embedded devices, low power consumption, small size and low cost requirements also led to hard drive is not widely used, and a large-capacity flash memory devices, just to meet the current needs of this rapidly developed. 从闪存设备装载代码来启动嵌入式系统是一项基本且必要的Soc技术,如何解决Soc从闪存启动技术中的一些特定问题是目前业内的研究重点。 From the flash memory device is loaded code to start embedded system is a fundamental and necessary technical Soc, Soc how to solve a specific problem from a number of flash-start technology is the focus of current research industry.

[0003]目前国际上成熟的Soc从闪存启动技术通常需要完成四个部分功能和过程: [0003] At present mature international Soc start from flash technology usually requires four to complete the process and some of the features:

第一步,首先Soc内部硬件固化的过程代码被执行,这段硬件固化的过程代码将对闪存进行基本的初始化,然后把闪存中的装载程序代码调入SoC内部的高速缓存中(如图I所示); First step, Soc internal hardware code is executed during curing, during curing of this hardware will flash the code for basic initialization, loader code is then transferred to the internal flash memory cache SoC (I in FIG. shown);

第二步,片内高速缓存中的装载代码被执行,初始化内存并将启动代码从闪存拷贝到内存中(如图2所示); The second step, on-chip cache loader code is executed, the boot code and initialize the memory to be copied from the flash memory (FIG. 2);

第三步,内存中的启动代码被执行,初始化外部系统及其相关设备,并将操作系统核心代码从NAND闪存拷贝到内存中(如图3所示); A third step, boot code memory is executed, the external system initialization and related equipment, and copying the code from the operating system kernel to the NAND flash memory (FIG. 3);

第四步,内存中的操作系统核心被执行,执行操作系统的控制任务(如图4所示)。 A fourth step, the operating system kernel memory is performed, the control task operating system (Figure 4).

[0004] 然而,NAND闪存不同于其它存储设备,现有技术中装载代码程序的文件格式,往往由于NAND闪存数据特有的不可靠性,NAND闪存中对装载代码访问过程中的数据的准确性无法得以保证。 [0004] However, unlike other NAND flash memory device, the program code is loaded prior art file formats, often due to the NAND flash memory unreliability specific data, the accuracy of the data in the NAND flash memory access during loading of the code can not be can be guaranteed.

[0005] 所以,有必要提出一种新的装载代码的文件格式以满足相应要求。 [0005] Therefore, it is necessary to propose a new loading file format code in order to meet the corresponding requirements.

发明内容 SUMMARY

[0006] 为解决上述技术问题,本发明的目的在于提供一种新的NAND闪存的装载代码的文件格式,通过这样的特定格式的装载代码来保证NAND闪存中对装载代码访问过程中的数据的准确性。 [0006] In order to solve the above problems, an object of the present invention is to provide a new file format NAND flash loader code, to ensure that the code is loaded by a specific format such as NAND flash memory access codes to the data during the loading of accuracy.

[0007] 为实现上述发明目的,本发明提供的一种NAND闪存的装载代码的文件格式,所述装载代码的文件格式包括:文件标识、文件标识起始标志、若干数据段、文件数据结束标志以及文件数据校验码。 [0007] In order to achieve the above object, the code is loaded NAND flash file format provided by the present invention, the loading code file formats comprising: a file identification, file identifier start flag, a number of data segments, a data file end marker checksum and file data.

[0008] 作为本发明的进一步改进,所述数据段包括:数据长度信息、数据类型信息、数据段地址信息以及数据内容或数据表单内容。 [0008] As a further improvement of the present invention, the data segment comprising: a length information data, data type information, data segment address information and the data content or data content of the form.

[0009] 作为本发明的进一步改进,所述文件标识为32比特二进制数据。 [0009] As a further improvement of the present invention, the file identifier is a 32-bit binary data.

[0010] 作为本发明的进一步改进,所述文件标识起始标志与所述文件数据结束标志为32 比特二进制数据。 [0010] As a further improvement of the present invention, said file identifier and said file data start flag end flag is 32-bit binary data. [0011] 与现有技术相比,本发明通过采用这样的特定格式的装载代码,经过对读取的装载代码进行数据校验来检测是否是正确完整的装载代码,从而保证NAND闪存中对装载代码访问过程中的数据的准确性,且实现方法简单易行。 [0011] Compared with the prior art, the present invention adopts a specific format of such code is loaded, after loading the code of the read data check is performed to detect whether the code is correct and complete loading, so as to ensure loading of NAND flash the accuracy of data during the access code and simple implementation.

附图说明 BRIEF DESCRIPTION

[0012] 图I是现有技术中Soc从闪存启动的步骤一的工作原理示意图; [0012] FIG. I is a schematic view of the prior art Soc flash start from step one works;

图2是现有技术中Soc从闪存启动的步骤二的工作原理示意图; FIG 2 is a schematic view of the prior art from the operation principle Soc flash booting step II;

图3是现有技术中Soc从闪存启动的步骤三的工作原理示意图; 3 is a schematic step of the prior art Soc start from the flash memory of the working principle of the three;

图4是现有技术中Soc从闪存启动的步骤四的工作原理示意图;; FIG 4 is a prior art flash Soc step starting from the working principle schematic diagram of a four ;;

图5是本发明一实施方式中硬件固化代码的启动和运行的工作流程图; FIG 5 is a flowchart of a hard-wired embodiment to start and run code of an embodiment of the present invention;

图6是本发明一实施方式中NAND闪存设备初始化过程的工作流程图; FIG 6 is a flowchart of an embodiment of the present invention in a NAND flash memory device initialization process;

图7是本发明一实施方式中系统参数表的三种参数获取方式的工作流程图; FIG 7 is a flowchart of an embodiment of the present invention, three kinds of parameters of the system embodiment of the manner of obtaining the parameter table;

图8是本发明一实施方式中固化代码使用的系统参数表以多副本的方式存储的示意 FIG 8 is an embodiment of the present invention is cured using the code system parameter table stored in multiple copies of a schematic

图; Figure;

图9是本发明一实施方式中读取NAND闪存中的参数表的工作流程图; FIG 9 is a flowchart of an embodiment of the present invention is read in the parameter table of the NAND flash memory;

图10是本发明一实施方式中对NAND闪存硬件访问地址宽度参数的处理步骤的流程 FIG 10 is an embodiment of the present invention in the process of the NAND flash memory access hardware address width parameter processing procedure

图; Figure;

图11是本发明一实施方式中读取并解析闪存中的装载代码的具体步骤的流程图; FIG 11 is a flowchart showing specific steps of the read and flash loader code to parse one embodiment of the present invention;

图12表示的是本发明一实施方式中装载代码的特定文件格式以及数据段格式; 12 shows an embodiment of the present invention is loaded in a particular file format code segment and a data format;

图13表示的是本发明一实施方式中逻辑数据区装载代码的访问原理; FIG 13 shows the principles of an embodiment of the present invention, access mode logical data loading area code;

图14是本发明一实施方式中固化代码读取装载代码的具体过程的流程图; FIG 14 is a flowchart the process of loading the code reading codes specific to an embodiment of the present invention is cured;

图15表示的是本发明一实施方式中固化代码对数据页的访问原理。 15 shows an embodiment of the present invention is in principle curable code access data pages.

[0013] [0013]

具体实施方式 detailed description

[0014] 以下将结合附图所示的具体实施方式对本发明进行详细描述。 [0014] Hereinafter, specific embodiments shown in the drawings in conjunction with the present invention will be described in detail. 但这些实施方式并不限制本发明,本领域的普通技术人员根据这些实施方式所做出的结构、方法、或功能上的变换均包括在本发明的保护范围内。 However, these embodiments do not limit the present invention, the structure of those of ordinary skill in the art according to these embodiments made, methods, or change in function are included within the scope of the present invention.

[0015] 为了解决由NAND闪存特性引出的问题,制定并研发设计了一系列特定的过程和方法,用以保证初始化过程正确进行和正确读取NAND闪存中的数据参数,这些过程和方法是在固化代码中被执行的。 [0015] To solve the problems characteristic leading from NAND flash memory, a series of research and design and develop specific procedures and methods to ensure the initialization process correctly and correctly read data parameter NAND flash memory, in these processes and methods curing the code being executed.

[0016] 请参照图5所示,在本发明一实施方式中,硬件固化代码的启动和运行包括如下步骤: [0016] Referring to FIG. 5, in one embodiment of the present invention, a hard-wired up and running code comprising the steps of:

51、启动固化代码以初始化NAND闪存,并为读取NAND闪存中的装载代码做准备,其中, 所述固化代码中包括一保存多种型号NAND闪存参数的设备参数表,且固化代码支持设备参数表中保存的各型号NAND闪存; 51, code to initialize the start curing NAND flash memory, and NAND flash memory prepares to read the load code, wherein said code comprises a curing parameter table storage device parameter models NAND flash, the code and curing support equipment parameters held in the table for each model NAND flash memory;

52、读取并解析所述NAND闪存中的装载代码,并采用数据错误检测及数据纠错过程(ECC)对数据进行处理,所需ECC码按照访问区的不同分别存储在数据页的不同位置。 52, of the NAND flash memory reads and parses the code is loaded and uses the data error detection and data error correction process (ECC) for data processing, an ECC code according to the different desired access area are stored in different locations of the page data .

[0017] 值得一提的是,所述固化代码支持NAND闪存行业标准ONFI 2. 0(0pen NAND FlashInterface 2.0)。 [0017] It is worth mentioning that the curing code supports industry standard NAND flash ONFI 2. 0 (0pen NAND FlashInterface 2.0). Open NAND Flash Interface (ONFI)工作组已经于2008-2009 年公布了其ONFI 2. O标准。 Open NAND Flash Interface (ONFI) Working Group has published its ONFI 2. O standard in 2008-2009. 该公司成立于2006年5月,拥有100多个涉及制造、设计以及使用闪存产品的成员,包括海力士、英特尔、镁光、SanDisk以及索尼。 The company was founded in 2006, has more than 100 involved in manufacturing, design and the use of members of flash memory products, including Hynix, Intel, Micron, SanDisk and Sony. ONFI 2. O标准要求NAND闪存能够通过处理特殊指令OxEC提供硬件设备的具体参数。 ONFI 2. O standards to provide the specific parameters of the NAND flash memory by the processing hardware special instructions OxEC. 在固化代码的参数获取流程中,能够通过这个命令将支持ONFI 2. O标准的NAND闪存中的参数读取并更新到系统参数表中。 Cured parameter code acquisition process, it is possible to support the ONFI 2. O standard NAND flash memory using this command reads and updates the parameters of the system to the parameter table.

[0018] 其中,如图6所示,步骤SI具体包括: [0018] wherein, as shown in step SI 6 comprises:

511、初始化用于与NAND闪存通信以控制NAND闪存的NAND闪存硬件控制器; 511, initialization for controlling NAND flash memory in communication with the NAND flash memory NAND flash memory controller hardware;

512、检测当前NAND闪存参数并读取与当前NAND闪存对应的固化代码参数。 512, detects the current parameter NAND flash memory and read the current parameters cured codes corresponding to the NAND flash memory. NAND闪存参数检测,固化代码参数读取过程依据不同类型的闪存包含不同的内容,目前在成熟的方案中可以同时支持SPI闪存以及NAND闪存,这两种闪存中NAND闪存由于固有的硬件特征使得控制更为复杂。 Parameter detection NAND flash memory, the code reading curing process parameters include different types depending on the content of the flash memory, the current mature programs may be supported simultaneously SPI flash and NAND flash memory, NAND flash two flash memory due to the inherent characteristics such that the control hardware more complex.

[0019] 具体地,在本实施方式中的步骤SI中,首先需要进行硬件的启动(系统加电),接下来需要通过硬件启动控制器初始化片内存储器(步骤SlOl),硬件启动控制器分析并解析存储在片内存储器上的特定格式的固化代码(步骤S102),紧接着判断解析是否成功(步骤S103),若不成功,则硬件启动停止;若成功,则进行固化代码的启动(步骤S104),通过启动固化代码来初始化闪存并为读取装载代码做必要准备,并判断是否成功(步骤S106),若成功,便进入读取并解析闪存中的装载代码的步骤,若不成功,则判断是否需要启动下一个闪存(步骤S110),若是,则返回步骤SI、若否,跳转步骤Slll :停止固化代码。 [0019] Specifically, in the step SI the present embodiment, first the hardware required to start (power system), the need to start the next memory chip controller initializes (step the SLOL) hardware, the hardware start controller Analysis curing and analyzing the code stored in a particular format on the memory chip (step S102), followed by determining whether parsing is successful (step S103), if successful, the hardware start stop; if successful, the curing is performed starting code (step S104), by starting curing code to initialize the flash memory and make the necessary preparations for the load code reading, and determines whether or not successful (step S106), if successful, will enter the flash memory is read and the step of loading the code analysis, if not successful, it is judged whether to start a flash memory (step S110), and if so, returns to step SI, if not, skip step S111: stopping cured code.

[0020] 在读取并解析闪存的装载代码之后,还需判断该过程是否成功(步骤S108),若是, 则启动控制权交给特定的软件来装载代码(步骤S109);若否,同样需要判断是否需要启动下一个闪存(步骤SI 10)。 [0020] After reading and parsing of the flash loader code, determines whether the process needs to successful (step S108), if yes, the start control to specific software to load code (step S109); if not, the same need determine whether the need to start a flash memory (step SI 10).

[0021] 在本实施方式中,固化代码最终使用的参数(比如闪存设备参数、设备ID、尺寸信息等等)保存于一系统参数表中,所述系统参数表的参数获取方式包括搜索固化代码内部NAND闪存设备参数表、或者从支持ONFI 2. O标准的NAND闪存获取、或者读取NAND闪存首页保存的参数表。 [0021] In the present embodiment, the curing parameters (parameters such as a flash memory device, a device ID, size information, etc.) stored in a system parameter table used in the final code, the system parameter table comprises a search parameter acquisition mode codes cured NAND flash memory device internal parameter table, or get support from ONFI 2. O standard NAND flash memory, NAND flash memory read or home saved parameter table.

[0022] 具体地,请参图7所示,“搜索固化代码内部NAND闪存设备参数表”的参数获取方式具体为: [0022] In particular, see FIG. 7, "search curing NAND flash memory device internal code parameter table" Obtaining parameters specifically:

内部设备表参数获取开始; Table internal parameter acquisition apparatus starts;

读取NAND闪存设备的ID,其中,设备参数表中为每一个型号的NAND闪存都分别配置了唯一的ID ; NAND flash memory device reads the ID, wherein the device parameter list in each model are NAND flash memory are arranged as a unique ID;

判断读取ID是否成功,若是,则读取内部设备参数表;若否,则内部设备表参数获取结 Determining whether the ID is read successfully, and if yes, the reading parameter table inside the device; if not, then the internal node parameter acquisition device table

束; bundle;

读取内部设备参数表结束后,还需判断是否找到闪存信息,若是,则对系统参数表进行更新;若否,则内部设备表参数获取结束; After reading the internal device parameter table, find the need to determine whether the flash memory information, and if so, the system parameter table is updated; if not, then the internal device table parameter acquisition ends;

“从支持ONFI 2. O标准的NAND闪存获取”的参数获取方式具体为: "Get support from ONFI 2. O standard NAND flash memory 'parameter to get specific ways:

ONFI信息表读取开始; ONFI reading start information table;

与NAND闪存通信并获取ONFI读取信息表; NAND flash memory communicates with the ONFI reads and acquires information table;

判断是否成功获取,若是,则对系统参数表进行更新;若否,则ONFI信息表读取结束; “读取NAND闪存首页保存的参数表”的参数获取方式具体为:NAND闪存中的参数表获取开始; Determine whether the successful acquisition, if so, the system parameter table is updated; if not, ONFI end information table read; "read the NAND flash Home Saved Parameter List" parameter to get specific way: the parameter table NAND flash memory get the start;

读取NAND闪存中的参数表; Reading parameter table of the NAND flash memory;

判断是否成功获取,若是,则对系统参数表进行更新;若否,则NAND闪存中的参数表获取结束; Determine whether the successful acquisition, if so, the system parameter table is updated; if not, the NAND flash memory acquisition parameter table end;

表[I]中列举了其中的部分参数: TABLE [I], wherein a partial list of parameters:

Figure CN102609331AD00061

表[2]列举了这些闪存的具体型号: Table [2] include those specific flash model:

Figure CN102609331AD00071

在固化代码中,设备参数表中存有目前市场上已经存在的32种以上的不同NAND闪存的信息,这些闪存都是固化代码能够支持的,优选地,所述设备参数表中为每一种型号的NAND分别配置唯一的ID (如表2所示)。 In curing the code, the device has a message different from the parameter table of the NAND flash memory over 32 already present on the market, these drives are supported code to curing, preferably, the device parameter table for each a NAND type are disposed a unique ID (as shown in table 2).

[0023] 参图8所示,在本发明一实施方式中,一种固化代码参数表的保存及获取方法,包括如下步骤: [0023] reference to FIG. 8, in one embodiment of the present invention, a parameter table stored codes and access curing method, comprising the steps of:

将固化代码的参数表保存于NAND闪存的第一个可使用的存储页中,其中,所述固化代码的参数表保存为多个副本,且每个副本内容与原参数表内容一致; A first memory page may be cured using the code parameter table stored in the NAND flash memory, wherein the curing parameters of the code table holding a plurality of copies, with each copy of the content is consistent with the original parameter table of contents;

采用ECC (Error Correcting Code ,数据错误检测及数据纠错)方式来读取参数表数据。 Using ECC (Error Correcting Code, data error detection and data error correction) scheme to read the parameter table data.

[0024] 优选地,该方法包括采用MD4或MD5校验方式对原参数表及各参数表副本进行校验。 [0024] Preferably, the method comprises using MD4 or MD5 checksum mode parameters Table replica of the original and the parameters for verification.

[0025] 本发明为解决NAND闪存的多样性特点,在NAND闪存的第一个可访问的存储页中设立参数表保存重要的硬件参数以及固化代码运行需要的必要的参数,同时为保证数据的正确性,参数表保存采用多个副本,同时采用国际流行的MD4和MD5校验方式,并采用数据错误检测及数据纠错(ECC)流程。 [0025] The present invention is to solve the diversity of the NAND flash memory, is important to establish the parameter table stored hardware parameters and curing the necessary parameters required to run the code in a first memory page accessible in the NAND flash memory, as well as to ensure data accuracy, using the parameter table holding a plurality of copies, while internationally popular MD4 and MD5 checksum embodiment, and uses the data error detection and error correction data (ECC) process.

[0026] 在本实施方式中,这样的存储结构的三个重要内容是:第一,参数表保存采用多个副本(副本I、副本2、副本3…),且每个副本内容与原参数表内容一致,其中,原参数表和副本参数表均为128字节,其中,参数表包括版本信息、系统参数、保留字段以及MD4 (5)代码部分,采用此方式可以在一定程度上避免局部数据损坏的问题;第二,采用国际流行的MD4 或MD5校验方式,对参数表及每个副本进行MD4或MD5校验,以确保该参数表数据的正确性和安全性;第三,采用数据错误检测及数据纠错(ECC),这个方案针对NAND的数据不可靠性设计的,在数据读取过程中,数据的错误检测以及纠错是通过固化代码控制NAND闪存控制器完成的,目前可以对NAND闪存中保存的参数表以及随后的保留区出现的24位数据错误进行检测纠错。 [0026] In the present embodiment, three such important storage structure is: first, using parameter table holding a plurality of copies (copies I, copy 2, copy 3 ...), and each copy of the original contents of the parameter consistent with the table of contents, wherein a copy of the original parameter table and the parameter table are 128 bytes, wherein the parameter table includes version information, system parameters, retention (5), and field code portions MD4, partially in this manner can be avoided to some extent data corruption; second, internationally popular MD4 or MD5 checksum mode, and each copy of the parameter table for MD4 or MD5 checksum to ensure the accuracy and security of the data parameter table; third, using data error detection and error correction data (the ECC), the data for a program designed for the NAND unreliability in the data read process, data error detection and error correction is done by controlling NAND flash controller curing code currently can be detected on the 24-bit data error correction stored in the parameter table of the NAND flash memory and subsequent reserved area appears.

[0027] 如图9所示,在本发明一实施方式中,所述“采用ECC读取参数表数据”的步骤具体为: Step [0027] 9, in one embodiment of the present invention, the "ECC read table data using the parameter" specifically:

5201、读取NAND闪存中的参数表开始; 5201, reading parameter table of the NAND flash memory starts;

5202、使能硬件ECC,读取参数表数据; 5202, enabling the ECC hardware, data reading parameter table;

5203、判断ECC是否失败,若是,则关闭硬件ECC,读取参数表数据(步骤S204);若否,则继续S205的操作; 5203, it is determined whether the ECC fails, if yes, turn off hardware ECC, the read parameter table data (step S204); if not, the operation S205 is continued;

S205、对当前参数表(原参数表及各参数表副本)进行MD4或MD5的数据校验;并判断校验是否成功,若成功,则保存并更新固化代码中系统参数表;反之,则判断是否完成所有副本(步骤S207):如果未完成所有副本,则跳转S205 ;反之,则跳转步骤S208。 S205, the current parameter table (parameter table and the parameters of the original copy of the table) is the MD4 or MD5 checksum data; and determining whether the verification is successful, if successful, the tag storing and updating curing system parameter table; otherwise, it is determined all copies is completed (step S207): If not all copies, then jump S205; on the contrary, then jump to step S208.

[0028] 值得一提的是,所述固化代码支持NAND闪存行业标准ONFI 2. 0(0pen NAND Flash Interface 2. O)。 [0028] It is worth mentioning that the curing code supports industry standard NAND flash ONFI 2. 0 (0pen NAND Flash Interface 2. O).

[0029] 在NAND闪存硬件参数中,访问地址宽度参数至关重要,对NAND闪存的任何硬件访问协议都包含这个部分内容。 [0029], the width parameter access address critical parameter in the NAND flash memory hardware, any hardware access protocol for NAND flash are included in this part. 目前国际市场上存在多种类型访问地址宽度不同的NAND闪存,这就要求固化代码要对这个重要参数实现自动检测。 Currently there are many different types of NAND flash memory access address width on the international market, which requires automatic detection code to be cured of this important parameter. 固化代码根据设计方案的执行过程中,首次访问存储数据是在读取NAND闪存中的参数表这个过程,因此在这一过程中采用独特的顺序依次设置不同的访问地址宽度参数是目前采用的有效方式之一。 Code executed during the curing of the design, the first access data stored in the NAND flash read parameter table according to this process, and therefore a unique set different access order of the width of the address parameters is effective in the process currently used one of the ways.

[0030] 接下来,请参图10所示,在本实施方式中,对NAND闪存硬件访问地址宽度参数的处理的过程具体为: [0030] Next, please refer to FIG. 10, in the present embodiment, the process of the NAND flash memory access hardware address width parameters of a process specifically comprises:

5301、地址宽度检测开始; 5301, a width detection start address;

5302、读取NAND闪存中的参数表(即图9所示的步骤); 5302, reading a parameter table (i.e., the step shown in FIG. 9) NAND flash memory;

5303、判断是否成功读取参数表,若是,则更新系统参数表中的参数(S304),然后地址宽度检测结束(S307); 5303, it is determined whether the parameter table read successfully, if the parameter (S304) the system parameter table is updated, then the address width detection end (S307);

若否,则还需判断是否所有参数都完成了设置(若是,地址宽度检测结束(S307);若否, 则按照特定顺序更新新地址宽度参数(S306 )。) If not, it is determined whether all parameters are needed to complete the setting (if address width detection end (S307); if not, the new address is updated width parameter (S306) in a particular sequence.)

参图11所示,在本发明一实施方式,读取装载代码(步骤S2)是固化代码在完成必要的 Reference to FIG. 11, in one embodiment of the present invention, reads the code is loaded (step S2) is cured to complete the necessary code

8设备初始化以后做的主要工作,这个过程的工作原理可以用图11表示。 8 device initialization after doing major work, the working principle of this process can be represented by 11. 其中,步骤S2具体为: Wherein the step S2 is specifically:

5401、必要的系统初始化; 5401, the necessary system initialization;

5402、读取下一可访问数据区闪存中的装载代码,其中,装载代码的读取按照一定顺序进行逐一读取; 5402, access to read the next data area in the flash loader code, wherein the code is read by one read load in a certain sequence;

5403、判断装载代码的读取是否成功,若是,则对跳转到:对读取的装载代码进行解析检测(步骤S404)其中,检测的具体方法在下文会介绍;若否,则判断是否已完成了所有数据区的读取(步骤S405),其中,若还有未完成读取的数据区,则跳转到步骤S401再进行一次循环,反之,结束装载代码的读取操作; 5403, determined loading code reading is successful, and if yes, jump to: read the code for analyzing the load detection (step S404) in which, in the specific detection method will be described hereinafter; if not, it is determined whether completion of reading all the data area (step S405), wherein, if there are outstanding data read region, and then jumps to step S401 for the next cycle, on the contrary, the end of the loading of the code reading operation;

S406、判断装载代码是否正确,若是,结束装载代码的读取操作;反之,跳转到步骤S405。 S406, determining the loading code is correct, and if so, code reading operation the loading end; otherwise, jumps to step S405.

[0031] 在这个过程中,对闪存可访问的数据区中的装载代码的读取是个重要的内容。 [0031] In this process, the reading of the data area in the flash memory access code that is loaded important content.

[0032] 在NAND闪存中,装载代码可以是一个,也可以是多个,它们都具有相同的特定格式。 [0032] In NAND flash memory, a code can be loaded, a plurality may be, they have the same specific format. 固化代码依据文件格式中的字段从NAND闪存中读取满足条件的数据,然后经过对读取的装载代码进行数据校验来检测是否是正确完整的装载代码。 Curing the code fields in the file format based on the data read from the NAND flash memory to meet the conditions, and then through the loading of the read data check codes to detect whether the code is correct and complete loading. 接下来,参图12所示,本发明的一具体实施方式中,装载代码的文件格式按一定次序具体为:包括文件标识(4字节)、 文件数据起始标志(4字节)、若干数据段(数据段I、数据段2···数据段η)、文件数据结束标志(4字节)以及文件数据校验码(4字节)。 Next, reference FIG. 12, one embodiment of the present invention, the loading of the code format is specifically a certain order: a file identification (4 bytes), a file start flag data (4 bytes), a number of the data segment (segment I, the data segment a data segment 2 ????? η), file data end flag (4 bytes) and a checksum file data (4 bytes).

[0033] 其中,数据段的格式按次序具体为:数据段长度信息(2字节)、数据段类型信息(2 字节)、数据段地址信息(4字节)以及数据内容或数据表单内容。 [0033] wherein, the format of data segment in order, in particular: data length information (2 bytes), the data segment type information (2 bytes), data segment address information (4 bytes) and the data content or data content of the form .

[0034] 其中,标有“4字节”的内容为为32比特的二进制数据,标有'2字节'的内容为16 比特的二进制数据。 [0034] wherein, marked "4 bytes," the contents of 32 bits of binary data, with '2 bytes' content is 16-bit binary data. 文件标识,数值为0χ??55??55 (??表示16进制00到FF,下同),文件数据起始标识数值为0xC2C2????,文件数据结束标志数值为0xC288C288。 File identifier, a value of 0χ ?? 55 ?? 55 (?? 00 to the FF indicates hexadecimal, the same below), the file data for the start flag value 0xC2C2 ????, file data end flag value is 0xC288C288. 数据段类型信息数值为0xC2??。 Segment type information for the data value 0xC2 ??.

[0035] 参图12所示,为了解决NAND闪存中包含坏块的问题,装载代码不保存在有坏块的数据区中。 [0035] The parameters shown in FIG. 12, in order to solve the problem included in the NAND flash memory of the bad block, loader code is not stored in the data area of ​​bad blocks. 针对在使用过程中可能造成损坏的问题,允许在NAND闪存中保存为具备相同文件格式的一个或多个装载代码,这些装载代码可以是相同的也可以是不同的,当读取过程中某一数据区出现坏块时,忽略对该数据区的访问并跳到下一个数据区进行访问。 Problems which may be damaged during use, allowing to save one or more load codes have the same file format in the NAND flash memory, loading these codes may be the same or may be different, when a reading process bad blocks occur when the data area, ignoring the access to the data area of ​​a data area and skip to the next visit. 这些保存在NAND闪存中的装载代码最多占用32个数据块,在本发明一实施方式中,固化代码读取这些装载代码的时候依据图12中箭头所示的方式从后向前逐一访问的。 The loader code stored in the NAND flash memory occupy up to 32 data blocks, in an embodiment of the present invention, the curing code reading these codes when loaded individually accessed from the front in accordance with the manner shown by arrow 12 in FIG. 其中,每一个数据区都对应设置有一物理数据区号和一逻辑数据区号,特别的,坏块的逻辑数据区号为空。 Wherein each of the data area corresponds to the area code is provided with a physical data and logical data a code, in particular, logical data code bad block is empty.

[0036] 固化代码中按照这种访问方式读取装载代码的过程可以用图13来表示。 [0036] The curable loaded code read access code in this way the process can be represented by 13 in FIG.

[0037] 其中,该过程具体包括: [0037] wherein the process comprises:

5501、必要的初始化; 5501, necessary initialization;

5502、从下一个逻辑数据区块读取数据; 5502, reads data from a logical data block;

5503、对读取的装载代码进行校验; 5503, of loading the code read for verification;

5504、判断校验是否成功,若是,装载代码读取结束;若否,判断是否所以数据区的访问结束(步骤S505):若是,结束装载代码的读取;若否,跳转步骤S501进行一次循环。 5504, it is determined whether or not the verification is successful, if yes, loading the code reading end; if not, it is determined whether the data access region is completed (step S505): If the end of the loading of the code reading; if not, skip step S501 once cycle.

[0038] “从逻辑数据块读取数据“的过程具体为:5601、计算所要读取的数据的数量; [0038] "read data from the logical block" process specifically: 5601, calculates the amount of data to be read;

5602、搜索坏块列表,将逻辑地址转换为物理地址; 5602, searches the bad block list, converts the logical address into a physical address;

5603、判断数据区数据是否保留在缓存中,若是,进入步骤S604 :从缓存中读取数据; 若否,进入步骤S605:从闪存中读取页数据,并更新缓存数据(S606)。 5603, it is determined whether the data area of ​​the data retained in the cache, and if yes, proceeds to step S604: reading the data from the cache; if not, proceeds to step S605: reading page data from flash memory and updates the cache data (S606).

[0039] 在步骤S604和步骤S606之后,跳转到步骤S607 :判断是否需要读取更多的数据, 若是,跳转到步骤S602进行再一次循环;若否,读取数据结束。 [0039] After step S604 and step S606, the jumps to the step S607: determining whether more data needs to be read, if yes, proceeds to step S602 to re-cycle; if not, the read data ends.

[0040] 针对NAND闪存数据不可靠性特征,数据读取过程中采用数据错误检测及数据纠错流程(ECC),这些纠错过程需要的纠错代码按照特定的格式存储在NAND闪存中。 [0040] wherein unreliability, the data reading process using the data error detection and data error correction process (ECC) for data NAND flash memory, the error correcting codes which require error correction process according to a specific format is stored in the NAND flash memory.

[0041] 如图15所示,在NAND闪存的国际标准中数据区(块)内的数据是以数据页为单位存贮的,每个数据页分为尺寸相异的两个段,即数据段和备用段(00B或Spare area)。 Data in the [0041] As shown, the NAND flash memory in the International Standards data area 15 (blocks) of data is stored in units of pages, each page of data is divided into two different segment size, i.e., the data section and the standby section (or are 00B spare area). 为了解决NAND闪存数据的不可靠性的特点,固化代码在进行数据页访问的时候,采用数据错误检测及数据纠错过程(ECC)处理。 In order to solve the time characteristics of unreliability NAND flash memory data, data pages during curing access codes using data error detection and data error correction process (ECC) process. 在所有SoC中,NAND闪存的ECC是通过控制NAND闪存硬件控制器,由控制器硬件完成的,其中需要的ECC码将按照访问区的不同分别存储在数据页的不同位置。 In all the SoC, an ECC NAND flash memory is a NAND flash memory by controlling the hardware controller, the controller hardware to complete, which requires the ECC codes are stored in different regions of different access positions in the data page.

[0042] 其中,在本实施方式中,固化代码对数据页的访问过程具体为(参照图15中箭头 [0042] In the present embodiment, the curing process code access to particular data pages (refer to the arrow 15 in FIG.

1、2、3、4 所示): As shown 1,2,3,4):

按次序逐一访问数据段中某一数据段(数据段O、数据段I);其中,数据段为1024字节。 One by one in sequence to access data in a segment data segment (data segment O, the I data segment); wherein the data segment is 1024 bytes.

[0043] 调用备用段中与当前被访问数据段对应的ECC码(数据段O对应ECC-0、数据段I 对应ECC-1.…)对当前访问数据进行处理; In [0043] the current call standby period corresponding to the data being accessed ECC code segment (data segment corresponding to O ECC-0, I corresponds to data segment ECC-1 ....) Out of the current process data;

经过使用以上描述的方法和过程,在多种SoC中,系统加电以后硬件部分能正确的从闪存将装载代码读取到片内缓存中并将控制权交给软件。 After using the above methods and processes described, in various SoC, the power system after the hardware portion can be correctly read from the flash memory chip will be loaded into the code buffer and control to software.

[0044] 此项技术完全实现了从NAND闪存以及SPI闪存中启动的功能,配合自主研发的闪存烧写软件,这套成熟的技术已经应用到众多的设计项目中。 [0044] This technology is fully realized starting from the NAND flash memory and SPI flash function, with independent research and development of flash memory programming software, this mature technology has been applied to many design projects.

[0045] 针对NAND闪存的特点提出的解决方案目前支持国际市场上所有满足硬件控制器ECC要求的NAND闪存。 [0045] According to the characteristics of NAND flash memory solutions proposed by the international market currently supports all hardware controllers meet the requirements of the ECC NAND flash memory. 在此项技术固化到成熟的SoC芯片后,由三星(Samsung)为代表的NAND闪存厂商又推出了具有更大容量的27纳米技术产品(如K9GBG08系列),现代(Hynix) 则近期推出相同容量的NAND闪存。 After curing the technology to mature SoC chips by Samsung (Samsung) for the NAND flash memory manufacturers representative has introduced a 27 Nanotechnology products with larger capacity (such as K9GBG08 series), Hyundai (Hynix) recently introduced the same capacity NAND flash memory. 经测试,虽然这些闪存都采用了最先进的工业技术和具有新的硬件特性,但应用此项技术的SoC却能够非常好的支持它们。 After testing, although these flash memory have adopted the most advanced industrial technology and with the new hardware features, but the application of this technology can be very good but SoC support them.

[0046] 应当理解,虽然本说明书按照实施方式加以描述,但并非每个实施方式仅包括一个独立的技术方案,说明书的这种叙述方式仅仅是为清楚起见,本领域技术人员应当将说明书作为一个整体,各实施方式中的技术方案也可以经适当组合,形成本领域技术人员可以理解的其他实施方式。 [0046] It should be understood that while the present specification be described in terms of embodiments, but not every embodiment comprises only one separate aspect, this narrative description only for the sake of clarity, those skilled in the art should be used as a specification overall, the embodiments of the technical solutions may be suitably combined to form other embodiments of the present art can be appreciated in the art.

[0047] 上文所列出的一系列的详细说明仅仅是针对本发明的可行性实施方式的具体说明,它们并非用以限制本发明的保护范围,凡未脱离本发明技艺精神所作的等效实施方式或变更均应包括在本发明的保护范围之内。 [0047] A series of the detailed description set forth above is merely for the feasibility of specifically described embodiments of the present invention, they are not intended to limit the scope of the present invention, who have not departing from the spirit of the present invention the equivalent skills made embodiments or changes be included within the scope of the present invention.

Claims (4)

  1. 1. 一种NAND闪存的装载代码的文件格式,其特征在于,所述装载代码的文件格式包括:文件标识、文件标识起始标志、若干数据段、文件数据结束标志以及文件数据校验码。 Loader code file format 1. A NAND flash memory, wherein the loading code file formats comprising: a file identification, file identifier start flag, a number of data segments, the data file and a file end marker data checksum.
  2. 2.如权利要求I所述的NAND闪存的装载代码的文件格式,其特征在于,所述数据段包括:数据长度信息、数据类型信息、数据段地址信息以及数据内容或数据表单内容。 2. The load file format of the code I as claimed in claim NAND flash memory, wherein the data segment comprises: data length information, data type information, data segment address information and the data content or data content of the form.
  3. 3.如权利要求2所述的NAND闪存的装载代码的文件格式,其特征在于,所述文件标识为32比特二进制数据。 Loader code file format NAND flash memory as claimed in claim 2, wherein the file is identified as 32-bit binary data.
  4. 4.如权利要求3所述的NAND闪存的装载代码的文件格式,其特征在于,所述文件标识起始标志与所述文件数据结束标志为32比特二进制数据。 4. The loader code file format NAND flash memory according to claim 3, wherein said file identifier and said file data start flag end flag for the 32-bit binary data.
CN 201210017254 2012-01-19 2012-01-19 File format of loading code in NAND flash CN102609331A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201210017254 CN102609331A (en) 2012-01-19 2012-01-19 File format of loading code in NAND flash

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201210017254 CN102609331A (en) 2012-01-19 2012-01-19 File format of loading code in NAND flash

Publications (1)

Publication Number Publication Date
CN102609331A true true CN102609331A (en) 2012-07-25

Family

ID=46526723

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201210017254 CN102609331A (en) 2012-01-19 2012-01-19 File format of loading code in NAND flash

Country Status (1)

Country Link
CN (1) CN102609331A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015014106A1 (en) * 2013-07-27 2015-02-05 深圳市瑞耐斯技术有限公司 Nand flash memory storage device and out-of-band data reading method therefor
CN104407886A (en) * 2014-11-05 2015-03-11 中国航天科技集团公司第九研究院第七七一研究所 Curing and loading method of embedded software guiding separation from target

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070043938A1 (en) * 2003-08-01 2007-02-22 Symbian Software Limited Method of accessing data in a computing device
CN101118517A (en) * 2007-08-14 2008-02-06 北京佳讯飞鸿电气股份有限公司 Data storage realizing method based on NOR FLASH chip
CN101305350A (en) * 2005-06-09 2008-11-12 惠而浦公司 Software architecture system and method for communication with, and management of, at least one component within a household appliance
CN101436158A (en) * 2008-12-25 2009-05-20 中兴通讯股份有限公司 Parameter management method and system based on embedded type equipment flash memory
CN101609544A (en) * 2009-07-21 2009-12-23 华中科技大学 Method and device for loading and measuring data of image processing device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070043938A1 (en) * 2003-08-01 2007-02-22 Symbian Software Limited Method of accessing data in a computing device
CN101305350A (en) * 2005-06-09 2008-11-12 惠而浦公司 Software architecture system and method for communication with, and management of, at least one component within a household appliance
CN101118517A (en) * 2007-08-14 2008-02-06 北京佳讯飞鸿电气股份有限公司 Data storage realizing method based on NOR FLASH chip
CN101436158A (en) * 2008-12-25 2009-05-20 中兴通讯股份有限公司 Parameter management method and system based on embedded type equipment flash memory
CN101609544A (en) * 2009-07-21 2009-12-23 华中科技大学 Method and device for loading and measuring data of image processing device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈明: "《计算机网络协议教程》", 31 May 2008, article ""X.25分组格式"", pages: 228 - 229 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015014106A1 (en) * 2013-07-27 2015-02-05 深圳市瑞耐斯技术有限公司 Nand flash memory storage device and out-of-band data reading method therefor
CN104407886A (en) * 2014-11-05 2015-03-11 中国航天科技集团公司第九研究院第七七一研究所 Curing and loading method of embedded software guiding separation from target
CN104407886B (en) * 2014-11-05 2017-11-14 中国航天科技集团公司第九研究院第七七研究所 A method of guiding and separating the target embedded software curing, loading method

Similar Documents

Publication Publication Date Title
US20110004871A1 (en) Embedded electronic device and firmware updating method thereof
US20090070374A1 (en) Generating Incremental Program Updates
US20090024899A1 (en) System and Method for Providing Data Integrity in a Non-Volatile Memory System
CN101344840A (en) Instruction set optimization
US20050207232A1 (en) Access method for a NAND flash memory chip, and corresponding NAND flash memory chip
CN101515967A (en) Over-the-air downloader of terminal firmware and method thereof
CN101937340A (en) Method and device for dynamically updating and controlling software by using patches
CN101324867A (en) Device and method for managing data based on semiconductor storage medium
US7921339B2 (en) Flash storage device with data correction function
CN102945174A (en) Method for upgrading singlechip program by means of connected off-chip Flash
JPH11265283A (en) Correction method for firmware in storage device, and storage device
CN1758220A (en) Method of updating software release
US20110276794A1 (en) Information processing device having configuration changing function and system configuration method
US6314024B1 (en) Data processing apparatus
CN101126920A (en) Method and device implementing on-line upgrading of a fixed programme
CN101567217A (en) Flash memory safely writing method and data writing method
CN101819552A (en) Method for improving debugging speed during process of system development
CN101727361A (en) Method for storing edition of terminal product and system
US20120265921A1 (en) Boot data storage schemes for electronic devices
CN103678030A (en) Multi-system equipment start system and method thereof
CN101551780A (en) Television and data storage method and device thereof
CN102890657A (en) Method for reducing data read-write errors of EEPROM (electrically erasable programmable read-only memory)
CN103473067A (en) Embedded Linux partitioning and data recovery method, embedded Linux partitioning and data recovery system and system development method
CN104572206A (en) Application program self updating and backup recovery method
CN102609241A (en) Hot patching method and device

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 215021 SUZHOU, JIANGSU PROVINCE TO: 518057 SHENZHEN, GUANGDONG PROVINCE

ASS Succession or assignment of patent right

Owner name: SOLOMON-SYSTECH (SHENZHEN) CO., LTD.

Free format text: FORMER OWNER: SUZHOU XITU SHIDING MICROELECTRONICS CO., LTD.

Effective date: 20130829

C12 Rejection of a patent application after its publication