Fast FatFS file opening method based on DSP and NandFlash bare computer, medium and product

By pre-constructing basic data cache tables and building file triple and hash indexes, the time-consuming problem of FatFS file opening is solved, and fast file access and efficient file opening process is realized. It is suitable for DSP and NandFlash bare metal systems.

CN120429271APending Publication Date: 2025-08-05傅昊
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510512935.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

The existing FatFS file opening process takes a long time, especially in scenarios where a large number of files are required to be opened and read continuously, resulting in a degradation in system performance and cannot meet the practical needs of embedded applications.

Method used

By pre-constructing the basic data cache table, obtaining the FAT table of the FatFS file and building a directory hierarchical table, traversing the directory items to extract file names, building file triples and hash indexes, establishing a file quick access table, and reducing the number of accesses to NandFlash.

Benefits of technology

It realizes fast opening of files, reduces dynamic memory allocation and memory fragmentation, improves file opening speed and system performance, and is suitable for a wide range of embedded application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429271A_ABST
    Figure CN120429271A_ABST
Patent Text Reader

Abstract

The invention discloses a fast FatFS file opening method based on a DSP and a NandFlash bare computer, a medium and a product, and belongs to the technical field of data processing. The fast FatFS file opening method comprises the steps that FAT tables of all storage areas in a FatFS file are added into a pre-constructed basic data cache table; constructing a directory hierarchy table according to the FAT table; traversing directory entries of the FAT table, and extracting the directory entries of the FAT table of each storage area as file names of effective files; obtaining a current directory name corresponding to the file name in the directory hierarchy table, and constructing a file triple and a hash index based on the current directory name and the file name; and constructing a file quick access table based on the file triple and the hash index. According to the method, the data stored in the NandFlash is stored in the basic data cache table, so that the NandFlash is prevented from being read for multiple times when the file is opened, the access frequency is reduced, the file opening time is shortened, dynamic memory allocation is not needed, the practicability is high, the file can be quickly positioned through the file quick access table, and the file can be quickly opened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing, and in particular relates to a method, medium and product for quickly opening a FatFS file based on a DSP and a NandFlash bare metal. Background Art

[0002] FatFS is a linked list file system based on the "File Allocation Table". Its principle is simple and suitable for embedded fields, so it is widely used. The existing standard process of opening a file with FatFS is: (1) Find the DOS Boot Record (DBR) through the Master Boot Record (MBR); (2) Find the FAT table (File Allocation Table) through the DOS Boot Record. Table, file allocation table) and the root directory data area; (3) using the file name (including the absolute path) as the unique identifier, starting from the root directory data area, compare each directory entry in the data area one by one. If a match is found, it means that the target file is found, and obtain the file attributes from the directory entry, such as the starting cluster number, file size and creation date, etc.; (4) If the directory hierarchy of the target file is more than one layer, compare the first-level directory name where the target file is located in the root directory data area. At this time, by reading the directory entry corresponding to the directory name, obtain the starting cluster number of the directory, enter the first-level directory where the target file is located from the root directory, and continue to match the second-level directory where the target file is located. Repeat the above operation until the target file is found and obtain the file attributes according to the directory entry; (5) If the number of directory entries that need to be traversed and compared exceeds the range that can be accommodated by a directory entry cluster during the traversal of the directory entries, it is necessary to obtain the location of the next directory entry cluster by searching the FAT table.

[0003] In the existing technology, FatFS undergoes multiple comparisons during the file opening process and needs to continuously search the FAT table and directory entries. The more files contained in the same directory, the more time-consuming it is. This is unacceptable for scenarios that require continuous opening and reading of large numbers of files and real-time graphical display of data, and may cause the system to malfunction. Moreover, as a middleware for file management, FatFS cannot take into account the various specific environments of embedded applications. Therefore, how to provide an effective technical solution to solve the problems of FatFS in the existing technology, such as time-consuming file opening, low practicality, and limited application scenarios, has become a difficult problem that needs to be solved urgently in the existing technology. Summary of the Invention

[0004] The purpose of the present invention is to provide a method, medium and product for quickly opening FatFS files based on DSP and NandFlash bare metal, so as to solve the above problems existing in the prior art.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, the present invention provides a method for quickly opening a FatFS file based on a DSP and a NandFlash bare metal, comprising:

[0007] Obtain the FAT table of each storage area in the FatFS file, and add the FAT table of each storage area to the pre-built basic data cache table;

[0008] Construct a directory hierarchy table based on the FAT table of each storage area;

[0009] In the basic data cache table, the directory entries of the FAT table of each storage area are traversed, and when the directory entry of the FAT table of each storage area is a valid file, the file name of the current directory entry is extracted;

[0010] Get the current directory name corresponding to the file name in the directory hierarchy table, and build a file triple and hash index based on the current directory name and file name;

[0011] Build a file fast access table based on file triples and hash index.

[0012] In one possible design, the directory entries of the FAT table of each storage area are traversed, and when the directory entry of the FAT table of each storage area is a valid file, the file name of the current directory entry is extracted, including the following steps:

[0013] Step 1: traverse the directory entries of the FAT table of each storage area, use the found directory entry as the current directory entry, and determine the attributes of the current directory entry;

[0014] Step 2: If the attribute of the current directory item is an invalid directory or file, repeat step 1;

[0015] Step 3: If the attribute of the current directory entry is a valid directory, then enter the next level of the current directory entry, update the directory level table, and repeat step 1;

[0016] Step 4: If the attribute of the current directory entry is a valid file, extract the file name of the current directory entry.

[0017] In one possible design, the file name of the current directory entry is extracted, including:

[0018] If the file name of the current directory entry is a long file name, the long file name is combined into a composite file name according to the long file name rule of the FatFS file, and the composite file name is used as the file name of the current directory entry;

[0019] If the file name of the current directory entry is a short file name, the short file name will be used as the file name of the current directory entry.

[0020] In one possible design, after building a file quick access table based on the file triples and the hash index, the method further includes:

[0021] Get the target file name to be opened, the target file name includes the absolute path of the target file;

[0022] Convert lowercase letters in the target file name to uppercase letters, and perform hash operation on the converted target file name to obtain the hash value;

[0023] The hash index in the file quick access table is searched based on the hash value, and the target file is opened according to the file triplet corresponding to the hash index.

[0024] In one possible design, the file triplet includes the full file name, the starting cluster number, and the file size; based on the current directory name and the file name, the file triplet and the hash index are constructed, including:

[0025] Combine the current directory name and the file name to get the full path file name, and convert the lowercase letters in the full path file name to uppercase letters to get the full file name;

[0026] Get the starting cluster number and file size of the directory entry where the current valid file is located, combine the full file name, starting cluster number and file size to obtain a file triplet;

[0027] Perform hash calculation on the full path file name to obtain the hash index corresponding to the full path file name.

[0028] In one possible design, the file quick access table includes multiple basic data blocks and hash buckets, the basic data block includes a file triplet, a hash bucket index and the number of the next basic data block, and the hash bucket includes a hash index bucket, a currently available data block number pointer and the number of valid data blocks.

[0029] In one possible design, the method further includes writing the file triple into a basic data block, and updating the corresponding content in the hash index bucket to the number of the basic data block where the triple is located;

[0030] Update the pointer of the currently available data block number to point to the new blank basic data block;

[0031] Update the hash index bucket based on the hash index.

[0032] In a possible design, the currently obtained file triplet is used as a new file triplet. When the new file triplet is stored in the basic data block and a hash conflict occurs with the existing file triplet, the method further includes:

[0033] Change the content in the bucket corresponding to the hash index bucket to the block number of the basic data block where the new file triple is located;

