Skip Headers
Oracle® Java ME Embedded Getting Started Guide for the Reference Platform (Keil)
Release 3.3.1
E38140-02
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

1 Running the Oracle Java ME Embedded Software on the Keil MCBSTM32F200 Board

The Keil MCBSTM32F200 board is the reference device of the Oracle Java ME Embedded software. This chapter documents how to install the Java ME Embedded software with RTX binary onto the Keil MCBSTM32F200 board, configuring the Java ME Embedded system, connecting to the command-line and logging interfaces, and installing and running a Java ME Embedded "IMlet" application.

The following items are required for developing on the Keil MCBSTM32F200 board:

Downloading and Installing the MDK-ARM Lite Development Kit

To install the Oracle Java ME Embedded software on the reference board, first download and install version 4.54, 4.6, or 4.7 of the MDK-ARM development kit. The MDK-ARM development kit can be obtained from the following site:

https://www.keil.com/download/product

Be sure the download completes successfully: for example, the file size for the MDK-ARM Lite version is approximately 500 MB.

Once downloaded, install the MDK-ARM tool by double-clicking on the executable. After the tool install finishes, verify the installation by double-clicking on the Keil µVision 4 IDE executable.


WARNING:

There is currently a bug in Version 4.60 of the MDK-ARM Development Kit that prevents an output file from being generated during binary flashing onto the Keil boards. If this occurs, please use a different version of the MDK-ARM Development Kit.


Downloading and Installing the PuTTY Terminal Emulator Program

Download the PuTTY Terminal Emulator Program (putty.exe) from the following site:

http://www.putty.org/

The terminal emulator executable is directly downloadable as putty.exe. The terminal emulator is used to connect to two separate sockets: one for the command-line interface (CLI) that issues commands to the board, and one for the logging or system output provided by the board.

Connecting the Keil MCBSTM32F200 Board to the Computer

The Keil MCBSTM32F200 board comes with two USB cables. Both cables must be connected to the desktop computer. The first USB cable attaches to the USBHS connector, and provides power to the board, as shown in Figure 1-1. The other connects to the hardware debugging unit, such as the ULINK-ME, which in turn connects to a compatible debugging port on the evaluation board. See the instructions that come with your specific hardware debugging unit for more information.

After the USB cables are connected, ensure that the board and the debugger are receiving power by verifying that the LEDs on both the board near the USB connection and the hardware debugger are lit. The LED near the USB connection should be lit green. With the Keil MCBSTM32F200, the backlight of the touchscreen display also lights up, even though it might not be displaying any information. See Figure 1-1.

Figure 1-1 The Keil MCBSTM32F200 Board

Surrounding text describes Figure 1-1 .

The first time the board is connected to the desktop computer, Windows typically installs the device driver software for the debugger. The ULINK-ME, for example, uses the standard set of USB drivers that comes with Microsoft Windows.

Setting Up the MicroSD Card

The MicroSD card must contain configuration files used by the Java ME Embedded native distribution, including the initialization properties and security policy files. Ensure that you are using a compatible SD card. This release has been tested with the Transcend 2 GB card. For a list of supported cards, please refer to the appropriate documentation for the RTX OS and the Keil F200 series embedded boards.


Note:

All filenames on the MicroSD card must adhere to the 8.3 file format.


