SD card startup method, device, equipment and medium supporting file system

By adding relocation commands to the reserved area of ​​the FAT file system, the problem of insufficient startup performance in embedded SOCs in traditional SD card startup methods is solved, and efficient SD card startup is achieved, saving ROM space and startup time.

CN119847621BActive Publication Date: 2025-06-06HUNAN GREAT WALL GALAXY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510327886.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-19
Publication Date
2025-06-06
Estimated Expiration
2045-03-19

AI Technical Summary

Technical Problem

Traditional SD card startup methods have problems with insufficient startup performance in embedded SOCs, especially when supporting file systems.

Method used

By adding relocation commands to the reserved area of ​​the FAT file system, the relocation command is used to relocate the index of the read sector in the memory of the SD card, and quickly locate user image data, thereby achieving efficient SD card startup.

Benefits of technology

This method eliminates the need for secondary boot programs and FatFS components, saves ROM space and startup time, and improves the startup performance of SD cards on embedded SOCs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847621B_ABST
    Figure CN119847621B_ABST
Patent Text Reader

Abstract

The present invention relates to a method, device, equipment and medium for starting an SD card supporting a file system. By utilizing an unused reserved area in a FAT file system, adding a relocation command only requires two words, so that the startup boot can quickly locate the physical location of the user image data in the memory of the SD card, thereby realizing efficient startup of the SD card supporting a file system. Compared with the traditional technology, the above scheme supports booting from a specified file of the file system of the SD card without the need for a secondary boot program or adding a FatFS component to a primary boot program; the SBL secondary boot process is omitted, thereby saving the secondary boot time, and there is no need to add a FatFS component to an RBL primary boot program, thus saving ROM space, and effectively improving the startup performance of the SD card on the embedded SOC.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of embedded SOC (system on chip), and relates to a SD card startup method, device, equipment and medium supporting a file system. Background Art

[0002] SD cards have large capacity and are easy to plug and unplug. They are widely used in the embedded field. As a common storage device, SD cards are also commonly used boot devices for embedded SOCs. Currently, large-capacity SDHC cards (less than 32GB) and SDXC cards (more than 32GB) are commonly used. In order to facilitate data management, they generally need to be managed using a file system. The most commonly used file system formats in the embedded field are FatFS for Windows and exFAT for Linux. The open source FatFS software is developed using the ANSI C language (C89) standard. It is easier to transplant for embedded SOCs and occupies less resources, so it is widely used. Therefore, SD cards are often formatted as FatFS or at least one partition is formatted as a FatFS file system.

[0003] When an embedded SOC uses an SD card as a boot device, if it wants to support the SD card's file system, it is often necessary to transplant the FatFS file system component in the boot (BootLoader) program to facilitate the program to locate and boot the user's image firmware file through the file system. RBL (ROM BootLoader, first-level boot program) is the first-level boot code solidified inside the chip. Transplanting an additional component requires more storage resources. Therefore, in general, embedded SOCs generally support SD card booting in the following three ways: (1) booting from the first address or fixed address of the memory according to the binary data format specified by the SOC boot requirements; (2) using SBL (Second BootLoader, i.e., second-level boot boot) to boot from the specified file of the SD card's file system; (3) transplanting the FatFS file system component in RBL to boot from the specified file of the SD card's file system. However, the above traditional SD card boot methods still have the technical problem of insufficient boot performance. Summary of the invention

[0004] In view of the problems existing in the above-mentioned traditional methods, the present invention proposes an SD card startup method supporting a file system, an SD card startup device supporting a file system, a computer device and a computer-readable storage medium, which can effectively improve the startup performance of the SD card on an embedded SOC.

[0005] In order to achieve the above objectives, the embodiments of the present invention adopt the following technical solutions:

[0006] On the one hand, a method for starting an SD card supporting a file system is provided, comprising the steps of:

[0007] Store the user image data file in image format into the memory of the SD card; the image format includes magic words, segment load commands and jump end commands;

[0008] After entering the RBL startup process to initialize the SD card's software and hardware environment, if it is determined to be a single file system, the relocation command is searched from the reserved area of ​​the DBR in the SD card's memory;

[0009] Use the relocation command to relocate the index of the read sector in the memory of the SD card, and read the user image data into the data buffer according to the index of the read sector;

[0010] After parsing the user image data from the data buffer, execute the jump end command to end the RBL startup process and jump to the user program execution.

[0011] On the other hand, an SD card boot device supporting a file system is also provided, comprising:

