Embedded system development study notes (4)

Last review

Embedded system development study notes (3)

Embedded Linux development tools

Debugger

Debugger-gdb

1. gdb is also a GUN plan (a\start program b\set breakpoint c\view variable value)
2. Before using gdb: need to use -g compile option
3. /ro+tab: automatically complete to /root/
4. The commands in the bin directory can be executed in any directory; otherwise, the path of the file needs to be pointed out.
5. @gcc: hide gcc

gdb command

1. gdb executable file--tui: enter the gdb running interface
2. run(r): run command
3. continue(c): run command
4. break + line number: set breakpoint
5. break + function name: set Breakpoint
6, break + line number + condition: set breakpoint
7, info break: view breakpoint information
8, layout src: return to position
9, layout asm:
10, delete (d) + number of breakpoint lines: delete breakpoint
11. Single step execution: next step
12, n: the next step, the loop will be skipped
13, s: the next step, you can enter the loop
14, view the variable value: print variable name

gdb command use

Insert picture description here

Compile with -g, and then rename it into an executable file with -o

Insert picture description here

run: run the program

Insert picture description here
Insert picture description here

list: display program code

Insert picture description here

break: set a breakpoint

Insert picture description here

q: Quit gdb

Insert picture description here

d: Eliminate breakpoints

Insert picture description here
Insert picture description here
Insert picture description here

info break: view breakpoint information

Project Manager

Project Manager—make

1. Project/project: project code composed of multiple source files and resource files
2. How to compile multiple source file codes?
(1000 source files, and not in the same directory)-project manager make
3. Function: automatic compilation
4. The function of the makefile file: store the command to compile the project (how to compile all the operations of the project)
5. The makefile is a script File: Batch

Syntax of makefile

Three elements: target (the final target is written in the first line), dependency, command (execute the command, generate the corresponding target according to the dependent file)
Format:
target: rely on
tab Command
execution order: make target name (execute from the target name) , If the target does not exist, start execution from the next line.

Algorithm of makefile calculator

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Create add.c, sub.c, mul.c, div.c files

Insert picture description here

Create main.c file

Insert picture description here
Insert picture description here

Create the main.h file

Insert picture description here

Compile the makefile

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

make operation

Insert picture description here

Run the cal file

Guess you like

Origin blog.csdn.net/m0_52251623/article/details/114685021