fopen() not functioning with emulator. - venk...@yahoo.co.in - May 15 7:54:28 2008
I am working on a test application where I am reading/writing files for processing. On the
simulator everything is working perfect, but when running on emulator/board, the fopen()
returns null. It is happening quite frequently, but not all the time. I also tried with both
relative (w.r.t executable file) and absolute files paths. The part of the code is here; can
some one help what is going wrong.
char rOutfile[200]="../testvecs/op/r_out.out";
char bOutfile[200]="../testvecs/op/b_out.yuv";
fpr = fopen(rOutfile, "wb");
if (!fpr) {
/* control almost always comes here */
return;
}
fpb = fopen(bOutfile, "wb");
if ( !fpb) {
/* control almost always comes here */
fclose(fpr);
return;
}
------------------------------------
OMAP35x EVM jump-starts low-power apps
------------------------------------
The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building
applications based on the OMAP35x architecture:http://www.DSPRelated.com/omap35x

(You need to be a member of code-comp -- send a blank email to code-comp-subscribe@yahoogroups.com )
Re: fopen() not functioning with emulator. - Jeff Brower - May 15 13:54:24 2008
Venki-
> I am working on a test application where I am reading/writing files
> for processing. On the simulator everything is working perfect, but
> when running on emulator/board, the fopen() returns null. It is
> happening quite frequently, but not all the time. I also tried with
> both relative (w.r.t executable file) and absolute files paths. The
> part of the code is here; can some one help what is going wrong.
>
> char rOutfile[200]="../testvecs/op/r_out.out";
> char bOutfile[200]="../testvecs/op/b_out.yuv";
>
> fpr = fopen(rOutfile, "wb");
> if (!fpr) {
> /* control almost always comes here */
> return;
> }
> fpb = fopen(bOutfile, "wb");
> if ( !fpb) {
> /* control almost always comes here */
> fclose(fpr);
> return;
> }
I'm not sure of the reason for the NULL return, but I might make a couple of
comments:
1) If you are running the above code during real-time processing -- i.e. when other
code/interrupts/DMA is making onchip memory bus and CPU demands -- then you are
likely to see problems. CCS file I/O uses the JTAG emulator connection, which is
typically very slow, causing code such as the above to take a long time and in turn
affect timing and performance.
2) Normally CCS file I/O should only be used "when nothing else is going on", for
example at the beginning of main() to initialize some arrays, or at a known "stop or
pause point" for debug purposes.
You could try some things to improve efficiency. You could open the files in main.c
before real-time code starts, and save the file handles. Then you could save the
data in memory after each frame, and write to file later, maybe after N number of
frames were processed.
-Jeff
------------------------------------
OMAP35x EVM jump-starts low-power apps
------------------------------------
The modular and extensible OMAP35x Evaluation Module (EVM) enables developers to start building
applications based on the OMAP35x architecture:http://www.DSPRelated.com/omap35x

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