September 20, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Getting Started with WinARM for Qualcomm BREW

  • November 1, 2006
  • By Ray Rischpater
  • Send Email »
  • More Articles »

Setting Linker Options

Linker options are a little tricker because you need to use a linker script that Ward's helpfully crafted to ensure the proper ordering of all the object files in the project to create an ELF file that's palatable to the BREWelf2mod converter. His web page has an excellent discussion of what's necessary and why; the upshot is that the BREWelf2mod converter is very picky about the input ELF file, and if things aren't just right, it gets hopelessly confused and creates multi-megabyte module files that aren't likely to be executable anyway. Consequently, your linker command should look like this:

winarmbinarm-elf-ld.exe
   --script armelf.brew
   --emit-relocs
   --no-warn-mismatch
   -L winARMlibgccarm-elf4.1.1
   -lgcc
   -o "file.elf"
   AEEAppGen.o
   file.o

The first argument tells the linker to pull in the linker script, about which I'll say more in a moment. The second option is required, and tells the linker to output code relocation information; BREWelf2mod uses this information when creating the MOD file. The third is optional but a good idea, especially if you end up mixing ARM and Thumb code, and tells the linker not to warn about the different architectures being linked. Finally comes a list of what to link; the .L and .l options bring in the GCC library containing the application bootstrap glue, while the actual files being linked in this case are AEEAppGen.o and file.o to make the output file file.elf.

What happened to AEEModGen.o? If you've ever done any nosing around at the lowest levels of BREW development, you know how important this file is; it contains AEEMod_Load, the entry point for every application (and extension). Including AEEModGen.o is now the responsibility of the linker script, which also specifies the order of functions in the file (namely that AEEMod_Load must come first), and other details of the contents of the ELF file required by the BREWelf2mod utility.

In the make file with this article and most Qualcomm make files, check out the LINK_OBJS and LINK_CMD variables to configure the linker options.

Converting the ELF to a MOD

Converting the ELF file to a dynamic module is the purview of BREWelf2mod, and I've been successful doing this with two different versions of BREWelf2mod: the one included in the Microsoft Visual Studio Addins ZIP file I mentioned previously in this article, and the BREWelf2mod provided by Qualcomm dated 15 March 2004, a 52,248 byte executable.

Conclusion

In this article, I've shown you how to configure WinARM to compile C files for Qualcomm BREW in ARM architecture mode. With this knowledge and the resources at the end of this article, you should be able to modify your make file to build C++ files for ARM, or either C or C++ files for Thumb as well with just a few changes. There are many reasons you might choose WinARM, including compiler costs, the ability to debug using GDB on BREW 3.1.4 and later handsets, and the tool chain's support for function pointer tables and global and static variables (recently also supported by Qualcomm with the ARM compiler via a newer BREWelf2mod utility). Regardless of your reasons, though, its good to know there's another tool on the bench for building BREW applications.

Related Resources

About the Author

Ray Rischpater is the chief architect at Rocket Mobile, Inc., specializing in the design and development of messaging and information access applications for today's wireless devices. Ray Rischpater is the author of several books on software Development including eBay Application Development and Software Development for the QUALCOMM BREW Platform, both available from Apress, and is an active Amateur Radio operator. Contact Ray at kf6gpe@lothlorien.com.





Page 2 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel