NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Java ME

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

Java MicroEdition, also known as Java ME, was developed to bring Java to cell phones and other portable media devices. More information is available on Sun's website at http://java.sun.com/javame/index.jsp.

phoneME Feature is an open source project that provides Java ME's CLDC capabilities. It is available at https://phoneme.dev.java.net/. phoneMe can be built for Linux, Windows as well as Windows Mobile and CE.

There are a number of other open source and clean room options available for ARM9, but below are some simple instructions to get a Java ME application running on a DaVinci EVM.

Getting phoneME Feature to run on DM355[edit]

The following instructions assume the use of Montavista Linux 4.0.1, RHEL4 Host and DM355 DVSDK. A similar procedure should also work for DM6446.

Setting up your environment[edit]

  1. Download and install phoneME Feature from https://phoneme.dev.java.net/downloads_page.html
  2. Download and install Java 2 Platform, SE Development Kit 1.4.2 from http://java.sun.com
  3. Detailed instructions can be found at: https://phoneme.dev.java.net/content/mr2/buildenv_feature.html
  4. Create a file, myenv.sh, on your host, then copy and paste the following into it. Then edit your paths appropriately (first 3 lines), followed by: host# source myenv.sh

<syntaxhighlight lang='bash'>export MEHOME=/home/user/workdir/phoneme_feature export JDK_DIR=/usr/java/j2sdk1.4.2_17 export MONTAVISTA=/opt/montavista/pro/devkit/arm/v5t_le/armv5tl-montavista-linuxeabi export PATH=$PATH:$JDK_DIR/bin export BuildDir=$MEHOME/javacall-com/configuration/phoneMEFeature/win32_x86 export JAVACALL_DIR=$MEHOME/javacall export JAVACALL_PROJECT_DIR=$MEHOME/javacall-com export JAVACALL_OUTPUT_DIR=$MEHOME/javacall-com export PCSL_OUTPUT_DIR=$MEHOME/output/pcsl export PCSL_PLATFORM=linux_arm_gcc export NETWORK_MODULE=bsd/generic export ENABLE_PCSL=true export ENABLE_ISOLATES=true export JVMWorkSpace=$MEHOME/cldc export JVMBuildSpace=$MEHOME/output/cldc export MIDP_OUTPUT_DIR=$MEHOME/output/midp export CLDC_DIST_DIR=$MEHOME/output/cldc/linux_arm/dist export TOOLS_DIR=$MEHOME/tools export TARGET_CPU=arm export USE_MULTIPLE_ISOLATES=true</syntaxhighlight>

Compiling phoneME Feature for DM355[edit]

  1. Start by: host# cd /phoneme_feature/pcsl
  2. To build PCSL: host# make NETWORK_MODULE=$NETWORK_MODULE PCSL_PLATFORM=$PCSL_PLATFORM GNU_TOOLS_DIR=$MONTAVISTA
  3. Then: host# cd /phoneme_feature/cldc/build/linux_arm
  4. To build CLDC: host# make ENABLE_PCSL=$ENABLE_PCSL PCSL_OUTPUT_DIR=$PCSL_OUTPUT_DIR ENABLE_ISOLATES=$ENABLE_ISOLATES GNU_TOOLS_DIR=$MONTAVISTA
  5. Then: host# cd /phoneme_feature/midp/build/linux_fb_gcc
  6. To build MIDP: host# make PCSL_OUTPUT_DIR=$PCSL_OUTPUT_DIR CLDC_DIST_DIR=$CLDC_DIST_DIR TOOLS_DIR=$TOOLS_DIR TARGET_CPU=$TARGET_CPU USE_MULTIPLE_ISOLATES=$USE_MULTIPLE_ISOLATES GNU_TOOLS_DIR=$MONTAVISTA

Running a test[edit]

  1. Enable the following two device drivers by typing: host# make menuconfig in LSP_dir/montavista/pro/devkit/lsp/ti-davinci
    1. Device Drivers -> Character Devices -> Support for console on virtual terminal
    2. Device Drivers -> Graphics Support -> Console display driver support -> Framebuffer Console support
  2. Rebuild the kernel via: host# make uImage and copy to /tftpboot
  3. Connect an LCD via composite cable and USB keyboard to the EVM
  4. Use standard TFTP/NFS bootargs as given in the Getting Started Guide, but remove "console=ttyS0,115200n8" and boot the EVM
  5. Copy the /phoneme_feature/output/midp directory (on host) to /opt/java (target file system)
  6. From the serial terminal, type: target# ln -s /dev/fb/0 /dev/fb0
  7. Then type: target# ln -s /dev/console /dev/tty0
  8. For a quick test, do: target# cd /opt/java/midp/bin/arm and type: target# ./usertest

Running a sample application[edit]

  1. Download and install JDK 1.5.0 from http://java.sun.com
  2. Download and install Sun Java Wireless Toolkit 2.5.2 (or later) for CLDC from http://java.sun.com/products/sjwtoolkit/download.html
  3. Run host# ./ktoolbar in WTK2.5.2/bin
  4. Click New Project, then enter: Project Name: Hello, Class name: my.project.hello.Hello
    1. This will create several directories including a src dir
    2. Add "Hello World" code as Hello.java in the src directory (Several examples are available online)
  5. Then click Build and Run (this will verify that the MIDlet runs on an emulator)
  6. Create Hello.jar by clicking Project->Package->Create Package
  7. Copy Hello.jad and Hello.jar from your_project_dir/bin on your host to your target file system: target/opt/java/midp/bin/arm
  8. Install the MIDlet by typing the following on the terminal: target# ./installMidlet Hello.jad
  9. Verify MIDlet installed via: target# ./listMidlets.sh and note the suite # of your MIDlet
  10. Run your MIDlet via: target# ./runMidlet # (where # is your suite number)
  11. Note: F1 will act as the left menu button (usually to quit the MIDlet), F2 will act as the right menu button (usually to open the MIDlet's menu)
  12. The MIDlet will now be displayed to the LCD and the keyboard can be used to interact with the MIDlet

Java SE Embedded[edit]

Sun currently offers Java SE for ARM (available at http://java.sun.com/javase/downloads/embedded.jsp). Unfortunately, the currently available EABI binaries require glibc 2.4.

By default, DM355 and DM6446 (Montavista Linux) use glibc 2.3.x. To determine which glibc version you use, try:

target# rpm -qa glibc

If this does not work, try:

target# ls -al /lib/libc*

On OMAP3 (or if you upgrade your glibc), you should be able to evaluate Java SE Embedded. Download the EABI / glibc 2.4 / soft float, and copy the directory to your target file system. To test, try:

target# /opt/java_se/java -version

On your host, compile a Java program, say HelloWorld.java, then copy the resulting HelloWorld.class to your target. Then:

target# /opt/java_se/java HelloWorld
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Java ME here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Java ME here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Java ME here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Java ME here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Java ME here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Java ME here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Java ME here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Java ME here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Java ME here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity