by Bernth Andersson, Technical Consulting Engineer and
Max Domeika, Technical Consulting Engineer
One of the merits of the Ultra Mobile Device (UMD) is the large degree of compatibility with existing software that targets the notebook and desktop PC market segments. In addition, the need for high performance on applications targeting UMD provides motivation to use a high performance C++ compiler for compilation. This document shows you how to use the Intel® C++ Compiler 9.1 for Windows* to build programs running on a UMD device.
- This document uses the convention of placing '<' (less than) and '>' (greater than) signs around menu options. For example, directions specifying you to select <File><New><Projects> means to click the File menu on the screen, click the New selection and choose Projects.
- SSE3 – Streaming SIMD Extensions 3 are a set of instructions supported in later generation IA-32 architectures and offer high performance floating point and prefetch capabilities.
It is assumed that you have access to an UMD device. This document employs the Samsung Q1 UMPCi in all the examples. The high level features of the device are as follows:
- Intel® Celeron® processor, 900MHz ULV
- 40GB hard drive
- 512 MB DDR2 main memory
- 7" touch screen (800 x 480 resolution)
- Several I/O ports (2x USB, VGA, etc.)
- The device is running an extended version of Microsoft Windows* XP.
As a development host environment an IBM ThinkPad* T41p was used with Microsoft Visual Studio 6.0 with Service pack 6 and the Intel® C++ Compiler 9.1 for Windows* installed. In addition the Microsoft Tablet PC Platform SDK was installed on the laptop. The two devices were connected via a local area network (LAN) with the Samsung Q1 on a fixed IP address. The Intel® C++ Compiler was installed on the development host using the default installation options.
Building and Running "Hello World"
- Open Microsoft Visual Studio and select <File><New><Projects>. Choose a Win32 Application and give the project a name. Figure 1 shows an example using the project name, UMPC_remote_test. You may want to change the location to your own test directory. When ready press OK.
- Select a typical “Hello World Application” as shown in Figure 2 and press Finish.
- A default project similar to what is displayed in Figure 3 is generated. Press F7 to build the project. You should not expect any errors or warnings. An executable file (exe file) is generated and can be tested on the host laptop. Run the executable and as expected a window with the text “Hello World” is generated.
- Transfer to UMD device. The sample application can be transferred to the UMD device via LAN. The method used was to share the C: drive on the Samsung Q1 device with the laptop. As an alternative you can use remote desktop.
- Run the application on the UMD device. Use the UMD stylus and double click on the exe file and the program will start. The menu item <help> <about> shows the dialogue box depicted in Figure 4.
Application Employing Unique UMD Functionality
The first example (“Hello World”) does not use any specific functionality either available on the Samsung Q1 device or in the Intel® C++ Compiler. The Microsoft Tablet PC Platform SDK does contain several sample programs illustrating the use of specific functionality available on a UMD – for example handwriting recognition.
- Build the TPCInfo program. Open the Samples and Source Code section in the Microsoft Tablet PC Platform SDK. Select the TPCInfo program by clicking on the ‘Open Project’ button. Figure 5 displays a sample screen shot. A normal C++ project is opened in the Visual Studio. No changes are needed for this project – press F7 to build.
- Transfer to UMD device. Use the LAN connection to transfer the exe file over to the UMD. A shared folder between the UMD and the laptop was used. Use copy and paste or drag the exe file over to the UMD.
- Run the Application. Double click on the exe file on your UMD device and the window depicted in Figure 6 is displayed.
- Run the same application on your laptop and you will see a dialogue box similar to Figure 7. The program correctly indicates that there is no handwriting software installed on the laptop.
Application Employing Compiler Run Time Library
The Intel® C++ Compiler may generate executable files that employ the compiler’s dynamic runtime libraries. These libraries need to be available on the UMD device for the generated executable to run correctly. For example, Figure 8 shows a Console Application which computes the value of pi. The major loop in the program is parallelized with help of the OpenMP* capabilities in the Intel® C++ Compiler. A #pragma omp is added just in front of the for-loop in the code.
- Build the Application: Open a new project in the Visual Studio. Select ‘Win32 Console Application’ in the project window and ‘a simple application’ in the console application window. You should now have an almost empty project as displayed in Figure 9. Add the code to compute pi to the console application. When you are ready press F7 and correct any errors. Before the link phase a comment about the #pragma omp similar to Figure 10 is displayed. This comment indicates that the compiler did manage to parallelize the specified loop. You should now have an exe file.
- Transfer the application to the UMD device: Use the LAN connection to transfer the exe file over to the UMD. A shared folder between the UMD and the laptop was used. Use copy and paste or drag the exe file over to the UMD.
- Run the Application: Double click on the exe file on the UMD device. An error is displayed indicating that the application could not be started because a DLL (libguide40.dll) was missing. This is depicted in Figure 11.
When the application was parallelized it became dependent on the libguide40.dll run time library hence it will not run unless it has access to this DLL.
You can copy this DLL (from <compiler install directory>compiler9.1IA32lib) over to a folder of your choice on the UMD. For example – in our sample we used C:Program FilesCommon FilesSystem. Unless you have copied the required DLL into the same directory as the exe file you need to make sure that the environment variable (PATH) contains the full path name to the directory selected. Execute the application and a screen similar to Figure 12 is displayed.
Hint: How can you find out what DLLs your application is dependent on? There is a utility called ‘Dependency Walker’ – part of the Microsoft Visual Studio Tools. This utility will list the dependencies of an application. Figure 13 displays a screenshot of the utility.
The file ‘credist.txt’ contains a list of files which can be redistributed with your application built with the Intel® C++ Compiler. This file is found in <compiler install directory>compilerC++9.1Docs.
The Intel® C++ Compiler 9.1 for Windows* supports instruction sets available on newer Intel® IA-32 architectures. For example, the UMD device employed in this paper possesses an Intel® Celeron® processor which does not support SSE3. The developer should avoid using options that generate SSE3 instructions that will not execute correctly on a given UMD device. Please refer to the fo llowing table:
|SSE3||-QxP, -fast||If the processor executes an instruction that it does not support, a runtime exception occurs and the application terminates.|
Installing the Intel® C++ Compiler 9.1 for Windows* on a UMD device
The Samsung Q1 device allows you to connect an external DVD drive to the device. This is recommended if you would like to install the Microsoft Visual Studio and Intel® C++ Compiler on such a device. It has been verified that it works – just follow the installation guide. However you should be aware that the limited screen size makes it cumbersome to use as a development environment.
You can use the Intel® C++ Compiler to develop applications for a UMD device. As this is a typical embedded cross development environment you need to be aware that if your application is dependent on any run-time libraries these must be transferred over to the device for the application to run properly. Also be aware of the processor used in the UMD device to make sure the compiler options specified generates code that is compatible.
About the Authors
Bernth Andersson is a staff software engineer in the Developer Products Division at Intel, creating software tools targeting the Intel Architecture market. Over the past 20 years, Bernth has held several positions at Intel in software and architecture support and training. Bernth currently provides technical consulting for a variety of products targeting Embedded Intel Architecture. Bernth earned a BS in Mathematics from the University of Umea (Sweden).
Max Domeika is a senior staff software engineer in the Developer Products Division at Intel, creating software tools targeting the Intel Architecture market. Over the past 10 years, Max has held several positions at Intel in compiler development which include project lead for the C++ front end and developer on the optimizer and the IA32 code generator. Max currently provides technical consulting for a variety of products targeting Embedded Intel Architecture. Max also provides software tools training serving as an instructor with the Intel Academic Community. Max earned a BS in Computer Science from the University of Puget Sound, an MS in Computer Science from Clemson University, and a MS in Management in Science & Technology from Oregon Graduate Institute.