Qt development on A20

Started by toxivirus_jon, February 13, 2014, 11:20:49 AM

Previous topic - Next topic

toxivirus_jon

Hi,

looking for install Qt Creator on A20, and develop app on my linux laptop, cross compiling and run on A20.
But I have no info,

Any suggest ?

Thanks

John

ikozic

Hi John,

I'm in a similar problem - but it seems that there are no out-of-the-box solutions for A20, so we should configure and compile Qt for it. The closest topic I have found is at:

http://nickguthrie.com/embedd_gui/doc/

However, I haven't managed so far to get it working the same way - something seems to be off with the cLib on the Debian rootfs that we all use. I've also tried compiling it against ArchLinux rootfs and it gets much farther, but still has some issues and doesn't compile completely.

I'm currently doing some other mods to the kernel and I'll start the work on the Qt next week or so, so if you get somewhere with the link I've sent, please post back - as I said, I had very limited success with it.

Also a tip - I'm pretty sure tslib is not really needed, as touchscreen can work with normal Linux input mouse, so you can discard it.

ikozic

I've mostly managed to figure out what's wrong. So, basically, we all use arm-linux-gnueabihf- set of compiler/linker. A dependency to this is libc6 armhf package, but since I'm using Ubuntu 12.04, libc6 is set to 2.15. I'm not really sure whether gcc-4.6 has issues with libc6 2.13 or qt somehow pulls the 2.15 libraries from the libc6 package, but this 0.02 offset in libc6 versions on the host and rootfs is making a lot of compiler errors (I dare say untrackable errors).

Either way, it seems that you should either build with Debian on host for Debian rootfs, or build with Ubuntu on host for Ubuntu rootfs. A bit of a drag really, but I cannot find a way to successfully cross compile qt for Debian rootfs by using Ubuntu host, as libc6 is off.

I don't have a PC with a working Debian distro, but when I compile qt (tried 4.7, 4.8 and 5.2) linked against host's cross-compiled armhf libc6 (so 2.15), it compiles normally, but it'll not run on Debian rootfs as it requires libc6 2.15.

If someone finds a way for this to work, I would really like to hear about it.

codifies

just a thought... why not compile on the actual board itself, especially if you install rootfs on sata and put it on a decent display its quite capable little machine...

ikozic

Was already doing it when you wrote your post :)

However, even though it compiled, there are setbacks:
1. Compilation takes forever. Especially with my NFS setup - I basically block both my host and my target for a few hours. I guess it would be much faster with a SATA setup.
2. Support libraries and qmake are only on the target. I'm quite new with Qt, but I guess you will not be able to simply use Qt Creator on host, since you don't have cross qmake.

Also good thing to note:
I have a rev. E Olinuxino-A20-Micro. I'm pretty sure that something is off with the uSD-card slot, since SD-card gets garbled every time I don't use poweroff. It sometimes happens that my FAT partition gets messed up before I even start the kernel, just because I'm power-cycling it (or pressing reset). I was also power cycling several other boards in u-boot and this was never happening. It came to the point where I had to rewrite the SD-card every time my target froze (quite often in development ;) ), so I gave up on the SD-card - I only use it for u-boot (which still gets messed-up once or twice in 2 weeks).

codifies

I've found SD cards too be *very* flaky in sudden power loss situations... (at least on other embedded platforms)

Personally I only use a FAT32 boot partition on micro SD - with root on sata, the boot partition is not in fstab and is never auto mounted...

ikozic

If anyone is interested, I have successfully compiled both Qt 4.8.5 and Qt 5.2.1 for A20. It's actually not that difficult. Regarding the issues with libc6 - just upgrade libc6 in debian rootfs (via apt-get) - I've used instructions from the following link:

http://stackoverflow.com/questions/10863613/how-to-upgrade-glibc-from-version-2-13-to-2-15-on-debian

Works like a charm - you'll end up with libc6 2.18 (which is excellent, because my Ubuntu 12.04 has it at 2.15).
I used the instructions on how to compile from the above link. The libraries are ALWAYS pulled from the cross compiler that you have installed (hence cross libc6 is the same version as your host's libc6).

Once it's compiled and ready, brace yourself for some real issues :)

I'm currently trying to modify Qt's display driver in order to use layers...

srxa

#7
I have crosscompiled Qt5.2.1 and 5.3.0 alfa,on ubuntu x64, now i am ready for beta. Actually, it is not easy process to do, but when you catch everything it is pretty straight forward afterwards. I need eglfs option, so I did not try it yet with some window server, maybe i will compile QtWayland plugin if i need to, but for now, i am working on EglfsHooks for Qt, because i need dual monitor support and Qt does not provide it out of the box,at least for eglfs, so i must edit Qt source and make it work for my project. Eglfs also need some patches to work on Mali 400, but now it performs very well. QtCinematicExperience demo gives me at least 85 fps in 1280X720. If you have any questions or issues installing it, I am glad to help. maybe i will write some short tutorial here if i can catch some time ;)
Also, i use little modified kernel, because official one supports Mali r3p0 drivers, and performance are doubled with latest r3p2..

