JEVM JNI Interface
The text below will briefly describe how to develop and use native methods with JEVM package. Use the provided JNI examples for illustration. The advised procedure is as follows:
- Declare the native methods in your .java source file.
- Use System.loadLibrary() method in the .java file to load the native library where appropriate.
- Compile your .java source file with the javac.exe compiler using -classpath option to specify c:/fadata/jevm/lib/jevm.jar class library.
- Use the javah.exe tool to produce header file from the .class file produced by the compiler.
- Include this header in your .c source file containing native methods (for prototype checking).
- At the end of your .c source file #define _NATIVE_TABLE native_table
- Immediately after this #include
- Immediately after this declare a table of type jvm_pair_t, containing pairs of the name string and the function address of the native methods.
- Compile the .c source file using little endian and large memory model (-ml3) for the C6xxx DSP and large memory model (-ml) for the C55xx family. See provided Makefiles for additional compiler options. Required JNI headers are in c:/fadata/jevm/include directory.
- Link the resulting object .obj file with the proper JEVM library (jevmXXXX.lib or jevmXXXXdi.lib if you will use JEVM debugger connection) at the first place and with the appropriate TI run-time library at the second place. Use -c -ar options for the linker to produce relocatable COFF .out file with ROM initialization.
Now you can execute the Java class file that dynamically loads native methods. Do not forget to include the path to the .out files in the LIBPATH environment variable and the path to the .class file in the CLASSPATH variable.
For more information about JNI interface consult Java documentation.
Note: JEVM loads and relocates the .out file at some arbitrary place in memory and you will not be able to easily debug it using Code Composer Studio, because the symbol information in the file will not be correct. Use print messages for debugging.
Note: JEVM honors the alignment of the sections in your .out file, and therefore you can use DSP-specific algorithms requiring memory alignment.
Note: You can't use internal DSP memory. Dynamically loaded native methods will be located in external memory.


