Construction of ARM cross compiler and in-circuit debugger environment with Eclipse and GDB

Environment Introduction

  • Host: ubuntu 16.04 virtual machines
  • Card: hisi3559A

Installing Eclipse

Installation jdk

sudo add-apt-repository ppa:openjdk-r/ppa  
sudo apt-get update  
sudo apt-get install openjdk-8-jdk 

Determine whether the JDK installed successfully:

java
javac

Installation eclipse, eclipse-cdt

sudo apt-get install eclipse
sudo apt-get install eclipse-cdt

Create cross-application engineering

In the Eclipse main screen, click> New> C / C ++ Project , in the pop-up "C / C ++ Project" dialog box, enter the name of the menu item File. Select an item type (such as Executable / Empty Project), in the Toolchains must choose ** Cross GCC **, which is support for cross CDT environment, providing additional features to facilitate the development of embedded applications.
Click Next came "Select Configurations" page, we use the default, direct the next step, to the "Cross GCC Command" setting. Here we can fill in the cross-compiler tool chain and cross the path prefix, such as:

aarch64-himix100-linux-
/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin

The above configuration should be based on their actual situation.
Finally click Finish, a cross-project has been created. Set on cross-compiler prefix and path, after the project is created, you can change it in the project's properties.

test

#include <iostream>
using namespace std;

int main(int argc, char ** argv)
{
    cout<<"This is a message !\n";
    return 0;
}

Click to build, compile it. After compiling, we can, Binaries in the project directory to see the translation of the program on the left "Project Explorer" in. Copy it to the target development board, and the result is correct.

Set up remote debugging environment

Gdb compiled and gdbserver

Gdb choice needs to be compiled and gdbserver. You can refer to:

Development board terminal ready

Gdbserver the compiled file and copy to the development board, do:
./gdbserver 192.168.199.101:1234 filename
Note 192.168.199.101the ip host filenameis the name of the executable file.

Eclipse Set

Select a project in Eclipse, click on the menu Run> Debug Configurations, find the "C / C ++ Remote Application" in Dubug type on the left, right-point "New", create a remote debugging configuration, as shown below:



then you can be debugging.

Guess you like

Origin www.cnblogs.com/chay/p/11605960.html