ashishpidev
Posts: 5
Joined: Sat Feb 27, 2016 2:20 pm

Compiling remotly on ubuntu machine in eclipse

Sat Feb 27, 2016 2:49 pm

Hello all. I received my pi 2 few days ago.Now I can access the raspberry pi via vncserver and access the gpio. I use C/C++ for coding. But all the code were compiled in the raspberry pi A7 processor, which was obviously slower to compile then my i5 ubuntu machine. I use eclipse IDE in my ubuntu machine to create and compile c/c++ projects. Now I want to configure the eclipse so that I can compile the raspberry pi remotely in my ubuntu machine run it.

what steps, toolchain and settings do I need to use for this purpose? any documentation? links? :|

rzusman
Posts: 347
Joined: Fri Jan 01, 2016 10:27 pm

Re: Compiling remotly on ubuntu machine in eclipse

Sun Feb 28, 2016 12:29 am

It’s not a simple task, but there is lots of information about this on the web. For example:
http://hertaville.com/2012/09/28/develo ... -compiler/

I’m working on doing this on OS X, using Xcode, which is one step harder...

ashishpidev
Posts: 5
Joined: Sat Feb 27, 2016 2:20 pm

Re: Compiling remotly on ubuntu machine in eclipse

Sun Feb 28, 2016 5:09 am

Thanks rzusman. I used gcc-arm-none-eabi toolchain for compiling cortex m-4 controller in eclipse, but this was not being remotely. It needed to burn into the memory of that microcontroller. since the raspberry pi has cortex A7, this tool-chain is probably not going to work.
I am going to try this solution, and will post the result.
Thanks again. :|

ashishpidev
Posts: 5
Joined: Sat Feb 27, 2016 2:20 pm

Re: Compiling remotly on ubuntu machine in eclipse

Sun Feb 28, 2016 11:19 am

It worked :) But now I am only able to setup the toolchain path and compile in the eclipse. After building the binaries it needs to copy over the network every time to run on the raspberry pi.
I think I need to share the path for Debug folder so that I can build my project via eclipse on my machine and run it on the raspberry pi. link was helpful thanks. :idea:

rzusman
Posts: 347
Joined: Fri Jan 01, 2016 10:27 pm

Re: Compiling remotly on ubuntu machine in eclipse

Sun Feb 28, 2016 12:12 pm

You can also mount the Pi on your PC, and have eclipse build the executable into the Pi’s directory automatically.
Where are you going to be putting your Pi executables?

ashishpidev
Posts: 5
Joined: Sat Feb 27, 2016 2:20 pm

Re: Compiling remotly on ubuntu machine in eclipse

Sun Feb 28, 2016 1:51 pm

Thanks rzusman. I have mounted the Debug directory and now I can run directly. Sorry to bother you again but how do you install library for the cross platform like bcm2835 for accessing gpio.
I tried configure with --prefix but it didn't work maybe I am missing something. I am newbie for cross platform :? :?:

rzusman
Posts: 347
Joined: Fri Jan 01, 2016 10:27 pm

Re: Compiling remotly on ubuntu machine in eclipse

Sun Feb 28, 2016 7:39 pm

That's the big issue.
The simplest way is to apt-get it on the Pi, then copy it to the PC, along with the headers. You need to tell the linker about it explicitly.

ashishpidev
Posts: 5
Joined: Sat Feb 27, 2016 2:20 pm

Re: Compiling remotly on ubuntu machine in eclipse

Tue Mar 01, 2016 9:31 am

Now I am feeling like dumb :oops: . The solution was easy. Just copied the code file and header file in to the project directory and included them into my main file "bcm2835.h" ,solved the problem. Thanks for your help BTW.

Return to “General programming discussion”