Original: http://blog.chinaunix.net/uid-21977330-id-3761022.html
1. Installing dependent files
sudo apt-get install Texinfo
sudo apt-get install Libncurses5-dev
sudo apt-get install M4
sudo apt-get install Flex
sudo apt-get install Bison
To support the Python script extension feature
Apt-get Install Python-dev
Determines whether XML support is enabled, if Libexpat-dev is installed by default,
If XML is not supported, OPENOCD->GDB memory map transfer does not work
2. Compiling gdb for Arm
# It ' s actually quite straightforward:
wget http://ftp.gnu.org/gnu/gdb/gdb-7.0.1a.tar.bz2
Tar jvxf gdb-7.2.tar.bz2
CD gdb-7.2
./configure--target=arm-none-linux-gnueabi--program-prefix=arm-none-linux-gnueabi---prefix=/home/enzo-- With-python
which
--target I indicates the target system type
--Prefix refers to the directory in which the generated executable file is installed
--program-prefix refers to the prefix of the generated executable file
Make
Fortunately, three subdirectories are generated in the directory specified by--prefix: Bin, lib, share, and the arm-none-linux-gnueabi-gdb we need is in the bin directory.
Enter the GDB directory to strip the generated elf file, or about 12M
Strip Gdb-o Arm-none-linux-gnueabi-gdb
Size after cropping
-rwxr-xr-x 1 root root 2.7M June 9 21:14 arm-none-linux-gnueabi-gdb
Copy the arm-none-linux-gnueabi-gdb to the target location
3. Compiling gdbserver
CD Gdb/gdbservver
CC=ARM-HISIV100NPTL-LINUX-GCC./configure--host=arm-hisiv100nptl-linux--target=arm-hisiv100nptl-linux
Here's--hostSpecifies the platform and system on which the build executable runs: The Linux system running on the arm platform
Make
Check the generated Gdbserver
$ file Gdbserver
Gdbserver:elf 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
4. Removing symbol information
$ Arm-hisiv100nptl-linux-strip Gdbserver-o Gdbserver
[Email protected]:~/downloads/gdb-7.3.1/gdb/gdbserver$ file Gdbserver
Gdbserver:elf 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
Errors that may occur:
Xml-builtin.o:could not read symbols:file in wrong format
This error occurs because the cross-compiler is not specified
./configure--host=arm-hisiv100nptl-linux--target=arm-hisiv100nptl-linux
Own Development Board,
./configure--target=arm-none-linux-gnueabi--host=arm-none-linux-gnueabi--program-prefix= arm-none-linux-gnueabi---prefix=/home/ljl/gdb
Make sudo-i before install, then set environment variable, otherwise cannot find compiler
"Go" cross-compile arm gdb