Changes between Initial Version and Version 1 of Yocto/qt

10/22/2017 05:28:45 AM (5 years ago)



  • Yocto/qt

    v1 v1  
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     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>
     27<h1 id="QtforEmbedded">Qt for Embedded</h1>
     29Qt for Embedded Linux is a C++ framework for GUI and application development for embedded devices.
     31<h2 id="InstructionsforHelloWorldQTE4.8.6onYocto1.7">Instructions for Hello World QTE 4.8.6 on Yocto 1.7</h2>
     33<strong>Note these instructions were made using Yocto 1.7 which may no longer be the latest</strong>
     35<h3 id="DownloadPre-BuiltQTEImageandSDK">Download Pre-Built QTE Image and SDK</h3>
     37Download the following files here:
     39<ul><li><a class="ext-link" href=""><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=""><span class="icon">​</span>QTE SDK File</a>
     41</li></ul><h3 id="BuildingtheQTEImage">Building the QTE Image</h3>
     43The steps below first require building Yocto from source documented <a class="wiki" href="/wiki/Yocto/Building">here</a>
     46Then, after building, to include QTE 4.8.6, we have modified a base Gateworks recipe file.
     49Below are the lines we have added:
     51<pre class="wiki">inherit qt4e
     55IMAGE_INSTALL += "\
     56qt-in-industrial-embedded-smarthome-e \
     58</pre><ul><li>Create a copy of a Gateworks recipe file in /sources/meta-gateworks/recipes-core/images/ and call it (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
     66<pre class="wiki">#include &lt;QApplication&gt;
     67#include &lt;QPushButton&gt;
     68#include &lt;QWidget&gt;
     70int main(int argc, char **argv)
     72 QApplication app (argc, argv);
     73 QPushButton button ("Hello world !");
     74 button.showFullScreen();
     76 return app.exec();
     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
     91AR            = arm-poky-linux-gnueabi-ar cqs
     92LINK          = $(CXX)
     93</pre></li></ul></li><li>Run make
     95</li><li>Find binary output
     96<pre class="wiki">ryan@ryan-Inspiron-660:~/Downloads/helloworld$ file helloworld
     97helloworld: 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>