Embedded system development study notes
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
Compile with -g, and then rename it into an executable file with -o
run: run the program
list: display program code
break: set a breakpoint
q: Quit gdb
d: Eliminate breakpoints
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
Create add.c, sub.c, mul.c, div.c files
Create main.c file
Create the main.h file
Compile the makefile
make operation
Run the cal file