PrevNextUpHome SophiaFramework UNIVERSE 5.3

2.5. Testing on the BREW Device

2.5.1. Setting License Code

To test an application on the BREW device, it is necessary to set the license code at the

*license = "heap://"

statement in the SFCApplet::Boot function.

Example 2.5. SFCApplet::Boot function: before setting the license code

// Boot Loader
SFCApplet::FactorySPP SFCApplet::Boot(AEECLSID id, SFXAnsiStringPtr license)
{
    *license = "heap://";

    return (id == AEECLSID_HELLOWORLD) ? (&HelloWorld::Factory) : (null);
}

Example 2.6. SFCApplet::Boot function: after setting the license code

// Boot Loader
SFCApplet::FactorySPP SFCApplet::Boot(AEECLSID id, SFXAnsiStringPtr license)
{
    *license = "heap://"
      "TIXDRQXNU5WHU8Y3Z9WOHWQR6Z3VPSDHDV5CR1S4XASPWLUHWAS7Z5Z2TGS3XMSAT3UPUQTLTARCYPSF"
      "UEJZ6ROSJWGUQSEYKR6V2U4VESMTQLHKZ6X7Y2VKXHWIX3XBU0Z7VHWHXIZBSGT5SPU3XLX0Z1Y4R3TC"
      "U6WGT9WHWIVNYHYCUCR9T3SMTEWPRNVAX1Y4VPW2YCY9YQV5R7Z9UIVHT6SDUPU2SIW6VCRCWBR2S4WQ"
      "UPYFWCYGT4VIT1WHXGYPTQSFYPWNV3ULRNWFW7RBRFVKUKS2YQSQYHW1TPUPXBZ6UEY2WOYKR7S3TAU4"
      "TQS6UHVFVEVLU3R5SDSKW7RPTNTPVQU2T4R8Z4VLUGEW3U98TLDR8/";

    return (id == AEECLSID_HELLOWORLD) ? (&HelloWorld::Factory) : (null);
}
[Note] License Code

"TIXDRQXNU5WHU8Y3Z9WOHW .................. U2T4R8Z4VLUGEW3U98TLDR8/" is the license code for HelloWorld application.

The license code must correspond to the ClassID for application.

As the license code is very long and can be splitted by using the double quotation marks, it is usually written in multiple lines like the above.

[Caution] Testing on the BREW Simulator

You do not need to modify the following code in the SFCApplet::Boot function when testing an application on the BREW simulator.

*license = "heap://";

In case of using RVCTB 1.2, Visual Studio Add-ins automate the process of creating a makefile and building an application.

In case of using other development environments, you have to create a makefile and build manually.

See the each sections for how to create makefiles,

Makefile of RVCTB 3.0, Makefile of GNUARM 4.1.1, Makefile of YAGARTO 4.4.2.

2.5.2. Development by Add-ins of Visual Studio (only for RVCTB 1.2)

STEP 1. Confirm or Set up the Add-ins of Visual C++

Confirm two kinds of add-in icons on the tool bar of Visual Studio.

Figure 2.22. Tool Bar of Visual Studio

Tool Bar of Visual Studio

Figure 2.23. Add-in icons attached to BREW SDK

Add-in icons attached to BREW SDK

Figure 2.24. Add-in icons attached to SophiaFramework UNIVERSE

Add-in icons attached to SophiaFramework UNIVERSE

If the above add-in icons cannot be confirmed, click [Tools], choose [Customize], and check [ARMMakeBREWApp] and [SophiaFramework UNIVERSE Addin] in the [Addins and Macro files] tab.

Figure 2.25. Set up the Visual C++ Add-ins

Set up the Visual C++ Add-ins
[Note] Note
  1. You must download BREW SDK Tools to access the Visual Studio Addins when using BREW SDK 3.0 or later.
  2. If [ARMMakeBREWApp] does not appear in the [ Addins and Macro files ] tab, shut down Visual Studio and re-install "BREW SDK".
  3. If [SophiaFramework UNIVERSE Addin] does not appear in the [ Addins and Macro files ] tab, shut down Visual Studio and re-install "SophiaFramework UNIVERSE".

STEP 2. Generate and Edit the Makefiles

1. Click the [ARM MAK] icon on the tool bar, and then the makefile "HelloWorld.mak" is generated.

2. Click the [SF MAK] icon on the tool bar, and then the makefile "HelloWorld.mak" is updated.

[Note] How to update the makefile " HelloWorld.mak " manually

STEP 2-1. Set the SophiaFramework UNIVERSE Include directory and "-I" option to the APP_INCLUDE variable.

[Note] What is SF_HOME?

SF_HOME is an environment variable for the folder where SophiaFramework UNIVERSE is installed and automatically set by its installer.

STEP 2-2. Change "-g" option.

#DBG = -g                        # Enable debug
DBG = -g-                        # Enable debug

[Note] About "-g" option

"g-" is the option for not outputting debug information. The compilation speed will be also faster with this option.

STEP 2-3. Change "-entry" option.

#LFLAGS = $(ROPILINK) -rwpi -entry 0x8000#
LFLAGS = $(ROPILINK) -rwpi -entry AEEMod_Load#0x8000#
[Caution] If forget to set

Omitting this setting will cause the application size to be much larger after the link.

STEP 2-4. Set the SophiaFramework library for the device to the APP_OBJS variable.

[Caution] File Name of Library

The extention of library file is not ".lib" but ".a".

For example, it is "SophiaFrameworkBrew310EngRVCTB.a" for BREW 3.1.

[Note] Using Thumb for RealView Compilation Tools for BREW 1.2

Specify SophiaFrameworkBrew310EngRVCTB12Thumb.a in case of BREW 3.1.

Specify SophiaFrameworkBrew400EngRVCTB12Thumb.a in case of BREW 4.0.

When building an applet with the Thumb mode, change the ARM compiler("armcpp") into the THUMB compiler("tcpp") in its makefile.

Example 2.7. Makefile to be modified when using the Thumb mode

# ... (omitted) ...

#ARMCPP   = $(ARMBIN)\armcpp
TCPP     = $(ARMBIN)\tcpp

# ... (omitted) ...

#.cpp.o:
#	$(ARMCPP) $(CFLAGS) $(INC) $(OBJ_FILE) $(SRC_CPP_FILE)

.cpp.o:
	$(TCPP) $(CFLAGS) $(INC) $(OBJ_FILE) $(SRC_CPP_FILE)

APP_OBJS = $(OBJS) "$(SF_HOME)\Library\SophiaFrameworkBrew310EngRVCTB12Thumb.a"

# ... (omitted) ...

STEP 3. Build the executable file "HelloWorld.mod" for the BREW Device

With Visual Stidio, click [Tool], choose [BREW ARM Make], and generate the executable file "HelloWorld.mod" for the BREW device.

[Caution] If the project has been changed

If the application is saved in the directory other than the SophiaFramework UNIVERSE home folder, its makefile paths to SophiaFramework UNIVERSE libraries and include files must be modified.

2.5.3. Makefile of RVCTB 3.0

Since the addin of SophiaFramework UNIVERSE does not support RVCTB 3.0, it is necessary to create your own makefile by yourself.

A typical makefile template is available at this site.

Set the TARGET variable, the OBJS variable, and the dependent list in the makefile if necessary.

You can use values generated by the BREW addin for setting these values.

Example 2.8. Example/chelloworld applet

# ... (ommited) ...

TARGET      = chelloworld
OBJS        = chelloworld.o

# ... (ommited) ...

# link SophiaFramework library for BREW SDK 4.0
# if BREW SDK 4.0, change into SophiaFrameworkBrew400EngRVCTB30.a
LIBS        = "$(SF_HOME)\Library\SophiaFrameworkBrew310EngRVCTB30.a"

# ... (ommited) ...

# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

chelloworld.o:  chelloworld.cpp
chelloworld.o:  chelloworld.hpp
chelloworld.o:  chelloworld.bid

Example 2.9. Example/chelloworld applet in the Thumb code

# ... (ommited) ...

TARGET      = chelloworld
OBJS        = chelloworld.o

# ... (ommited) ...

# build applet with the Thumb mode
ARMCPP      = "$(ARMBIN)\tcpp"

# ... (ommited) ...

# link SophiaFramework library for building with the Thumb mode
LIBS        = "$(SF_HOME)\Library\SophiaFrameworkBrew310EngRVCTB30Thumb.a"

# ... (ommited) ...

# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

chelloworld.o:  chelloworld.cpp
chelloworld.o:  chelloworld.hpp
chelloworld.o:  chelloworld.bid

2.5.4. Makefile of GNUARM 4.1.1

Since the addin of SophiaFramework UNIVERSE does not support GNUARM, it is necessary to create your own makefile by yourself.

A typical makefile template is available at this site.

Set the TARGET variable, the OBJS variable, and the dependent list in the makefile if necessary.

You can use values generated by the BREW addin for setting these values.

Example 2.10. Example/chelloworld applet

# ... (omitted) ...

TARGET      = chelloworld
OBJS        = chelloworld.o

# ... (omitted) ...

# link SophiaFramework library for BREW SDK 3.1
# if BREW SDK 4.0, change into -lSophiaFrameworkBrew400EngGNUARM41
LIBS        = -lSophiaFrameworkBrew310EngGNUARM41 -lgcc

# ... (omitted) ...

# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

chelloworld.o:  chelloworld.cpp
chelloworld.o:  chelloworld.hpp
chelloworld.o:  chelloworld.bid

Example 2.11. Example/mathematicsexplainer applet which uses mathematical functions

# ... (omitted) ...

TARGET      = mathematicsexplainer
OBJS        = mathematicsexplainer.o

# ... (omitted) ...

