嵌入式linux操作系统Chapter 4.doc
《嵌入式linux操作系统Chapter 4.doc》由会员分享,可在线阅读,更多相关《嵌入式linux操作系统Chapter 4.doc(34页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Chapter 4. Development ToolsMuch like mainstream software developers, embedded system developers need compilers, linkers, interpreters, integrated development environments, and other such development tools. The embedded developers tools are different, however, in that they typically run on one platf
2、orm while building applications for another. This is why these tools are often called cross-platform development tools, or cross-development tools, for short.This chapter discusses the setup, configuration, and use of cross-platform development tools. First, I will discuss how to use a practical pro
3、ject workspace. I will then discuss the GNU cross-platform development toolchain, the C library alternatives, Java, Perl, Python, Ada, other programming languages, integrated development environments, and terminal emulation programs.4.1 Using a Practical Project WorkspaceIn the course of developing
4、and customizing software for your target, you will need to organize various software packages and project components in a comprehensive and easy-to-use directory structure. Table 4-1 shows a suggested directory layout you may find useful. Feel free to modify this structure to fit your needs and requ
5、irements. When deciding where to place components, always try to find the most intuitive layout. Also, try to keep your own code in a directory completely separated from all the packages you will download from the Net. This will minimize any confusion regarding the sources ownership and licensing st
6、atus.Table 4-1. Suggested project directory layoutDirectoryContentbootldrThe bootloader or bootloaders for your targetbuild-toolsThe packages and directories needed to build the cross-platform development toolchaindebugThe debugging tools and all related packagesdocAll the documentation you will nee
7、d for your projectimagesThe binary images of the bootloader, the kernel, and the root filesystem ready to be used on the targetkernelThe different kernel versions you are evaluating for your targetprojectYour own source code for this projectrootfsThe root filesystem as seen by the targets kernel at
8、runtimesysappsThe system applications required for your targettmpA temporary directory to experiment and store transient filestoolsThe complete cross-platform development toolchain and C libraryOf course, each of these directories contains many subdirectories. We will populate these directories as w
9、e continue through the rest of the book.The location of your project workspace is up to you, but I strongly encourage you not to use a system-wide entry such as /usr or /usr/local. Instead, use an entry in your home directory or a directory within the /home directory shared by all the members of you
10、r group. If you really want to have a system-wide entry, you may want to consider using an entry in the /opt directory. For the example embedded control system, I have the following layout in my home directory:$ ls -l /control-projecttotal 4drwxr-xr-x 13 karim karim 1024 Mar 28 22:38 control-moduled
11、rwxr-xr-x 13 karim karim 1024 Mar 28 22:38 daq-moduledrwxr-xr-x 13 karim karim 1024 Mar 28 22:38 sysmgnt-moduledrwxr-xr-x 13 karim karim 1024 Mar 28 22:38 user-interfaceSince they all run on different targets, each control system component has a separate entry in the control-project directory in my
12、home directory. Each entry has its own project workspace as described above. Here is the daq-module workspace for example:$ ls -l /control-project/daq-moduletotal 11drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 bootldrdrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 build-toolsdrwxr-xr-x 2 karim karim 1024 M
13、ar 28 22:38 debugdrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 docdrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 imagesdrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 kerneldrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 projectdrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 rootfsdrwxr-xr-x 2 karim karim 1024 Mar 28 22:
14、38 sysappsdrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 tmpdrwxr-xr-x 2 karim karim 1024 Mar 28 22:38 toolsBecause you may need to provide the paths of these directories to some of the utilities you will build and use, you may find it useful to create a short script that sets appropriate environment va
15、riables. Here is such a script called develdaq for the DAQ module:export PROJECT=daq-moduleexport PRJROOT=/home/karim/control-project/$PROJECTcd $PRJROOTIn addition to setting environment variables, this script moves you to the directory containing the project. You can remove the cd command if you w
16、ould prefer not to be moved to the project directory right away. To execute this script in the current shell so that the environment variables are immediately visible, type:11 All commands used in this book assume the use of the sh or bash shell, because these are the shells most commonly used. If y
17、ou use another shell, such as csh, you may need to modify some of the commands accordingly.$ . develdaqFuture explanations will rely on the existence of the PROJECT and PRJROOT environment variables.Since the distribution on your workstation has already installed many of the same packages you will b
18、e building for your target, it is very important to clearly separate the two types of software. To ensure such separation, I strongly encourage you not to carry out any of the instructions provided in the rest of this book while being logged in as root, unless I provide explicit instructions otherwi
19、se. Among other things, this will avoid any possible destruction of the native GNU toolchain installed on your system and, most importantly, the C library most of your applications rely on. Therefore, instead of logging in as root, log in using a normal user account with no particular privileges.4.2
20、 GNU Cross-Platform Development ToolchainThe toolchain we need to put together to cross-develop applications for any target includes the binary utilities, such as ld, gas, and ar, the C compiler, gcc, and the C library, glibc. The rest of the discussion in the later chapters relies on the cross-plat
21、form development toolchain we will put together here.You can download the components of the GNU toolchain from the FSFs FTP site at ftp:/ftp.gnu.org/gnu/ or any of its mirrors. The binutils package is in the binutils directory, the gcc package is in the gcc directory, and the glibc package is in the
22、 glibc directory along with glibc-linuxthreads. If you are using a glibc version older than 2.2, you will also need to download the glibc-crypt package, also from the glibc directory. This part of the library used to be distributed separately, because U.S. cryptography export laws made it illegal to
23、 download this package to a computer outside the U.S. from the FSFs site, or any other U.S. site, for that matter. Since Version 2.2, however, glibc-crypt has been integrated as part of the main glibc package and there is no need to download this package separately anymore.2 Following the project di
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 嵌入式linux操作系统Chapter 嵌入式 linux 操作系统 Chapter
限制150内