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.

AM437x PRU download file

Hi,

After I use insmod mount remoteproc,

Using this cde download .bin file but it‘s failed

// Standard header files
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>

#define PRU_NUM          0
#define ADDEND1          0x98765400u
#define ADDEND2          0x12345678u
#define ADDEND3          0x10210210u

#define DDR_BASEADDR     0x80000000
#define OFFSET_DDR       0x00001000
#define OFFSET_SHAREDRAM 2048           //equivalent with 0x00002000

#define PRUSS0_SHARED_DATARAM    4

// Driver header file
#include "prussdrv.h"

#define PRU_NUM          0
static int LOCAL_exampleInit ();

static int mem_fd;
static void *ddrMem, *sharedMem;

static unsigned int *sharedMem_int;

int main (void)
{
    volatile unsigned long i,j;
unsigned int ret;
    printf("\nINFO: Starting %s example.\r\n","test");
    /* Initialize the PRU */
    prussdrv_init ();

  /* Open PRU Interrupt */
    ret = prussdrv_open(PRU_EVTOUT_0);
    if (ret)
    {
        printf("prussdrv_open open failed\n");
        return (ret);
    }

 /* Initialize example */
//    printf("\tINFO: Initializing example.\r\n");
//    LOCAL_exampleInit();

    /* Execute example on PRU */
    printf("\tINFO: Executing example on PRU0.\r\n");
    prussdrv_exec_program (PRU_NUM, "./test.bin");
printf("\tINFO: Executing example done.\r\n");
    for(i = 0; i < 5000;i++)
        for(j = 0; j < 1000000; j++);

    /* Disable PRU*/
 //   printf("Disable PRU\r\n");

 //   prussdrv_pru_disable(PRU_NUM);
 //   prussdrv_exit ();
    return(0);
}
/*****************************************************************************
* Local Function Definitions                                                 
*****************************************************************************/

static int LOCAL_exampleInit ()
{
    void *DDR_regaddr;

    /* open the device */
    mem_fd = open("/dev/mem", O_RDWR);
    if (mem_fd < 0) {
        printf("Failed to open /dev/mem (%s)\n", strerror(errno));
        return -1;
    }

    /* map the memory */
    ddrMem = mmap(0, 0x0FFFFFFF, PROT_WRITE | PROT_READ, MAP_SHARED, mem_fd, DDR_BASEADDR);
    if (ddrMem == NULL) {
        printf("Failed to map the device (%s)\n", strerror(errno));
        close(mem_fd);
        return -1;
    }

    //FLush the flag locations of PRU0 and PRU1
    DDR_regaddr = ddrMem;
    *(unsigned long*) DDR_regaddr = 0x00;

    DDR_regaddr = ddrMem + 0x000000004;
    *(unsigned long*) DDR_regaddr = 0x00;

    return(0);
}

please give me some advice 

thanks

li

  • hi

    yes i have.

    could you tell me the problem is caused by drive or download application....

    please give me some advices.

    li

  • hi 

    I have checked this wiki: http://processors.wiki.ti.com/index.php/PRU-ICSS_Getting_Started_Guide again,and do it again.

    and I get the new zImage and targeNFS directory ,I use it to replace the EVM entry/lib/modules directory ,also  replace the  zImage and .dtb . display mount success after restart. but I stil could not download.

    //mytest.c  
    #include <stdio.h>  
    #include <prussdrv.h>  
    #include <pruss_intc_mapping.h>  
      
    #define PRU_NUM 0  
      
    int main (void)  
    {  
        unsigned int ret;  
        tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA;  
          
        prussdrv_init ();//Initialize the PRU  
        if (prussdrv_open(PRU_EVTOUT_0))//Open PRU Interrupt  
        {  
            printf("prussdrv_open open failed\n");  
            return (-1);  
        }  
        prussdrv_pruintc_init(&pruss_intc_initdata);  
        prussdrv_exec_program (PRU_NUM, "./prucode.bin");//Execute example on PRU  
        prussdrv_pru_wait_event (PRU_EVTOUT_0);//Waiting for this instruction: MOV r31.b0, PRU0_ARM_INTERRUPT+16  
        prussdrv_pru_clear_event (PRU_EVTOUT_0, PRU0_ARM_INTERRUPT);  
        prussdrv_pru_disable (PRU_NUM);//Disable PRU and close memory mapping  
        prussdrv_exit ();  
      
        return(0);  
    }  

    please give me some advide 

    thanks

    aria

  • Hi Aria,

     Please note that there are two PRU Linux drivers for loading and interacting with the PRU:

    • PRU Remoteproc & Rpmsg drivers  (Available in the pru-sw package on ti.com & documented here.)
    • PRU UIO & prussdrv drivers    (Available to the BeagleBone community here.  This implementation is only available for AM335x.)

    These are two completely independent approaches to programming the PRU and cannot be combined.  Based on the code snippets in your posts, it looks like you are trying to use both the Remoteproc driver and the UIO-based driver APIs (prussdrv_*), which will not work.  This is why you receive an error when running the test application.  

     As described in the PRU Remoteproc Driver wiki page (http://processors.wiki.ti.com/index.php/PRU-ICSS_Remoteproc_Driver), this driver is responsible for loading the PRU firmware, configuring the PRU INTC, and enabling the PRU to begin executing instructions.  Remoteproc functions solely in the kernel space and will therefore automatically handle the mentioned functionality when the driver in invoked. 

    Also, please note that the current version of the AM437x PRU Remoteproc driver only supports interactions with the PRU-ICSS1 PRU cores.  PRU-ICSS0 support is on the roadmap, but I do not have an ETA as of today.  For PRU-ICSS0 firmware development, my recommendation would be to use CCS to load, run, and debug PRU firmware.

    Regards,

    Melissa

  • HI Melissa

    Thanks for your advice.I have try to use  ccs ,but I can't find the am437x pru gel file . so i could not load, run, and debug .

    Regards

    Aria

  • Hi Aria,

    Attached is an AM437x PRU gel file.  I will work to add this to the next revision of the pru-sw package.

    Regards,

    Melissa

    AM437x_PRU_ICSS.gel
  • Hi Melissa

    Thanks for your pru gel file.but i also could not debug  pru.

    am437x‘s gel could not enable the pru clock.

    could you give me the gel of am437x bare-metal development(include pru initialization).

    Regards,

    Aria

  • Hi Aria,

    I see this same error if I do not run the PRU_ICSS_Init script (in the PRU-ICSS gel file.  Here are the steps I take to connect to the PRU core:

    1.  Connecting to the CortexA9

    2.  Load the gel file to the CortexA9

    3.  Run the PRU_ICSS_Init script 

    4.  Connect to the PRU core

    This wiki article describes these basic steps in more depth, if you have additional questions:  http://processors.wiki.ti.com/index.php/GEL

    Regards,

    Melissa