Arm-Linux-gcc-wall
-O2-c-o $ <
-O only activates preprocessing, compilation, and assembly, that is, he only makes the program into an OBJ file.
-Wall indicates that all warning messages are generated.
-The compilation optimization option provided by the O2 compiler for the program. This option can be used during compilation to improve the execution efficiency of the generated execution file.
-C indicates that only the compiler is required to compile the file, instead of linking the file. The generated file is named after the file name of the source file, but its suffix is changed from. C or. CC
. O target file
-S only activates preprocessing and compilation, which means to compile a file into assembly code.
Arm-Linux-LD
Specify the starting address of the code segment, data segment, and BSS segment.
-Ttext startaddr
-Tdata startaddr
-Tbss startaddr
Example:
Arm-Linux-LD-ttext 0x0000000-G led. O-o
Led_elf
Use the connection script to set the address:
Arm-Linux-LD-ttimer. LDS-o
Timer_elf $ ^
Timer. LDS is the connection script.
Complete connection script format:
Sections {
...
Secname start aling (aling)
(Noload): At (ldaddr)
{Contents}> region: phdr = fill
.....
}
Example:
Sections {
Firtst 0x00000000: {Tron. O init. O}
Second 0xb0004000: At (2048 ){
Led_on.o}
}
In fact, it is to plan how to place each program in a binfile and the location where each code segment is stored during the running process.
Arm-Linux-objcopy is used to copy the content of a target file to another file. It can be used for format conversion between different source files.
Example:
Arm-Linux-objcopy-O Binary-s elf_file
Bin_file
Common options:
1. Input-File
, Outflie
Input and Output files. If no OUTFILE exists, the output file name is the input file name.
2.-l bfdname or-input-target = bfdname
It is used to specify the source file format. bfdname is the standard format name described in the BFD library. If it is not specified, arm-Linux-objcopy will analyze it by itself.
3.-O bfdname output format
4.-F bfdname simultaneously specifies the format of the source file and target file
5.-R sectionname: Remove all segments named sectionname from the output file.
6.-S does not copy the relocation information and symbol information from the source file to the target file.
7.-G does not copy the debugging symbol from the source file to the target file.
Arm-Linux-objdump
I. Arm-Linux-objdump is commonly used to display binary file information and to view disassembly code.
Ii. Common options:
1.-B
Bfdname specifies the target code format
2.-disassemble or-D disassembly executable segment
3.-dissassemble-all or-D disassembly of all segments
4.-EB,-El specifies the byte order
5.-file-headers or-F displays the overall header Summary of the file.
6.-section-headers, -- headers or-H displays the header summary information of each segment in the target file.
7.-info or-I displays supported target file formats and CPU architecture
8.-Section = Name or-J name: displays the information of the specified section.
9.-architecture = machine or-M machine specifies the architecture used to disassemble the target file
Iii. Example
Arm-Linux-objdump
-D elf_file> dis_file or
Arm-Linux-objdump
-D-B Binary-M arm bin_file> dis_file
Arm-Linux-objdump
-D-M arm led_elf> led. Dis
-D
Display All assembly information in the file
-M Machine
Specify the architecture used for the disassembly target file. This option is useful when the file to be disassembly does not describe the architecture information (such as S-records. You can use the-I option to list the racks that can be specified here.
Original post address:
Http://www.cublog.cn/u3/94311/showart_2015890.html