# add include path for mathematical function library included in GNUARM
LIBDIRS     = -L"$(GCC_LIBPATH)\interwork" -L"$(GCC_HOME)\arm-elf\lib\interwork" -L"$(SF_HOME)\Library"

# ... (omitted) ...

# link mathematical function library included in GNUARM (never change order of specified libraries)
LIBS        = -lSophiaFrameworkBrew310EngGNUARM41 -lm -lgcc -lc

# ... (omitted) ...

# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

mathematicsexplainer.o: mathematicsexplainer.cpp

Example 2.12. Example/mathematicsexplainer which uses mathematical functions in the Thumb mode

# ... (omitted) ...

TARGET      = mathematicsexplainer
OBJS        = mathematicsexplainer.o

# ... (omitted) ...

# build applet with the Thumb mode
TARG        = -mthumb

# ... (omitted) ...

# add include path for the Thumb mode
LIBDIRS     = -L"$(GCC_LIBPATH)\thumb\interwork" -L"$(GCC_HOME)\arm-elf\lib\thumb\interwork" -L"$(SF_HOME)\Library"

# ... (omitted) ...

# add linker option for the arm/thumb interworking
LINK_CMD    = -script $(LINKERSCRIPT) --gc-sections --emit-relocs --stub-group-size=2 --pic-veneer -o

# link SophiaFramework library for building with the Thumb mode
LIBS        = -lSophiaFrameworkBrew310EngGNUARM41Thumb -lm -lgcc -lc

# ... (omitted) ...

# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

mathematicsexplainer.o: mathematicsexplainer.cpp

2.5.5. Makefile of YAGARTO 4.4.2

Since the addin of SophiaFramework UNIVERSE does not support YAGARTO, it is necessary to create your own makefile by yourself.

A typical makefile template is available at this site.

Set the TARGET variable, the OBJS variable, and the dependent list in the makefile if necessary.

You can use values generated by the BREW addin for setting these values.

Example 2.13. Example/chelloworld applet

# ... (omitted) ...

TARGET      = chelloworld
OBJS        = chelloworld.o

# ... (omitted) ...
# link SophiaFramework library for BREW SDK 3.1
# if BREW SDK 4.0, change into -lSophiaFrameworkBrew400EngYAGARTO44
LIBS        = -lSophiaFrameworkBrew310EngYAGARTO44 -lgcc

# ... (omitted) ...


# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

chelloworld.o:  chelloworld.cpp
chelloworld.o:  chelloworld.hpp
chelloworld.o:  chelloworld.bid

Example 2.14. Example/mathematicsexplainer applet which uses mathematical functions

# ... (omitted) ...

TARGET      = mathematicsexplainer
OBJS        = mathematicsexplainer.o

# ... (omitted) ...

# add include path for mathematical function library included in YAGARTO
LIBDIRS     = -L"$(GCC_LIBPATH)\interwork" -L"$(GCC_HOME)\arm-elf\lib\interwork" -L"$(SF_HOME)\Library"

# ... (omitted) ...

# link mathematical function library included in YAGARTO (never change order of specified libraries)
LIBS        = -lSophiaFrameworkBrew310EngYAGARTO44 -lm -lgcc -lc

# ... (omitted) ...

# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

mathematicsexplainer.o: mathematicsexplainer.cpp

Example 2.15. Example/mathematicsexplainer which uses mathematical functions in the Thumb mode

# ... (omitted) ...

TARGET      = mathematicsexplainer
OBJS        = mathematicsexplainer.o

# ... (omitted) ...

# build applet with the Thumb mode
TARG        = -mthumb

# ... (omitted) ...

# add include path for the Thumb mode
LIBDIRS = -L"$(GCC_LIBPATH)\thumb\interwork" -L"$(GCC_HOME)\arm-elf\lib\thumb\interwork" -L"$(SF_HOME)\Library"

# ... (omitted) ...

# add linker option for the arm/thumb interworking
LINK_CMD  = -script $(LINKERSCRIPT) --gc-sections --emit-relocs --stub-group-size=2 --pic-veneer -o

# link SophiaFramework library for building with the Thumb mode
LIBS    = -lSophiaFrameworkBrew310EngYAGARTO44Thumb -lm -lgcc -lc

# ... (omitted) ...

# --------------------------------------------
# DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE
# --------------------------------------------

mathematicsexplainer.o: mathematicsexplainer.cpp

2.5.6. Build the Execution File for Mobile Phone

If the created makefile is "chelloworld.mak" and the applet folder is "chelloworld",

execute the following command at the command prompt.

cd chelloworld
nmake /f chelloworld.mak

If the execution file for mobile phone "chelloworld.mod" is created, it is success.

[Caution] execution path of the nmake command

To use the nmake command, it is necessary to add the environment variable "PATH" with the execution path of "nmake.exe" included in Visual Studio C++.

[Note] Build with Visual Studio Add-ins

In case of RVCTB 1.2, Visual Studio add-ins can build an applet.