junetec

Where I can find a step by step to install qt in the A20?


ikozic

Quote from: srxa on March 25, 2014, 02:38:32 PM
I have crosscompiled Qt5.2.1 and 5.3.0 alfa,on ubuntu x64, now i am ready for beta. Actually, it is not easy process to do, but when you catch everything it is pretty straight forward afterwards. I need eglfs option, so I did not try it yet with some window server, maybe i will compile QtWayland plugin if i need to, but for now, i am working on EglfsHooks for Qt, because i need dual monitor support and Qt does not provide it out of the box,at least for eglfs, so i must edit Qt source and make it work for my project. Eglfs also need some patches to work on Mali 400, but now it performs very well. QtCinematicExperience demo gives me at least 85 fps in 1280X720. If you have any questions or issues installing it, I am glad to help. maybe i will write some short tutorial here if i can catch some time ;)
Also, i use little modified kernel, because official one supports Mali r3p0 drivers, and performance are doubled with latest r3p2..

Well nice :) My problem with Qt is that it has a rather slow interface to display when using standard display driver. So now I'm modifying Qt's linux fb driver to use /dev/disp instead of the /dev/fb. Actually, the problem is in Allwinner for doing such a dumb display interface... On a normal display driver there would be a separate /dev/fb for each overlay.

@junetec:
Regarding a step-by-step guide - this is difficult to find. Most of the stuff is in the link I've provided in an earlier post (nick gurthie), but in case you're running anything newer than Debian 7 on host, you'll have issues with the libc6, which are solved if you upgrade it to anything higher than you have on host - you'll find the info on that in the second link I've provided in this thread.

srxa

@ikozic

You don't need to do that, actually they use virtual frame buffers, just edit .fex file and under [disp_init] edit fb0_framebuffer_num to 4. Now it is set for double buffering with 2. But consider to use eglfs with Qt instead of linuxfb, because it is much faster and you will have much more options in Qt, including all OpenGL es2 stuff. For now , i am using eglfs for first display, and for other I start another Qt executable with option -platform linuxfb:fb=/dev/fb1, but i would like to use eglfs on both screens, and i can do this by editing EglfsHooks for Mali 400. You did install Qt with -eglfs -opengl es2 option, didn't you?

Welshman

#11
I have compiled QT for A10 and A13 Olinuxino boards

The linked guide above works for these

But I would expect the Qmake config file to be slightly different

can somebody post the contents of their Qmake.conf for A20 


Thanks

here is the qmake.conf for A13

A20 is a cortex A7 for the first difference, anything else to take care of

#
# qmake configuration for building with arm-linux-g++
#
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabihf-gcc -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt
QMAKE_CXX               = arm-linux-gnueabihf-g++ -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt
QMAKE_LINK              = arm-linux-gnueabihf-g++ -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++ -mcpu=cortex-a8 -mtune=cortex-a8 -O0 -mfpu=neon -lrt

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
QMAKE_STRIP             = arm-linux-gnueabihf-strip
QMAKE_RANLIB            = arm-linux-gnueabihf-ranlib

# tslib
QMAKE_INCDIR  += /usr/local/tslib/include
QMAKE_LIBDIR  += /usr/local/tslib/lib
QMAKE_LFLAGS += -Wl,-rpath-link=/usr/local/tslib/lib

load(qt_config)


ikozic

Quote from: srxa on March 26, 2014, 01:14:11 AM
@ikozic

You don't need to do that, actually they use virtual frame buffers, just edit .fex file and under [disp_init] edit fb0_framebuffer_num to 4. Now it is set for double buffering with 2. But consider to use eglfs with Qt instead of linuxfb, because it is much faster and you will have much more options in Qt, including all OpenGL es2 stuff. For now , i am using eglfs for first display, and for other I start another Qt executable with option -platform linuxfb:fb=/dev/fb1, but i would like to use eglfs on both screens, and i can do this by editing EglfsHooks for Mali 400. You did install Qt with -eglfs -opengl es2 option, didn't you?

For some reason, I'm not getting e-mails when someone replies to the topic - I have to check my settings, so sorry for late reply.

Anyway, interesting - I have made Layers work with a modified driver, although now I am quite curious about this virtual fb stuff. Will try it out in an hour or so and post back. Regarding OpenGL - no, I didn't compile it with OpenGL - not even sure what I need for it, as I've never worked with OpenGL before - I'm just guessing that I should probably load Mali drivers before I start the App on the target, and also point to the correct Mali libs when configuring Qt. Will try it out as well, especially since I don't need GUI on second screen (just video stream).

Regarding qmake.conf - I'll post mine, just give me an hour to have something to eat first :)

ikozic

Qmake.conf that I've been using:

