Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).
|
Hi all, m using DM642 board and CCS 2.21 version. I m reading a file whose size is 1MB(uinsg fread()in host PC) and writing it to the External RAM ..SDRAM . what i have noticed is that ,m able to copy contents of the file upto certain location only.beyond that ,the copy is not sucessful.(m not gettting memory errors..) the count is 15099 bytes.beyond that ....its not gettting copied properly beyond that location. what may be the reasons. also 1)what is the best way to copy from PC to board.??? thanks MA Imran void main() { FILE *p; unsigned char *p1; unsigned char *image_data; unsigned long file_size,count,i; p1=(unsigned char *)0x80000000; p=fopen("test.bmp","r"); if(p==NULL) { LOG_printf(&trace,"file open fail"); } else { LOG_printf(&trace,"sucesful\n"); } rewind(p); fseek(p,0L,SEEK_END); file_size=ftell(p); rewind(p); LOG_printf(&trace,"file size %x \n",file_size); image_data=MEM_alloc(SEG0,file_size,0); LOG_printf(&trace, "before allocating ..."); /* print initial memory status */ printmem(SEG0);//calling printmem function ..using SEG0 id. if(image_data==MEM_ILLEGAL) { LOG_printf(&trace,"memory allocation failed\n"); exit(); } else { LOG_printf(&trace,"mem allocation sucessful\n"); } fread(image_data,file_size,1,p); count=0; for(i=0;i<file_size;i++) { *p1=*image_data; p1+=1; image_data+=1; count=count+1; if(count==100*1024) { LOG_printf(&trace,"i = %d ",i); LOG_printf(&trace,"100K copy over\n"); count=0; } } LOG_printf(&trace,"content %x %x ",*p1,*image_data); LOG_printf(&trace,"memory copy over\n"); fclose(p); MEM_free(SEG0,image_data,file_size); } |
|
|
|
MA Imran,
It looks like you might have hit a limit.
My advice is "when you cannot eat an elephant in one bite, take more smaller bites". ie,
read something like 14,000 bytes at a time.
FYI-I hope that you are using this for setup or initialization because standard I/O
performance is very S L O W!!
mikedunn
Imran Akthar <i...@yahoo.com> wrote: Hi all, |
|
Hi Imran,
I guess Mike is right. With my prior experience on C6x boards, I would like to share that FILE I/O operations are not implemented correctly and moreover they have some problems. I would suggest you to read in chunks of 8 KB which is more appropriate. However, I have tried with 100 KB at one shot with a fread and maximum I have tried approx. 340 KB. One suggestion: try this. p->flags |= 0x4; ./* where p is
your file pointer which you are using to read */
Hope this helps.
Thanks and Regards,
Ganesh
|