Embedded 3.10 summary

All linux file (- normal file directory file d c / d l file device link file
p pipe stack file file f s shared files)
root directory structure (sys proc lib)
function commands (grep sed awk find which)
Software Installation apt- get install

linux development tools, (vim, gcc, gdb, the make)
vim (text editor): learn to use and configure
gcc (compiler): how to make dynamic and static libraries and use the difference
gdb (debugger): set breakpoints, single-step execution, debug memory errors
make (project Manager): write the makefile

Text editor vim- most powerful text editor (to get rid of a mouse)
vi-vim-gvim: command line esc, insert i / a, the bottom line mode:
copy and paste 2yy p u delete 2dd restore
configuration vim: / etc / Vim / the vimrc
the IDE (integrated development environment) substituted vim-vscode

Embedded linux development tools -gcc
compiler: gcc (GNU CC)
gcc features (GNU tools, cross compiler arm-linux-gcc)
What is the cross-compiler? In the current cpu platform (host) compiled in the other (target) executable
source file into an executable file which needs to go through several steps (pretreatment, compiler, assembler, linker)
Pretreatment: Expand the header files, macro substitution , conditional compilation (gcc -E) <> header file system directory (/ usr / include) "" current directory - header file system directory specified -I -D macro condition
compilation: documents translated into the pre-assembly file .s ( gcc -S)
compilation: the compilation of documents compiled object file .o (gcc -c)
link: the establishment of the symbol table - the executable file a.out (gcc -o rename the executable file) -O3 operation optimization, -Wall error the reason

Production of static and dynamic libraries
What is a library? Saving functions and variables, features: Save the matter can not be seen can only be used to achieve
a static library (.a): Load at compile time; dynamic library (.so): loaded at runtime
the resulting executable advantages and disadvantages:
1. Static library generation is greater than the dynamic library executable file generation, memory for running multiple
2. static libraries is difficult to upgrade the executable file
3. static library executable file running speed
4. the static library within an executable code that is easy to deploy
linux file storage path:
/ lib for system operation; / usr / lib procedures required

How to make a static library:
1. Copy the files you need to save a function of where the compiled target culture and education (gcc -c)
2. static library creation tool: ar rcs library name of the target file name
3. Use: gcc source file -l library name -L inventory put path

How to make a dynamic library?
gcc -shared -fPIC source file -o new name .so

Job: gcc -static role

Released four original articles · won praise 0 · Views 137

Guess you like

Origin blog.csdn.net/weixin_46412477/article/details/104881872