This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to compile prussdrv code on remote machine?

Hello there,

I have a problem with pru package. I am using eclipse and crosscompiller to remotelly compile, debug and deploy c++ apps to beaglebone black. everything worked so far. Problems started when i tried to use pru. I have downloaded the pru package from github and installed it on bbb. I can now compile and execute aps on bbb with lprussdrv linker flag. i have copoed all tje necessary .h and .c files to the remote system. also copied the libs frob bbb to remote system. i could then compile the code with -lprussdrv flag on remote system. the problem is, that when i try to run that crosscompiled code, i am getting a segfault when trying to open the .bin file... what did I do wrong? I installed the ccs6 sitara ti compiler hoping to find anything i could use in eclipse there, but I cant.

Could someone please tell me how to use the pru package from remote xcompile system? I would really really aprichiatw all help, im really stuck without pru in my project. I can post additional info if needed.

  • Moving this to Sitara form.
  • Hi Lukasz,

    Which PRU package are you asking about? This one https://github.com/beagleboard/am335x_pru_package is not supported by TI. You can check here for the latest PRU package released by TI: http://software-dl.ti.com/sitara_linux/esd/PRU-SWPKG/latest/index_FDS.html

  • Hello,

    Yes I was asking about the one from github. Could you please tell me either it is possible to use the one you linked from eclipse and deploy to BeagleBone Black? I am desperate right now as I have only a little tile to finish the project and this is a blocking point for me. I would really aprichiate all help.

  • I will ask the factory team about this. Response will be posted here as soon as available.

  • Thank you a lot. At the moment I have a big project configured and running in eclipse on my remote linux x86 system. I have to add the PRU functionality now and I dont know how to add it to this existing enviroment. I Would really aprichiate all help, this is really urgent for me. Looking forward to your answer.
    There are a lot of descriptions how to install the package you have linked, but there are no real examples of how is it working, thats also confusing for me as I am not sure how will this work in the end.
  • Here is a wiki link: http://processors.wiki.ti.com/index.php/PRU-ICSS_Getting_Started_Guide I don't know if you have seen this, but you may find something helpful there. I have already asked the factory team for help.

  • Ive seen this, thank you.
  • Hey, any news regarding the case?

  • Feedback will be posted here when available.

  • >>running in eclipse on my remote linux x86 system

    What remote machine are you using and which SDK?

    (Understanding as Biser says above that this package is not supported by TI), I've built with SDK6.0 (i.e. Linaro gcc tool chain) using UBuntu12.04 as a host machine.  Attached is my build log for /am335x_pru_package-master/pru_sw/example_apps in Ubuntu.  The PRU_memAccess_DDR_PRUsharedRAM example I use the most is compiled at line 39. And I can manually build it with make:

    make
    arm-linux-gnueabihf-gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/PRU_memAccessPRUDataRam.o PRU_memAccessPRUDataRam.c
    arm-linux-gnueabihf-gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/PRU_memAccessPRUDataRam obj/PRU_memAccessPRUDataRam.o -L../../app_loader/lib -lprussdrv -lpthread

    I don't understand the Linux libraries paths well so when running (on Beaglebone White):

    root@am335x-evm:~/bin# ./PRU_memAccessPRUDataRam

    ./PRU_memAccessPRUDataRam: error while loading shared libraries: libprussdrv.so: cannot open shared object file: No such file or directory

     

    I had to specify the path:

    root@am335x-evm:~/bin# LD_LIBRARY_PATH=/usr/local/lib ./PRU_memAccessPRUDataRam

    INFO: Starting PRU_memAccessPRUDataRam example.         INFO: Initializing example.         INFO: Executing example.         INFO: Waiting for HALT command.         INFO: PRU completed transfer. INFO: Example executed succesfully.

    >> i am getting a segfault when trying to open the .bin file 

    I did get these when I was experimenting with PRU Compiler (clpru) output when using hexpru.  Must have been a binary mismatch (I never solved).

    >>I can now compile and execute aps on bbb with lprussdrv linker flag

    Interesting that you are natively compiling the apploader code.  And even that you must be compiling and running pasm on the bbb.

     >> I installed the ccs6 sitara ti compiler hoping to find anything i could use in eclipse there

    Rereading this, are you building with the TI CCSv6 C compiler?

    If so, you are probably seeing a similar binary mismatch to what I saw.

    Can't you just run make and the Linaro gcc tool chain on you Linux host? 

    If not, you might use a hex editor to figure out the format differences (which is what started to do).

    root1@root1-Latitude-E6410:~$ cd /home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/interface
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/interface$ export PATH="$PATH:/usr/local/ti-sdk-am335x-evm/linux-devkit/sysroots/i686-arago-linux/usr/bin"
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/interface$ ls
    debug  FIXME  Makefile  prussdrv.c  __prussdrv.h  release
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/interface$ make
    make: Nothing to be done for `all'.
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/interface$ make clean
    rm -rf release debug *~ ../lib/*
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/interface$ make
    arm-linux-gnueabihf-gcc -I. -Wall -I../include  -c -g -O0 -D__DEBUG -o debug/prussdrv.o prussdrv.c
    arm-linux-gnueabihf-ar rc ../lib/libprussdrvd.a debug/prussdrv.o
    arm-linux-gnueabihf-gcc -I. -Wall -I../include  -c -O3 -mtune=cortex-a8 -march=armv7-a -o release/prussdrv.o prussdrv.c
    arm-linux-gnueabihf-ar rc ../lib/libprussdrv.a release/prussdrv.o
    arm-linux-gnueabihf-gcc -I. -Wall -I../include  -c -fPIC -g -O0 -D__DEBUG -o debug/prussdrv_PIC.o prussdrv.c
    arm-linux-gnueabihf-gcc -shared -o ../lib/libprussdrvd.so debug/prussdrv_PIC.o
    arm-linux-gnueabihf-gcc -I. -Wall -I../include  -c -fPIC -O3 -mtune=cortex-a8 -march=armv7-a -o release/prussdrv_PIC.o prussdrv.c
    arm-linux-gnueabihf-gcc -shared -o ../lib/libprussdrv.so release/prussdrv_PIC.o
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/interface$ cd /home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/utils/pasm_source
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/utils/pasm_source$ ./linuxbuild
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/utils/pasm_source$ cd /home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps$ ls
    bin   Makefile                        PRU_memAccessPRUDataRam
    DIRS  PRU_memAccess_DDR_PRUsharedRAM  PRU_PRUtoPRU_Interrupt
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps$ make clean
    for dir in  PRU_memAccess_DDR_PRUsharedRAM PRU_memAccessPRUDataRam PRU_PRUtoPRU_Interrupt; do make -C $dir clean LIBDIR_APP_LOADER="../../app_loader/lib" LIBDIR_EDMA_DRIVER="" INCDIR_APP_LOADER="../../app_loader/include" INCDIR_EDMA_DRIVER="" BINDIR="../bin"; done
    make[1]: Entering directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM'
    rm -rf obj/ *~  ../../app_loader/include/*~  ../bin/PRU_memAcc_DDR_sharedRAM
    make[1]: Leaving directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM'
    make[1]: Entering directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccessPRUDataRam'
    rm -rf obj/ *~  ../../app_loader/include/*~  ../bin/PRU_memAccessPRUDataRam
    make[1]: Leaving directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccessPRUDataRam'
    make[1]: Entering directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt'
    rm -rf obj/ *~  ../../app_loader/include/*~  ../bin/PRU_PRUtoPRU_Interrupt
    make[1]: Leaving directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt'
    for bin_file in  PRU_memAcc_DDR_sharedRAM.bin PRU_memAccessPRUDataRam.bin PRU_PRU0toPRU1_Interrupt.bin PRU_PRU1toPRU0_Interrupt.bin; do rm -fr bin/$bin_file; done
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps$ make
    mkdir -p bin
    for dir in  PRU_memAccess_DDR_PRUsharedRAM PRU_memAccessPRUDataRam PRU_PRUtoPRU_Interrupt; do make -C $dir CROSS_COMPILE="arm-linux-gnueabihf-" LIBDIR_APP_LOADER="../../app_loader/lib" LIBDIR_EDMA_DRIVER="" INCDIR_APP_LOADER="../../app_loader/include" INCDIR_EDMA_DRIVER="" BINDIR="../bin"; done
    make[1]: Entering directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM'
    arm-linux-gnueabihf-gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/PRU_memAcc_DDR_sharedRAM.o PRU_memAcc_DDR_sharedRAM.c
    arm-linux-gnueabihf-gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/PRU_memAcc_DDR_sharedRAM obj/PRU_memAcc_DDR_sharedRAM.o -L../../app_loader/lib -lprussdrv
    make[1]: Leaving directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccess_DDR_PRUsharedRAM'
    make[1]: Entering directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccessPRUDataRam'
    arm-linux-gnueabihf-gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/PRU_memAccessPRUDataRam.o PRU_memAccessPRUDataRam.c
    arm-linux-gnueabihf-gcc -Wall -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/PRU_memAccessPRUDataRam obj/PRU_memAccessPRUDataRam.o -L../../app_loader/lib -lprussdrv
    make[1]: Leaving directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_memAccessPRUDataRam'
    make[1]: Entering directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt'
    arm-linux-gnueabihf-gcc -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -c -o obj/PRU_PRUtoPRU_Interrupt.o PRU_PRUtoPRU_Interrupt.c
    arm-linux-gnueabihf-gcc -I../../app_loader/include -D__DEBUG -O2 -mtune=cortex-a8 -march=armv7-a -o ../bin/PRU_PRUtoPRU_Interrupt obj/PRU_PRUtoPRU_Interrupt.o -L../../app_loader/lib -lprussdrv
    make[1]: Leaving directory `/home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/PRU_PRUtoPRU_Interrupt'
    for a_file in  PRU_memAccess_DDR_PRUsharedRAM/PRU_memAcc_DDR_sharedRAM.p PRU_memAccessPRUDataRam/PRU_memAccessPRUDataRam.p PRU_PRUtoPRU_Interrupt/PRU_PRU0toPRU1_Interrupt.p PRU_PRUtoPRU_Interrupt/PRU_PRU1toPRU0_Interrupt.p ; \
    	do \
              ../utils/pasm_2 -V3 -b $a_file ; \
    	done ; \
    	mv *.bin bin
    
    
    PRU Assembler Version 0.86
    Copyright (C) 2005-2013 by Texas Instruments Inc.
    
    
    Pass 2 : 0 Error(s), 0 Warning(s)
    
    Writing Code Image of 16 word(s)
    
    
    
    PRU Assembler Version 0.86
    Copyright (C) 2005-2013 by Texas Instruments Inc.
    
    
    Pass 2 : 0 Error(s), 0 Warning(s)
    
    Writing Code Image of 14 word(s)
    
    
    
    PRU Assembler Version 0.86
    Copyright (C) 2005-2013 by Texas Instruments Inc.
    
    
    Pass 2 : 0 Error(s), 0 Warning(s)
    
    Writing Code Image of 16 word(s)
    
    
    
    PRU Assembler Version 0.86
    Copyright (C) 2005-2013 by Texas Instruments Inc.
    
    
    Pass 2 : 0 Error(s), 0 Warning(s)
    
    Writing Code Image of 14 word(s)
    
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps$ ls
    bin   Makefile   Makefile.ori                    PRU_memAccessPRUDataRam
    DIRS  Makefile~  PRU_memAccess_DDR_PRUsharedRAM  PRU_PRUtoPRU_Interrupt
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps$ cd bin
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/bin$ ls
    PRU_memAcc_DDR_sharedRAM      PRU_PRU0toPRU1_Interrupt.bin
    PRU_memAcc_DDR_sharedRAM.bin  PRU_PRU1toPRU0_Interrupt.bin
    PRU_memAccessPRUDataRam       PRU_PRUtoPRU_Interrupt
    PRU_memAccessPRUDataRam.bin
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/bin$ file PRU_memAccessPRUDataRam
    PRU_memAccessPRUDataRam: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0x7b6c7ffaf5b058d3e2b013a4e09bbd8c01a17575, not stripped
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/bin$ file PRU_memAccessPRUDataRam.bin
    PRU_memAccessPRUDataRam.bin: data
    root1@root1-Latitude-E6410:~/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/example_apps/bin$ cd /home/root1/joetemp/AM335x/PRU/am335x_pru_package-master/pru_sw/app_loader/lib
    
    
      

  • hello, thank you for answer.

    i am building my code also using linaro xcompiller, on a linux mint system.

    i dont quite understand what you advise me to do- i can only compile c prpgrams with pru libs on bbb.and my whole project is on my host linux mint. I would like to compile pruss using cross gcc on my pc instead of bbb but the script did not work.

  • >>I would like to compile pruss using cross gcc on my pc instead of bbb but the script did not work
    So I am doing this on Ubuntu 12.04 with above build log. Have you tried the same examples as an experiment?

    Have you followed all the instructions in PRU - 03-AM335x_PRU_Linux_Application_Loader-ug.pdf from /am335x_pru_package-master/Documentation directory?
  • I have it doesnt reffer to a remote system, but building everything on bbb.
  • P. 6 (copied below) along with the kernal build on p. 4 is all built on the host (i just manually built with Ubuntu 12.04 in a different directory):

    Installing the PRUSSDRV User Space Library
    The user space library is provided by am335x_pru_package/pru_sw/app_loader/interface/prussdrv.c.
    1. Set environment variables
    $host . /home/.../ti-sdk-am335x-evm-xx.xx.xx.xx/linux-devkit/environment-setup
    2. Compile prussdrv.c
    $host cd pru_sw/app_loader/interface
    $host make clean
    $host make
    2. Compile application code using PRUSSDRV APIs.
    3. Download executable file and PRU binaries to your file system.
  • So you can compile pru c code on ubuntu pc and then run it on bbb with success? So i have to simply cross compile prussdrv.c and the run make?
  • In other words- how are the steps different than from building this package on bbb?
  • >>So you can compile pru c code on ubuntu pc and then run it on bbb with success?

    Yes.

    >>So i have to simply cross compile prussdrv.c and the run make?

    Would be a good experiment.

    >>In other words- how are the steps different than from building this package on bbb?

    Honestly don't know what seems to make the images different.  Maybe there is an Endian issue?

     

    BTW if you have CCSv6 connected, you can look at the code from the PRU side after loading from Linux as I did on the attached screenshot.

    Newly loaded PRU opcodes in red (I was following from the PRU dissassembly and Hex Editor in the bottom left. Beaglebone-White Linux window (Putty) on the bottom right.

     ). 

     

  • I will try to build ot on linux mint again tommorow, thanks. I dont have the ccs6 yet, I was only using the package from github.

    The .bin files are not the problem as I can compile them on bbb. The problem is building the userspace .c app on bbb vs on linux min with x compiller.
  • Hi Biser;

        I too am having difficulties with the clpru installation. The install package comes off your website in aome sort of windows install file. There appear to be no directions for installation in the docs. Even the BiSS firmware docs assume you know what to do with it. What exactly is the process for using this file?

    Thanks,

    Aaron Kellner

  • Which SDK are you using? PRUSSDRV has been superseded by remoteproc. Please see quickstart and even lab examples here:
    e2e.ti.com/.../483778