C programming

Applications, development tools, FPGA, C, WEB
Post Reply
javat15
Posts: 17
Joined: Thu Nov 03, 2016 12:15 am

C programming

Post by javat15 » Mon Dec 19, 2016 11:07 am

Hi,

I'm a beginner in Red Pitaya and I'm trying to program the device using C. I compiled and executed the examples, but I want to make a project from scratch using the APIs. My question is how doing that in eclipses moon without use remote system?

Thanks in advanced

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: C programming

Post by Nils Roos » Tue Dec 20, 2016 2:57 am

You need
  • eclipse CDT
  • Vivado installed with SDK
  • /lib/librp.so and /include/redpitaya/rp.h from the ecosystem.zip
In eclipse, select "New -> C Project". First page: give it a name and choose "Executable -> Empty Project" with "Cross GCC". Second page: no changes. Third page: use prefix "arm-linux-gnueabihf-" and set the path to /opt/Xilinx/SDK/2016.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin . Open the properties of your new project and go to "C/C++ Build -> Settings". In the tab "Tool Settings", choose "Cross GCC Compiler -> Includes" and add the path to rp.h in "Include paths", then choose "Cross GCC Linker -> Libraries" and add "rp", "m", and "pthread" under "Libraries" and then add a "Library search path" to the librp.so.

Then you can start adding C-files to the project. To generate a program, you can simply use the "Build" button. Beware that running and debugging the executable can only be done on the Red Pitaya, so for these steps you need the remote setup.

javat15
Posts: 17
Joined: Thu Nov 03, 2016 12:15 am

Re: C programming

Post by javat15 » Sun Jan 08, 2017 10:43 pm

Hi, I have tried several times but always appers these messages of error:

failed to merge target specific data of file /home/usr/Documentos/RedPitaya/Header/librp.so
librp.so uses VFP register arguments, test does not test

How can solve this problem?

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: C programming

Post by Nils Roos » Sun Jan 08, 2017 10:59 pm

Where does this message appear and what were you trying to do at the time?

javat15
Posts: 17
Joined: Thu Nov 03, 2016 12:15 am

Re: C programming

Post by javat15 » Sun Jan 08, 2017 11:18 pm

I try to build a simple program that is an empty main. These error messages appears in console:

make: *** [test] Error 1
failed to merge target specific data of file /home/usr/Documentos/RedPitaya/Header/librp.so
librp.so uses VFP register arguments, test does not test


Also appers these warning in console:

ld-linux-armhf.so.3, needed by /home/usr/Documentos/RedPitaya/Header/librp.so, not found (try using -rpath or -rpath-link)

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: C programming

Post by Nils Roos » Mon Jan 09, 2017 12:24 am

OK, I see - if you happen to have the linaro toolchain for arm available, try to use that as cross-toolchain and the prefix "arm-linux-gnueabihf-" - you can find links in the README of eg. Red Pitaya branch release-v0.95 .

edit: sorry, forget the bit about linaro, the right path is "/opt/Xilinx/SDK/2016.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin" with the prefix "arm-linux-gnueabihf-". I also updated the original instructions to avoid confusion.

javat15
Posts: 17
Joined: Thu Nov 03, 2016 12:15 am

Re: C programming

Post by javat15 » Mon Jan 09, 2017 12:24 pm

I've tried an old version of ecosystem and now I can compile the project, but I can not do the remote debugger. This message appears in the screen:

      Session.connect: java.net.NoRouteToHostException (Host unreachable) [/ i]

I follow these instructions to do the remote debug:

      http://wiki.redpitaya.com/index.php?tit ... _for_Linux [/ i]

I can connect to my RP (Set remote system explorer seccion), but not to upload the program (Set remote debugge section). Could it be the parameters are wrong? How can I solve this?

javat15
Posts: 17
Joined: Thu Nov 03, 2016 12:15 am

Re: C programming

Post by javat15 » Mon Jan 09, 2017 12:26 pm

javat15 wrote:I've tried an old version of ecosystem and now I can compile the project, but I can not do the remote debugger. This message appears in the screen:

      Session.connect: java.net.NoRouteToHostException (Host unreachable)

I follow these instructions to do the remote debug:

      http://wiki.redpitaya.com/index.php?tit ... _for_Linux

I can connect to my RP (Set remote system explorer seccion), but not to upload the program (Set remote debugge section). Could it be the parameters are wrong? How can I solve this?

javat15
Posts: 17
Joined: Thu Nov 03, 2016 12:15 am

Re: C programming

Post by javat15 » Wed Jan 11, 2017 1:13 am

Now I can upload the program (I had the parameters of Red Pitaya in Eclipse wrong) but RP don't detect gdbserver. This message appers when I try to remote debbuger:

chmod 777 /tmp/test;gdbserver :2345 /tmp/test;exit

root@rp-f0087d:~# chmod 777 /tmp/test;gdbserver :2345 /tmp/test;exit
Process /tmp/test created; pid = 2269
Cannot exec /tmp/test: No such file or directory.

Child exited with status 127
No program to debug. GDBserver exiting.
logout

I have tryed differents versions of Linaro but always crash. How can I solve this?
Thanks for help!

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 36 guests