Question on fopen() and fprintf()

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question on fopen() and fprintf()

4,209 Views
king
Contributor I
Hi,
I just started to use CodeWarrior 5.7 for Coldfire development. Its stdio.h file doesn't support fopen() or fprintf(). Does anyone have ideas of how to do file I/O in the simulator? Thanks.
King
Labels (1)
0 Kudos
3 Replies

1,021 Views
CrasyCat
Specialist III

Hello

Support for file I/O functions like fopen, frpintf requires a file system to be available on the target (or simulated target).

When you are using CodeWarrior on a bare board, there is no file system available, so there is no support for file operation in the library.

If you have an operating system available, you can create stubs for the file I/O functions to link to the OS file system primitives.

This is explained in the manual {Install}\Help\PDF\MSL_C_Reference.pdf manual.
take a look at chapter "Configuring MSL C" section "Configuring File I/O".

CrasyCat

0 Kudos

1,021 Views
king
Contributor I

Thank you CrasyCat. I read the document and some code from your reference.

If I want to avoid writing the platform specific routines for file I/O, is there a way for me to feed test data from my PC to the running code in the simulator? I saw there's an item of "Debug->ColdFile->fill memory" in the IDE, but not sure if I can do it in an automatic way to continuously fill a buffer for data input.

I'm using a simulator only. Thanks.

King

0 Kudos

1,021 Views
CrasyCat
Specialist III
Hello
 
I assume you want to perform some automated tests on your application and need to do the following:
 - Input some data in the system
 - Run application
 - Input another set of data to the system
 - Run application again
 - and so on..
 
Am I right?
The Fill memory or Load memory entry in debug menu do not help in that as they are only executed when you select them.
 
You might have to use debug script to do that.
 
Coldfire debugger comes with a tcl command console where you can run some debug script.
 
You have some commands to load memory with some data, commands to set breakpoint and start application there and so on.
 
Please refer to the {Install}\Help\PDF\IDE_5.7_Automation_Guide.pdf manual.
Chapter Command Window Scripting explains you how to run debug script.
 
I hope this helps.
 
 
CrasyCat
0 Kudos