[0012] File burning module, used to store user image data files in image format into the memory of SD card; image format includes magic words, segment loading command and jump end command;

[0013] The RBL startup module is used to enter the RBL startup process to initialize the SD card's hardware and software environment. If it is determined to be a single file system, it will search for the relocation command from the reserved area of ​​the DBR in the SD card's memory, use the relocation command to relocate the index of the read sector in the SD card's memory, read the user image data into the data buffer according to the index of the read sector, and execute the jump end command after parsing the user image data from the data buffer, ending the RBL startup process and jumping to the user program execution.

[0014] On the other hand, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned SD card startup method supporting a file system when executing the computer program.

[0015] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned SD card startup method supporting a file system are implemented.

[0016] One of the above technical solutions has the following advantages and beneficial effects:

[0017] The above-mentioned SD card boot method, device, equipment and medium supporting the file system, by utilizing the unused reserved area in the FAT file system, only 2 words are needed to add the relocation command, so that the boot boot can quickly locate the physical location of the user image data in the memory of the SD card, and realize the SD card supporting efficient boot with file system. Compared with the traditional technology, the above-mentioned scheme supports booting from the specified file of the file system of the SD card without the need for a secondary boot program or adding a FatFS component in the primary boot program; it eliminates the SBL secondary boot process, thereby saving the secondary boot time, and there is no need to add a FatFS component in the RBL primary boot program, saving ROM space, and effectively improving the boot performance of the SD card on the embedded SOC. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 A schematic diagram of a flow chart of a method for starting an SD card supporting a file system in one embodiment;

[0020] Figure 2 is a schematic diagram of a user image data format in one embodiment;

[0021] Figure 3 A schematic diagram of a DBR data structure of a file system of an SD card in one embodiment;

[0022] Figure 4 A schematic diagram of data distribution of a file system in an SD card memory in one embodiment;

[0023] Figure 5 A schematic diagram of the physical distribution of multi-partition file system relocation commands in an SD card memory in one embodiment;

[0024] Figure 6 It is a flowchart of a method for starting an SD card supporting a file system in another embodiment;

[0025] Figure 7 A schematic diagram of a module framework of an SD card boot device supporting a file system in an embodiment. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0027] It should be noted that the reference to "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The presentation of this phrase at various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It will be appreciated by those skilled in the art that the embodiments described herein may be combined with other embodiments. The term "and / or" used in the specification and appended claims of the present invention refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0028] The following will describe the implementation of the present invention in detail with reference to the accompanying drawings in the embodiment diagram of the present invention.

[0029] According to binary data storage, users store raw data in the memory without using the file system. Later, users can only use the SD card memory by reading the memory data. This method is inconvenient for the current SD card data management with a capacity of several GB. If the log data stored in the embedded platform in daily production is to be analyzed later, a specific software system is required to manage it. Since the file system must use the first sector data of the SD card, the SBL secondary boot requires other boot storage devices, which increases the complexity of user use and the time of the boot process. To support it under RBL, the source code of the Fatfs file system needs to be transplanted in RBL. This method will undoubtedly increase the amount of RBL code and increase the ROM size of the SOC. Therefore, supporting the boot method with a file system in RBL and not requiring the known FatFS file system component has unique practical significance.

[0030] In one embodiment, Figure 1 As shown, a method for starting an SD card supporting a file system is provided, which may include the following steps S10 to S16:

[0031] S10, storing the user image data file in the image format into the memory of the SD card; the image format includes magic words, segment loading commands and jump end commands, and the relocation command data can be written into the reserved area of ​​the SD card file system;

[0032] S12, after entering the RBL startup process to initialize the software and hardware environment of the SD card, if it is determined to be a single file system, a relocation command is searched from the reserved area of ​​the DBR in the memory of the SD card;

[0033] S14, using the relocation command to relocate the index of the read sector in the memory of the SD card, and reading the user image data into the data buffer according to the index of the read sector;

[0034] S16, after parsing the user image data from the data buffer, a jump end command is executed to end the RBL startup process and jump to the user program execution.

[0035] It can be understood that the general format of user image data mainly includes magic words, segment loading commands and jump end commands. The user uses the development tool to generate a user image data file in image format on the host computer and then stores it in the memory of the SD card. The format of user image data can be as follows: Figure 2 As shown in the figure, the magic word is a fixed 32-bit constant 0x41504954. The segment load command is used to organize the data, including the command flag 0x434D4400 and the data length (that is, the destination address to be moved to, the data of the specified length). The jump end command includes the command flag 0x434D4402 and the jump address (that is, the entry point of the user program).

[0036] In the case of a file system, user image data is stored in a specific file of the file system, such as the "boot.bin" file, which corresponds to the physical address of a sector in the memory of the SD card. During the burning process, the physical address of the sector is recorded, and when the burning is completed, the relocation command and the address of the sector are written to the reserved area of ​​the file system. For a single file system, the reserved area can be the DBR (DOS Boot Record) reserved area in the first 512 bytes of the memory of the SD card; for a multi-partition file system, the reserved area can be the reserved sector of the file system.

[0037] The startup process of RBL is divided into three stages: (1) Initialize the software and hardware environment. (2) Identify the relocation command and locate the sector location of the user image data in the SD card. (3) Parse the user image data, such as the segment load command and the jump end command, boot and load the user image data, and jump to the user program. Among them, when identifying the relocation command and locating the user image data, first identify whether it is a single file system. A single file system needs to find the relocation command from the reserved area of ​​the DBR.

[0038] The above-mentioned SD card boot method supporting the file system utilizes the unused reserved area in the FAT file system, and only occupies 2 words (8 bytes) to add the relocation command, so that the boot boot can quickly locate the physical location of the user image data in the memory of the SD card, thereby realizing the efficient boot of the SD card supporting the file system. Compared with the traditional technology, the above-mentioned scheme supports booting from the specified file of the SD card file system without the need for a secondary boot program or adding a FatFS component to the primary boot program; it eliminates the SBL secondary boot process, thereby saving the secondary boot time, and there is no need to add a FatFS component to the RBL primary boot program, saving ROM space, and effectively improving the boot performance of the SD card on the embedded SOC.

[0039] In one embodiment, in the step of storing the user image data file in image format in the memory of the SD card, if the SD card does not have a file system, the user image data is stored in a low address of the physical address in the memory of the SD card.

[0040] It can be understood that in the case of no file system: for the SD card does not have a file system, the user image data is stored in the low address of the SD card, and RBL starts reading from the physical address 0 in the memory of the SD card according to the image data format, matching the magic word 0x41504954. If the magic word 0x41504954 is not matched, it will match from the next sector read, and the matching range is 2MB space. After matching the magic word, continue to parse the subsequent commands to complete the transfer of the user image data, and finally jump to the user program entry address for execution.

[0041] If the SD card has a file system and it is a single file system, the user image data is stored starting from a certain sector in the memory of the SD card, and the area where the user image data is located is indicated by a relocation command added in an unused area in the DBR of the SD card.

[0042] It can be understood that for the case of a single file system: for the FAT32 file system format, when multiple partitions are not used (partitions are divided into multiple file systems), the SD card is formatted as a FAT32 file system under the Windows system. The 512-byte data of the first physical sector of the SD card is the DBR (DOS Boot Record), and the user image data file is stored starting from a certain sector of the SD card. The DBR includes a 3-byte jump instruction, basic information of the file system, an unused reserved area, and a two-byte terminator. The DBR data structure of the SD card file system can be as follows: Figure 3 shown.

[0043] The key issue for RBL to boot the user image data is to locate the sector where the user image data is stored in the SD card. The relocation process can use the unused area in the DBR and add a relocation command. The relocation command can include the command word 0x58535993 and the relocation address, which consists of two words. The relocation command is not part of the user image data. The purpose of the relocation command is to let RBL skip the data in the SD card storage that is not related to the startup and locate the area where the user image data is located to start booting. The relocation command is written to the unused reserved area of ​​the DBR after burning the user image data to the SD card.

[0044] The user image data is stored in the mth physical sector of the SD card. The sector size of the SD card is 512 bytes. Figure 4 The physical address shown is 512*m, the physical address x of the reserved area space of DBR starts to store the relocation command, and the address x+4 stores the relocation address. The data distribution of the file system in the memory of the SD card can be as follows Figure 4 shown.

[0045] If the SD card has a file system and it is a multi-partition file system, the user image data is stored in a reserved area between the first sector of the SD card and the first file system, or a relocation command is added in the reserved area between the first sector of the SD card and the first file system to indicate the physical sector in the file system where the user image data is located.

