嵌入式Linux的调试及设备驱动的开发
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
随着信息技术与网络技术的高速发展,嵌入式系统正越来越广泛地应用于科学研究、军事技术、工程设计、计算机、通信、消费类电子等方面。嵌入式系统是以应用为中心,以计算机技术为基础,并且软硬件均可裁剪,适用于应用系统对功能、可靠性、成本、体积、功耗有严格要求的专用计算机系统。采用Linux进行嵌入式开发要面对的问题主要有两个:首先是操作系统的改造,裁减内核或是直接改写Linux的内存管理、进程调度机制,其次就是设备驱动程序的设计开发。
     本文的研究重点为Linux设备驱动程序的设计。文章主体分为以下部分:
     首先,从介绍嵌入式Linux系统的体系结构及其核心入手。详细研究了基于X-scale内核PXA255硬件平台的交叉编译环境的建立以及Linux中断处理机制,在此基础上,对此平台上嵌入式Linux的操作系统的移植技术,包括启动代码(Bootloader)的移植、嵌入式Linux的内核移植等进行了研究,给出了移植的具体步骤。
     其次,分析了设备驱动程序的设计原理、设计方法——模块化的概念以及编写、编译、调试。从程序结构角度而言,驱动程序是子程序和数据的集合,是输入输出设备的软件接口,它的任务就是向系统提供接口函数,所以简单的说编写驱动程序就是实现这接口函数。驱动程序分三类:字符设备、块设备、网络设备,文章详细分析了Linux设备驱动程序的设计并编程加以实现。
     通过对外部设备驱动程序的分析,本文设计了字符设备驱动程序模型和块设备驱动程序模型。这两个模型完成了驱动程序中与内核相关的几乎所有事务,包括设备的注册和注销、设备的打开和关闭及读写等系统调用的统一接口、数据从内核内存传送到用户内存的方法等。对内存的使用和设备的访问方式,本文也作了详细的说明。有了以上的基础,开发者只需再熟悉外部设备的使用方法和数据格式等硬件信息,一个完整的驱动程序就很容易写成了。模型中还加入了一定的安全措施以保证它的可靠性。
With the rapid development of information technology and computer network, embedded system has being more and more widely used in science research, military, engineering design, computer, commnication, and consumer electronic, et c. Embedded system centres on application and bases on computer techonolgy, it’s hardware and software can be cut off by users, and is suit for a special computer operating system that has limitation with function, reliability, cost, cubage and power waste. You will face with two aspects if you develop embedded system by Linux: first is rebuild operating system, including reducing kernel or rewriting derectly memory management of Linux and the mechanism of process call; the second is the design and develop of devices drivers.
     In this paper, I emphasize on the development of devices drivers. It can be divided into some parts as follow.
     First, it starts with system structure and kernel of embedded Linux system. I study particularly on the across-compile environment based on X-scale kernel PXA255 hardware platform and the interrupt mechanism of Linux. And then I investigate the transplantation technology of embedded Linux system, which includes replanting Bootloader and migrating embedded Linux kernel. I generalize the steps of migration in detail.
     Second, I analyze the design theory and method of devices drivers, introduce the conception of modularization, and make an anatomy about the method how to write, compile and debug devices drivers. Devices drivers are the collection of subprogram and data, they are the software interfaces of I/O devices and provide interface function to the system. So programming drivers means to realize these functions. Drivers can be divided into three types: character device drivers, block device drivers and network device drivers. I study the design of device drivers and program them.
     Through my research based on peripheral equipment drives program, I contrive the models of character device dirvers and block device drivers. The two models should finish nearly all transactions that have relationship with kernel, including the interface with function registers, logout, open, close, write and read, also including the method with which sends data from kernel to user and so on. The paper studies the use of memory and the access mode to equipment too. Based on above, if a developer wants to write his device driver, he only needs to be familiar with the hardware information, such as the working of peripheral equipment and the data type. Safe precautions are added to the module for reliability in my paper.
