PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1

2.6. Testing on the BREW Device

STEP 1. Set the License Code in the Boot function of "HelloWorld.cpp"

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.1. 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.2. 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://";

STEP 2. 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.2. Tool Bar of Visual Studio

Tool Bar of Visual Studio

Figure 2.3. Add-in icons attached to BREW SDK

Add-in icons attached to BREW SDK

Figure 2.4. Add-in icons attached to SophiaFramework

Add-in icons attached to SophiaFramework

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

Figure 2.5. 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 4.1 Addin] does not appear in the [ Addins and Macro files ] tab, shut down Visual Studio and re-install "SophiaFramework".

STEP 3. 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 3-1. Set the SophiaFramework 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 is installed and automatically set by its installer.

STEP 3-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 3-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 3-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 "SophiaFrameworkBrew310RVCTB.a" for BREW 3.1.

STEP 4. 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 home folder, its makefile paths to SophiaFramework libraries and include files must be modified.