VM Labs SDK Sample Code

\vmlabs\sample\File-Server\fileio

Copyright © 2000-2001 VM Labs, Inc.  All Rights Reserved

March 2, 2001


This program demonstrates the use of the file server function of the MLOAD tool.  It uses standard C library functions to open a file, read the contents, and then print a portion back to the host PC's console.  Using similar techniques, your programs can also create files and write to them, and this will be a useful debugging technique.

Filename Description
fstest.c Main program code for sample.
makefile MAKEFILE for building and running sample program.

A Little Information About The File Server

On the NUON development system, known as the "client", your programs calls functions in standard C library for performing file access. In the library, these calls are then translated into messages sent over the TCP/IP connection to your host PC.

On the PC side, the file server is one of two separate items:

  1. The FSSERV.EXE program.  (Obsolete)
  2. The "-fs" option of the MLOAD tool.  Add this option immediately before the name of the COFF file that you are downloading.  For example:

    mload -p3 -n -fs fstest.cof -r -m

The plan is that a future version of the PUFFIN debugger will also have the file server built into it.

When you run the file server on the PC side, it tells the client that the file server is available so that it knows what TCP/IP address to use when making requests.

When the file server receives a message from the client, it performs whatever file operation was requested and then sends the appropriate information back to the client.

 

STDIN & STDOUT

The STDOUT and STDIN file streams are both directed to the PC console, so you can use it for character-based input and output.

File Server Caveats

Please note that while you might otherwise successfully use more than one PC to transfer data to your NUON system, this will only confuse things when using the file server. Stick to one server per client.

Also remember that using standard C library functions to read data from your host PC is something that will only work on a development system. Final production code must use the Media Access Library functions that are part of the BIOS. Therefore it is highly recommended that you encapsulate your data access routines into a few functions within a single module so that you may change things more easily when the time comes.


Before attempting to load or run any of the SDK samples, make sure you have first read the Hitchhiker's Guide To NUON document.  

After that, if you're still having trouble getting this sample program to work,  click here to request assistance from developer support.

Click here for other online SDK documentation.