SOC embedded software architecture design 7: System zone file system design of embedded system firmware

Source: Internet
Author: User

System Disk (SD) includes the operating system, driver, middleware, application and font library, UI resources, and other files. This article describes the file system design of the SD area. The primary goal of a file system is to locate and read/write a single file. Generally, the Code cannot be modified by itself, that is, no write operation is performed after mass production. The SD File System of the embedded system is designed to locate a file and read the data in the file in a simple and efficient manner. The design principles and key points are as follows:

1. Logically stores a single object in a row, which is aligned by slices.

A single code and resource file in the SD area is generally not large, so it is not necessary to use a fat table like the FAT32 File System to concatenate file clusters and store them logically and consecutively, in this way, the location will be simpler and faster. Of course, the file should be aligned by sector for easy reading, and the file offset information can also be recorded by the number of sectors.

 

2. SD Header

This is a description of the entire SD region, including the verification code, version number, date, and OEM. Sometimes, to ensure intellectual property rights, some encrypted ID information that prevents copying is added.

 

3. dir Section

The dir section is the directory information, that is, the positioning information of each file in the SD area. It is the most important data structure of the SD file system. The file location is dependent on the directory information. The packaging tool will package each file in a certain order and generate the corresponding directory information for each file accordingly. The directory data structure of each file is as follows:

1) file name, generally in 8 + 3 Format

2) file properties to distinguish between system files and application files, and hide files

3) offset of the file in the SD area, in the unit of slice

4) file size, in bytes

5) Verification Code

 

4. file data

The dir section is followed by real code, resources, configuration, and other files.

 

5. fopen

When a file is opened, it is matched in the Dir section based on the file name. After successful matching, the offset of the file in SD is obtained. The 9-bit offset (512 bytes, one sector) is the position of the file. Fopen returns a handle that corresponds to a data structure. The structure generally includes the start position, length, and current read pointer position of the file. The record start position and length are used to prevent cross-border reading.

 

6. fread

The read operation is performed based on the current read pointer of the handle, and the current read pointer must be modified after the read operation.

 

7. fseek

Modify the read pointer based on the mode.

It should be clear that the SD area is a logical area, which is only part of the firmware. A firmware includes the boot area, SD area, Vm area, and specific functional area (such as VM). Then, the data area will deploy standard file systems such as FAT32 and exfat.

SOC embedded software architecture design 7: System zone file system design of embedded system firmware

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.