In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Due to some needs, in order to develop programs on the Windows platform, the target board is based on the Micrel chip (ARMv4t). It runs the minimum Linux system, only the most basic commands, cross-compile the object code that can run on the ARMv4t on the Windows platform, and be able to debug remotely. Based on these requirements, the initial plan is as follows:
1. First cross-compile a simple C language program on the Windows platform and upload it to the development board, which can run normally.
2. Cross-compile gdbserver and upload it to the development board
3. Remote debugging.
According to the above plan, the first step is to find a cross-compilation environment under the Windows environment. Refer to http://www.veryarm.com/arm-none-linux-gnueabi-gcc to download the arm-2011.03-41-arm-none-linux-gnueabi.exe Windows installation version (I feel it is better to use the installation version under Windows, and the decompressed version needs to be set up PATH). After the installation is successful, write a simple Hello,World in C! To compile using the following command:
Arm-none-linux-gnueabi-gcc hello.c-o hello
The target board is connected with the Windows host through Ethernet and serial port. Ethernet is used to upload files, and serial port is used for terminal access. The target board and the Windows host use tfpt for file transfer. Tftp server runs on Windows, as shown below:
Through the serial port terminal, run the following command on the target board to download the hello program compiled on the Windows host:
Tftp-gr hello 10.32.2.10
When you add execute permissions using the command chmod 755 hello, the following error message appears:
Illegal Instruction
This means that the program can run, but the instructions are wrong, which may be the reason why the specific target architecture is not specified when cross-compiling on Windows (programs that use the above command to cross-compile under Ubuntu can execute normally). In order to solve this problem, we first look at the information when the target board starts through the serial port terminal, and know that the ARM chip is armv4t architecture, then use arm-none-linux-gnueabi-gcc-target-help to check the ARM architecture type supported by the cross compiler, and find that the command can specify the target type through-march=option, so the compilation command is changed to:
Arm-none-linux-gnueabi-gcc-march=armv4t hello.c-o hello-g
The compiled program can run on the target machine! (good luck)
The first step is complete, and then cross-compile the gdbserver. The previously installed arm-2011.03-41-arm-none-linux-gnueabi.exe contains arm-none-linux-gnueabi-gdb.exe commands running under Windows, and for remote debugging, you need to run gdbserver on the target board. So go to the official website of gdb (http://ftp.gnu.org/gnu/gdb) downloads the code of gdb7.6. It suddenly occurred to me that since arm-2011.03-41-arm-none-linux-gnueabi.exe contains gdb executed on Windows, does it also include gdbserver running on Linux? As soon as you enter the installation directory, Bingo, sure enough, you have good luck in the installation directory CodeSourcery\ Sourcery_G++_Lite\ arm-none-linux-gnueabi\ libc\ armv4t\ usr\ bin. After putting the gdbserver in this directory on the target version, it will work. The second step is completed (I am sometimes lazy, so I no longer compile by myself under Windows)
The third step is relatively easy, running the command on the target board to start gdbserver:
. / gdbserver 10.32.2.80:3333 hello
The IP in the above command is the IP address of the target board, and the port number is specified by yourself, as long as there is no conflict. The following hello is the debugged program that contains debugging information. Then run arm-none-linux-gnueabi-gdb.exe under Windows, after entering the gdb prompt, execute target remote 20.32.2.80 target remote 3333 to connect the target board gdbserver, and then execute file hello under the gdb prompt, which is to load the debugged program under Windows, and then press the gdb command to set the endpoint and so on, you can debug.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.