Follow these steps to prepare the card:

  1. Insert the card on the Windows desktop computer, select the card in the My Computer window, and right-click and select Format...

  2. Select File System as FAT32, Allocation Unit Size as the default allocation unit size, and ensure that Quick Format is not selected, as shown in Figure 1-2. The Volume label is optional. Press the Start button.

    Figure 1-2 Windows Formatter Settings

    Surrounding text describes Figure 1-2 .
  3. Once the formatting completes, copy all the files inside the directory sd_card/ in the Oracle Java ME Embedded distribution to the root directory of the SD card.

  4. Edit the file rtc_upd.cfg on the root directory of the SD card. (This can be done by opening the file with a standard text editor.) Edit the current time and date that the device should use, in the format YYYY/MM/DD HH:MM:SS Zone. For example, the file rtc_upd.cfg could contain the following:

    2012/11/22 18:46:00 GMT
    

    Next, rename the file rtc_upd.cfg to rtc.cfg.

  5. Open the file platform.cfg on the root directory of the SD card to specify the appropriate networking information for the device.

    Edit the MAC address if you have more than one board in your local network or if you think that there is a MAC address conflict. The following is an example of a MAC address:

    #---------------------------------------------
    # MAC Address 
    # - It should be unique value in the same LAN
    #---------------------------------------------
    mac.addr= 00:0A:0C:0E:07:0A
    

    Note:

    The MAC address must comply with the IEEE 802.3 standard.


    If your network uses dynamic IP addresses, uncomment the DHCP line under Dynamic IP Address and comment the lines under Static IP Address. If your network uses static IP addresses, uncomment and edit the lines under Static IP Address and comment the line under Dynamic IP Address.

    The following is an example of configuring options for using static IP addresses:

    #---------------------------------------------
    # Dynamic IP addess (DHCP)
    #---------------------------------------------
    #ip.method= dhcp
    
    #---------------------------------------------
    # static IP addess
    #---------------------------------------------
    ip.method= static
    ip.addr= 10.0.0.10
    ip.netmask= 255.0.0.0
    ip.gateway= 10.0.0.1
    ip.dns= 10.0.0.1
    
  6. In the file platform.cfg, disable the watchdog by setting its value to false:

    #---------------------------------------------
    # H/W Watchdog
    #---------------------------------------------
    watchdog.enable= false
    

    The watchdog resets the system if a program appears to be stuck. However, the watchdog may trigger while the board communicates with the Oracle ME SDK and NetBeans, especially during debugging.

  7. If you plan to use on-device debugging (ODD) with an IDE, edit the file jwc_prop.ini in the java/ directory of the SD card. Set the property odt_run_on_start to true to enable ODD.

Installing the Firmware on the Evaluation Board

The Java ME Embedded distribution contains a utility that uses the MDK-ARM software to erase and flash the Oracle Java ME Embedded binary onto the evaluation board. Use the following procedure to prepare the SD card and install the firmware:

  1. Use the Safely Remove Hardware function on the Windows desktop to remove the SD card from the computer. (In Windows XP, for example, the Safely Remove Hardware tool is present in the lower right system tray near the clock.) Alternatively, you can select the SD card in the My Computer window, right click and select Eject. If necessary, remove the MicroSD card from the SD card housing.

  2. Be sure that the board is not powered up by temporarily disconnecting the USB cables. Insert the MicroSD card into the SD card slot on the board.

  3. Switch the "BAT/3V3" jumper near the RS-232C connection on the board to the left (BAT) position, outlined in Figure 1-3.

  4. Connect the board to the Windows desktop computer as you did previously, including the network cable, the USB power cable, and the debugger with its USB cable. The board should now be receiving power.

  5. On the desktop, check the file flash.bat inside the directory flash/ in the Oracle Java ME Embedded software. Ensure that this file contains the correct path to the MDK-ARM tool binary. For example:

    C:\Keil\UV4\UV4.exe -f jmee.uvproj -o output.txt
    
  6. With the board connected, run the batch file flash.bat to download the distribution to the evaluation board. The MDK-ARM tool notifies you when the download has completed. If the MDK-ARM tool requires a Flash Upgrade of the debugger, press OK to allow this, then restart the flash.bat when completed.

  7. Once completed, push the Reset button on the board to start the Java ME Embedded native platform. The runtime will then use the configuration files on the MicroSD card to initialize itself. If successful, the touchscreen on the device should look similar to Figure 1-3. Note that after the time clock has been initialized, the runtime will rename the rtc.cfg file on the MicroSD card back to rtc_upd.cfg and ask you to reset the board to activate the clock's settings.

Figure 1-3 The MCBSTM32F200 Touchscreen After Installing Java ME Embedded

Surrounding text describes Figure 1-3 .

Connecting to the CLI and Logging Ports