[0034] The hash bucket index in the basic data block where the new file triple is located is modified to the block number of the basic data block where the existing file triple is located, and the hash bucket index in the basic data block where the new file triple is located points to the basic data block where the existing file triple is located.

[0035] In one possible design, the pre-built basic data cache table includes a cluster number array, a pointer and a data area. The cluster number array includes multiple units, each unit corresponds to a cluster number, and the content in the unit represents the serial number of the data area where the data of the unit is stored. The pointer is used to point the data of the unit to the data area to be allocated, and the data area is used to store the FAT table.

[0036] In a second aspect, the present invention provides a FatFS file fast opening system based on DSP and NandFlash bare metal, comprising:

[0037] An acquisition module is used to obtain the FAT table of each storage area in the FatFS file and add the FAT table of each storage area to the pre-built basic data cache table;

[0038] A first construction module is used to construct a directory hierarchy table according to the FAT table of each storage area;

[0039] An extraction module is used to traverse the directory entries of the FAT table of each storage area in the basic data cache table, and when the directory entry of the FAT table of each storage area is a valid file, extract the file name of the current directory entry;

[0040] The second construction module is used to obtain the current directory name corresponding to the file name in the directory hierarchy table, and construct a file triple and hash index based on the current directory name and the file name;

[0041] The third building module is used to build a file fast access table based on the file triples and hash index.

[0042] In a third aspect, the present invention provides a computer-readable storage medium having instructions stored thereon. When the instructions are run on a computer, the FatFS file fast opening method based on DSP and NandFlash bare metal as described in the first aspect is executed.

[0043] In a fourth aspect, the present invention provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the FatFS file fast opening method based on DSP and NandFlash bare metal as described in the first aspect.

[0044] The beneficial effects of the present invention are as follows:

[0045] The present invention discloses a method, medium and product for quickly opening FatFS files based on a DSP and NandFlash bare metal. The method comprises obtaining a FAT table of each storage area in a FatFS file, adding the FAT table of each storage area to a pre-built basic data cache table; constructing a directory hierarchy table according to the FAT table of each storage area; traversing the directory entries of the FAT table of each storage area in the basic data cache table, and extracting the file name of the current directory entry when the directory entry of the FAT table of each storage area is a valid file; obtaining the current directory name corresponding to the file name in the directory hierarchy table, constructing a file triple and a hash index based on the current directory name and the file name; and constructing a file quick access table based on the file triple and the hash index. The present invention stores data stored in NandFlash in the basic data cache table, avoids reading NandFlash multiple times when opening a file, reduces the number of accesses, thereby improving the time of opening a file, does not require dynamic memory allocation, is highly practical, does not cause memory fragmentation, can quickly locate a file through the file quick access table, realizes quick file opening, and has a wide range of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 Flowchart of the method for quickly opening a FatFS file based on DSP and NandFlash bare metal provided in Example 1;

[0047] Figure 2 This is a module block diagram of the FatFS file fast opening system based on DSP and NandFlash bare metal provided in Example 2. DETAILED DESCRIPTION

