APP下载

FATFS在嵌入式操作系统FreeRTOS中的移植与应用

2017-04-10高兆强王绍举徐伟代书博李治根

现代电子技术 2017年6期

高兆强 王绍举 徐伟 代书博 李治根

摘 要: FreeRTOS作为一款免费的实时操作系统,系统内核小、裁剪方便、移植性好,广泛应用于对成本敏感的小型嵌入式系统中,但是FreeRTOS本身不带文件管理功能,不便于很多需要经常进行文件存储与读写的应用。为了提高该操作系统易用性,介绍一款免费、小巧并且读写高效的文件管理系统,即FATFS,详细说明FATFS在FreeRTOS上的移植与注意事项,重点说明了FATFS在FreeRTOS中如何解决重入的问题,最后在STM32F4平台上对U盘进行读写来验证其文件管理的效果。结果表明,其可以很好地完成文件管理的功能。

关键词: 嵌入式操作系统; FATFS; FreeRTOS; 文件管理系统

中图分类号: TN911?34; TP319 文献标识码: A 文章编号: 1004?373X(2017)06?0065?03

Abstract: As a free real?time operating system, FreeRTOS is widely used in cheap system due to its small system kernel, convenent trim and good portability. However, FreeRTOS itself does not have any file management function, so it is not inconvenient for some applications of often writing and reading files. To make it easy to use, a free?charge, small and efficient file management system, FATFS is introduced in this paper. The FATFS transplantation and matters needing attention on FreeRTOS are illustrated in detail. The method that how to solve the problem of FATFS′s re?entry in the FreeRTOS is described emphatically. A test to read and write something in a U?disk on the platform STM32F4 was conducted to verify its effect. The result shows that it can realize the function of file management.

Keywords: embedded operating system; FATFS; FreeRTOS; file management system

随着信息技术的发展,当今社会的信息量越来越大,以往由单片机系统简单地对存储媒介按地址、按字节的读/写已经无法满足人们实际应用的需要,利用文件系统对存储媒介进行管理成了今后单片机系统的一个发展方向[1]。目前常用的文件系统主要有微软的FAT12,FAT16,FAT32,NTFS,以及Linux 系统下的EXT2,EXT3 等。由于FAT高效、灵活的特点,在当前的消费类电子产品中,用得最多的还是FAT 文件系统,如U 盘,MP3,MP4,数码相机等,因此本文介绍了一款易于移植和使用、占用硬件资源相对较小而功能又强大的FAT 开源文件系统——FATFS[2]。

嵌入式操作系统FreeRTOS的内核不带文件系统,虽然提供了带文件系统的例子,但是需要授权[3],这势必会增加嵌入式开发的成本;因此本文在FreeRTOS中引进了免费、开源的文件管理系统FATFS,使得FreeRTOS的使用更加方便快捷。……

登录APP查看全文