wiki:Yocto/qt

Version 1 (modified by trac, 7 years ago) ( diff )

--

Qt for Embedded

Qt for Embedded Linux is a C++ framework for GUI and application development for embedded devices.

Instructions for Hello World QTE 4.8.6 on Yocto 1.7

Note these instructions were made using Yocto 1.7 which may no longer be the latest

Download Pre-Built QTE Image and SDK

Download the following files here:

Building the QTE Image

The steps below first require building Yocto from source documented here

Then, after building, to include QTE 4.8.6, we have modified a base Gateworks recipe file.

Below are the lines we have added:

inherit qt4e

IMAGE_INSTALL += "${QT4EDEPENDS}" 

IMAGE_INSTALL += "\
qt-in-industrial-embedded-smarthome-e \
"
  • 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/)
  • Create Image and SDK
    • Create qte supported image: bitbake gateworks-image-qte
    • Create SDK: bitbake -cpopulate_sdk gateworks-image-qte
    • Download SDK .sh file and follow SDK instructions

Creating the Hello World Program

  • Create a new directory and place in it a main.cpp with example code
    • #include <QApplication>
      #include <QPushButton>
      #include <QWidget>
       
      int main(int argc, char **argv)
      {
       QApplication app (argc, argv);
       QPushButton button ("Hello world !");
       button.showFullScreen();
       
       return app.exec();
      }
      
      
  • Use qmake to create a project file (creates .pro file named off directory you are in using the source files in the directory)
    • qmake -project
  • Use qmake to create makefile using -spec (which uses the project file from the previous step and a mkspecs config directory from the SDK)
    • qmake -spec $SDKTARGETSYSROOT/usr/share/qtopia/mkspecs/qws/linux-arm-gnueabi-g++
  • You must also tweak Makefile
    • Comment out CC and CXX and STRIP
    • Set: LINK= $(CXX)
    • Modify AR line to say: arm-none-linux-gnueabi-ar cqs
    • The total and final lines that are changed in the Makefile:
      #CC            = arm-none-linux-gnueabi-gcc
      #CXX           = arm-none-linux-gnueabi-g++
      #STRIP         = arm-none-linux-gnueabi-strip
      AR            = arm-poky-linux-gnueabi-ar cqs
      LINK          = $(CXX)
      
  • Run make
    • make
    • Find binary output
      ryan@ryan-Inspiron-660:~/Downloads/helloworld$ file helloworld
      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
      
  • Copy application to the Ventana board via a method like wget
    • chmod the application to be executable
  • Run the application
    • ./helloworld -qws
  • </ul

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.