Altera_Forum
Honored Contributor
17 years agoproblem of handling pointers: !!!
I have a problem in reading the data that I wrote in memory.
I tried to write data on a memory chip. the operation is to transfer data from one memory chip to another. I managed to make the first operation that is writing data on the target memory. the second is to read the data that I have already classified in the second memory. but I can not do this. the first processor written in memory of the second processor. the first processor written in memory of the second processor. the second processor accesses the data, there is the problem. the second processor displays nothing. -----------------code first processor------------------- #include "io.h" #include "system.h" #include <stdio.h> #include "data.h" #include <sys/alt_cache.h> int h1,h2,g1,g2,p; int taille_matrice; int *z1,*z2,*z3, *z4,*z5,*z6,*y,*x,B,i,j; int *k; void load_data() { y=(unsigned int*)0x000020020;// base address memory of the second processor j=0;// à ne pas changer for (i=0; i<2;i++) { B=(M1);y=y+j;
*y=b;
j=1;
alt_dcache_flush_all();
}
j=1;
for (i=0; i<4;i=i+2)//i+la taille d'une ligne
{
b=(m2); y=y+j; *y=B; //j=j+1; j=1; alt_dcache_flush_all(); } z4=(unsigned int*)0x000020030;// i try print the result (see second processor) printf("u4=%d\t", *(z4)); ------------------------second processor----------------------------- ////////////////////////////////////////////////////////////////////// #include "io.h" #include "system.h" #include <stdio.h> int i; unsigned int h1,h2,g1,g2,p,p1; int taille_matrice; int *z1,*z2,*z3,*z4,*z5,*z6; int *k; void load_data() { taille_matrice = 4; z1 = (unsigned int*)0x000020020; h1 =*z1; z2 = (unsigned int*)0x000020024; h2=*z2; z3= (unsigned int*)0x000020028; g1=*z3; z4= (unsigned int*)0x00002002C; g2=*z4; z5= (unsigned int*)0x000020030;// this result will be print by the first processor *z5=(h1*g1)+(h2*g2); } ------------------------------------------------------------ first processor print nothing u4=-653432534 can someone help me thks for all