嵌入式系统讲义 第 5 章 嵌入式系统软件开发环境与工具
DESCRIPTION
嵌入式系统讲义 第 5 章 嵌入式系统软件开发环境与工具. 周国运 2007.9. 第 5 章主要内容. 1 、 Linux 与嵌入式 Linux 概述 2 、 Windows 下的 Linux 环境软件 ---cygwin 3 、 Linux 文件系统结构 4 、 Linux 常用命令 5 、 Linux 文本编辑器 vi 6 、 Linux 编译器 gcc 及编译工具 7 、交叉编译工具的创建. 5.1 Linux 与嵌入式 Linux. 主要内容 1 、 Linux 操作系统的产生 2 、 Linux 操作系统的特点 - PowerPoint PPT PresentationTRANSCRIPT
-
5
2007.9
-
51LinuxLinux2WindowsLinux---cygwin3Linux4Linux5Linuxvi6Linuxgcc7
-
5.1 LinuxLinux
1Linux2Linux3Linux4Linux5Linux
-
5.1.1 LinuxLinux1984MITRichard StallmanFSF(Free Software Foundation)FSFGNUGNUs Not UnixUnixRichardGPLGeneral Public LicenseGNU
-
19841991GNUUNIXOSshellCC++gcc/gcc++ Linux 1991Linus Torvald MINIX UNIXMINIXLinux GNULinuxGNUGNUUNIXLinux
-
LinuxLinuxLinuxUnix
-
5.1.2 LinuxOSI
-
5.1.2 Linux2 LinuxWindows LinuxLinux
-
5.1.2 Linux3Linux
-
5.1.3 LinuxLINUXLINUX SHELLShell
-
5.1.3 Linux2LINUX: LinuxEXT2EXT3FATVFATISO9660NFSSMBLINUXLinuxX WindowInternet
-
5.1.4 LinuxLinuxx.y.zzxyzzBUGx09yyzz099
-
5.1.4 Linux2yy12.4.18
-
5.1.5 LinuxLinuxLinuxLinuxLinuxkernelkB
-
LinuxLinuxLinuxLinuxLinuxLinux3
-
Linuxext2ext3NFScramfsTCPIP
-
Linux
LinuxCPUUnixLinuxPC
-
Linux(1) x86, ARM, IPS,APARCCPU(2)(3) TCP/IPftp, Telnet, httpSocket
-
(4) linuxFAT32, EXT2, EXT3ROMFS,JFFS(5) linuxPC
-
(6)Linux Linux
-
5.2 WindowsLinux---Cygwin
1 Cygwin 2 Cygwin 3 Cygwin
-
5.2.1 CygwinCygwinWindowsLinuxGNUWin32CygwinCygwinWindowsLinuxLinuxLinux
-
5.2.1 Cygwin2LinuxWindowsWindows
-
5.2.2 CygwinCygwinCygwin solutionsCygwin Cygwin solutionshttp:// www.cygwin.com/Install Cygwin Nowsetup.exeCygwinsetup.exeIntall from Internet
-
Intall from InternetDownload without IntallingIntall from Local Directory
-
5.2.3 Cygwin1Cygwinsetup.exeIntall from Local Directory21C2GB2All UsersUnix
-
3DefaultInstallReinstallUninstall4 1All Default2InstallAdminArchiveBaseLinuxLibs
-
NetShallUntilsEditor
-
5. 3 Linux
1Linux2Linux
-
5.3.1 Linuxlinux
-
5.3.2 LinuxDOSLinux DosDOS /sbin /usr /etc /root /lib /hom /mnt/
-
LinuxLinux
-
5.3.3 Linux/ /usr Linux/var
-
/home EMAIL/mnt FAT32NTFS/bin
-
/sbin /etc /root Home/dev LINUX
-
/lib/boot Linux vmlinuzLinuxLILOLILOLinuxLILOGRUB
-
/opt REDHAT 5.2KDE REDHAT 6.0KDEX-WINDOWS/usr/bin/tmp /lost+found
-
5.3.4 LinuxWindowsCLinuxmountumount/etc/fstab
-
FAT32/mntwinDmount t vfat o iocharset=cp936 /dev/hda2 /mnt/winDhda2Dfdisk l/ntfs-t ntfsUmount t vfat o iocharset=cp936 /dev/sda1 /mnt/udisk
-
5.3.5 Linux Linux extext2ext3CRAMFSmsdosumsdosVfatNTFS minix linux ext2 linuxext3 linux nfs cramfs
-
5.3.6 LinuxLinux.file
-
(1).bz2 bzip2 . gz gzip .tar tartape archive tar .tbz tar bzip .tgz tar gzip .zip ZIP MS-DOS Linux gzip Linux .zip
-
2 .au .gif GIF .html/.htm HTML .jpg JPEG .pdf PDF Portable Document Format .png PNG Portable Network Graphic .ps PostScript .txt ASCII .wav .xpm
-
(3). .conf .cfg .lock lock .rpm Red Hat
-
(4).c C .cpp C++ .h C C++ .o .pl Perl .py Python .so .sh shell .tcl TCL
-
5. 4 Linux
1Linuxshell2Linux
-
5.4.1 LinuxshellLinuxshellshellLinuxLinuxshell
-
shell
bashashcshkshtcshbashLinuxshellBrian Fox Chet Ramey bashBourne Again Shell40Bash12Tab3*4||
-
5.4.2 Linux1ls---ls [option] [file] ls ls a ls l ls F/*@
-
arwxrwxrwx n owner group size date namea:d:n:l: (1)b: (2)c: r:read,w:write,x:execute,
-
21cat---cat filenamecat file1file1cat file2 | morefile22more---more filename
-
3cd---cd [directory]cd dir dir cd / cd .. cd ~/abcabc /...
-
4cp---cp [] [] cp -r cp file1 file2 file1file2cp /root/file ./rootfile file cp file /usr file /usrfile cp r dir1 dir2 dir1dir2
-
5 rm--- rm [filename]rm file1file1rm *.ccrm abc.*abcrm *
-
6mv---mv mvfile1 file2file1file2mvfile1 dir2file1dir2file1mvdir1 dir2dir1dir2
-
7mkdir [option]mkdir dir1dir1mkdir dir1/dir2 dir1dir2mkdir -p dir3/dir4 dir3 dir3dir4
-
8rmdir rm r rmdir dir1dir1dir1rm r dir2dir2
-
91cat---cat filenamecat file1file1cat file2 | morefile22more---more filename
-
3less---less filenamebq
-
10ln---1ln ln file1 dir2/file2file1dir2file2ln dir3/file3 file4dir3file3file4rm
-
2Win2kln s ln -s file1 dir2/file2 file1dir2file2ln s dir3/file3 file4dir3file3file4rm
-
11 tar--- 1 tar cfzv tar cfzv dir1/file1.tgz dir2 dir2file.tgzdir14cfzv
-
2tar xfzv tar xfzv file.tgz dir1file.tgz dir14xfzv
-
121mount---mount [option] mount IP option::mount -t yaffs /dev/mtdblock/0 /mnt /dev/mtdblock/0 /mnt mount -t nfs 192.168.0.1:/friendly-arm/root /mnt nfs /friendly-arm/root /mnt 2umount---umount
-
12shell---manLinuxman mancp
-
13Linux---helpLinux---help --helpgcc --help
-
5. 5 Linuxvim
1vim2vim3vim
-
5.5.1 vimvimLinuxvi Visual interfaceWindows/ DOSEDITVimLinux---EmacsLinux---EdEx
-
5.5.2 vimVim1vimvim2vimfilevimfilefilefile
-
5.5.3 vimvim1vim12
-
21Vim2ESC31ZZvimshell
-
2ashift+aishift+ioshift+o
-
3V/vY/yP/p4xd$ddshift+d
-
5rshift+rcwcecbc$shift+ccc
-
aiai
-
123
-
1ww w2qq!x qq!ZZx
-
5. 6 Linuxgcc
1gcc2makemakefile
-
5.6.1 Linuxgccgcc
gccGNU C Compiler Richard StallmangccCAdcC++JavapascalCOBOLGNU Compiler CollectionGMU gcc gccGNUC gcc20---30%
-
gccgcc(Preprocessing)(Compilation)(Assembly) (Linking)gcc
-
gccgccgcc [option] filegcc-o -c .o
-
-g a.exe -E -S -O -Wall
-
gccLinuxELFa.exea.outELFExecutive linked file .exeELFLinux
-
Hello.cvoid main(){printf(Hello the world\n)}1gcc o hello hello.chello.chello.exe 2gcc c hello.chello.chello.ogcc
-
3gcc g hello.ca.exe4gcc S hello.chello.chello.s 5gcc O hello.ca.exe6gcc Wall hello.ca.exe
-
5.6.2 MakefileMake MakefileMake1MakefileMake2MakefileMake1Makefile .c.s.o.h.lib Makefile
-
2MakefileMakeMakeMakefileMakeMakefileLinuxshellgccMakefileMakefileMakefile.o.exe
-
Cexample.cexample.hgccexample.o 1example.o2example.cexample.h3gcc -cMakefileexample.oexample.c example.hgcc -c example.c
-
2Makefilemyproject.exemyproject p1.o p2.ogcc -o myproject p1.o p2.op1.op1.c p1.hgcc c p1.cp2op2.c util.cgcc c o p2.o p2.c util.c
-
1Makefile2Rules.makeMakefile3MakefileMakefileMakefileMakefile
-
linux 1linux.config .configMakefileMakefile.config .configmake menuconfig2MakefileLinuxvmlinuxLinuxmodule3Rules.makeMakefile
-
MakefileMakefileMakefile12CPUARCH3TOPDIRSUBDIRS456CONFIG_*
-
Rules.makeRules.makeO_OBJSL_OBJSOX_OBJSLX_OBJSM_OBJSMX_OBJSO_TARGETL_TARGET
Linux.configLinux.config
-
Makefile1Linuxmake makefile2Linuxmakemakemakefile
-
5.7
12
-
12
-
3 gccbinutilscglibc Linux
-
1 LinuxbinutilsgccglibcLinux glibcshellPREFIX2binutilsconfigure --prefix= $PREFIX--target= arm-linuxmake install
-
3Linux make mrproper make config ARCH=arm ( make menuconfig/ xconfig ARCH=arm) ARCH=armCPUCPU : cp -dr include/asm-arm $PREFIX/arm-linux/include/asm cp -dr include/linux $PREFIX/arm-linux/include/linux
-
4gcc configure --prefix=$PREFIX --target=arm-linux --disable-threads -disable-shared --enable-languages=c make installgccgccglibcgccglibc
-
5glibc cpuLinux$PREFIX/arm-linux/sys-linux$PREFIX/arm-linuxsys-linuxincludeconfigure--with-headerslinux
-
6gcc configure --prefix=$PREFIX --target=arm-linux --enable-languages=cc++ make install
-
1236710Linux1ls2cat , more , less3cd4cp5rm6mv7mkdir8rmdir
-
GNUGNU is not UNIXRichard StallmanUNIXLinuxFSFGNUwww.gnu.org)GNU GNUGNU gccGNU makegccmakegccLinux
-
5.1 GNU gcc5.2 GNU make
-
7.1 GNU gcc
-
7.1 GNU gccgccas
-
7.1.1 gccgccGNU C ComplierLinuxgccGNUGNUgcc20%-30%gccCC++
-
7.1.1 gccgccgcc .cC .a .C.cc.cxx C++ .h .i C .iiC++ .mObjective-C .o .s .S
-
7.1.2 gcccc Ccpp C#include#define g++ C++ gcc C gccbug shellbug gcov libgcc gcc libstdc++ C++libsupc++ C++
-
7.1.3 gccgccC(Preprocessing)(Compilation)(Assembly) (Linking)1gcccpp(include)(define)
-
7.1.3 gcc2cc1.o3as.S.s.o4gccld
-
7.1.4 gcc gccgcc [options] [filenames]optionsfilenames -c.c.o -o output_filenameoutput_filenamegcca.out -g(GNUgdb) -O
-
7.1.4 gccgccgccarm-linux-gcc C
-
7.2 GNU make
-
7.2.1 GNU makegccLinuxGNU makemakemake
-
7.2.1 makemakeMakefileGNU makemakefileGNU makefile makefile MakefileLinuxMakefilemakefilemakefilemakemakefile#make f Makefile.debug Makefilemake
-
7.2.1 makeMakefiletargetmakeDependency Command: (Tab)target: dependency [dependency[]] command command []
-
7.2.2 automakemakefileMakefile Makefile Makefile Makefile Automake (macro) Automake Autoconf Makefile.in Autoconf configure GNU Makefile Makefile
-
1c#cd /home#mkdir hello#cd hello#vi hello.c#include stdio.hint main(){ printf(hello GNU\n); return 0; }
-
2 autoscan configure.in autoscan configure.scan configure.in #autoscan#lsautoscan.log configure.scan hello.c
-
3configure.scan,configure.in#vi configure.scanAC_INIThello.c) #AC_INIT(FILE) AM_INIT_AUTOMAKE(hello,1.0)#PACKAGEVERSIONmake disthelloworld-1.0.tar.gzAC_PROG_CC #C AC_OUTPUT(Makefile) #Makefile #mv configure.scan configure.in#configure.inconfigure
-
4 aclocal autoconf aclocal.m4 configure aclocalperl aclocalconfigure.inaclocal.m4aclocalaclocal - create aclocal.m4 by scanning configure.acautoconfconfigureconfigureMakefile#aclocal#autoconf
-
4. Makefile.am #vi Makefile.am AUTOMAKE_OPTIONS= foreign bin_PROGRAMS= hello hello_SOURCES= hello.c automakeMakefile.amMakefile.in
-
AUTOMAKE_OPTIONS automakeautomakeGNUAUTHORSChangeLogNEWSforeignautomakebin_PROGRAMS helloworld_SOURCES helloworldhelloworld.hhelloworld.chelloworld_SOURCES= helloworld.h helloworld.c
-
6 automake --add-missing Automake Makefile.am Makefile.in
#automake - -add-missing # --add-missing automake
-
7./configure,Makefile#./configure8Makefile#make9#./hello Hello GNU!
-
Makefilemake clean makeobject.omake install /usr/local/binmake dist distribution packagetar.gz PACKAGE-VERSION.tar.gzPACKAGEVERSIONconfigure.inAM_INIT_AUTOMAKE(PACKAGE, VERSION)
-
Makefilemake distcheck configuremake===========================================helloworld-1.0.tar.gz is ready for distribution ===========================================make distclean make cleanconfigureMakefile