引文
[1] Wilmshurst, T. A design model for embedded systems[J]. Enginneering Education: Innovations in Teaching, Learning and Assessment (Ref. Nol 2001/046),IEEInternational Symposium on, 2001(1).
    [2] Mishra, Rajesh. Debugging and Embedded Linux runtime environments[J]. Dr. Dobb's Journal, 2006(3).
    [3] Hu Yongqi, Hou Zifeng. Storage system design on NAND flash for embedded Linux system[J]. Computer Engineering, 2006(4).
    [4] Fischer, Todd. Optimizing embedded Linux[J]. Dr. Dobb's Journal, 2002(5).
    [5] 周思轶. 嵌入式Linux设计与应用[M]. 北京: 清华大学出版社, 2000.
    [6] 赵敏哲. 64位Linux操作系统与应用实例[M]. 北京: 机械工业出版社, 2000.
    [7] [美]Scott Maxwell 著. Linux 内核源代码分析[M]. 冯锐, 邢飞, 刘隆国, 陆丽娜译. 北京: 机械工业出版社, 2006,7.
    [8] [美]Robert Love著. Linux内核设计与实现[M]. 陈莉君, 康华, 张波译. 北京: 机械工业出版社, 2004.
    [9] 程佩清.嵌入式系统设计与实现[M].第2版.北京: 清华大学出版社, 1995.
    [10] [美]Alessandro Rubini. Linux设备驱动程序[M]. Lisoleg译.北京: 中国电力出版社, 2000: 11-358.
    [11] Stevens Richard.Advanced Programming in the Unix Enironment[J]. Addison Wesley, 1992:78-90.
    [12] 胡希明, 毛德操. Linux内核源代码情景分析(上、下册)[M]. 浙江: 浙江大学出版社,2001.9.
    [13] 李善平, 陈文智等. 边干边学一Linux内核指导[M]. 浙江: 浙江大学出版社,2002.8.
    [14] 胡希明, 毛德操. 嵌入式系统——采用公开源码和StrongARM/Xscale处理器[M]. 浙江: 浙江大学出版社,2003.10.
    [15] 贺纲, 吴灏. Linux字符设备驱动程序工作机理[J]. 信息工程大学学报, 2001(1) No. 2.
    [16] [美]David Pitts. RedHat Linux Unleashed[M].Sams Publishing,1998: p114-130.
    [17] John Lions. Lions's Commentary on Unix Sixth Editon with Source Code[J]. Peer-to–Peer Communic- ations, 1997: p297-311.
    [18] [美]Brian. HatchHacking Linux Exposed[M]. McGraw-Hill Higher Education, 2001: p16-49.
    [19] Daniel Pierre. Understanding the Linux Kernel[C]. O'Reilly&Associates,2000 :p113-154.
    [20] Ramon J, Hontanon. Linux Security[J].Sy bex,2001(2): p15-244.
    [21] 李善平, 刘文峰, 李程远, 王焕龙, 王伟波. Linux内核2.4版源代码分析大全[M]. 北京: 机械工业出版社, 2002.2 p3-11.
    [22] Steve Heath. Essential Linux[M]. Digital Press, 1997: p1-16.
    [23] Alessandro Rubini. Linux Device Driver (2nd Edition) [M] . USA:O’Reilly ,2001.
    [24] [美]Don Anderson. USB系统体系[M]. 北京: 中国电力出版社, 2001.
    [25] USB Specification ,v2. 0. [EB/OL]. http:// www. usb.org , 2006-03-10.
    [26] 阴晓峰, 葛安林, 张伯英. 孙淼Linux环境下设备驱动模型及开发技术[J]. 计算机工程与应用, 2002(8): p104-106.
    [27] Naba Barkakati. Linux Secrets[S]. IDG Books Worldwide, 1997: 10-34.
    [28] 徐千洋. Linux C函数库参考手册[S].中国青年出版社, 2002: 20-187.
    [29] 刘淼. 嵌入式系统接口设计与Linux驱动程序开发[M]. 北京: 北京航空航天大学出版社, 2006.5.
    [30] 马忠梅等. ARM 嵌入式处理器结构与应用基础[M]. 北京: 北京航空航天大学出版社, 2002.
    [31] 杜春雷. ARM体系结构与编程[M]. 北京: 清华大学出版社. 2003.2.
    [32] [美]ALESSANDRO RUBINI, JONATHAN CORBET著. Linux设备驱动程序第二版[M]. 魏永明, 骆刚等译.北京: 中国电力出版社.2002.11.
    [33] 王田苗. 嵌入式系统设计与实例开发一基于ARM微处理器与uC/OS-11实时操作系统[M]. 北京:清华大学出版社.2003.10.
    [34] 马忠梅, 马广云, 徐英慧等. ARM嵌入式处理器结构与应用基础[M]. 北京: 北京航空航天大学出版社,2002.1.
    [35] 陈章龙, 唐志强, 涂时亮. 嵌入式技术与系统一Intel Xscale结构与开发[M]. 北京: 北京航空航天大学出版社, 2004.2.
    [36] 周立功等.ARM为控制器基础与实战[M]. 北京: 北京航空航天大学出版社.2003.11.
    [37] 李程远, 刘文峰, 李善平. ARM Linux在EP7312上的移植[J].计算机工程与设计.2003, 第24卷(第7期).73-760.
    [38] 顾咏枫, 陈章龙.嵌入式Linux裁减方法[J].小型微型计算机系统.2003.9, 第24卷(第9期).1697- 1700.
    [39] WRIGHT W. J2ME and embedded systems[J]. Dr. Dobb's Journal, 2003, 28(3): 54-58.
    [40] MOURAD D, AZZAM M, NADIA T. Armed E-bunny: A selective dynamic compiler for embedded Java virtual machine targeting ARM processors[C]//ACM SIGAPP. 20th Annual ACM Symposium on Applied Computing. Santa Fe, NM, United States: Association for Computing Machinery, 2005.
    [41] HUANG G J, HU Z G. Kilos Virtual Machine For Embedded Distributed System[J]. Journal of Hunan University of Arts and Science (Natural Science Edition), 2003,15 (3):53-57.
    [42] Garbutt Jason, John Sabu, Vinay Thurai. Embedded systems for real-time control of a differential drive WMR[C]. Proceedings of the International Conference on Embedded Systems and Applications ESA'04 - Proceedings of the International Conference on VLSI, VLSI'04. Las Vegas. 2004.
    [43] Kato, Kazuomi; Yamamoto, Tetsuji; Hirota, Teruto; Mizuyama, Masashige. Embedded Linux technologies to develop mobile phones for the mainstream market[C]. 2006 3rd IEEE Consumer Communications and Networking Conference, Las Vegas. 2006.
    [44] http://www.kernel.org/
    [45] http://www.arm.linux.org.uk/
    [46] http://www.intel.com/
    [47] http://www.usb.org/
    [48] http://www.sourceforge.net/

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700