Cross compile Qt for Raspberry Pi (OpenGL)
 Page :   [ 1 ]    [ 2 ]    [ 3 ]  

 

Back on Kubuntu Virtual Machine

 

Start the Qt installer running:

chmod +x qt-opensource-linux-x64-5.9.1.run
./qt-opensource-linux-x64-5.9.1.run

Press Next

Skip the account stuff

Accept default install location

Accept default intall options.

 

After the installer finishes it should launch Qt Creator.

We now need to configure a "Kit" for building for the Pi.

To do this we need to define/setup a Device, Compiler, Debugger, Qt Version and specify all those in a Kit.

 

Device

Go to Tools -> Options
Click the tab called "Devices"  (in the left column)
Click the "Add" button which opens the defice config Wizard
Choose "Generic Linux Device" and press "Start Wizard"
I used the following parameters

The Name to identify this configuration : Qt Pi 3
The device's host name or IP address    : 192.168.1.144
The username to log into this device    : pi
The authentication type                 : password
The user's password                     : xxxxxxx

 

Compiler

Go to Tools -> Options
Click the tab called "Build and Run"  (in the left column)
Select "Compilers"
Click "Add / GCC / C++"

Give it a name like
    "GCC (RPi 3)"

Set the compiler path to

    ~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++

the ABI should say "arm-linux-generic-elf-32bit"

 

Debugger

Go to Tools -> Options
Click the tab called "Build and Run"  (in the left column)
Select "Debuggers"

Click "Add" with a suitable name like "gdb (RPi 3)"

Set the path to
     ~/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gdb

 

Qt Version

Go to Tools -> Options
Click the tab called "Build and Run"  (in the left column)
Select "Qt Versions"

Check to see if any qmake location is set to "~/raspi/qt5/bin/qmake"
If not then click "Add" and add it in with a descriptive name like "Qt 5.9.1 RPi 3"

Kit

Go to Tools -> Options
Click the tab called "Build and Run"  (in the left column)
Select "Kits"

Click "Add" to make a kit with a descriptive name such as "Qt RPi 3"

Create it with the device, compiler, debugger and Qt version created previously

My settings are as follows:

Name             : QT Pi 3
File system name :
Device Type      : Generic Linux Device
Device           : Qt Pi 3
Sysroot          : ~/raspi/sysroot
compier C        : <no compiler>
Compiler C++     : GCC (Rpi 3)
Environment      : No changes to apply
Debugger         : gdb (Rpi 3)
Qt Version       : Qt 5.9.1 Rpi 3

Ignore rest of the options

 
When building and deploying I wanted to make sure all applications previously built were stopped before building and deploying anything else.  To do this :

Go to Tools -> Options
Click the tab called "Build and Run"  (in the left column)
Select "General"

For  the option called "Stop Applications before building" choose "All"

 

Load up one of the example apps in Qt Creator and build it.
Be sure to select the "Qt Rpi 3" kit when the configure project screen appears.
Build and run it.

It SHOULD be running and displayed on the Pi !!!! :)

 

Trying to supress output from Pi console

Put the following into /boot/config.txt

disable_splash=1
avoid_warnings=1

 Add this to the end of the line in /boot/cmdline.txt

quiet splash consoleblank=1 loglevel=0 logo.nologo vt.global_cursor_default=0 nocursor

Also in /boot/cmdline.txt change

console=tty1

to

console=tty3

 And do this

sudo systemctl disable getty@tty1

There's a lot of info out there that reference a script in init.d called "asplashscreen" which slaps some image into the framebuffer.  I use that script but instead run a Qt app that I name "launch_screen".  The app is a blank Qt Quick project which I simply added a background color to.  In the future I'll make it a bit nicer with some graphics and animation etc.

sudo pico -w /etc/init.d/asplashscreen.sh

add this to that file:

#! /bin/sh
do_start () {
/home/pi/launch_screen 1>/dev/null 2>/dev/null &
exit 0
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
exit 0
;;
*)
echo "Usage: asplashscreen.sh [start|stop]" >&2
exit 3
;;
esac

:

make it executable

sudo chmod +x /etc/init.d/asplashscreen.sh

I also kill that app after the application I auto run later is loaded.  See the next bit for the applicable bit of code in rc.local. (pkill launch_screen)

 

Make the stuff in /etc/rc.local a bit more quiet (for my reference)

The stuff I added into rc.local just above the "exit 0" in order to do the framebuffer stuff and to run an application when the device boots

is as follows.  It all redirects to /dev/null to make sure no junk is displayed on the screen when booting and running.

This will also kill the app loaded from asplashscreen.sh (see earlier)

dmesg --console-off

/home/pi/test_application 1>/dev/null 2>/dev/null &

/usr/bin/pkill launch_screen

 

 

 

 

 

 

 

 

 

(Page 3 of 3)