[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly introduced below in conjunction with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.

[0049] It should be understood that although the terms first and second, etc., may be used herein to describe various objects, these objects should not be limited by these terms. These terms are merely used to distinguish one object from another. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.

[0050] Example 1:

[0051] The application scenario of this embodiment selects a TI C6x series DSP (Digital Signal Processing) single-core processor and a NandFlash storage medium, wherein the NandFlash storage medium is connected to the DSP processor through an EMIF interface, and the external memory DDR SDRAM (Double Data Rate SDRAM) of the DSP single-core processor is divided for storing a basic data cache table, a file quick access table, and a directory hierarchy table.

[0052] like Figure 1 As shown, this embodiment provides a method for quickly opening a FatFS file based on a DSP and NandFlash bare metal, which may include but is not limited to the following steps:

[0053] S1 obtains the FAT table of each storage area in the FatFS file and adds the FAT table of each storage area to the pre-built basic data cache table;

[0054] Specifically, the data space of each storage area in the FatFS file is redistributed in the form of clusters, and the cluster usage is constructed in the FAT table, such as used or free. At the same time, clusters are connected with a cluster chain structure, and the length of the cluster is manually defined.

[0055] In one possible design, the pre-built basic data cache table includes a cluster number array, a pointer, and a data area. The cluster number array includes multiple cells, each corresponding to a cluster number. The content of the cell represents the sequence number of the data area where the cell's data is stored. The pointer is used to point the cell's data to the data area to be allocated. The pointer occupies 4 bytes of memory. The data area is used to store the FAT table. The length of each cell in the data area is the same as the cluster length. The initial state of the pre-built basic data cache table is that all cells in the cluster number array are filled with -1, the pointer points to cell 0 in the data area, and all cells in the data area have no valid data.

[0056] S2 constructs a directory hierarchy table based on the FAT table of each storage area;

[0057] S3 in the basic data cache table, traverse the directory entries of the FAT table of each storage area, when the directory entry of the FAT table of each storage area is a valid file, extract the file name of the current directory entry;

[0058] Specifically, in step S3, the directory entries of the FAT table of each storage area are traversed, and when the directory entry of the FAT table of each storage area is a valid directory, the file name of the directory entry of the FAT table of each storage area is extracted, including the following steps:

[0059] S301 traverses the directory entries of the FAT table of each storage area, finds the directory entry as the current directory entry, and determines the properties of the current directory entry;

[0060] S302. If the attribute of the current directory item is an invalid directory or file, repeat step S301;

[0061] S303. If the attribute of the current directory item is a valid directory, then enter the next level of the current directory item and update the directory hierarchy table, repeating step S301;

[0062] S304. If the attribute of the current directory entry is a valid file, extract the file name of the current directory entry.

[0063] Furthermore, when encountering a directory entry with the attribute of a directory, enter the directory and continue to traverse the directory entries under the directory. If there is a directory entry with the attribute of a directory, enter the directory entry and continue to traverse until the bottom directory is traversed. When the traversal of the bottom directory is completed, return from the bottom directory to the upper directory to continue traversing, and at the same time record the current directory level and the complete path name, so that after the traversal is completed, the file name containing the absolute path can be correctly combined.

[0064] At this time, the directory hierarchy table is defined as a global two-dimensional array and does not exceed the preset number of layers. In this embodiment, the preset number of layers is selected as 10 layers. Since the length of each directory name does not exceed 256 bytes, the size of the directory hierarchy table is 2560 bytes.

[0065] Furthermore, in step S304, the file name of the current directory entry is extracted, including:

[0066] S3041. If the file name of the current directory entry is a long file name, the long file name is combined into a combined file name according to the long file name rules of the FatFS file, and the combined file name is used as the file name of the current directory entry;

[0067] S3042. If the file name of the current directory entry is a short file name, the short file name is used as the file name of the current directory entry.

[0068] Specifically, there are two types of FatFS file names. The first is a short file name, which has the naming rule of an 8-character file name + a 3-character extension, connected by a "." in the middle, such as readme1.txt; the other is a long file name, with a maximum of 255 characters, such as abcdefghijklmnopqrstuvwxyz.txt, which is displayed as ABCDEF~1.txt.

[0069] S4. Get the current directory name corresponding to the file name in the directory hierarchy table, and build a file triple and hash index based on the current directory name and file name;

[0070] Specifically, in step S4, based on the current directory name and file name, a file triple and hash index are constructed, including:

[0071] S401. Combine the current directory name and the file name to obtain the full path file name, and convert the lowercase letters in the full path file name to uppercase letters to obtain the full file name;

[0072] Specifically, converting lowercase letters to uppercase letters and unifying them into uppercase letters can avoid errors such as different hash values when performing hash operations on the same file name due to different uppercase and lowercase letters.

[0073] S402 obtains the starting cluster number and file size of the directory entry where the current valid file is located, combines the full file name, starting cluster number and file size to obtain a file triplet;

[0074] S403. Perform hash calculation on the full path file name to obtain a hash index corresponding to the full path file name.

[0075] The principle of hash calculation is to map the input data into an output value of a fixed length through a specific mathematical function.

[0076] S5. Build a file fast access table based on file triples and hash index.

[0077] Furthermore, the file quick access table includes multiple basic data blocks and hash buckets. The basic data block includes a file triple, a hash bucket index, and the number of the next basic data block. The file triple includes the full file name, the starting cluster number, and the file size. The hash bucket includes a hash index bucket, a pointer to the currently available data block number, and the number of valid data blocks. The full file name occupies 256 bytes of memory, the starting cluster number occupies 4 bytes of memory, the file size occupies 4 bytes of memory, the next basic data block number occupies 2 bytes of memory, the hash index bucket occupies 2 bytes of memory, the currently available data block number pointer occupies 2 bytes of memory, and the number of valid data blocks occupies 2 bytes of memory. Therefore, the basic data block occupies 266 bytes of memory, the hash bucket occupies 131954 bytes of memory, and the file quick access table occupies 266 bytes of memory × the number of basic data blocks + 131954 bytes.

[0078] In one possible design, the method further includes writing the file triple into a basic data block, and updating the corresponding content in the hash index bucket to the number of the basic data block where the triple is located;

[0079] Update the pointer of the currently available data block number to point to the new blank basic data block;

[0080] Update the hash index bucket based on the hash index.

[0081] Furthermore, using the currently obtained file triple as a new file triple, when the new file triple is stored in the basic data block and a hash conflict occurs with the existing file triple, the method further includes:

[0082] Change the content in the bucket corresponding to the hash index bucket to the block number of the basic data block where the new file triple is located;

[0083] The hash bucket index in the basic data block where the new file triple is located is modified to the block number of the basic data block where the existing file triple is located, and the hash bucket index in the basic data block where the new file triple is located points to the basic data block where the existing file triple is located.

[0084] In this embodiment, a hash collision refers to a situation where different input values are mapped to the same storage location when storing a new file triple into a basic data block, that is, the hash value calculated from the full path file name of the new file triple is repeated with the hash value calculated from the full path file name of the existing file triple.

[0085] Specifically, after the DSP single-core processor is powered on, it can build a table and cache data so that files can be directly searched when needed, avoiding table construction and data caching when searching is needed, which wastes time.

[0086] In a possible design, after building a file fast access table based on file triples and hash indexes, it also includes:

[0087] Get the target file name to be opened, the target file name includes the absolute path of the target file;

[0088] Convert lowercase letters in the target file name to uppercase letters, and perform hash operation on the converted target file name to obtain the hash value;

[0089] Based on the hash value, the hash index in the file quick access table is searched, and the target file is opened according to the file triplet corresponding to the hash index.

[0090] Furthermore, when searching for a hash index in the file quick access table based on the hash value, if there is a hash conflict, the file names in the basic data blocks corresponding to the hash index are compared.

[0091] The present embodiment discloses a method for quickly opening a FatFS file based on a DSP and a NandFlash bare metal, comprising obtaining a FAT table of each storage area in a FatFS file, adding the FAT table of each storage area to a pre-built basic data cache table; constructing a directory hierarchy table according to the FAT table of each storage area; traversing the directory entries of the FAT table of each storage area in the basic data cache table, and extracting the file name of the current directory entry when the directory entry in the FAT table of each storage area is a valid file; obtaining a current directory name corresponding to the file name in the directory hierarchy table, and constructing a file triple and a hash index based on the current directory name and the file name; constructing a file quick access table based on the file triple and the hash index; and obtaining a target file name to be opened, the target file name including an absolute path of the target file; converting lowercase letters in the target file name to uppercase letters, and performing a hash operation on the converted target file name to obtain a hash value; searching for a hash index in the file quick access table based on the hash value, and opening the target file according to the file triple corresponding to the hash index. In this embodiment, assuming that the number of files stored in NandFlash is 200,000, the memory occupied by the basic data cache table, the file quick access table and the directory hierarchy table does not exceed 65.4MB in total. If the file name size is limited to 128 bytes, the memory can be reduced by 200,000*128 bytes, that is, at least 25MB of memory consumption can be reduced. The memory is divided into segments, and there is no need to dynamically allocate memory. The real-time performance is high and there is no memory fragmentation. The time required to traverse each directory entry each time is reduced, and the time used to build cache data and the time used to compare file names (including directory entries) one by one are saved, so that the files to be opened can be quickly found, and the time to open the file is not related to the number of files.

[0092] Example 2:

[0093] like Figure 2 As shown, this embodiment provides a FatFS file fast opening system based on DSP and NandFlash bare metal, including:

[0094] An acquisition module is used to obtain the FAT table of each storage area in the FatFS file and add the FAT table of each storage area to the pre-built basic data cache table;

[0095] A first construction module is used to construct a directory hierarchy table according to the FAT table of each storage area;

[0096] An extraction module is used to traverse the directory entries of the FAT table of each storage area in the basic data cache table, and when the directory entry of the FAT table of each storage area is a valid file, extract the file name of the current directory entry;

[0097] The second construction module is used to obtain the current directory name corresponding to the file name in the directory hierarchy table, and construct a file triple and hash index based on the current directory name and the file name;

[0098] The third building module is used to build a file fast access table based on the file triples and hash index.

[0099] In this embodiment, a FatFS file fast opening system based on a DSP and NandFlash bare metal is disclosed. The system comprises an acquisition module that obtains the FAT table of each storage area in a FatFS file and adds the FAT table of each storage area to a pre-built basic data cache table. A first construction module constructs a directory hierarchy table based on the FAT table. An extraction module traverses the directory entries of the FAT table of each storage area in the basic data cache table and extracts the file name of the current directory entry when the directory entry in the FAT table of each storage area is a valid file. A second construction module obtains the current directory name corresponding to the file name in the directory hierarchy table and constructs a file triple and hash index based on the current directory name and the file name. A third construction module constructs a file fast access table based on the file triple and hash index. Files are searched according to the file fast access table to achieve fast file opening while occupying less memory and saving memory space.

[0100] Example 3:

[0101] This embodiment provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed on a computer, the method for quickly opening a FatFS file based on a DSP and NandFlash bare metal is executed as described in Example 1. The computer-readable storage medium refers to a data storage medium, which may include, but is not limited to, a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, and / or a memory stick. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable device.

[0102] The working process, working details and technical effects of the aforementioned computer-readable storage medium provided in this embodiment can be referred to the FatFS file fast opening method based on DSP and NandFlash bare metal as described in Example 1, and will not be repeated here.

[0103] Example 4:

[0104] This embodiment provides a computer program product, including a computer program or instructions. When the computer executes the computer, the computer program or instructions are used to implement the FatFS file fast opening method based on DSP and NandFlash bare metal as described in Example 1.

[0105] The working process, working details and technical effects of the aforementioned computer program product provided in this embodiment can be referred to the FatFS file fast opening method based on DSP and NandFlash bare metal as described in Example 1, and will not be repeated here.

[0106] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.

Claims

1. A method for quickly opening FatFS files based on DSP and NandFlash bare metal, characterized in that: include: Obtain the FAT table of each storage area in the FatFS file, and add the FAT table of each storage area to the pre-built basic data cache table; Construct a directory hierarchy table based on the FAT table of each storage area; In the basic data cache table, the directory entries of the FAT table of each storage area are traversed, and when the directory entry of the FAT table of each storage area is a valid file, the file name of the current directory entry is extracted; Get the current directory name corresponding to the file name in the directory hierarchy table, and build a file triple and hash index based on the current directory name and file name; Build a file fast access table based on file triples and hash index.

2. The method for quickly opening a FatFS file based on DSP and NandFlash bare metal according to claim 1, characterized in that: Traversing the directory entries of the FAT table of each storage area, and extracting the file name of the current directory entry when the directory entry of the FAT table of each storage area is a valid file, including the following steps: Step 1: traverse the directory entries of the FAT table of each storage area, use the found directory entry as the current directory entry, and determine the attributes of the current directory entry; Step 2: If the attribute of the current directory item is an invalid directory or file, repeat step 1; Step 3: If the attribute of the current directory entry is a valid directory, then enter the next level of the current directory entry, update the directory level table, and repeat step 1; Step 4: If the attribute of the current directory entry is a valid file, extract the file name of the current directory entry.

3. The method for quickly opening a FatFS file based on DSP and NandFlash bare metal according to claim 1, characterized in that: Extract the file name of the current directory entry, including: If the file name of the current directory entry is a long file name, the long file name is combined into a composite file name according to the long file name rule of the FatFS file, and the composite file name is used as the file name of the current directory entry; If the file name of the current directory entry is a short file name, the short file name will be used as the file name of the current directory entry.

4. The method for quickly opening a FatFS file based on DSP and NandFlash bare metal according to claim 1, characterized in that: After constructing a file quick access table based on the file triples and the hash index, the method further includes: Get the target file name to be opened, the target file name includes the absolute path of the target file; Convert lowercase letters in the target file name to uppercase letters, and perform hash operation on the converted target file name to obtain the hash value; The hash index in the file quick access table is searched based on the hash value, and the target file is opened according to the file triplet corresponding to the hash index.

5. The method for quickly opening a FatFS file based on DSP and NandFlash bare metal according to claim 1, characterized in that: The file triplet includes the full file name, the starting cluster number and the file size; Based on the current directory name and file name, a file triple and hash index are constructed, including: Combine the current directory name and the file name to get the full path file name, and convert the lowercase letters in the full path file name to uppercase letters to get the full file name; Get the starting cluster number and file size of the directory entry where the current valid file is located, combine the full file name, starting cluster number and file size to obtain a file triplet; Perform hash calculation on the full path file name to obtain the hash index corresponding to the full path file name.

6. A method for quickly opening a FatFS file based on DSP and NandFlash bare metal according to claim 5, characterized in that: The file quick access table includes multiple basic data blocks and hash buckets. The basic data blocks include file triples and hash bucket indexes. The hash buckets include hash index buckets and currently available data block number pointers.

7. The method for quickly opening a FatFS file based on DSP and NandFlash bare metal according to claim 6, characterized in that: The method further comprises: taking the currently obtained file triple as a new file triple, and when the new file triple is stored in the basic data block and a hash conflict occurs with the existing file triple, Change the content in the bucket corresponding to the hash index bucket to the block number of the basic data block where the new file triple is located; The hash bucket index in the basic data block where the new file triple is located is modified to the block number of the basic data block where the existing file triple is located, and the hash bucket index in the basic data block where the new file triple is located points to the basic data block where the existing file triple is located.

8. The method for quickly opening a FatFS file based on DSP and NandFlash bare metal according to claim 1, characterized in that: The pre-built basic data cache table includes a cluster number array, a pointer and a data area. The cluster number array includes multiple units, each unit corresponds to a cluster number, the content in the unit represents the serial number of the data area where the data of the unit is stored, the pointer is used to point the data of the unit to the data area to be allocated, and the data area is used to store the FAT table.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the FatFS file fast opening method based on DSP and NandFlash bare metal according to any one of claims 1 to 8 is executed.

10. A computer program product comprising a computer program or instructions, characterized in that When executed by a computer, the computer program or the instruction implements the FatFS file fast opening method based on DSP and NandFlash bare metal as described in any one of claims 1 to 8.