Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
QUALCOMM Incorporated
5775 Morehouse Drive
San Diego, CA. 92121-1714
U.S.A
.
This documentation was written for use with Brew Mobile Platform, software version 1.0. This document and the Brew Mobile
Platform software described in it are copyrighted, with all rights reserved. This document and the Brew Mobile Platform software
may not be copied, except as otherwise provided in your software license or as expressly permitted in writing by QUALCOMM
Incorporated.
Not to be used, copied, reproduced in whole or in part, nor its contents revealed in any manner to others without the express written
permission of Qualcomm.
This technical data may be subject to U.S. and international export, re-export or transfer ("export") laws. Diversion contrary to U.S.
and international law is strictly prohibited.
The BREW MP logo is a trademark of QUALCOMM Incorporated.Brew is a registered trademark of QUALCOMM Incorporated.
QUALCOMM is a registered trademark of QUALCOMM Incorporated in the United States and may be registered in other countries.
Other product and brand names may be trademarks or registered trademarks of their respective owners.
Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, QUALCOMM provides the Sample Code on an
"as is" basis, without warranties or conditions of any kind, either express or implied, including, without limitation, any warranties or
conditions of title, non-infringement, merchantability, or fitness for a particular purpose. You are solely responsible for determining
the appropriateness of using the Sample Code and assume any risks associated therewith. PLEASE BE ADVISED THAT
QUALCOMM WILL NOT SUPPORT THE SAMPLE CODE OR TROUBLESHOOT ANY ISSUES THAT MAY ARISE WITH IT.
Limitation of Liability. In no event shall QUALCOMM be liable for any direct, indirect, incidental, special, exemplary, or consequential
damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business
interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or
otherwise) arising in any way out of the use of the Sample Code even if advised of the possibility of such damage.
HT80-VT500-166 Rev.B
June 28, 2010
Command-Line Primer
Contents
Command-Line Primer..........................................................................................................2
Setup.......................................................................................................................................3
Building the application....................................................................................................... 5
Running the application......................................................................................................6
Debugging.............................................................................................................................. 8
Appendix ........................................................................................................................... 10
Device setup............................................................................................................. 10
Device compilers......................................................................................................11
i
Command-Line Primer
Command-Line Primer
®
This primer gets you started as a Brew Mobile Platform (Brew MP) developer. This document is written
for use with the Brew MP multiplatform SDK.
The purpose of this primer is to provide you with instructions for building, running and debugging a Brew
MP application using the command-line.
The following steps are covered in this primer.
1. Setup on page 3
2. Building the application on page 5
3. Running the application on page 6
4. Debugging on page 8
Setup
This topic covers setup of your development environment.
Prerequisites/Environment setup
The Brew MP downloads page on the Brew MP website provides information about the required software
to proceed through this primer. You should complete all the steps under Setup for C/C++ Environment -
command-line.
Once you have installed the required software, make the following changes to environment variables:
• Remove C:\utils\Cygwin\bin from the Path environment variable
• Remove the path to make.d from the Path environment variable (the path to the make.d that used to
be in the Brew MP SDK)
• Ensure CodeSourcery bin precedes Cygwin or other bin\utils tool in PATH. For instance:
Add C:\Program Files\CodeSourcery\SourceryG++Lite\bin to the PATH environment variable.
This example uses RVCT 2.2.
Device Setup
Steps to prepare your PC and Brew MP device for running Brew MP applications are covered in the
device setup on page 10 section of this primer.
1. Connect one or more physical targets to PC (USB port, internet), and turn physical target(s) on.
2. Make sure the device is in developer mode.
3. To obtain a list of connected devices, enter the following on the command-line prompt:
"%BREWMP_TOOLSET%\bin\ct" -g usb listtargets
Note: If the connected device(s) does not show up in the list the phone needs to be put in
developer mode and reset. The USB driver should also be properly installed once the device has
rebooted. If it is not Windows will prompt you to install the USB driver from the SDK.
4. Check if the device is signature file enabled by entering the following on the command-line prompt:
"%BREWMP_TOOLSET%\bin\ct" -p <target_desc> -g usb enablestatus
Note: <target_desc> is not needed if only one device is connected.
5. If the device needs to be signature file enabled, enter the following on the command-line prompt:
"%BREWMP_TOOLSET%\bin\ct" -p <target_desc> -g usb sigenable <sig file path>
Note: <target_desc> is not needed if only one device is connected.
To enable the device using a brewmp.com username and password (username/password enabled)
enter the following on the command-line prompt:
%BREWMP_TOOLSET%\bin\ct" -p <target_desc> -g usb tepenable -u <username>
Note: <target_desc> is not needed if only one device is connected.
You will then be prompted for the password.
This primer compiles a sample application from the command-line, using a makefile and make.d. The
makefile for c_basicapp is included in the samplecode folder installed on your machine from the SDK
Manager.
Run application
To run the application on the target, do the following:
1. To run the application on the target, enter the following in the command-line prompt:
"%BREWMP_TOOLSET%\bin\ct" -p <target_desc> -g usb start <classID>
<target_desc> is only necessary if only one device is connected.
For more information on Connect Tool or using the Simulator, including creating targets, see the
Simulator Help section of the Brew MP Tools Reference.
Debugging
This section covers using Brew MP Debugger with the GDB command-line interface.
1. Use cdblauncher.exe to start Debugger on the target by navigating in a command-prompt to the
location of cdblauncher, %BREWMP_TOOLSET%\bin. The following is a sample command.
cdblauncher -device 1 -mod c_basicapp -app <ClassID>
This starts the Debugger server on the target, sends a request to start the Brew MP application with
the provided ClassID, and waits for the application module to load. When the application loads, it
stops at the module entry point as a result of hitting a breakpoint auto-inserted by Debugger. For
help using cdblauncher.exe, type the following in the location of cdblauncher:
cdblauncher -help
2. The next step is to connect to the device with GDB. GDB should be given the ELF file for the
module to be debugged as an argument. The following is a sample to enter in the command-prompt,
in the c_basicapp folder:
arm-none-eabi-gdb.exe RVCT22arm9_Debug\c_basicapp.elf
3. To connect GDB to the device, type the following in the GDB command-shell:
target remote :60891
It make take several seconds for GDB to connect to the device. When GDB connects to the device
it shows the application stopped at the module entry point (for example, AEEMod_Load for Brew
MP MOD files). After this, regular GDB commands can be used to debug the module, set any
breakpoints, and resume execution of the application.
Pending breakpoints can be set in modules yet to be loaded, such as in the following code example:
16 (gdb) br MyExt_DrawText
17 Function "MyExt_DrawText" not defined.
18 Make breakpoint pending on future shared library load? (y or [n]) y
The Debugger server on the device shuts down when the application being debugged ends or
when the debug session is terminated from the PC. Before connecting with GDB the next time, the
cdblauncher command needs to be run again. Debugger supports most GDB commands. Please see
GDB documentation for more information.
Appendix
The Appendix provides additional application development information on device compilers on page
11, and device setup on page 10.
Device setup
This topic discusses steps to prepare your device for working with Brew MP applications.
A Brew MP device needs to be put in Developer Mode prior to using Brew MP SDK Tools to load, run,
and test applications on a Brew MP device.
Note: Developer Mode (Gateway) is supported on Brew MP 1.0.2 devices. Brew MP 1.0.0 and some
1.0.1 devices do not support Developer Mode.
Developer Mode involves the following steps:
• Developer Mode Port Settings -- Enabling the port on the device (USB / Serial) so the tools can
connect. The method of using key sequence on the device is covered in this primer. For other
methods, see the Connect Tech Guide on the Brew MP website.
• Developer Mode device plug in and driver setup -- Physically connecting the device. Instructions for
installation PC drivers for the device are covered in this topic.
• Developer Mode Connect -- Establishing communication between the PC tools and device. This is
done using the Connection Manager dialog in Loader and/or Logger. See the Tools Reference for
more information.
• Developer Mode Enable -- Authorizing the device to run the developer's code and opening the
device to the tools. The legacy method is to copy a Test Signature to the device, which is discussed
in this document.
to "USB". Failure to do this will probably cause the phone to be unresponsive to all PC-based tools,
including QPST and QXDM.
Device compilers
This topic is a discussion of Brew MP device compiler options and their generated output.
Brew MP applications are run on the Brew MP Simulator using DLL/DDL1s. Brew MP applications run on
a device use a MOD/MOD1 file. The ARM compiler is used to generate these files for the ARM processor.
The following table shows the files used to run an application on the Simulator versus the files used to run
an application on a physical device
File type Required files for Required files for File source
Brew MP Simulator Brew MP device
Module Information yes yes Generated by Brew MP
File (MIF) Resource Manager
Brew MP Applet yes yes Generated by Brew MP
Resource File (BAR) Resource Manager
Dynamic Link Library yes n/a Compiled by Visual Studio or
(DLL/DLL1) Eclipse IDEs
Module File (MOD/ n/a yes Compiled by ARM Compiler
MOD1)
Test Signature File n/a yes Obtained from the device
(SIG) manufacturer
Locally-generated yes n/a Locally generated via the
ClassID contained in Resource Manager
MIF
Unique ClassID n/a yes Web-based Brew MP ClassID
included in MIF Generator
ARM Compilers
The following ARM compilers are compatible with Brew MP devices. This primer uses the RVCT 2.2
compiler.
• RealView Compilation Tools (RVCT) for Brew MP is based on the popular compiler, linker, and
assembler components of the ARM Developer Suite version, but are specifically designed to target
the Brew MP environment. Both the ARM Developer Suite and RVCT for Brew MP can be obtained
from the ARM website. The Brew MP Debugger (CDB) and Brew MP IDE Plugins are compatible
with RVCT 2.2.
• The ARM RealView Development Suite (RVDS) is a software development solution for creating
applications for ARM architecture.
• The CodeSourcery G++ compiler for Brew MP is a free, open-source compiler.
Note: The ARM compiler should be installed in a path that doesn't contain any spaces.
Troubleshooting
The makefile generated points to the ARM environment variable RVCT22BIN. Also ensure that the
ARMLMD_LICENSE_FILE environment variable is pointing to the correct location.