Post Go back to editing

plutosdr : minimal tool chain for c compiling

Hello,

I’d like to use my C code with pluto to build a ‘’simple’’ stand alone receiver.

I read a lot of Q&A and your answer here: https://ez.analog.com/university-program/f/q-a/104394/how-to-implement-c-code-examples-for-ad9361-in-pluto/309664#309664

I read your interresting presentation here : https://www.gnuradio.org/assets/files/grcon2018/8-Michael_Hennerich.pdf

I try to follow your example with dump1090. Make file confirm missing some libs on my linux 18,04.

For a simple C code ( without building FW image ) , do we need to install all the sw toolchain used to build the firmware image? As here:

https://wiki.analog.com/university/tools/pluto/building_the_image

Or could we use a lighter solution? Or compile on board?

( I’ dont have anough space to install the 30Gb vivado toolchain. I’m able to write basics SDR function in C, use matlab and Gnu radio. But im’ not a software guy. Start from scratch with a new buildroot is hard for me. RF Engenieer, I start my first numerical receiver with AD9042...Now  i’d like to use the radio of the futur. )

Regards

Remi

  • To run applications on Pluto itself requires using the same compiler that was used to create its userspace, and you must link against that userspace. You do not need all of vivado, just the SDK.

    There is an example c file here: https://github.com/analogdevicesinc/plutosdr_scripts/blob/master/power_check.c

    and Makefile (See ARM target): https://github.com/analogdevicesinc/plutosdr_scripts/blob/master/makefile#L4

    The compiler called is arm-xilinx-linux-gnueabi-gcc which is included in the Xilinx SDK. The sysroot folder, which is pointed to in the makefile, is provided in the firmware releases we provide here: https://github.com/analogdevicesinc/plutosdr-fw/releases

    -Travis

  • Hello Travis

    Thus first step is to install arm-xilinx-linux-gnueabi-gcc. The xilinx tool   Xilinx_Vivado_SDK_Web_2018.3_1207_2324_Lin64.bin need more that 30 GB ; Other web install  : Xilinx_SDK_2018.3_1207_2324_Lin64.bin  need more than 10Gb. I found also 

    xilinx-2015.05-17-arm-xilinx-linux-gnueabi.src1.tar.bz2   only 230MB. But it I don't know to install it. Version seem to be old

    Please could you confirm the arm-xilinx-linux-gnueabi-gcc version witch is working?

    Regards

  • For firmware version V.30 you need release 2018.2.

    See instructions: https://github.com/analogdevicesinc/plutosdr-fw/

    I would recommend asking Xilinx if they have a minimal install of the SDK.

    -Travis

  • Hello Travis. It seem difficult to found proper installation for   arm-xilinx-linux-gnueabi-gcc . Thus I prefer to uses last installation setup:  web installer for SDK and VIVADO 2018.2 , as describes in your plutosdr-fw link. After xilinx installation I see  /opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin.

    To come back to my first question, how could we use your make file ? juste replace the compiler by  gcc-arm-linux-gnueabi/bin ?

    Regards

    Remi

  • Hello Travis
    
    Thanks for your fast Answer. I follow your example: It works now with my ubuntu 18.04. and with last Pluto Fwupdate 0.30 .
     To help others I add the vivado configuration that I used.
    First I create /opt/Xilinx dir for installation:

    sudo mkdir /opt/Xilinx
    sudo chown remi /opt/Xilinx
    sudo chmod u+rwX /opt/Xilinx

    start vivado 2018.2 with :
    Xilinx_Vivado_SDK_Web_2018.2_0614_1954_Lin64.bin


    After vivado install don’t forget to install arm-linux-gnueabihf-gcc with
    $sudo apt-get install gcc-arm*
    After your example, I have also try the Hennerich example with dump1090: in the /tmp/lutoapp dir : git clone -q https://github.com/PlutoSDR/dump1090.git cd dump1090 export PATH=$PATH:/opt/Xilinx/SDK/2018.2/gnu/aarch32/lin

    CC=arm-linux-gnueabihf-gcc CFLAGS=--sysroot=../sysroot LDFLAGS=--sysroot=../sysroot make results: arm-linux-gnueabihf-gcc --sysroot=../sysroot -c dump1090.c arm-linux-gnueabihf-gcc --sysroot=../sysroot -c anet.c arm-linux-gnueabihf-gcc -g -o dump1090 dump1090.o anet.o --sysroot=../sysroot -liio -lpthread -lm -lad936 /tmp/plutoapp/dump1090$ file dump1090 dump1090: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.2.0, BuildID[sha1]=7f6f5a501e607f6c1b8fc248ee29cdba64d70b64, not stripped scp dump1090 root@192.168.2.1:/tmp/ ssh on pluto and start : cd tmp ./dump1090 --net We can see flight traffic in terminal or with www server on http://192.168.2.1:8080
    Application is working on target!
    If somebody knows how to avoid 20GB of vivado install...it could help
    Many Thanks Remi
  • Hello, Travis.

    To solve compiler error,I'd like to add more information around gcc arm setup wich is not detailed here.
    I follow your example on a new ubuntu 18.04 installation:

    wget raw.githubusercontent.com/.../ad9361-iiostream.c
    wget github.com/.../sysroot-v0.30.tar.gz
    tar zxvf sysroot-v0.30.tar.gz
    mv staging sysroot

    after vivado installation: source /opt/Xilinx/Vivado/2018.2/settings64.sh

    The issue occurs with compilation command:

    arm-linux-gnueabihf-gcc -mfloat-abi=hard --sysroot=./sysroot -I./include -Lsysroot/lib -std=gnu99 -g -o pluto_stream ad9361-iiostream.c -lpthread -liio -lm -Wall -Wextra

    error message:
    In file included from ad9361-iiostream.c:20:0:
    /opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/lib/gcc/arm-linux-gnueabihf/7.2.1/include/stdint.h:9:16: erreur fatale: stdint.h : Aucun fichier ou dossier de ce type
    # include_next <stdint.h>
    ^~~~~~~~~~
    compilation terminée.

    But this file exist here /opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/lib/gcc/arm-linux-gnueabihf/7.2.1/include/stdint.h

    I have a different error message ( other include files error) with sudo command...
    I suspect a bad installation around gcc-arm.

    I know you can't solve all gcc compiler issues. May be you can gives us the minimal gcc packages and rules needed to compile properly, maybe command used aroud gcc before beginning you example.
    Many Thank's
    Remi