Home  >  Article  >  Operation and Maintenance  >  What are the embedded linux development tools?

What are the embedded linux development tools?

藏色散人
藏色散人Original
2023-03-17 09:43:152958browse

Embedded Linux development tools include: 1. vim tool. Vim is a text editor developed from vi. It has code completion, compilation and error jump and other convenient programming functions; 2. gcc compilation compiler, a programming language compiler developed by GNU; 3. Project manager make, make is an automatic project compilation manager in Linux, etc.

What are the embedded linux development tools?

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

What are the embedded Linux development tools?

Embedded Linux development tools

Using vim

1. Text editor: vim vscode: Learn to use and configure vim, install and use plug-in remote link vscode

2. Compiler gcc: common compilation options, production and use of static libraries and dynamic libraries

3. Debugger gdb: Breakpoint debugging, viewing memory, debugging memory errors

4. Project manager make: writing Makfile, multi-directory Makefile writing

5. Shell programming (after C language)

6. git version management tool (online: C language)

7. Cmake (project)

8. Memory detection tool (online: C language)

vi/vim/gvim: Text editor gedit emac (off the mouse)

  • Applicable scenarios: single file editing; vim plug-in (highly customized)>IDE

  • vim mode: command line mode (first time to enter, press a,i), bottom line mode, insert mode (esc switches to command line) wq save and exit

  • vim configuration (vimc):

Modify the /etc/vim/vimc file (line number, indentation style, mouse support)

vim /etc/vim/vimrc

Install plug-in

  • Usage of vim command:

Command line: yy copy p paste dd delete u restore previous line

Bottom line: find /str ?str

Replace: line number or %s/old/new/gc

Edit multiple files: vim file 1 file 2 file 3.

Jump: n file name

File saving w r

sp file name multiple file writing

gcc compiler

The difference between "" and "": the search paths are different: the former searches in the system header file directory "/usr/include", if not, an error will be reported

The latter searches in the current directory, if If not, search in the system header file directory. If not, an error will be reported.

Specification: Contains system header files "" Contains custom header files

#if 0 //注释 //#if 1//取消注释
#endif

Different processors have Different assembly

All header files in the system are in vim/user/include/header files

  • gcc Overview: The compiler provided by the GNU Project (Unix cc compilation Converter) (compilation tool chain g ld ldfd) –> (cross-compilation tool chain)

  • What is cross-compilation? .c->.s->.o->elf

The process of compiling code under the host machine to run under the target machine

In The process of compiling code running on other CPU platforms under the current CPU platform

a\源文件到可执行经历了哪几个步骤?(预处理,编译,汇编,链接)
b\预处理的任务:头文件展开(#include)、宏替换(#define)、条件编译(#ifdef)(#开头的代码)
c\编译的任务:检查语法。转成汇编、生成汇编文件(.s/.S)
d\汇编的任务:编译汇编文件,生成目标文件(.o)
e\链接的任务:链接所有目标文件,生成符号表,生成可执行文件
  • Compilation options

-o (executable rename: elf format?)

-E (the compiler only performs preprocessing)

-I: Specify the third-party path for header file compilation

-S: Perform compilation phase

-c: Proceed to the assembly stage

-O1 -O2 -O3 (compilation optimization): Baidu check what has been done

-w (off warning) -Wall ( Turn on warning): Switch warning information

Library file

  • Compiler gcc (production and use of static libraries and dynamic libraries)

  • Debugger gdb (common naming, calling memory errors)

  • Project manager make (makefile writing, multi-directory Makefile writing)

extern: This function has been defined in other files

Library function: printf scanf strcpy strcat (saved in library file)

Library file: save functions and variables , the functions and variables inside can only be used, but their implementation cannot be seen

Library file classification: static library (.a) and dynamic library (.so)

Static library (.a ): The saved functions and variables are loaded into the executable file during the compilation phase

Dynamic library (.so): The saved functions and variables are loaded into the executable file during the execution phase

The difference between using static libraries and dynamic libraries (the difference between executable files:)

  • The executable file compiled using the static library>The size of the executable file compiled using the dynamic library-- Overhead affecting memory

  • Execution speed of executable files compiled using static libraries>Execution speed of executable files compiled using dynamic libraries

  • Use the executable file compiled from the static library to upgrade

  • Use the executable file compiled from the static library to program deployment>Use the dynamic library to compile Deploy the executable file program that comes out

Storage path of library files:

Library files required for system operation: /lib

Third-party software and libraries required to run the tool:/usr/lib

When compiling, the compiler will automatically go to these two directories to find the library files that need to be linked

Make static libraries:

  • Compile the target source file into a target file: gcc -c target source file (can be multiple) (gcc -c add.c)

  • Use The ar tool makes static: ar -rcs (create if the library does not exist, update if it exists) the name of the library file to be generated (lib library name suffix .a) target file

Example: ar -rcs libadd.a add.o

Use static library:

-l: Specify which static library to load -l library name

-L: Specify the library to load File storage path

gcc source file-l library name-L library storage path

Example: gcc demo.c -ladd -L./libls

Project Managermake

  • What is a project?

Multiple source files and other files (picture header file script file)

  • Jobs of the project manager: Compile multiple source files

gcc All source files -o executable files—>Automatic compilation

  • ##make depends on the Makefile file;

  • Makefile is a script file (batch processing), and there is related syntax

  • Makefile syntax:

Three elements: target , dependency, command

Format:

Target: dependency

tab command

Target: the final generated file

Dependency: generate Files required for the target

Commands: Commands that need to be executed when generating the target

Execution order:

make: execute from the first target by default

make target body: execute from the corresponding target body

If the file that the target body depends on is a target, execute the dependent target first, and then execute the command of the target body

You can build a makefile or Makefile make -f Makefile -f to specify which Makefile to execute

Makefile:

Comments:

#You can use $@ instead of

for the target

What are the embedded linux development tools?

What are the embedded linux development tools?

What are the embedded linux development tools?

What are the embedded linux development tools?

What are the embedded linux development tools?# under multi-level directories Makefile:

    Top-level Makefile: Master Control Makefile
  • Subdirectory Makefile: Function Makefile
  • scripts directory Makefile: header file Makefile
  • General control Makefile: enter each functional subdirectory to execute the make command, and link the .o files in each subdirectory into an executable file

Function Makefile: Compile the .c file in the current directory to generate an .o file

Header file Makefile: Define some variables

Related recommendations: "

Linux Video Tutorial

The above is the detailed content of What are the embedded linux development tools?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn