Running the RI
Invoke cref using cref.bat from JC_CLASSIC_HOME\bin
To run the RI:
Installer Mask
The development kit installer, the Java Card virtual machine interpreter, and the Java Card platform framework are built into the Installer mask. You can use it as-is to load and run applets. Other than the installer, it does not contain any applets.
The RI requires no other files to start proper interpretation and execution of the mask image's Java Card technology-based bytecode.
Obtaining Resource Consumption Statistics
Use the RI -z command line option to print memory usage at startup and at shutdown. Although memory usage statistics vary among Java Card RE implementations, this give you general idea of the amount of memory needed to install and execute an applet.
Getting Resource Statistics With the PhotoCard Sample
This example shows the resources used to download and execute a single application. These statistics can also be used to install a set of applications and execute several transactions.
The PhotoCard sample program downloads and installs an applet, illustrating using the large address space available in the 32-bit version of the RI (see PhotoCard Sample). The sample uses the large address space of the smart card's EEPROM memory to store up to four GIF images. Statistics are provided regarding the following resources: EEPROM, transaction buffer, stack usage, clear-on-reset RAM, and clear-on-deselect RAM. The statistics are printed twice, once at RI start up and once when it shuts down.
To get resource statistics with the photocard sample:
Example 10-1 PhotoCard Sample Showing Resource Statistic Output
Java Card 3.0.5 C Reference Implementation Simulator
32-bit Address Space implementation - with cryptography support
T=1 / T=CL Dual interface APDU protocol (ISO 7816-4)
Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
Memory configuration -
Type Base Size Max Addr
RAM 0x0 0x1000 0xfff
ROM 0x2000 0xe000 0xffff
E2P 0x10020 0xffe0 0x1ffff
ROM Mask size = 0xcec9 = 52937 bytes
Highest ROM address in mask = 0xeec8 = 61128 bytes
Space available in ROM = 0x1137 = 4407 bytes
EEPROM will be saved in file "e2p"
Mask has now been initialized for use
0 bytecodes executed.
Stack size: 00384 (0x0180) bytes, 00000 (0x0000) maximum used
EEPROM use: 06994 (0x1b52) bytes consumed, 58510 (0xe48e) available
Transaction buffer: 00000 (0x0000) bytes consumed, 03560 (0x0de8) available
Clear-On-Reset RAM: 00000 (0x0000) bytes consumed, 00576 (0x0240) available
Clear-On-Dsel. RAM: 00000 (0x0000) bytes consumed, 00256 (0x0100) available
CREF was powered down.
132232 bytecodes executed.
Stack size: 00384 (0x0180) bytes, 00252 (0x00fc) maximum used
EEPROM use: 09558 (0x2556) bytes consumed, 55946 (0xda8a) available
Transaction buffer: 00000 (0x0000) bytes consumed, 03560 (0x0de8) available
Clear-On-Reset RAM: 00198 (0x00c6) bytes consumed, 00378 (0x017a) available
Clear-On-Dsel. RAM: 00025 (0x0019) bytes consumed, 00231 (0x00e7) available
Temporary memory usage:
Java stack: 0 bytes
Clear on Deselect, channel space 0 : 0 bytes
Clear on Deselect, channel space 1 : 0 bytes
Clear on Deselect, channel space 2 : 0 bytes
Clear on Deselect, channel space 3 : 0 bytes
Clear on Deselect, channel space 4 : 0 bytes
Clear on Deselect, channel space 5 : 0 bytes
Clear on Deselect, channel space 6 : 0 bytes
Clear on Deselect, channel space 7 : 0 bytes
Clear on Reset: 0 bytes
C:\JCDK3.0.5\bin>cref_tdual -z -i e2p
Java Card 3.0.5 C Reference Implementation Simulator
32-bit Address Space implementation - with cryptography support
T=1 / T=CL Dual interface APDU protocol (ISO 7816-3)
Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
Memory configuration -
Type Base Size Max Addr
RAM 0x0 0x1000 0xfff
ROM 0x2000 0xe000 0xffff
E2P 0x10020 0xffe0 0x1ffff
ROM Mask size = 0xcec9 = 52937 bytes
Highest ROM address in mask = 0xeec8 = 61128 bytes
Space available in ROM = 0x1137 = 4407 bytes
EEPROM (0xffe0 bytes) restored from file "e2p"
Using a pre-initialized Mask
0 bytecodes executed.
Stack size: 00384 (0x0180) bytes, 00000 (0x0000) maximum used
EEPROM use: 09558 (0x2556) bytes consumed, 55946 (0xda8a) available
Transaction buffer: 00000 (0x0000) bytes consumed, 03560 (0x0de8) available
Clear-On-Reset RAM: 00198 (0x00c6) bytes consumed, 00378 (0x017a) available
Clear-On-Dsel. RAM: 00025 (0x0019) bytes consumed, 00231 (0x00e7) available
CREF was powered down.
4624835 bytecodes executed.
Stack size: 00384 (0x0180) bytes, 00250 (0x00fa) maximum used
EEPROM use: 56993 (0xdea1) bytes consumed, 08511 (0x213f) available
Transaction buffer: 00000 (0x0000) bytes consumed, 03560 (0x0de8) available
Clear-On-Reset RAM: 00198 (0x00c6) bytes consumed, 00378 (0x017a) available
Clear-On-Dsel. RAM: 00125 (0x007d) bytes consumed, 00131 (0x0083) available
Temporary memory usage:
Java stack: 0 bytes
Clear on Deselect, channel space 0 : 0 bytes
Clear on Deselect, channel space 1 : 0 bytes
Clear on Deselect, channel space 2 : 0 bytes
Clear on Deselect, channel space 3 : 0 bytes
Clear on Deselect, channel space 4 : 0 bytes
Clear on Deselect, channel space 5 : 0 bytes
Clear on Deselect, channel space 6 : 0 bytes
Clear on Deselect, channel space 7 : 0 bytes
Clear on Reset: 0 bytes