When the Java ME Embedded distribution is running, note the IP address that is shown on the touchscreen in green, and start two PuTTY executables. Use these to create raw socket connections to the IP address and two ports shown in Table 1-1. For example, the PuTTY settings to initiate a connection to the IP address of 10.0.0.10 and the port 65000 is shown in Figure 1-4. Note that the IP address of your embedded board may be different.

Figure 1-4 PuTTY Options for Connecting to the Keil Board

Surrounding text describes Figure 1-4 .

The two default ports that are used are shown in Table 1-1.

Table 1-1 Ports Used by the Embedded Board

Port Description

65000

Logging / Java VM System Output

65002

Command-line interface


The window that outputs data from port 65000 provides logging and standard output information from the device. This is useful when determining if a Java ME embedded program ran successfully on the board. The window from port 65002 provides a command-line interface (CLI). Both the CLI and logging windows are shown in Figure 1-5. The logging port is defined in the jwc_prop.ini properties file using value assigned to the log.tcp.port property.

Figure 1-5 Logging and Command Line Interfaces

Surrounding text describes Figure 1-5 .

WARNING:

The command-line interface (CLI) feature in this Oracle Java ME Embedded software release is provided only as a concept for your reference. It uses insecure connections with no encryption, authentication, or authorization.


In the CLI window, you can run the Application Management System (AMS) commands shown in Table 1-2. Note that the AMS syntax may change in future releases; entering help [command] is the best way to obtain the latest CLI syntax.

Table 1-2 AMS CLI Commands

Syntax Description

ams-list [INDEX or NAME|VENDOR]

List all installed IMlet suites and their statuses or show the detail of a single suite

ams-install <URL> [username:password]

Install an IMlet using the specified JAR or JAD file, specified as a URL. An optional username and password can be supplied for login information as well.

ams-update <INDEX or NAME|VENDOR>

Update the installed IMlet

ams-remove <INDEX or NAME|VENDOR>

Remove an installed IMlet

ams-run <INDEX or NAME|VENDOR> [IMLET_ID] [-debug]

Execute the specified IMlet or the default if none is specified. An optional debug parameter can be specified to run the IMlet in debug mode.

ams-stop <INDEX or NAME|VENDOR> [IMLET_ID]

Stop the specified IMlet or the default if none is specified

ams-suspend <INDEX or NAME|VENDOR> [IMLET_ID]

Suspend (pause) the specified IMlet or the default if none is specified

ams-resume <INDEX or NAME|VENDOR> [IMLET_ID]

Resume the specified IMlet or the default if none is specified

ams-setup <INDEX or NAME|VENDOR>

Display the setup menu of the IMlet

ams-info <INDEX or NAME|VENDOR>

Show information about the installed IMlet

ams-log <command> [param1, param2, ..., paramN]

ams-log wdog

Display the IMlet log or watchdog log if recorded by the watchdog handler in the platform

ams-logger-list [INDEX or NAME|VENDOR]

Retrieve the logger list for the IMlet or all the tasks if one is not specified

ams-logger-info <INDEX or NAME|VENDOR> [LOGGER_NAME]

Retrieve logger info for the specified IMlet and logger or all the loggers if is one is not specified

ams-logger-level-set <INDEX or NAME|VENDOR> [LOGGER_NAME] <LOGGER_LEVEL>

Set the logger level for specified IMlet or all loggers if one is not specified

help [command name]

List the available commands or detailed usages for a single command

sysmenu <on PASSWORD|off>

Enable hidden system menu commands. Currently, the password is 12345.

exit

Terminates the current session.


When the sysmenu command is entered with the on option, additional system menu commands are available with the AMS CLI, as shown in Table 1-3.

Table 1-3 Additional System Commands Available in the AMS CLI

Syntax Description

setprop <KEY> <VALUE>

Sets a property identified by <KEY> with the value <VALUE>

getprop <KEY>

Returns a property identified by <KEY>

odd [on|off]

Explicitly sets the on-device debugging (ODD) property to on or off. If no parameters are passed, returns the current ODD value.

shutdown [-r]

