Remote development on ARM board with Netbeans

Requirements:

Netbeans 6.9.1 with the C/C++ feature.

Igepv2, Linaro 10.11

Useful links:

http://mechomaniac.com/BeagleboardDevelopmentWithNetbeans

http://netbeans.org/kb/docs/cnd/remotedev-tutorial.html

Why remote developement:

It’s pretty obvious: instead of developing on the target host (here the Igep board), you develop on your regular machine (I use a MacBook Pro). So the gain in performance and usability is great.

The developed project is then built on the target host (Igep board), and debugged on the regular machine (MBP).

Prerequisites:

First of all, you need to install Netbeans 6.9.1, if that has not already been done. I explicitly mention this version because I first tried with Netbeans 7.0 without success: I had an error when launching the compiled program on the remote host.

Then, on the Igep board, you need to install the Linaro 10.11 distribution (if I remember correctly, it’s Ubuntu Natty).

You’ll also need samba to share the project folder between the remote and local hosts, and samba-common-bin.

Configure samba:

I use my home on the remote target to host the project files. So you need to modify the /etc/samba/smb.conf file and uncomment the part where one gives permissions to browse folders/directories:

#=========== Share Definitions ======
[homes]
comment = Home Directories
browseable = yes
read only = no
create mask = 0775
directory mask = 0775

I chose to add a share definition targeting only my home (when using a prebuilt Linaro image, the user is named linaro).

[myHome]
comment = Linaro home
browseable = yes
path = /home/linaro
printable = yes
read only = no
guest ok = no
create mask = 0700

You have to save the /etc/samba/smb.conf and then restart samba so that it will use the new configuration.

sudo service smb reload

To test the file sharing configuration on Mac, right click on the Finder, select “Go to server” and type: smb://<IP@>, where IP@ the IP address of the remote target (the Igep board). You should see a folder named linaro or homes, depending on which configuration you chose to enable.

Configure Netbeans:

In order to develop remotely, you need the remote target to compile the project for you. To do that, you need to define a new developement host in Netbeans.

Go to Netbeans/Preferences, then select the c/c++ tab and click on Edit, next to Developement Host. This is where we will define the parameters of the Igep board. So click on Add and fill in the hostname textfield with the IP address or hostname of your board. Select Next.

Netbeans will ask you for your login. Beware, this is the login on the remote target! So use linaro, and password is also linaro. Here I use the password authentication scheme. You may try it with SSH authentication.

The next screen is a summary of what you just did, plus a couple of combobox to select the tolls collection and the way Netbeans will synchronize its sources with the remote target.

For now I only use the File System Sharing. I tried with Smart Secure Copy without success (this option uses ssh copy/paste utility to sync sources). With the file system sharing option, all sources live in the remote target.

Click on finish to validate the new development host configuration. Now you have to link the remote file system with your regular machine (MBP). Select your new developement host in the development host manager and then select Path Mapper. Now, when sharing a directory between Ubuntu and Mac using Samba, it behaves almost like a .dmg file: you’ll see an ejectable directory placed in your finder. Those actually live inside your /Volumes/ directory on your regular machine (MBP).

So the local path should be…. /Volumes/linaro and the remote path… ? Well, it should be /home/linaro of course.

Netbeans should detect all compilation tools automagically on the remote target, but I had to fill in the c++ compiler (/usr/bin/g++-4.5).

Now we should be ready to compile and debug remotely our first project.

In Netbeans, create a new sample project, like HelloWorld. Durign the project creation process, Netbeans will ask where do you want to put the sources of the project. This is where the Path Mapping is used: Instead of creating the project on your local machine like you do every time, you will store it under /Volumes/linaro/ so that the actual sources are stored on the remote target.

If all goes well, you should be able to Compile and Run the project and have this kind of build output:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/linaro/Welcome_1'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/welcome_1
make[2]: Entering directory `/home/linaro/Welcome_1'
make[2]: `dist/Debug/GNU-Linux-x86/welcome_1' is up to date.
make[2]: Leaving directory `/home/linaro/Welcome_1'
make[1]: Leaving directory `/home/linaro/Welcome_1'

BUILD SUCCESSFUL (total time: 719ms)
and run output:
Welcome ...

Arguments:
1: arg 1
2: arg 2
3: arg 3
4: arg 4

RUN SUCCESSFUL (total time: 821ms)

One thought on “Remote development on ARM board with Netbeans

  1. Pingback: Remote development on Igep using Netbeans « afewe

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s