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.

RTOS/PROCESSOR-SDK-K2G: RTOS driver for passing messages and data between the PRU cores and the ARM core

Part Number: PROCESSOR-SDK-K2G

Tool/software: TI-RTOS

I am using TI-RTOS on ARM and build/load PRU software in CCS. Is there any example to show passing messages and data between the PRU cores and the ARM core ruuning in RTOS?

The link of RTOS Drivers -> Programmable Real-Time Unit Subsystem (PRUSS) in
processors.wiki.ti.com/.../PRU-ICSS
leads to Bad title.

I only found RPMsg/Remoteproc for passing messages and data between the PRU cores and the ARM core but ARM core is running in Linux.

My packages:
 C:\ti\bios_6_46_01_38
 C:\ti\ccsv6\         [CCS  Version: 6.1.3.00034]
 C:\ti\edma3_lld_2_12_02_26
 C:\ti\pdk_k2g_1_0_4
 C:\ti\processor_sdk_rtos_k2g_3_02_00_05
 C:\ti\xdctools_3_32_01_22_core
 C:\ti\pru-software-support-package-pru-software-support-package [from pru-software-support-package-pru-software-support-package-v5.0.1.tar]

  • Hi Joshua,

    I've forwarded this to the software experts. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • Thanks for your suggestion.
    My PRU software is a very small, deterministic instruction set. The latency for reading/writing data has to be small and fixed. The IPC seems not a good choice for me.
    What I need is more like a memory mapping approach. Use ARM to access PRU data memory. PRU writes its output data to its own PRU data RAM. Then, send interrupt to ARM. ARM has hundreds usec to read the PRU output data from PRU data RAM and write data to PRU data RAM for PRU input.
    So, PRU only writes output and reads input data between its registers and PRU data RAM.

    Q1. I found that the PRUSS driver API, PRUICSS_pruWriteMemory, in pruicss.h delivered in processor_sdk_rtos_k2g_1_0_4 allows ARM/DSP to write data to PRU data RAM.
    Do you have example code for that and any API allows ARM to read data from PRU data RAM?

    Q2. The API, PRUICSS_setPRUBuffer, can load PRU binary code onto PRU Instruction RAM. The PRU binary code is generated with pasm_dos.exe but it takes .p files not the .asm, .lst and .out files I generated in CCS. What tool I can use to generate the PRU binary code for this API.
  • Joshua,

    1. You can look into the icss_emac driver icss_emac/test/src/main.c to see how PRUICSS_pruWriteMemory is used. There is no PRUICSS_pruReadMemory API, but you can refer to PRUICSS_pruWriteMemory in ./pruss/src/pruicss_drv.c to implement that.

    2. The compiler is a command-line program named clpru . This program can compile, optimize, assemble,
    and link programs in a single step. Within Code Composer Studio, the compiler is run automatically to
    perform the steps needed to build a project, see PRU Optimizing C/C++ Compiler User's Guide www.ti.com/.../spruhv7 and processors.wiki.ti.com/.../PRU-ICSS.

    Regards,
    Garrett
  • Garrett,

    I wrote my own function refer to PRUICSS_pruWriteMemory in ./pruss/src/pruicss_drv.c and I can use ARM core to read and write data to PRU data RAM now.


    I always use clpru in CCS to build my PRU software. But once I build my PRU software I run the steps -> Connect Target -> Load Program... -> Run.  I have to comment out the API, PRUICSS_setPRUBuffer in my ARM code since I load my PRU software separately from loading and running ARM code.
    How can I just load and run ARM code and ARM can take care of the loading and running PRU software?

    Br,
    Joshua

  • Joshua,

    We provide a aPRU-ICSS LLD driver for the ARM and the DSP which will load the firmware on the PRU-ICSS and then run the firmware on the PRU. you can look at the API flow for using the PRU_ICSS driver here:
    processors.wiki.ti.com/.../Processor_SDK_RTOS_PRUSS

    There is an example of this which is provide in the test folder of the pruss driver provided in the PDK package for this device. If you go to the PRU firmaware folder under pdk_k2g_x_x_x\packages\ti\drv\pruss\test\src\pru_firmware, you will find a read Me that will tell you how to convert your PRU firmaware into a header that can be included in the application. 

    To generate the binary file for PRU0 run the below command ,which will generate the "pruss_test_pru0_bin.h"
    which will be include in the main.c file

    pasm_dos.exe -b -V3 -L* -c -CXYZ pruss_test_pru0.p



    Please review the example provided with that driver for details and let us know if this works for you.

    Regards,
    Rahul

  • Rahul,

    Please see my 2nd question dated back on Feb.24.
    "Q2. The API, PRUICSS_setPRUBuffer, can load PRU binary code onto PRU Instruction RAM. The PRU binary code is generated with pasm_dos.exe but it takes .p files not the .asm, .lst and .out files I generated in CCS. What tool I can use to generate the PRU binary code for this API."

    I tried pasm_dos.exe but it doesn't take the .asm, .lst and .out files generated in CCS. CCS doesn't give me the .p files. Does TI have a simple script or tool can do something like pasm_dos.exe does for .p file?

    Regards,
    Joshua
  • Ok. I understand this issue a little better and looks like other users have run into the same issue. Please refer to Melissa`s response on the e2e post here to see how the same can be done using the PRU C compiler and hex utility.
    e2e.ti.com/.../1444340

    Regards,
    Rahul
  • Followed Melissa's instruction, I built all 8 pru projects under "pru_firmware" (the current pru_cape shows "pru_fw") directory and generated 8 .obj files for pru_demo project.
    After downloaded AM335X_StarterWare_02_00_01_01, I built pru_demo along with 8 pru_xyz.obj files successfully. The current pru_cape has pru_cape_demo_ccs.cmd instead of pru_cape_demo.cmd.

    But I got syntax error after changed linkcmd_bm_v7a.xdt (which linker.cmd is generated from) referring to pru_cape_demo_ccs.cmd.

    makefile:162: recipe for target 'MyProject.out' failed
    c:/ti/ccsv6/tools/compiler/gcc-arm-none-eabi-4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe:configPkg/linker.cmd:17: syntax error

    --retain=PRU_0_image.obj(*)  // Line 17 in my linker.cmd
    --retain=PRU_1_image.obj(*)


    makefile:162: recipe for target 'MyProject.out' failed
    c:/ti/ccsv6/tools/compiler/gcc-arm-none-eabi-4_9-2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe:configPkg/linker.cmd:189: syntax error
    collect2.exe: error: ld returned 1 exit status

        PRU0_text: {PRU_LED0_image.obj(.text)} load > DDR_MEM run_start(LED0_INST)  // Line 189 in my linker.cmd
        PRU0_data: {PRU_LED0_image.obj(.data)} load > DDR_MEM run_start(LED0_DATA)
     
    I am using GNU v4.9.3 to build ARM software. The pru_demo for AM335x is using TI v5.2.5. Is this the reason I got syntax error? How to resolve it?

    Melissa also mentioned "automated way to generate a PRU "<Filename>_bin.h" array file using the C-compiler or hex utility." Can you elaborate this method?

    Thanks.