Oracle® Java ME Embedded Getting Started Guide for the Reference Platform (Keil) Release 3.3.1 E38140-02 |
|
![]() Previous |
![]() Next |
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:
The Oracle Java ME Embedded RTX Software Distribution, Version 3.3.1
A desktop computer running Windows XP or later with two USB ports
A Keil MCBSTM32F200 Cortex Board
A hardware debugger, such as the ULINK-ME or ULINK 2
A MicroSD card (with an SD adapter, if necessary for connecting to the desktop computer)
A networking LAN cable with RJ-45 interface
A terminal emulation program, such as PuTTY
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. |
Download the PuTTY Terminal Emulator Program (putty.exe
) from the following site:
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.
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.
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.
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:
Insert the card on the Windows desktop computer, select the card in the My Computer window, and right-click and select Format...
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.
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.
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
.
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
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.
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.
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:
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.
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.
Switch the "BAT/3V3" jumper near the RS-232C connection on the board to the left (BAT) position, outlined in Figure 1-3.
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.
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
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.
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.
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.
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.
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 |
---|---|
|
List all installed IMlet suites and their statuses or show the detail of a single suite |
|
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. |
|
Update the installed IMlet |
|
Remove an installed IMlet |
|
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. |
|
Stop the specified IMlet or the default if none is specified |
|
Suspend (pause) the specified IMlet or the default if none is specified |
|
Resume the specified IMlet or the default if none is specified |
|
Display the setup menu of the IMlet |
|
Show information about the installed IMlet |
|
Display the IMlet log or watchdog log if recorded by the watchdog handler in the platform |
|
Retrieve the logger list for the IMlet or all the tasks if one is not specified |
|
Retrieve logger info for the specified IMlet and logger or all the loggers if is one is not specified |
|
Set the logger level for specified IMlet or all loggers if one is not specified |
|
List the available commands or detailed usages for a single command |
|
Enable hidden system menu commands. Currently, the password is |
|
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 |
---|---|
|
Sets a property identified by |
|
Returns a property identified by |
|
Explicitly sets the on-device debugging (ODD) property to on or off. If no parameters are passed, returns the current ODD value. |
|
Perform either a shutdown of the board, or a reboot if the |
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.
There are several additional ways to connect to the embedded board and obtain logging output. These include the following:
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.
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
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.