Design and implementation of file system for CF card storage in ARM7 system

Publisher:hylh2008Latest update time:2013-11-09 Source: eccnKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

As the performance of microcontrollers continues to improve, embedded applications are becoming more and more widespread. However, large commercial embedded real-time systems on the market are expensive and are all targeted at specific hardware platforms. For small and medium-sized system development, it is not cost-effective to purchase commercial real-time systems.

At present, we are working on the development of embedded system software for automotive satellite navigation system. Traditional embedded applications do not include file systems, and the file system we want to implement needs to realize the reading and writing of map data files in the vehicle navigation system. Therefore, it must support both file systems compatible with MS-DOS and other types of file systems. On the other hand, from digital cameras to MP3 players, from handheld computers to digital cameras, CF (CompactFlash) cards are increasingly widely used in digital devices due to their small size, strong compatibility, and relatively low price. However, if you want to transfer data between CF cards and PCs, you usually have to use a special card reader, which brings a lot of trouble to PC users. The full name of CompactFlash card is "standard flash memory card", or "CF card" for short. CF cards have a wide range of applications, and the most common use is for photo storage in digital cameras. Since the CF card uses an analog hard disk controller design, it can be easily connected to the computer through the IDE interface, which can play a role as mobile storage to a certain extent.

General embedded systems do not provide an interface for reading and writing CF cards, so a driver needs to be specially designed in the file system.

1 Basic principles

In the CF card shown in Figure 1, the controller interface of the host system allows data to be read and written from the Flash media. There are three access modes for CF cards: Memory mode, I/O mode, and True IDE mode. We chose the True IDE mode. It should be noted that when the host power is always on, plugging and unplugging the CF card will reconfigure it from the original True IDE mode to PC Card ATA mode. Therefore, to make the CF card always work in True IDE, the OE input signal needs to be grounded when the power is turned on. This mode also supports 8-bit access, but we chose 16-bit access. The maximum number of sectors accessed at one time can be determined by the 47th parameter word in the command code Ech.

The structure of a CF card is the same as that of a hard disk, as shown in Figure 2. The boot sector contains the code for starting the system and important information about the file system, followed by a table that records all disk space, then the root directory, and then everything else. The boot sector contains a partition table at the end. This table contains entries to mark the start and end of each partition. There can be up to four partitions, each of which can contain a different file system. Immediately following the boot sector is the FAT (file allocation table), which is used to record information about all disk space in the device (this table has the same function as the I-Node table and free table in UNIX).

When designing the software, both versatility and scalability were considered, with the goal of enabling the file system to operate on different storage media such as CF cards, IDE hard disks, RAM disks, electronic disks, SD cards, etc. without having to modify them separately; read data from these storage media, and transfer the data to different storage devices. [page]

In order to achieve these goals, we separated the hardware operation programs according to the different processing methods of different CPUs, and turned the low-level programs related to the device into upper-level operations that are independent of the device. In this way, when the system adds new functions, it is not necessary to change each subroutine, but only to add or change data items in the data structure of some interface files; considering the transparency of the upper-level operations to users, we adopt an object-oriented approach. The Driver structure (including Read and Write data items) of the access operation in the upper-level structure is virtual, and it is only at the bottom that it is concretized as the read and write sector commands of the CF card (operation code: 20h, 30h).

The main flow of the software program is shown in Figure 3.

2 System Design and Implementation

According to the above principles, the software design can be completed. Its basic framework is shown in Figure 4 and is divided into six main parts.

The key to the design of the CF card driver is that the command codes used by the access operation functions of the CF card are somewhat different. In addition, we use a driver object to represent the CF card device driver. The driver object is partially opaque to the user, and the data items include pointers to read and write functions, which are output by the file system program (including two parts of functions, user-visible API function calls and user-invisible driver access functions). The data structure of this object is declared as follows:

Typedef Struct CF_XFILE_DRIVER{

BYTE Driver_name; /*Media identification; CF card, IDE hard disk, Flash card, RAMDISK, etc. If you delete the driver, you need to re-record the DRIVER number*/

……/*IRP processing function*/

}CF_XFILE_DRIVER;

