The following is for the ARM series microprocessors
1. GCC is a compilation tool under the Linux operating system environment. It can compile and connect source programs written in C\C++\assembly language into executable files, including the following four stages:
Source program | preprocessing stage | Compilation phase | Assembly stage | connection phase | executable file |
Without -c -S -E parameters, generate executable file | |||||
-c, generate .o file | |||||
-S, generate .s file | |||||
-E, generate .i file |
2. GCC basic command format
GCC basic command format;
arm-linux-gcc [options] [filenames]
Example:
[Fixed format] [Command parameters] [File name]
- arm-linux-gcc -o test test.c executes the above four stages to generate the executable file test
- arm-linux-gcc -c -o test.o test.c executes the first three stages and generates the target file test.o
- arm-linux-gcc -S -o test.s test.c executes the first two stages and generates the assembly language file test.s
- arm-linux-gcc -E -o test.i test.c executes the first stage and generates the file test.i
- arm-linux-gcc -g -o test test.c executes the above four stages to generate an executable file test with debugging information.
Note: The green font indicates the name of the output file after compilation.
For 2, if the -o test.o parameter is removed, the compiler will automatically generate a target file named test.o. Similarly,
For 3, remove the -o test.s parameter, and the compiler will automatically generate an assembly language file named test.s.
Finished writing, 22.53, ready to wash up and go to bed!