Skip to content

Cross Remote Debug for Raspberry PI

jano42 edited this page Jan 18, 2016 · 1 revision

Prerequisites

The cross compilation must be operational

see : [Cross compile for raspberry PI]

Download and install Eclipse

Download the appropriate eclipse package for your platform (eclipse-cpp)

Configure Raspberry

  1. Install SD card with Raspbian Linux into the Raspberry Pi.

  2. Enable sshd (SSH server) on Raspberry Pi (run raspi-config from console).

  3. Assign static IP address to Raspberry Pi by editing /etc/network/interfaces with nano. Example configuration:

    auto lo
    
    iface lo inet loopback
    iface eth0 inet static
    address 192.168.1.50
    netmask 255.255.255.0
    gateway 192.168.1.1
    
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    
  4. Using putty or an unix terminal connect to the raspberry through ssh (ssh ip_of_rapsberry)

  5. Enter the following commands in terminal:

    mkdir remote-debugging
    cd remote-debugging
    touch .gdbinit
    
  6. Find gdbserver in the Raspberry tools (installed in Linux host)

    (....)/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/debug-root/usr/bin/gdbserver
    
  7. copy it to the raspberry

	scp path/to/gdbserver pi@<raspberryip>:/home/pi/remote-debugging
  1. Make sure /home/pi/remote-debugging/gdbserver has exec permissions on the Raspberry Pi (chmod +x /home/pi/remote-debugging/gdbserver).

Configure Eclipse

Generate project and import to Eclipse

  1. generate project for Eclipse

    sh cmake_linux.sh e
    
  2. open Eclipse

  3. Uncheck the menu "Project->Build Automatically".

  4. Import Eclipse project

    1. File -> Import
    2. Choose General -> "Existing Projects into Workspace"
    3. Browse for "trunk/projects" folder; then the project will be found
    4. Finish
  5. Build all

Configure remote debugging

http://www.gurucoding.com/en/raspberry_pi_eclipse/raspberry_pi_remote_access_in_eclipse.php

Clone this wiki locally