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