RaspBerry-HowTo-Windows-02-Eclipse-Configure

Print PDFEclipse C for Raspberry RaspBerry-HowTo-Windows-02-Eclipse-Configure   1      Info_ 1 2      Cross-compiler for Raspberry Pi. 1 2.1       gcc version” + “binutils version” + “eglibc version” + “kernel version. 1 3      […]

Eclipse C for Raspberry

RaspBerry-HowTo-Windows-02-Eclipse-Configure

 

1      Info_ 1

2      Cross-compiler for Raspberry Pi. 1

2.1       gcc version” + “binutils version” + “eglibc version” + “kernel version. 1

3      Eclipse Setup_ 2

3.1       C/C++ Build → Environment. 3

3.2       C/C++ Build → Tool Chain Editor 3

3.3       C/C++ Build → Settings → Tool Settings_ 4

3.4       C/C++ Build → Settings → Build Steps_ 7

3.5       C/C++ Build → Settings → Build Artifact 8

3.6       Debugging_ 9

3.7       Debugging 2_ 12

3.8       Project – properties – Copy 12

 

1         Info

 

The original post are here:

 

Other useful info :

 

I don’t explain how to setup Cygwin, the cross-compilation toolchain, PuTTY à refer to the original article for that.      

Below explanations are the eclipse configuration with screenshot.

2         Cross-compiler for Raspberry Pi.

2.1      gcc version” + “binutils version” + “eglibc version” + “kernel version.

gcc –version

gcc (Debian 4.6.3-8+rpi1) 4.6.3

 

ld –version

GNU ld (GNU Binutils for Debian) 2.22

 

as –version

GNU assembler (GNU Binutils for Debian) 2.22

 

ldd –version

ldd (Debian EGLIBC 2.13-35) 2.13

 

uname -r

3.2.27+

 

 

 

 


3         Eclipse Setup

Create a new project :

 → 

 

 

 

 


3.1      C/C++ Build → Environment.

  • Add a variable named CYGWIN with value nodosfilewarning (tick ‘add to all configurations’).

 

  • Append the following to the beginning of the PATH variable:
    c:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\bin;c:\cygwin\bin;

 

3.2      C/C++ Build → Tool Chain Editor

    Select Cygwin GCC from Current toolchain dropbox.

 

 


3.3      C/C++ Build → Settings → Tool Settings

    Set the Command field in Cygwin C++ Compiler to: arm-unknown-linux-gnueabi-g++

 

 

Add an include path (not include files) in Includes which points to:
c:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\arm-unknown-linux-gnueabi\sysroot\usr\include

 

 


Set the Command field in Cygwin C Compiler to: arm-unknown-linux-gnueabi-g++

 

Add an include path (not include files) in Includes which points to:

c:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\arm-unknown-linux-gnueabi\sysroot\usr\include

 

 

 


Set the Command field in Cygwin C++ Linker to: arm-unknown-linux-gnueabi-g++

 

 

Add a library search path (not Libraries) in Libraries which points to:

c:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\arm-unknown-linux-gnueabi\sysroot\usr\lib

 

 


3.4      C/C++ Build → Settings → Build Steps

  • Set the Command field in Post-build steps to:
    C:/eclipse/deployment_scripts/rpi_deploy_debug.bat $(OutDir)${ProjName}.a “/home/pi/projects/${ProjName}.a”
  • Add the description field to: Our auto deploy to RPi using putty script

 

You must create a directory on the R Pi → /home/pi/projects


3.5      C/C++ Build → Settings → Build Artifact

    Set Artifact Extension to: a

Compile and Run :  CTRL + B

Check on R Pi :

ls

testjunocross.a

root@raspberrypi:/home/pi/projects# ./testjunocross.a

!!!Hello World!!!

3.6      Debugging

Now setup a Debug Configuration.

Select Run > Debug configurations from the top menu.

 

 

Right click on C/C++ Remote Application and choose New to add a new configuration.

 

 

 


Main tab

 

    Set the C/C++ Application field to the name of the produced binary (e.g. Debug/my_project.a).

    Select Disable auto build.

 

    Click on Select other…, near the left of the Apply button. From the newly opened window, choose GDB (DSF) Manual Remote Debugging Launcher and click ok.

 


Debugger tab

 

    Set the GDB debugger field to the path of the gdb which is part of our downloaded tool chain, so: c:\cygwin\opt\cross\x-tools\arm-unknown-linux-gnueabi\bin\arm-unknown-linux-gnueabi-gdb.exe

 

 

    In the Connection sub tab, set the Type to TCP, the Host name or IP address field to the IP address of the Rapsberry Pi (the same you specified in the BAT settings) and Port number to 3785.

 

 


Source tab

 

    Add > Path mapping.

 

    Name it “Cygwin C Drive” and in Compilation Path enter: /cygdrive/c/

    In Local file system path enter: C:\

Click on Apply and then Debug. The debugger should start and Eclipse should switch to the Debug Perspective.

 

 

3.7      Debugging 2

http://hertaville.com/2013/01/11/remote-debugging/

 

s

sudo gdbserver 192.168.1.25:3785 testjunocross.a

 

 

3.8      Project – properties – Copy

I don’t find a way to export/import the project properties from a project to another.

The only way is to copy paste a project : select the project and use copy paste of the Edit menu to create
a clone of the project.