[0046] It can be understood that for the case of multi-partition file systems: for SD cards using multiple partitions, the first sector of the SD card is the MBR (Master Boot recorder), which can record up to 4 partitions, that is, 4 file systems. There is a reserved area between the MBR and the first file system, which generally reaches 1MB of space. The user image data can be stored in a physical sector of the first file system, and a relocation command is added to the reserved area. For the case where the amount of user image data is relatively small, the user image data can also be directly burned to the reserved area between the MBR and the first file system. RBL traverses the first 2MB of space on the SD card, matches the first word of 512 bytes of each sector, matches the magic header of the user image data, and parses the relocation command to quickly locate the location of the user image data file, start the boot program, and does not affect the file system of the SD card. The data structure of a multi-partition file system can be as follows Figure 5 shown.

[0047] The reserved area between the MBR and the first file system can be used to store relocation commands or user image data. To facilitate the RBL program to match the relocation command, a magic word is added before the relocation command, and the magic word, relocation command and relocation address are written in a sector (such as the third sector) of the reserved area.

[0048] In one embodiment, regarding the above step S12, after entering the RBL startup process to initialize the software and hardware environment of the SD card, if it is determined that there is no file system, the subsequent startup process may include the following steps:

[0049] Traverse the first 4 bytes of the SD card's sector to match the magic word;

[0050] After matching the magic word, read the user image data into the data buffer;

[0051] Jump to step S16.

[0052] In one embodiment, regarding the above step S12, after entering the RBL startup process to initialize the software and hardware environment of the SD card, if it is determined to be a multi-partition file system, the subsequent startup process may include the following steps:

[0053] Traverse the first 4 bytes of the SD card's sector to match the magic word;

[0054] After matching the magic word, search for the relocation command in the reserved area between the first sector of the SD card and the first file system;

[0055] Relocate the index of the read sector in the memory of the SD card by using the relocation command, and read the user image data into the data buffer according to the index of the read sector;

[0056] Jump to step S16.

[0057] It can be understood that in the (2) identification stage of the RBL boot process, in other cases other than a single file system, such as a multi-partition file system and no file system, the first 4 bytes of the SD card sector are traversed to match the magic word, and then the command is parsed. In the case of a multi-partition file system, the relocation command will be parsed, and the traversal range is 2MB, a total of 4096 sectors. The overall RBL boot process can be as follows: Figure 6 shown.

[0058] In one embodiment, when writing the data file of the user image data to the SD card using the burning program, the sector write interface of the SD card is called to match the first word data of each sector of the SD card. If the match is a magic word, the sector number of the corresponding sector is recorded. After the data files of the user image data are written to the SD card, the recorded sector number is multiplied by 512 to obtain the relocation address, and then the relocation command and the relocation address are written to the reserved area of ​​the file system; the reserved area is the reserved area of ​​the DBR or the reserved area between the first sector of the SD card and the first file system.

[0059] It can be understood that about image burning: when the burning program writes the user image data file to the SD card, the underlying write interface records the sector number where the magic word is located. After writing the user image data file, it adds a relocation command to the reserved area of ​​the SD card file system according to the recorded sector number.

[0060] Specifically, the burning program needs to support the file system function and be able to read and write the sectors of the SD card. The burning process needs to open the user image data file name (assuming it is "boot.bin") in write mode. The file write data interface will call the SD card's sector write interface. The SD card's sector write interface matches the first word data of each sector to see if it is a magic word. If it matches, the sector number is recorded. After the data of the user image data file is written to the SD card, the recorded sector number is multiplied by 512 to get the address to be relocated, and then the relocation command and other data are written to the DBR of the file system or a reserved area of ​​the multi-partition file system.

[0061] It should be understood that although Figure 1 and Figure 6 The steps in the method are shown in sequence as indicated by the arrows, but the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of the steps, and the steps can be executed in other orders. Figure 1 and Figure 6 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequentially, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0062] In one embodiment, Figure 7As shown, a SD card startup device 100 supporting a file system is provided, which may include a file burning module 11 and an RBL startup module 13. The file burning module 11 is used to store a user image data file in an image format into the memory of the SD card; the image format includes magic words, segment loading commands, and jump end commands. The RBL startup module 13 is used to enter the RBL startup process to initialize the software and hardware environment of the SD card. If it is determined to be a single file system, the relocation command is searched from the reserved area of ​​the DBR in the memory of the SD card, and the index of the read sector is relocated in the memory of the SD card using the relocation command. The user image data is read into the data buffer according to the index of the read sector, and the jump end command is executed after the user image data is parsed from the data buffer, thereby terminating the RBL startup process and jumping to the user program execution.

