At the moment most of the buzz is probably around Qt5, but it is good to remember that Qt4 is still alive. While we are working to increase platform coverage on Qt5, there are still some platforms that are officially supported by Digia only with the Qt4 codebase. One of those platforms is Windows Embedded Compact 7. In this blog post I wanted to share with you a small tip that can bring you big performance benefits on Windows Embedded Compact 7.
Windows Embedded Compact 7 is tied to Visual Studio 2008, and if you are targeting an ARM based device you might have realized that the Visual Studio 2008 toolchain only supports ARMV4 and ARVM4i instruction sets for ARM architecture. Due to this limitation, Qt mkspecs for Windows Embedded Compact 7 defaults to ARMV4i instruction set. However, there also exists a version of the Visual Studio 2008 compiler which can generate code for more recent ARM instruction sets and CPU cores. This compiler is included in the Platform Builder (the tool used to generate Windows Embedded Compact 7 OS images and SDKs). If you have Platform Builder installed, you can build Qt for ARMv7 instruction set and also benefit from the more advanced floating point units of the latest CPU cores. To build Qt 4.8.x with ARMV7 instruction set and to use the latest floating point instructions supported by ARM you can do the following:
In the mkspec you are using for WEC7 ARM build, change the value of CE_ARCH variable from armv4i to armv7, and add the following code block there:
QMAKE_CFLAGS += -QRarch7 -arch:VFPv3-D32 -QRfpe-
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
Then make sure that you have the cl.exe from platform builder (c:\WINCE700\SDK\BIN\i386\ARM) in your path before visual studio 2008, and just reconfigure and build Qt and your Qt application. That’s it – now just enjoy the better performance!
For more detailed information about the different Visual Studio 2008 compiler versions, and the options used for QMAKE_CFLAGS, please check the paper written by Adeneo Embedded. With the upcoming Windows Embedded 2013, Microsoft has also updated the Windows Embedded Compact toolchain to Visual Studio 2012.