Perform either a shutdown of the board, or a reboot if the -r parameter has been passed. Note that the watchdog should be enabled in the platform.cfg file to successfull reboot. (See Setting Up the MicroSD Card)


Here is a typical example of using the Application Management System (AMS) to install, list, run, and remove a Java ME Embedded application on the Cortex board.


Note:

Note that the AMS syntax and output may change in future Oracle Java ME Embedded releases.


First, install the application using the ams-install command, specifying its location either on the MicroSD card (using the Memorycard directory, which maps to memcard on the filesystem) or across a network using a URL.

oracle>> ams-install file:///Memorycard/hello.jar
<<ams-install,start install,file:///Memorycard/hello.jar
<<ams-install,install status: stage 0, 5%
<<ams-install,install status: stage 3, 100%
<<ams-install,install status: stage 4, 100%
<<ams-install,OK,Install success

oracle>> ams-install http://www.example.com/netdemo.jar
<<ams-install,start install,http://www.example.com/netdemo.jar
<<ams-install,install status: stage 0, 5%
<<ams-install,install status: stage 3, 100%
<<ams-install,install status: stage 4, 100%
<<ams-install,OK,Install success

oracle>> ams-install http://www.example.com/notthere.jar
<<ams-install,start install,http://www.example.com/notthere.jar
<<ams-install,FAIL,errorCode=103(OTHER_ERROR)

Note that the final installation example failed with an error code and matching description. If the install process shows any error code, see Table B-1 in Appendix B for more information on how to resolve the error.

Once an IMlet is installed, verify it using the ams-list command. Here, we have added an additional IMlet: rs232dem. Each IMlet has been assigned a number for convenience.

oracle>> ams-list
<<ams-list,0.hello|Oracle,STOPPED
<<ams-list,1.netdemo|Oracle,STOPPED
<<ams-list,2.rs232dem|Oracle,RUNNING
<<ams-list,OK,3 suites are installed

The ams-remove command can be used to remove any installed IMlet.

oracle>> ams-remove 0
<<ams-remove,OK,hello removed

The results can again be verified with the ams-list command.

oracle>> ams-list
<<ams-list,1.netdemo|Oracle,STOPPED
<<ams-list,2.rs232dem|Oracle,RUNNING
<<ams-list,OK,2 suites are installed

Finally, start up the IMlet using the ams-run command. The application can be terminated with the ams-stop command.

oracle>> ams-run 1
<<ams-run,OK,started
oracle>> ams-list
<<ams-list,1.netdemo|Oracle,RUNNING
<<ams-list,2.rs232dem|Oracle,RUNNING
<<ams-list,OK,1 suites are installed

Subsequent chapters will discuss how to use either the NetBeans or Eclipse IDE to develop, install, and test applications directly on the board.

Additional Methods of Obtaining Logging Information

There are several additional ways to connect to the embedded board and obtain logging output. These include the following:

  1. UART - Through RS232

    To utilize this method, connect to the board using an RS232 serial cable and use a tool such as PuTTY to create a serial connection from a terminal on the Windows desktop using the following options:

    Baud rate: 115200

    Data bits: 8

    Stop bits: 1

    Parity: None

    Flow control: XON/XOFF

    Also, ensure that the log.method property from the jwc_prop.ini file contains the value UART in its list.

  2. USB/COM - Through a USB COM port and an appropriate driver

    In order to use this method, connect a USB cable from your desktop to the Keil board. A USB to COM driver must also be installed on your Windows desktop machine. Drivers' installers and installation instructions can be found in the driver directory of the Keil bundle. Finally, ensure that the log.method property from the jwc_prop.ini file contains the value USBCOM in its list. Then, create a serial connection from your terminal with the following options:

    Baud rate: 115200

    Data bits: 8

    Stop bits: 1

    Parity: None

    Flow control: XON/XOFF

  3. ITM - Through ITM trace supported by MCU

    An instrumentation trace can be used as supported by the ARM microcontroller. See the embedded board documentation for more information on this method. Also, ensure that the log.method property from the jwc_prop.ini file contains the value ITM in its list.