DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • Long Tests: Saving All App’s Debug Logs and Writing Your Own Logs
  • How to Debug the Spring Boot Application in Eclipse? [Video]
  • New Web Management Console Simplifies High Availability and Disaster Recovery for Linux Environments
  • Debugging Tips and Tricks for Python Structural Pattern Matching

Trending

  • Generative AI With Spring Boot and Spring AI
  • Role-Based Multi-Factor Authentication
  • Implementing CI/CD Pipelines With Jenkins and Docker
  • Behavior-Driven Development (BDD) Framework for Terraform
  1. DZone
  2. Coding
  3. Frameworks
  4. Develop and Debug C++ for ARM Linux Boards on Windows With Eclipse

Develop and Debug C++ for ARM Linux Boards on Windows With Eclipse

Learn more about developing and debugging ARM Linux Boards on Windows.

By 
Jan Cumps user avatar
Jan Cumps
·
Sep. 26, 19 · Tutorial
Like (6)
Save
Tweet
Share
19.3K Views

Join the DZone community and get the full member experience.

Join For Free

debuging for ARM Linux boards

Learn more about developing and debugging ARM Linux Boards on Windows

You can have a complete development environment on a Windows PC to create and debug C++ programs for Raspberry Pi, BeagleBone, and other Linux devices.

All activities happen within Eclipse: build the executable, deploy it to your ARM device, and remotely debug it. In this post, we look at how to do all three, so without further ado, let's get started!

Remote Debug Experience in Eclipse

What Experience Do You Get

  • Code can be written in Eclipse
  • Compilation and linking for the ARM Linux target happen when building the project.
  • When a debug session is started, the executable is deployed to the Linux device and the remote debugger is automatically started. Source code is loaded in the editor and the execution halts at main().
  • You can step over and into the code, show assembly, watch variables and expressions, and set breakpoints.
  • You see the standard output generated by your executable in Eclipse.
  • When debugging is finished, the remote debug server on the ARM device closes.

System Preparation

Software Requirement on the ARM Linux Device

  • A working SSH connection
  • gdbserver installed

Software Requirement on the Windows PC:

  • Eclipse IDE (the version for C/C++ Developers)
  • Arm cross-compile toolchain.
There are no specific hardware requirements. Deploy and debug happen over the network.

Prepare the Windows PC

Download and install the arm-linux cross-compile toolchain. The package is available as a compressed archive. You can extract it to a location of choice.

Check your board documentation for the right one. I selected gcc-linaro-5.3-2016.02-i686-mingw32_arm-linux-gnueabihf to work with BeagleBone, Raspberry Pi and Hartung Mica

When you unpack it, take care that you start the unzip utility (I use 7-Zip) with administrator rights. That's needed to get the correct symbolic links created during the extract.

If you use 7-zip, you can do this by looking for the 7-Zip File Manager entry in Windows' start menu, right-click on it, and then select Execute as Administrator. Then, you navigate to the archive and extract it. This will give you a working cross-compilation toolset.

Then download and install the latest Eclipse. This also comes as an archive. Unpack that one (admin rights are not needed), also to a location of choice.

The setup on Windows is now complete.

Prepare the ARM Linux Board

Log on to Linux and check if the debug server is installed:

gdbserver --version

If not, install it:

apt-get install gdbserver

Create a working directory where Eclipse can deploy and run your developments. I prefer to have it in my home folder. You are free to choose the name for that directory. I called it ~/bin.

The setup on your ARM Linux device is now complete.

Develop a Program

Open Eclipse by double-clicking eclipse.exe in the folder where you installed it.

Accept or change the suggested Working Folder location. Your projects will be stored there.

File -> New -> Project

  • Search for C++ Project and select it.

  • Project Name: helloworld

  • Use default location

  • Project type: Hello World C++ Project

  • Toolchain: Cross GCC

Next -> Next-> Next

  • Cross-compiler path: Browse the bin subdirectory of the location where you unpacked the toolchain

  • Cross compiler prefix: arm-linux-gnueabihf-

The prefix is the fixed begin of the filename for most programs in the toolchain's bin directory (e.g.: arm-linux-gnueabihf-gcc.exe)

Finish

  • If asked to 'Open Perspective,' do that (normally, this is only asked the first time you create this type of project).

  • You may get two errors in the 'Problems' view. We don't need those.

Right Click on the Errors label -> Select All

Right Click on the Errors label Again -> Delete

Right-click on the project name -> Properties -> C/C++ Build -> Builder Settings

  • Builder type: Internal builder

Apply and Close

Right-click on the project name -> Build Project

  • Your console should show output similar to this:

16:56:52 **** Incremental Build of configuration Debug for project helloworld ****
Info: Internal Builder is used for build
arm-linux-gnueabihf-g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\helloworld.o" "..\\src\\helloworld.cpp"
arm-linux-gnueabihf-g++ -o helloworld "src\\helloworld.o"
16:56:53 Build Finished. 0 errors, 0 warnings. (took 808ms)


Deploy and Debug the Program

Run -> Debug Configurations

Right-click on C/C++ Remote Application -> New configuration

  • name: helloworld Debug

Main tab

Project -> Browse -> helloworld

Connection -> New -> SSH -> OK

  1. Connection Name: how you name your Linux board, e.g. raspberrypi

  2. Host: network address or IP of the Linux device

  3. User: your Linux account

  4. Password-based authentication -> Password

Finish

Remote Absolute File Path for C/C++ Applications -> Browse

  • This opens your home folder on the Linux device.

  • Select the development folder you created and confirm (the one I called bin in the preparation steps). If the application name is not shown in the entry field, add  /helloworld

Debugger tab -> Debugger Options -> Main

  • GDB debugger: Browse the bin subdirectory of the location where you unpacked the toolchain, then select the program that ends with gdb.exe (in my case: arm-linux-gnueabihf-gdb.exe)

Apply -> Debug

You are now debugging your application. It runs on the Linux device but you control it from your Windows machine. Enjoy!

Linux (operating system) Debug (command) Arm (geography) Eclipse

Opinions expressed by DZone contributors are their own.

Related

  • Long Tests: Saving All App’s Debug Logs and Writing Your Own Logs
  • How to Debug the Spring Boot Application in Eclipse? [Video]
  • New Web Management Console Simplifies High Availability and Disaster Recovery for Linux Environments
  • Debugging Tips and Tricks for Python Structural Pattern Matching

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: