Welcome, guest ( Login )

WikiHome » Java virtual machine (j2me _cldc 1.1) without OS

Java virtual machine (j2me _cldc 1.1) without OS

Version 1, changed by avimalik. 05/15/2007.   Show version history

This page is dedicated to getting j2me_cldc (1.1) up and running on the bare bone NIOS processor.
Advantages of doing so.. Faster speed, less program memory requirement, no overhead of having an operatng system.
Disadvantage.. Harder to get it up and running (that's why I am writing this page). Not all the drivers present especially ethernet on the barebone processor. No paging since NIOS does not have an mmu (uclibc provides soft mmu implementation)

I already have the wiki which get JVM up and running on uclinux. please refer Running Java on uclinux-niosII board to see how to get that going. This j2me port is linux centric (i.e. all development takes place on a linux-box). Windows will not work since the patch is for the linux makefiles and src code only.

OK Now the steps....
1.) Download the patch bare_bone.patch.
2.) Download this j2me_syslib Debug.tar.gz
3.) Now untar the Debug directory into your home folder..
4.) Apply the patch to the j2me_cldc directory take care of paths might have to use -p1, -p2 etc..
5.) Now open file j2me_cldc/kvm/VmUnix?/build/Makefile goto line 121 and change the paths to where ever you have downloaded the Debug directory be careful.
6.) Now go into directory j2me_cldc/build/linux. Type "make  all"
7.) In your j2me_cldc/kvm/VmUnix?/build folder you should have a kvm object file. This is the elf executable which will run on bare-bone processor.

Important things to note:
1.) I am using a DE2 board and the DE2_Net demonstration example with NIOS2. This executable starts from address 0x0 unlike uclinux which starts from 0x0005.. in SDRAM. So in the sopc builder change the SDRAM starting address to 0x0. Rebuild the cpu_0 image and download to the board.
2.) The patch provides the most basic changes
   a.) It will create a Java file called Asproto.Asproto in the api/src/ dir this is the testing function which will print helloworld from Java.
   b.) The patch creates a j2me.c file in the j2me_cldc/kvm/VmUnix?/src dir which initializes the Jvm and also takes in the name of the class which needs to be run. Instead of using command line arguments.
  c.) The patch also patches some very basd coding practices which made JVM not compile with gcc compiler >= 3.3. Now any compiler can be used.
  d.) The patch patches the Makefile to include the j2me.c src file and the libj2me_syslib.a library which provides all the functionalities otherwise provided by uclibc. The makefile now uses custom linker script line-121 from above.

3.)The Debug directory is basically a system library compiled using NIOS2-IDE (I am ashamed that I had to use it).  Any one can use (build their own libraries only thing that needs to be done is change the name of the library in the Makefile line-121 from above.

4.) Missing functionalities currently include--> No soft mmu support so during garbage collection their is no verification. Might lead to crashes haven't tested that as yet.


cheers,

Attachments (0)

  File By Size Attached Ver.