Qt5 (5.2.1) - taken from beagleboard and modified a bit:
#-----------------------------------------------------------------------------------------------------
#
# qmake configuration for the BeagleBoard and BeagleBoard xM boards
# http://beagleboard.org/

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental gdb_dwarf_index
QMAKE_INCREMENTAL_STYLE = sublib

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)

load(device_config)

#QMAKE_INCDIR            = $$[QT_SYSROOT]/usr/include
#QMAKE_LIBDIR            = $$[QT_SYSROOT]/usr/lib

QT_QPA_DEFAULT_PLATFORM = eglfs

# modifications to g++.conf
QMAKE_CC                = $${CROSS_COMPILE}gcc
QMAKE_CXX               = $${CROSS_COMPILE}g++
QMAKE_LINK              = $${QMAKE_CXX}
QMAKE_LINK_SHLIB        = $${QMAKE_CXX}

# modifications to linux.conf
QMAKE_AR                = $${CROSS_COMPILE}ar cqs
QMAKE_OBJCOPY           = $${CROSS_COMPILE}objcopy
QMAKE_NM                = $${CROSS_COMPILE}nm -P
QMAKE_STRIP             = $${CROSS_COMPILE}strip

COMPILER_FLAGS          = -march=armv7-a -mtune=cortex-a7 -mfpu=neon

#modifications to gcc-base.conf
QMAKE_CFLAGS           += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS         += $${COMPILER_FLAGS}
QMAKE_CXXFLAGS_RELEASE += -O3

QMAKE_LIBS             += -lrt -lpthread -ldl

# Extra stuff (OpenGL, DirectFB, ...)
QMAKE_INCDIR_EGL        = $$[QT_SYSROOT]/usr/include
QMAKE_LIBDIR_EGL        = $$[QT_SYSROOT]/usr/lib
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
QMAKE_LIBDIR_OPENGL_ES2 = $${QMAKE_LIBDIR_EGL}
QMAKE_INCDIR_OPENVG     = $${QMAKE_INCDIR_EGL}
QMAKE_LIBDIR_OPENVG     = $${QMAKE_LIBDIR_EGL}

QMAKE_LIBS_EGL          = -lEGL -lIMGegl -lsrv_um
QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 $${QMAKE_LIBS_EGL}
QMAKE_LIBS_OPENVG       = -lOpenVG $${QMAKE_LIBS_EGL}

# Sanity check
#deviceSanityCheckCompiler()

load(qt_config)
#-----------------------------------------------------------------------------------------------------

Qt4 (4.8.5) - modified arm-linux-g++:
#-----------------------------------------------------------------------------------------------------
#
# qmake configuration for building with arm-linux-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabihf-gcc -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon
QMAKE_CXX               = arm-linux-gnueabihf-g++ -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon
QMAKE_LINK              = arm-linux-gnueabihf-g++ -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++ -mcpu=cortex-a7 -mtune=cortex-a7 -O0 -mfpu=neon

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
QMAKE_STRIP             = arm-linux-gnueabihf-strip
QMAKE_RANLIB            = arm-linux-gnueabihf-ranlib

# modifications to gcc-base.conf
QMAKE_LIBS             += -lrt

load(qt_config)
#-----------------------------------------------------------------------------------------------------

Bare in mind that I have Ubuntu 12.04 LTS with gcc 4.6, which includes its own libc6 (2.15) and all the other necessary libs. This is why I haven't included anything from the actual rootfs. In fact I did try, but it wouldn't compile correctly.

ikozic

Quote from: srxa on March 26, 2014, 01:14:11 AM
@ikozic

You don't need to do that, actually they use virtual frame buffers, just edit .fex file and under [disp_init] edit fb0_framebuffer_num to 4. Now it is set for double buffering with 2. But consider to use eglfs with Qt instead of linuxfb, because it is much faster and you will have much more options in Qt, including all OpenGL es2 stuff. For now , i am using eglfs for first display, and for other I start another Qt executable with option -platform linuxfb:fb=/dev/fb1, but i would like to use eglfs on both screens, and i can do this by editing EglfsHooks for Mali 400. You did install Qt with -eglfs -opengl es2 option, didn't you?

Ok, one more reply, since you've put a bug in my head :)

Framebuffer:
Changed fb0_framebuffer_num to 4, but don't really know how to proceed. My solution opens a different layer only by using /dev/disp and only writes to this layer - it's same like normal framebuffer. For your solution, I really don't know where should I write, as I only have /dev/fb0?

Qt:
What is the difference between -opengl es2 and -eglfs? Seems that people are just using it and giving no explanation on what it does - I went through Qt documentation, but couldn't find anything useful...

OpenGL:
I have trouble finding how Mali is using DEBE/DEFE. I'm also not sure about this driver from Mali - don't really know how to use it for Qt. In the end, the whole GUI should also be layered on top of the video (so video goes under GUI). I'm also not sure on how should I include Mali driver in qmake.conf?

Any pointers are welcome!