Download - Development with Qt for Windows CE
![Page 1: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/1.jpg)
Development with Qtfor Windows CE
10/11/09
![Page 2: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/2.jpg)
Agenda
• Introduction to Windows CE
• How to build Qt for Windows CE
• Windows CE 5 memory model
• Ways to more memory
• Demonstration
![Page 3: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/3.jpg)
What is Windows CE?
• OS for embedded devices
• not derived from desktop Windows
• monolithic kernel
• highly configurable using Platform Builder
• runs on x86, ARM, SH4 and MIPS
3
![Page 4: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/4.jpg)
The world of Windows CE
• Windows CE 5.2– Windows mobile 5, 6, 6.1, 6.5
• SmartPhone (standard)• PocketPC (classic / professional)
• Windows CE 6.0 R2– Microsoft Auto– Windows mobile 7?
4
![Page 5: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/5.jpg)
Desktop Windows vs. Windows CE
• UTF16 string representation
• No NTFS support → no file security model• No file drives• No current directory• Only 32 processes• Only 32 MB memory per process (CE < 6)
5
![Page 6: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/6.jpg)
Desktop Windows vs. Windows CE
• Number of threads limited to system resources– no more free memory → no more threads
• API is a Win32 API subset– no *A functions– no asynchronous file I/O or network– incomplete standard C libs
6
![Page 7: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/7.jpg)
Desktop Windows vs. Windows CE
• Situation gets better with Windows CE 6– Up to 1 GB process memory– More than 32K processes– Improved system call performance– New product name:
Windows embedded CE
7
![Page 8: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/8.jpg)
What do you need for development?
• Visual Studio 2005 Standard or
Visual Studio 2008 Professional
• Windows CE SDK for your device
• Qt for Windows CE from qt.nokia.com
• Perl for using out-of-source builds
• Qt Visual Studio Add-in from qt.nokia.com
8
![Page 9: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/9.jpg)
Development work flow
• Prototype on Desktop Windows
• Switch to a Windows CE Qt build
• Build, deploy and run
– Not everybody in the team needs a
Windows CE development environment.
9
![Page 10: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/10.jpg)
How to build Qt for Windows CE?
• Use shadow builds.
C:\Qt\4.6.0\qtsource\win32\wincewm60professional\wince50standard-x86
10
![Page 11: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/11.jpg)
How to build Qt for Windows CE?
Open a Visual Studio command prompt.Add C:\Qt\4.6.0\wincewm60professional\bin to PATH.
cd C:\Qt\4.6.0\wincewm60professional.\qtsources\configure -xplatform wincewm60professional-msvc2008 -signature mysignature.pfx
Creates Qt configuration and builds the host tools:• qmake, moc, uic, rcc• setcepaths / checksdk• cetest (if Remote API is in INCLUDE, LIBS)
11
![Page 12: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/12.jpg)
How to build Qt for Windows CE?
...only two steps left...
setcepaths wincewm60professional-msvc2008
nmake
12
![Page 13: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/13.jpg)
Qt DLL sizes
Qt library Size in MB
QtCore4.dll 1.67 MB
QtGui4.dll 5.67 MB
QtNetwork4.dll 0.53 MB
QtWebKit4.dll 6.86 MB
qjpeg4.dll 0.12 MB
sum 14.85 MB
Library sizes of Qt 4.5.2 on Windows mobile 6 professional:
13
![Page 14: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/14.jpg)
The Windows CE 5.0 memory model
Slot 0
Slot 1
Slot 2
Slot 3
current process
bundled DLLs
Process 1
Process 2
Slot 32 Process 32
...
large memory area
Slot 63 Resource only DLLs • only 32 MB per slot• Application stack & heap grow from slot's bottom• DLLs are loaded into process slots top-down• DLLs are guaranteed to have the same address in every slot
14
![Page 15: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/15.jpg)
The Windows CE 5.0 memory model
Bundled DLLs
Load address for new DLLs
15
![Page 16: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/16.jpg)
The Windows CE 5.0 memory model
Qt DLLs
Stack & heap
16
![Page 17: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/17.jpg)
Ways to more Virtual Memory
• Reduce the DLL size• Use static linking• Load small DLLs first• Switch to Windows mobile 6.1
17
![Page 18: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/18.jpg)
Reducing Qt DLL sizes
• Exclude the features you don't need• “feature” = set of classes (e.g.
GraphicsView)• define QT_NO_FEATURENAMEconfigure -D QT_NO_FEATURENAME
• add this define to your application .pro fileDEFINES += QT_NO_FEATURENAME
• Tedious stuff! Is there no easier way to do this?
18
![Page 19: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/19.jpg)
Reducing Qt DLL sizes using qconfig
![Page 20: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/20.jpg)
Reducing Qt DLL sizes using qconfig
In your desktop Windows Qt build directory:
md tools\qconfigcd tools\qconfigqmake ..\..\..\tools\qconfig\qconfig.pronmake releaserelease\qconfig.exe
20
![Page 21: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/21.jpg)
Reducing Qt DLL sizes using qconfig
Good candiates for exclusion:
• Standard dialogs (color, font, input, wizard, …)
• Convenience widgets (QCalendarWidget, ...)
• Clipboard, drag and drop, shortcuts
• QtConcurrent, FTP, QSystemTrayIcon
• GraphicsView for QWidget only applications
• MDI
21
![Page 22: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/22.jpg)
Reducing Qt DLL sizes using qconfig
• Open the features description file in
src\corelib\global\qfeatures.txt• Unselect unwanted features
• Save the result in
src\corelib\global\qconfig-myfeatures.h• Reconfigure Qt
configure -qconfig myfeatures ...
22
![Page 23: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/23.jpg)
Reducing Qt DLL sizes
standard
small
minimal
0 1 2 3 4 5 6
1.67
1.67
1.42
5.67
4.18
2.43
QtCoreQtGui
23
![Page 24: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/24.jpg)
Accessing the Large Memory Area
• just 32 MB? Are you serious?• there's more behind slot 32• use memory mapped files• use the VirtualAlloc API
24
![Page 25: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/25.jpg)
Accessing the Large Memory Area
Using memory mapped files:• acquire memory at 64 K boundaries QFile memfile("myfile.bin"); memfile.open(QIODevice::ReadWrite); memfile.resize(1024*1024*2); uchar* buf = memfile.map(0, 1024*1024*2); ... memfile.unmap(buf); memfile.remove();
25
![Page 26: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/26.jpg)
Accessing the Large Memory Area
Using VirtualAlloc:• Reserve memory at 64 K boundaries or commit reserved memory at 4 K boundaries
void* ptrBase = VirtualAlloc(0, dwSize, MEM_RESERVE, PAGE_NOACCESS);buffer = VirtualAlloc(ptrBase, dwSize, MEM_COMMIT, PAGE_READWRITE);...VirtualFree(ptr, dwSize, MEM_DECOMMIT);VirtualFree(ptr, 0, MEM_RELEASE);
26
![Page 27: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/27.jpg)
Demonstration
![Page 28: Development with Qt for Windows CE](https://reader033.vdocument.in/reader033/viewer/2022042518/5551d8d3b4c905c2388b52e9/html5/thumbnails/28.jpg)
Questions and Answers