Generating QUALCOMM BREW™ Mod Files: Configuring GNU GCC for ARM
May 2004 by Lauren E. Darcey
This article describes the steps required to create a GCC for ARM installation along with everything else needed to compile to a mod file for loading onto a BREW™ handset.
This article assumes you have a valid BREW™ application which works in an emulator. You've downloaded the appropriate BREW SDKs (1.1 or later for these tools), and you've got the appropriate developer-enabled handset at your disposal. Check the OS/installation prerequsites for more information - most of the installs will tell you if you're not running the appropriate software.
Here are the packages you will need to download and install (in order). This process may take about half an hour - with a good net connection for the downloads. You should be able to take all the defaults of the installs - and beware of changing the installation directories to anything containing spaces (this can often caused troubles later on). It is a good idea to back up your data so you won't need to contact a data recovery service.
GCC ARM Compiler (GNU Cross Compiler for ARM) from SourceForge
- GNUDE Complete 1.2
- BinUtils 1.3 Component Upgrade
- GDB 1.3 Component Upgrade
QUALCOMM BREW™ Utilities and Support
Configuration - Environment Variables
You will need to add two new system environment variables: GCCLIBPATH and GCCHOME. The GCCHOME environment variable should point to location of the GCC cross compiler, e.g. C:\gnude. The GCCLIBPATH environment variable should point to location of libgcc.a, e.g. C:\gnude\lib\gcc-lib\arm-elf\3.3.1.
Also verify that the other environment variables have been set appropriately by the various installers. The BREWADDINS environment variable should point to the location of BREW™ Addins. The BREWDIR environment variable should point to the location of BREW™ SDK you wish to compile with (2.1.0 vs 3.0, etc.). The PATH environment variable must also contain the location of GCC (GCCHOME), (GCCHOME)\arm-elf\bin, and (GCCHOME)\lib\gcc-lib\arm-elf\3.3.1 or whichever version of GCC is installed. You'll also need (GCCHOME)\bin.
Create Your Makefile
Load up your application in Visual Studio, and you'll notice the BREW™ Addin toolbar now shows up. There is a button which you can now press which will generate a makefile for the GNU Cross Compiler. Click this button to generate your makefile.
Launch the Visual Studio .NET 2003 Command Prompt (from the VS.NET Tools submenu) and navigate to your makefile which should be in the same directory as your project files. You can now run the compile: nmake -f yourMakefile.mak.
As you are now using a different compiler, it is not uncommon to have this compiler catch programming errors/warnings that were overlooked by the Visual Studio C compiler. Fix any warnings or errors needed for a good compile. You may need to edit the makefile if you have additional include files (shared directories and such - by changing the APP_INCLUDES line to include more directories, e.g.
APP_INCLUDES = -I "$(BREWDIR)\inc" -I "..\..\Shared"
Once you're compiled successfully, you've got yourself a mod file that you can load onto a handset.