Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540

Discussion Groups

Discussion Groups | TMS320C54x | File I/O access

Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).

  

Post a new Thread

File I/O access - daya...@yahoo.com - Mar 9 8:15:37 2008



Hi,

Below program I found in the CCS help. I tried to simulate it but got errors. Why ?

"Read data.c", line 4: error: unrecognized token
"Read data.c", line 4: error: expected an expression
"Read data.c", line 7: error: identifier "fid" is undefined
"Read data.c", line 7: error: unrecognized token
"Read data.c", line 7: error: expected an expression
"Read data.c", line 8: error: unrecognized token
"Read data.c", line 8: error: expected an expression
7 errors detected in the compilation of "Read data.c".

==========================================================================
The C I/O functions make it possible to access the host's operating system to perform I/O
(using the debugger). For example, printf statements executed in a program appear in the
debugger command window. When used in conjunction with the debugging tools, the capability to
perform I/O on the host gives you more options when debugging and testing code.
To use the I/O functions, include the header file stdio.h for each module that references a C
I/O function.
For example, given the following program in a file named main.c:

#include <stdio.h>
main()
{
 FILE *fid;
 fid = fopen("myfile","w");
 fprintf(fid,"Hello, world\n");
 fclose(fid);
 printf("Hello again, world\n");
}
Issuing the following shell command compiles, links, and creates the file main.out:
cl500 main.c -z -heap 400 -l rts500.lib -o main.out
Executing main.out under the debugger on a SPARC host accomplishes the following:

1)	Opens the file myfile in the directory where the debugger was invoked

2)	Prints the string Hello, world into that file

3)	Closes the file

4)	Prints the string Hello again, world in the debugger command window

With properly written device drivers, the library also offers facilities to perform I/O on a
user-specified device. 
If there is not enough space on the heap for a C I/O buffer, buffered operations on the file
will fail. If a call to printf() mysteriously fails, this may be the reason. Check the size of
the heap. To set the heap size, use the -heap option when linking.

=======================================================================

Regards,
Dayah
Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467



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

Re: File I/O access - ahma...@yahoo.com - Mar 31 6:57:51 2008

Hi,
The "unrecognized token" error is only because of text and you must rewrite or edit
your text ( by using "delete" and "backspace" keys on keyboard).
Ahmad
>
>Below program I found in the CCS help. I tried to simulate it but got errors. Why ?
>
>"Read data.c", line 4: error: unrecognized token
>"Read data.c", line 4: error: expected an expression
>"Read data.c", line 7: error: identifier "fid" is undefined
>"Read data.c", line 7: error: unrecognized token
>"Read data.c", line 7: error: expected an expression
>"Read data.c", line 8: error: unrecognized token
>"Read data.c", line 8: error: expected an expression
>7 errors detected in the compilation of "Read data.c".
>
>==========================================================================
>The C I/O functions make it possible to access the host's operating system to perform I/O
(using the debugger). For example, printf statements executed in a program appear in the
debugger command window. When used in conjunction with the debugging tools, the capability to
perform I/O on the host gives you more options when debugging and testing code.
>To use the I/O functions, include the header file stdio.h for each module that references a
C I/O function.
>For example, given the following program in a file named main.c:
>
>#include   
>main()
>{
> FILE *fid;
> fid = fopen("myfile","w");
> fprintf(fid,"Hello, world\n");
> fclose(fid);
> printf("Hello again, world\n");
>}
>Issuing the following shell command compiles, links, and creates the file main.out:
>cl500 main.c -z -heap 400 -l rts500.lib -o main.out
>Executing main.out under the debugger on a SPARC host accomplishes the following:
>
>1)	Opens the file myfile in the directory where the debugger was invoked
>
>2)	Prints the string Hello, world into that file
>
>3)	Closes the file
>
>4)	Prints the string Hello again, world in the debugger command window
>
>With properly written device drivers, the library also offers facilities to perform I/O on
a user-specified device. 
>If there is not enough space on the heap for a C I/O buffer, buffered operations on the
file will fail. If a call to printf() mysteriously fails, this may be the reason. Check the
size of the heap. To set the heap size, use the -heap option when linking.
>
>=======================================================================
>
>Regards,
>Dayah
>Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding
Solution for Commercial & Consumer End Equipment: www.ti.com/dm6467

------------------------------------

Check Out Industry's First Single-Chip, Multi-Format, Real-Time HD Video Transcoding Solution
for Commercial & Consumer End Equipment: www.ti.com/dm6467



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