If there are multiple CF cards, another specific data structure Next_Driver is needed to connect them horizontally. Then, a linked list is used to manage these data structures, similar to WDM (Windows Driver Model).

3 Test Analysis

After debugging and running, the file system has good performance. Compared with the file systems of Nucleus, ΜC/OS-II, and UNIX operating systems that we have ported before, the file system introduced in this article is more portable; in addition to the CF card introduced in this article, it can be applied to other storage media such as RAMdisk, IDE hard disk, Flash, etc. (IDE hard disk and Flash have also been successfully debugged) after a simple modification of the underlying driver. In addition, the file system introduced in this article has lower configuration requirements for the hardware platform, and the running speed of file operations has not been slowed down.

Keywords:ARM Reference address:Design and implementation of file system for CF card storage in ARM7 system

Previous article:Developing stepper motor control system on PSoC4 platform
Next article:Dynamic Management of Energy Consumption in Embedded Systems

Recommended ReadingLatest update time:2024-11-16 23:38

stm32.cube(七)——arm-gcc.helloworld
1. Introduction There are corresponding examples in the cube package for the three commonly used ARM IDE tools: MDK-ARM (keil), EWARM (IAR) and TrueSTUDIO (Atollic). As for arm-gcc, cube only provides the source code of the examples. Since you need to write your own Makefile, the configuration is more complicated than
[Microcontroller]
Using ARM9 microprocessor PXA270 chip to realize low power consumption embedded computer
introduction Green environmental protection and energy saving are the global trend, and embedded computer systems are widely used in portable and highly mobile products. Low power consumption design is not only a requirement for green environmental protection, but also a constraint on the volume and quality of embedde
[Microcontroller]
Using ARM9 microprocessor PXA270 chip to realize low power consumption embedded computer
OK6410A development board (eight) 83 linux-5.11 OK6410A arm-gdb+JLinkGDBServer+Jlink+JTAG interface debugging u-boot
Previously at https://blog.csdn.net/u011011827/article/details/118713517 You can see that you can debug bare metal. It can be seen that I loaded the bin file to 0x50000000, which is the space of external sdram So before loading, it must be initialized, and u-boot helps to do this initialization (u-boot is burned in
[Microcontroller]
Research on Industrial Control Data Acquisition System Based on ARM7
0 Introduction In the field of industrial measurement and control, a large number of real-time field parameters need to be obtained. Due to the harsh, complex and changeable environment, data acquisition systems are mostly completed by industrial computers. However, industrial computers are large in size, power consu
[Microcontroller]
Research on Industrial Control Data Acquisition System Based on ARM7
Research and implementation of wall flatness detector based on embedded ARM9
The flatness of a house's wall is an important indicator of the quality of a house's construction. Existing wall flatness detection methods are either inconvenient to operate and inefficient, such as a ruler; or the detection instrument itself is complex and difficult to operate, requiring professional operating skill
[Microcontroller]
Research and implementation of wall flatness detector based on embedded ARM9
ARM9 wireless remote control video real-time monitoring car (I) -------- the motor control module of the car
The initial idea of ​​the project was mainly from the remote control of Android phones on the Internet. This is my first time doing this project, so I'm sure I'll waste a lot of money. The total cost of the project is about 1,000 yuan The following pictures show some of the work that has been done in
[Microcontroller]
ARM9 wireless remote control video real-time monitoring car (I) -------- the motor control module of the car
Design of 3G video helmet based on ARM11 and DSP collaborative video stream processing technology
  1. Introduction   In order to improve the controllability of on-site operations in high-risk workplaces, this paper adopts bionic principles and high-integration design to realize a 3G video helmet with the same viewing angle as the human eye. This design consists of a video helmet and a waist-span data processing
[Microcontroller]
Design of 3G video helmet based on ARM11 and DSP collaborative video stream processing technology
Development of Traffic Violation Capture System Based on ARM9
1 Introduction Intelligent Transportation System (ITS) applies advanced information technology, data communication transmission technology, electronic control technology, computer processing technology, etc. to the transportation industry, thereby realizing the modernization of development planning of various t
[Microcontroller]
Development of Traffic Violation Capture System Based on ARM9
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号