[0063] The above-mentioned SD card boot device 100 supporting the file system utilizes the unused reserved area in the FAT file system, and only takes up 2 words to add the relocation command, so that the boot boot can quickly locate the physical location of the user image data in the memory of the SD card, thereby realizing the efficient boot of the SD card supporting the file system. Compared with the traditional technology, the above-mentioned scheme supports booting from the specified file of the file system of the SD card without the need for a secondary boot program or adding a FatFS component in the primary boot program; it eliminates the SBL secondary boot process, thereby saving the secondary boot time, and there is no need to add a FatFS component in the RBL primary boot program, saving ROM space, and effectively improving the boot performance of the SD card on the embedded SOC.

[0064] In one embodiment, in the step of storing a user image data file in an image format into a memory of an SD card, if the SD card does not have a file system, the user image data is stored in a low address of a physical address in the memory of the SD card. If the SD card has a file system and it is a single file system, the user image data is stored starting from a certain sector in the memory of the SD card, and a relocation command added in an unused area in the DBR of the SD card indicates the area where the user image data is located. If the SD card has a file system and it is a multi-partition file system, the user image data is stored in a reserved area between the first sector of the SD card and the first file system, or a relocation command added in a reserved area between the first sector of the SD card and the first file system indicates the physical sector in the file system where the user image data is located.

[0065] In one embodiment, after the RBL startup module 13 enters the startup process of RBL to initialize the software and hardware environment of the SD card, if it is determined to be a multi-partition file system, the first 4 bytes of the sector of the SD card are traversed to match the magic word. After matching the magic word, a relocation command is searched from the reserved area between the first sector of the SD card and the first file system, and the relocation command is used to relocate the index of the read sector in the memory of the SD card, and the user image data is read into the data buffer according to the index of the read sector, and then the jump end command is executed after the user image data is parsed from the data buffer, so as to end the startup process of RBL and jump to the user program execution.

[0066] It can be understood that the explanation of each feature in the above-mentioned SD card boot device 100 supporting the file system can be understood in the same way as the corresponding explanation in each embodiment of the above-mentioned SD card boot method supporting the file system. Each module in the above-mentioned SD card boot device 100 supporting the file system can be fully or partially implemented by software, hardware and a combination thereof. The above-mentioned components can be embedded in or independent of a device with data processing functions in the form of hardware, or can be stored in the memory of the aforementioned device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. The aforementioned device can be, but is not limited to, various types of computers already available in the art.

[0067] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the following processing steps when executing the computer program: storing a user image data file in an image format into a memory of an SD card; the image format includes a magic word, a segment loading command, and a jump end command; after entering the RBL startup process to initialize the software and hardware environment of the SD card, if it is determined to be a single file system, searching for a relocation command from a reserved area of ​​a DBR in the memory of the SD card; using the relocation command to relocate the index of a read sector in the memory of the SD card, and reading the user image data into a data buffer according to the index of the read sector; executing a jump end command after parsing the user image data from the data buffer, terminating the RBL startup process and jumping to the user program for execution.

[0068] In one embodiment, when the processor executes the computer program, the processor may also implement the steps or sub-steps added in each embodiment of the above-mentioned SD card startup method supporting the file system.

[0069] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following processing steps are implemented: storing a user image data file in an image format into a memory of an SD card; the image format includes a magic word, a segment loading command, and a jump end command; after entering the RBL startup process to initialize the software and hardware environment of the SD card, if it is determined to be a single file system, searching for a relocation command from a reserved area of ​​a DBR in the memory of the SD card; using the relocation command to relocate the index of a read sector in the memory of the SD card, and reading the user image data into a data buffer according to the index of the read sector; executing a jump end command after parsing the user image data from the data buffer, terminating the RBL startup process and jumping to the user program for execution.

[0070] In one embodiment, when the computer program is executed by a processor, the added steps or sub-steps in each embodiment of the above-mentioned SD card startup method supporting a file system can also be implemented.

[0071] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus dynamic random access memory (RambusDRAM, referred to as RDRAM) and interface dynamic random access memory (DRDRAM).

[0072] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0073] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of protection of the invention. It should be pointed out that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the attached claims.

Claims

