Sign in

username:

password:



Not a member?

Search c6x



Search tips

Subscribe to c6x



c6x by Keywords

AD535 | BIOS | Booting | Bootloader | C621 | C6211 | C6415 | C671 | C6711 | C6711DSK | C6713 | CCS | Chassaing | COFF | DAT | DM64 | DM642 | DMA | DSK671 | DSK6711 | EDM | EDMA | EMIF | Emulator | EVM | EVM620 | FFT | FIR | GPIO | Halting | HPI | HWI | IDK | JTAG | LDB | LDH | LDW | Linker | LMS | LOG_printf | Matlab | McBSP | MEM_alloc | MIPS | PCI | PCM3003 | Pipeline | Profiling | QDM | Reset | ROM | RTDX | Sampling | SDRAM | Stack | TEB | THS1206 | TMS320C621 | TMS320C6416 | TMS320C6711 | TMS320C6713 | UART | Vector Table | XBUS | XDS560

Sponsor

NEW! TMS320C6474: 3x the performance. 1/3 the cost. Three 1 GHz cores on 1 chip.

Discussion Groups

Discussion Groups | TMS320C6x | Memory Copy on DM642

Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).

  

Post a new Thread

Memory Copy on DM642 - Imran Akthar - Jul 3 4:56:00 2004



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);
}






(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Memory Copy on DM642 - Mike Dunn - Jul 3 18:28:00 2004

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,
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 Imranvoid 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
{
*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);
}_____________________________________




(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: Memory Copy on DM642 - Ganesh Vijayan - Jul 5 11:19:00 2004

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
 
----- Original Message -----
From: Mike Dunn
To: Imran Akthar ; c...@yahoogroups.com
Sent: Saturday, July 03, 2004 11:58 PM
Subject: Re: [c6x] Memory Copy on DM642

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,
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 Imranvoid 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
{
*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);
}_____________________________________


_____________________________________




(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )