| | 1 | {{{#!html |
| | 2 | <div id="wikipage" class="trac-content"><p> |
| | 3 | </p><div class="wiki-toc"> |
| | 4 | <ol> |
| | 5 | <li> |
| | 6 | <a href="#QtforEmbedded">Qt for Embedded</a> |
| | 7 | <ol> |
| | 8 | <li> |
| | 9 | <a href="#InstructionsforHelloWorldQTE4.8.6onYocto1.7">Instructions for Hello World QTE 4.8.6 on Yocto 1.7</a> |
| | 10 | <ol> |
| | 11 | <li> |
| | 12 | <a href="#DownloadPre-BuiltQTEImageandSDK">Download Pre-Built QTE Image and SDK</a> |
| | 13 | </li> |
| | 14 | <li> |
| | 15 | <a href="#BuildingtheQTEImage">Building the QTE Image</a> |
| | 16 | </li> |
| | 17 | <li> |
| | 18 | <a href="#CreatingtheHelloWorldProgram">Creating the Hello World Program</a> |
| | 19 | </li> |
| | 20 | </ol> |
| | 21 | </li> |
| | 22 | </ol> |
| | 23 | </li> |
| | 24 | </ol> |
| | 25 | </div><p> |
| | 26 | </p> |
| | 27 | <h1 id="QtforEmbedded">Qt for Embedded</h1> |
| | 28 | <p> |
| | 29 | Qt for Embedded Linux is a C++ framework for GUI and application development for embedded devices. |
| | 30 | </p> |
| | 31 | <h2 id="InstructionsforHelloWorldQTE4.8.6onYocto1.7">Instructions for Hello World QTE 4.8.6 on Yocto 1.7</h2> |
| | 32 | <p> |
| | 33 | <strong>Note these instructions were made using Yocto 1.7 which may no longer be the latest</strong> |
| | 34 | </p> |
| | 35 | <h3 id="DownloadPre-BuiltQTEImageandSDK">Download Pre-Built QTE Image and SDK</h3> |
| | 36 | <p> |
| | 37 | Download the following files here: |
| | 38 | </p> |
| | 39 | <ul><li><a class="ext-link" href="http://blog.gateworks.com/?wpdmpro=gateworks-image-qte-ventana-tar-bz2"><span class="icon"></span>QTE rootfs tarball</a> - <a class="wiki" href="/wiki/Yocto/Building#InstallingonRemovablestorage:mSATAUSBuSDSD">SD Card flashing instructions here</a> |
| | 40 | </li><li><a class="ext-link" href="http://blog.gateworks.com/?wpdmpro=poky-glibc-x86_64-meta-toolchain-qte-cortexa9hf-vfp-neon-toolchain-qte-1-7-2-sh"><span class="icon"></span>QTE SDK File</a> |
| | 41 | </li></ul><h3 id="BuildingtheQTEImage">Building the QTE Image</h3> |
| | 42 | <p> |
| | 43 | The steps below first require building Yocto from source documented <a class="wiki" href="/wiki/Yocto/Building">here</a> |
| | 44 | </p> |
| | 45 | <p> |
| | 46 | Then, after building, to include QTE 4.8.6, we have modified a base Gateworks recipe file. |
| | 47 | </p> |
| | 48 | <p> |
| | 49 | Below are the lines we have added: |
| | 50 | </p> |
| | 51 | <pre class="wiki">inherit qt4e |
| | 52 | |
| | 53 | IMAGE_INSTALL += "${QT4EDEPENDS}" |
| | 54 | |
| | 55 | IMAGE_INSTALL += "\ |
| | 56 | qt-in-industrial-embedded-smarthome-e \ |
| | 57 | " |
| | 58 | </pre><ul><li>Create a copy of a Gateworks recipe file in /sources/meta-gateworks/recipes-core/images/ and call it gateworks-image-qte.bb (or download attached recipe file and place in /sources/meta-gateworks/recipes-core/images/) |
| | 59 | </li></ul><ul><li>Create Image and SDK |
| | 60 | <ul><li>Create qte supported image: <tt>bitbake gateworks-image-qte</tt> |
| | 61 | </li><li>Create SDK: <tt>bitbake -cpopulate_sdk gateworks-image-qte</tt> |
| | 62 | </li><li>Download SDK .sh file and follow <a class="wiki" href="/wiki/Yocto/SDK">SDK instructions</a> |
| | 63 | </li></ul></li></ul><h3 id="CreatingtheHelloWorldProgram">Creating the Hello World Program</h3> |
| | 64 | <ul><li>Create a new directory and place in it a main.cpp with example code |
| | 65 | <ul><li> |
| | 66 | <pre class="wiki">#include <QApplication> |
| | 67 | #include <QPushButton> |
| | 68 | #include <QWidget> |
| | 69 | |
| | 70 | int main(int argc, char **argv) |
| | 71 | { |
| | 72 | QApplication app (argc, argv); |
| | 73 | QPushButton button ("Hello world !"); |
| | 74 | button.showFullScreen(); |
| | 75 | |
| | 76 | return app.exec(); |
| | 77 | } |
| | 78 | |
| | 79 | </pre></li></ul></li><li>Use qmake to create a project file (creates .pro file named off directory you are in using the source files in the directory) |
| | 80 | <ul><li><tt>qmake -project</tt> |
| | 81 | </li></ul></li><li>Use qmake to create makefile using -spec (which uses the project file from the previous step and a mkspecs config directory from the SDK) |
| | 82 | <ul><li><tt>qmake -spec $SDKTARGETSYSROOT/usr/share/qtopia/mkspecs/qws/linux-arm-gnueabi-g++</tt> |
| | 83 | </li></ul></li><li>You must also tweak Makefile |
| | 84 | <ul><li>Comment out CC and CXX and STRIP |
| | 85 | </li><li>Set: <tt>LINK= $(CXX)</tt> |
| | 86 | </li><li>Modify AR line to say: <tt> arm-none-linux-gnueabi-ar cqs</tt> |
| | 87 | </li><li>The total and final lines that are changed in the Makefile: |
| | 88 | <pre class="wiki">#CC = arm-none-linux-gnueabi-gcc |
| | 89 | #CXX = arm-none-linux-gnueabi-g++ |
| | 90 | #STRIP = arm-none-linux-gnueabi-strip |
| | 91 | AR = arm-poky-linux-gnueabi-ar cqs |
| | 92 | LINK = $(CXX) |
| | 93 | </pre></li></ul></li><li>Run make |
| | 94 | <ul><li><tt>make</tt> |
| | 95 | </li><li>Find binary output |
| | 96 | <pre class="wiki">ryan@ryan-Inspiron-660:~/Downloads/helloworld$ file helloworld |
| | 97 | helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=34e0476f18f251ac85b72131957382f0bd00faeb, not stripped |
| | 98 | </pre></li></ul></li><li>Copy application to the Ventana board via a method like wget |
| | 99 | <ul><li>chmod the application to be executable |
| | 100 | </li></ul></li><li>Run the application |
| | 101 | <ul><li><tt> ./helloworld -qws </tt> |
| | 102 | </li></ul></li></ul |
| | 103 | }}} |