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.

PRU C based code sample

Other Parts Discussed in Thread: AM3358

Hi, I'm using PRU  C compiler TI V2.0.0.B2 to compile a code for PRU of AM3358. I'm trying to simulate a C sample similar to blink.p (https://github.com/lybrown/abx/blob/master/blink.p). I'm not able to raise a Interrupt from PRU to AM3358 (like MOV r31.b0, PRU0_ARM_INTERRUPT+16). Can you suggest me a best way to know on how to start C samples with PRU of AM3358

  • I have seem some in <>\ti\ccsv6\tools\compiler\pru_2.0.0B2\example but not complete. I know this is beta, but we are working on it. share if i can join hands with you.

  • found some here, https://github.com/BeaglePilot/PRUSS-C.

  • The PRU is not supported by TI at the moment. You can find some information here: https://github.com/beagleboard/am335x_pru_package

  • You need to define R31 in a special way so as to tell the compiler to use it directly (rather than another register). Try declaring it as the follows:

    volatile register unsigned int __R31;

    Then you can write to it as a variable:

    __R31 = value;

    As you mentioned the compiler is still in Beta, and documentation is still being developed. There's not much support for it yet, but feedback is appreciated.

  • hi Tim,

    I was able to progress some, can you let me know how can i generate bin file  from .c using CCS like as generated by pasm from .p. I hope i'm stuck here.

     

  • Suresh,

    You need to use the hexpru utility which is a part of the CGT package. It's similar to the other hex utilities found in other CGT packages (e.g., hex6x, etc.).

    Similar to my comment before this tool is not yet completely documented, but this process is discussed in the README file included in the download package. You should be able to see it in the <install dir>/ccsv6/tools/compiler/pru_2.0.0B2 directory. This info should be enough to get you going for now.

  • Hi Tim,

    Thanks I was able to move further. I saw the command in README "hexpru bin.cmd PRU_tests.out". Here I see you split the sections in to text and data and use CCS to load the memory seperately i.e., the program memory and data memory. In my case I use "prussdrv_exec_program()" from user space using "libprussdrv" library. So I tried generating a single binary using only one section. Say an example "text: o = 0x8, l = 0x00000100, files={text.bin}" using bin.cmd generating a bin file from hexpru.exe, but this does not help me. If you have any chance to give me a clue to move further it will be helpful.

    -Suresh

  • Suresh,

    We don't support that loader utility, and I don't have any documentation suggesting how to get hexpru to output a single binary file. I don't have any feedback to help push this at this time.

    The only suggestion I can make is that that driver is all open-sourced, so you could modify it to accept the two binaries and load one into IRAM, the other into DRAM. That is probably more effort than you were looking for, but that's about the only thought I've got at the moment.