Total Newby Help

Just about everything about Red Pitaya
Post Reply
g0mgx
Posts: 4
Joined: Mon Jun 20, 2016 7:39 am

Total Newby Help

Post by g0mgx » Thu Jun 23, 2016 5:12 pm

Hi All,

I'm completely new to the world of Linux & Red Pitaya with some very out of date programming skills from the past.

I have hooked my RP board to my network and have comms OK, I have also got myself a cheap desktop, installed Ubuntu and I am accessing this machine via RDP from my Windows 7 environment - all this is working fine.

I've run through all the examples I can using Python in my new Ubuntu environment and have been successful in this exploit, and would now like to try the examples again using cross compiled C.

I've followed the instructions here: https://github.com/RedPitaya/RedPitaya/ ... /README.md and have done all suggested except the Vivado toolset (which I don't think I need).

When I now try and cross compile (using gcc) one of the example files I get errors about undefined references to a number of things like 'rp_Init' and ;ro_OpinSetState' which are from the rp.h file which I have sat in the Examples/C directory in a subdirectory redpitaya.

It seems I am missing an idiots guide to getting the C cross compile environment setup correctly.

Is anyone willing to point me in the right direction and get me up and running?

Many thanks.

Mark

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

Re: Total Newby Help

Post by Nils Roos » Fri Jun 24, 2016 12:47 pm

Hi Mark,

the examples depend on the RP api, so you need to build that first; you also need to do some preparatory settings. In your case, without Vivado installed, you do the following:

Code: Select all

export TOOLCHAIN_PATH=/opt/linaro/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf
export PATH="$PATH:$TOOLCHAIN_PATH/bin"
export CROSS_COMPILE=arm-linux-gnueabihf-
to prepare your terminal session (you only need to do this once when you open a new terminal window).

Then build the RP api with "make api" in the RedPitaya directory.

To build the examples, I suggest you use the supplied Makefile. Change directory to Examples/C and just call "make".

The full gcc command to build a single C file "example.c" in the Examples/C directory would be

Code: Select all

arm-linux-gnueabihf-gcc -g -std=gnu99 -Wall -Werror -I../../api/include -L../../api/lib -lm -lpthread -lrp -o example example.c
This will generate an executable "example" that you can copy to the Red Pitaya and run with

Code: Select all

LD_LIBRARY_PATH=/opt/redpitaya/lib/ ./example

g0mgx
Posts: 4
Joined: Mon Jun 20, 2016 7:39 am

Re: Total Newby Help

Post by g0mgx » Sat Jun 25, 2016 9:00 am

Thanks very much.

I had to edit the settings.sh file to remove the Vivado setup call and then I also found that the scp command wasn't working as listed - it needed a ":" on the end.

But with your help I now have my first C cross compiled example running on the baord.

Thanks

Mark

albertryou2
Posts: 19
Joined: Thu Jun 23, 2016 8:20 pm

Re: Total Newby Help

Post by albertryou2 » Wed Jun 29, 2016 2:26 am

Hey guys,

More of a noob here. When I try to copy one of the compiled examples, say digital_led_blink, to Red Pitaya with the following command:
scp digital_led_blink root@ip:/opt/redpitaya/lib/digital_led_blink
I get an error message that says:
scp: /opt/redpitaya/lib/digital_led_blink: Read-only file system

So it seems I can't copy the file? How do I get around this?

Thanks!

Edit: NVM, forgot about "rw" command on Red Pitaya

New question:

When I run on Red Pitaya the command:

LD_LIBRARY_PATH=/opt/redpitaya/lib/ digital_led_blink

I get this error message:

-bash: digital_led_blink: command not found

Does this mean I compiled the blink file incorrectly? The filename appears green, so I assumed it was a successfully compiled executable.

Edit: NVM, it works when I put "./" in front of the executable (remembered this while taking a walk outside):

LD_LIBRARY_PATH=/opt/redpitaya/lib ./digital_led_blink

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 105 guests