1. A method for starting an SD card supporting a file system, characterized in that: Includes steps: Store a user image data file in image format in the memory of the SD card; wherein, if the SD card does not have a file system, the user image data is stored in the low address of the physical address in the memory of the SD card; if the SD card has a file system and it is a single file system, the user image data is stored starting from a certain sector in the memory of the SD card, and the area where the user image data is located is indicated by a relocation command added in an unused area in the DBR of the SD card; if the SD card has a file system and it is a multi-partition file system, the user image data is stored in a reserved area between the first sector of the SD card and the first file system, or a relocation command added in a reserved area between the first sector of the SD card and the first file system indicates the physical sector in the file system where the user image data is located, and the image format includes a magic word, a segment load command, and a jump end command; After entering the RBL startup process to initialize the SD card's software and hardware environment, if it is determined to be a single file system, the relocation command is searched from the reserved area of ​​the DBR in the SD card's memory; Relocate the index of the read sector in the memory of the SD card by using the relocation command, and read the user image data into the data buffer according to the index of the read sector; After parsing the user image data from the data buffer, a jump end command is executed to end the RBL startup process and jump to the user program for execution.

2. The SD card boot method supporting a file system according to claim 1, characterized in that: After entering the RBL startup process to initialize the software and hardware environment of the SD card, if it is determined that there is no file system, the subsequent startup process includes the following steps: Traverse the first 4 bytes of the SD card's sector to match the magic word; After matching the magic word, read the user image data into the data buffer; After parsing the user image data from the data buffer, a jump end command is executed to end the RBL startup process and jump to the user program for execution.

3. The SD card boot method supporting a file system according to claim 1, characterized in that: After entering the RBL startup process to initialize the software and hardware environment of the SD card, if it is determined to be a multi-partition file system, the subsequent startup process includes the following steps: Traverse the first 4 bytes of the SD card's sector to match the magic word; After matching the magic word, search for the relocation command in the reserved area between the first sector of the SD card and the first file system; Relocate the index of the read sector in the memory of the SD card by using the relocation command, and read the user image data into the data buffer according to the index of the read sector; After parsing the user image data from the data buffer, a jump end command is executed to end the RBL startup process and jump to the user program for execution.

4. The SD card boot method supporting a file system according to any one of claims 1 to 3, characterized in that: When the burning program is used to write the data file of the user image data to the SD card, the sector write interface of the SD card is called to match the first word data of each sector of the SD card. If the match is a magic word, the sector number of the corresponding sector is recorded. After the data files of the user image data are all written to the SD card, the recorded sector number is multiplied by 512 to obtain the relocation address, and then the relocation command and the relocation address are written to the reserved area of ​​the file system; the reserved area is the reserved area of ​​the DBR or the reserved area between the first sector of the SD card and the first file system.

5. An SD card boot device supporting a file system, characterized in that: include: The file burning module is used to store a user image data file in an image format into a memory of the SD card; wherein, if the SD card does not have a file system, the user image data is stored in a low address of a physical address in the memory of the SD card; if the SD card has a file system and it is a single file system, the user image data is stored starting from a certain sector in the memory of the SD card, and a relocation command added in an unused area in the DBR of the SD card indicates the area where the user image data is located; if the SD card has a file system and it is a multi-partition file system, the user image data is stored in a reserved area between the first sector of the SD card and the first file system, or a relocation command added in a reserved area between the first sector of the SD card and the first file system indicates the physical sector in the file system where the user image data is located, and the image format includes a magic word, a segment load command, and a jump end command; The RBL startup module is used to enter the RBL startup process to initialize the SD card's hardware and software environment. If it is determined to be a single file system, the relocation command is searched from the reserved area of ​​the DBR in the SD card's memory, and the index of the read sector is relocated in the SD card's memory using the relocation command. The user image data is read into the data buffer according to the index of the read sector, and the jump end command is executed after the user image data is parsed from the data buffer, thereby terminating the RBL startup process and jumping to the user program for execution.

6. The SD card boot device supporting a file system according to claim 5, characterized in that: After the RBL startup module enters the startup process of RBL to initialize the software and hardware environment of the SD card, if it is determined to be a multi-partition file system, the first 4 bytes of the sector of the SD card are traversed to match the magic word. After matching the magic word, a relocation command is searched from the reserved area between the first sector of the SD card and the first file system, and the relocation command is used to relocate the index of the read sector in the memory of the SD card, and the user image data is read into the data buffer according to the index of the read sector. After parsing the user image data from the data buffer, a jump end command is executed to end the startup process of RBL and jump to the user program execution.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the SD card startup method supporting the file system according to any one of claims 1 to 4 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the SD card startup method supporting a file system according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Method and device for managing and controlling data on SD card

    CN108008908A

  • Configurable chip starting guide method and system and medium

    CN116610368A