An Example Flash File System for TINI



The files included in this distribution are everything you need to install a flash file system on your TINI. This example assumes you are working with a DSTINIm400 with at least 1 MB of flash. It has not been tested with the 390, but assuming the build steps are modified appropriately, there is no reason for it not to work on that platform also. This example is provided as a convenience to developers and should be considered an unsupported pre-release of a future application note. As a result, the documentation is limited; however, this document and its accompanying source code should be enough to get you started. Permission is granted to modify the code to suit your needs.

At the end of this document you will find a list of limitations of this example and some suggestions of how to circumvent them.

For more information on:

Building and Installing the Example

The steps for building and using this example are outlined below. When appropriate, each step is followed by an example command to use when working at a Windows command prompt. Binaries are provided for TINI SDK ver. 1.15. If you want to use these pre-built files, you can skip to step 8.

  1. Download and install the latest TINI 1.1 SDK.
  2. Set a TINI_HOME environment variable to the path where you installed the TINI SDK.
        set TINI_HOME=C:\tini1.15
  3. (Note: Steps 3 through 7 can be performed by running the build.bat file included with this distribution.)

  4. Extract the SlushSrc.jar file found in TINI SDK to the src directory.
        cd src
        jar -xf %TINI_HOME%\src\SlushSrc.jar
        cd ..
  5. Extract the MountCommand.java and UnmountCommand.java files from the OptionalSlushCommandsSrc.jar file found in the TINI SDK.
        cd src
        jar -xf %TINI_HOME%\src\OptionalSlushCommandsSrc.jar com\dalsemi\slush\command\MountCommand.java com\dalsemi\slush\command\UnmountCommand.java
        cd ..
  6. Add the Mount and Unmount commands to the list of the commands loaded when slush boots by editing the com\dalsemi\slush\Slush.java file. Add these lines to the initializeShellCommands method.
        CommandInterpreter.addCommand("mount", new MountCommand());
        CommandInterpreter.addCommand("unmount", new UnmountCommand());
  7. Build the native library used by the file system driver.
        cd lib
        %TINI_HOME%\native\bin\win32\macro -I%TINI_HOME%\native\lib FlashFileSystem.a51
        %TINI_HOME%\native\bin\win32\a390 FlashFileSystem.mpp
        cd ..
  8. Rebuild slush, adding in the native library.
        dir src\*.java /B /S /ON > files
        javac -bootclasspath %TINI_HOME%\bin\tiniclasses.jar;%TINI_HOME%\bin\modules.jar -d bin @files
        java -classpath %TINI_HOME%\bin\tini.jar BuildDependency -f bin -d %TINI_HOME%\bin\tini.db -o bin\slush_flashFS.tbin -l -p %TINI_HOME%\bin\modules.jar -add FTPCLIENT;MAILTO -fake -noreflect -ref com.dalsemi.slush.util.FakeMainMaker -ref com.dalsemi.slush.command.SlushCommand -ref com.dalsemi.protocol.mailto.Handler -t 470100 -ref FlashFileSystemDriver -n lib\FlashFileSystem.tlib
  9. Load the new slush_flashFS.tbin file into your TINI using JavaKit.
        java -classpath %TINI_HOME%\bin\tini.jar;%classpath% JavaKit -flash 40 -m400
  10. Clear the area of flash you wish to use for the file system using the Z command of the DS80C400's loader. This example uses banks 0x49 through 0x4F.
        Z49
        Z4A
        ...
        Z4F
  11. Log in to slush and run the mount command to add the flash file system. The two hexadecimal numbers at the end of the command indicate the beginning and end flash addresses to use for the file system. If you build slush according to this document, it will occupy all of flash bank 47 and some of bank 48. We will use the remaining banks for our file system.
        mount mnt FlashFileSystemDriver 0x490000 0x500000
    If you do not want to have to mount the file system every time slush boots, you can add the following lines of code to the end of the initializeFileSystem method in Slush.java. After modifying the source code, go back to step 7 to rebuild the code.
        String[] params = {"0x490000", "0x500000"};
        DSFile.mount("mnt", "FlashFileSystemDriver", params);
  12. You will now see a new directory called 'mnt' in the root of your TINI's file system. All files and directories found here will be stored in the flash of your TINI.
  13. Any application started from slush will automatically inherit the mounted file systems if the new process has access to the necessary driver classes and libraries. There are two ways to achieve this. One is to build these files into each application where you want access to a mounted file system. Do this by adding in the FlashFileSystem*.class files and the FlashFileSystem.tlib file into your .tini file when running BuildDependency on your application. The second way is to make the class files and library available during runtime by adding them to the tiniext directory of your TINI.

Limitations Of This Example: