按照文档挂载编译吃 remoteproc 模块 通过insmod 挂载上去
运行编译好的 下载的应用程序
// Standard header files #include <stdio.h> #include <sys/mman.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <string.h> #define PRU_NUM0 #define ADDEND10x98765400u #define ADDEND20x12345678u #define ADDEND30x10210210u #define DDR_BASEADDR0x80000000 #define OFFSET_DDR0x00001000 #define OFFSET_SHAREDRAM 2048//equivalent with 0x00002000 #define PRUSS0_SHARED_DATARAM4 // Driver header file #include "prussdrv.h" #define PRU_NUM0 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 PRU1DDR_regaddr = ddrMem;*(unsigned long*) DDR_regaddr = 0x00;DDR_regaddr = ddrMem + 0x000000004;*(unsigned long*) DDR_regaddr = 0x00;return(0); }
然后运行后显示求帮忙的说 是模块没挂载成功么
437x下载找不到 cat /sys/class/uio/uio0/maps/map0/addr 这个目录的说 还是下载的程序有问题=。= .bin文件就在这个文件的边哈
Yaoming Qin:
请您检查下您的pru driver是不是对的,按照我们的文档来做:
http://processors.wiki.ti.com/index.php/PRU-ICSS
http://processors.wiki.ti.com/index.php/PRU-ICSS_Installer
aria li:
回复 Yaoming Qin:
能问下这个下载的程序是对的呢………….如何检查pru driver挂载是不是对的 我是make modules后 生成的ko文件然后 先用insmod 挂载的 virtio 然后挂载的remoteproc……