InfoCanvas – A mini440 Based Web-Client

As part of my MTech project here at COEP, I had spent some considerable amount of time developing a ARM SBC based touchscreen web-client which can easily be customized to be used according to the desired application. (I have demonstrated its use as an information-desk and as a terminal which fetched sensor data from another ARM SBC based web-server) Throughout the development I have taken help from many Embedded Linux enthusiasts and used Open Source technologies all the way.  I posted some stuff about the software design on my blog and sometimes helped some guys through mail also but never ever did I think once even to tell the world how I did it until now when I realized that ethically its wrong not to share good stuff with good guys like you. Oh! its not that I have rewritten a better Kernel than Linux, but some bits here and there are always missing when you work on embedded devices. Thats all I have to give back from the project I have done. Its small and humble but still, its for all of you to play with now. Everyone releases software but no-one releases how to build a complete device kind of thing. I guess I did it at last. Now adapt it according to your needs and create new devices. Host a Diaspora pod on the ARM server or just think crazy.

I am going to release the documentation in the form of my M.Tech. Thesis (Its pretty rough but still covers most of the work) in public domain currently and then will put up the related code/scripts etc on git very soon. The thesis contains some images and and data from various sources from the internet, cited wherever possible. Make use of it as it suits you. Only the work done my me in the thesis is under public domain. At any places if you find some data which is copyrighted, don’t use it without proper permissions.

In case you require some incentive to get interested in playing with such a device, some excerpts from the first chapter :

In this report, which supports and explains the work supplied with it, details of development of an ARM9 SBC based network capable LCD touch-screen device is explained. The device is essentially a versatile HMI module which can be customized according to the various need under various conditions with minimum effort. Stress on the human interaction, networking standards and an aesthetic look has also been given during the development of such a device.

System Overview

As a demonstration, the project has been configured and developed as a full fledged product to be used as a student information desk and feedback system. This device thus is aptly named COEP InfoCanvas. In addition to this another small ARM SBC has been configured as a web-server which serves the latest sensor values attached to the it. This sensor is accessed by the COEP InfoCanvas which displays the remote sensor’s value in text as well as a time series graph on the LCD touch-screen. The COEP InfoCanvas is driven by SBC-I which along with another SBC-II and an Info-Server is connected to the LAN/WAN. Refer Figure 1. SBC-I being network capable acts as a web client an can fetch and display on its LCD, information and other data from any server on LAN/WAN in standard web formats such as HTML and Javascript from Info-Server machine and SBC-II. The Info-Server is a Linux server grade machine which runs a web-server and supplies data to SBC-I. The SBC-II present at a remote location, is designed itself as a tiny ARM web-server which gathers sensor data through its ADC and serves it to the SBC-I for display. The system is pretty modular and uses mainly standard TCP/IP protocols to communicate and send data to and fro.

Figure 1

The system has been designed almost completely using FOSS tools and technologies. Right from configuring the OS to developing applications on it, Open Source tools have dominated the development of this device.

Some Images

This slideshow requires JavaScript.

Qt 4.6 on mini2440 – A Definitive Guide

Having Qt on your device is a awesome way to ensure that you and many other developers can enjoy developing applications and having fun in addition to doing rapid application development whenever required. The wealth of support provided by the Qt framework – right from OpenGL to WebKit tempts a embedded developer for sure. So I decided its time for a change. Lets dump the overkiiling Android and take shelter under Qt’s canvas for my device. I kept on roaming the intricately laid out web of information on having Qt 4.6.2 run successfully on my mini2440. But owing to the strange 12.1″ LCD that I have attached to it I was more-or-less stuck on the Touchscreen calibration part. So Now after hits and trials and many cups of tea, I am assembling a guide. I intend to make if definitive but only the willful enough to dare can tell.

What You Need

Qt 4.6.2 

GNU ARM Toolchain

Step 1

Setup the toolchain and modify the PATH variable accordingly. Untar qt-everywhere-opensource-src-4.6.2.tar.gz wherever you like. Mine is /usr/local/qt

Step 2

Replace the whole text in mkspecs/qws/linux-arm-g++/qmake.conf by the following:

#
# qmake configuration for building with arm-linux-g++
#

include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-none-linux-gnueabi-gcc -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_CXX               = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK              = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts

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

load(qt_config)

Remember that the PATH variable should have the location of arm-none-linux-gnueabi-gcc etc.

Step 3

Now turn off compiler optimization by making changes in /mkspecs/common/g++.conf Just change the following line to this :

QMAKE_CFLAGS_RELEASE  += -O0

Step 4

Now we have to configure Qt the way we want it by doing ./configure but we need to specify some options according to our requirements.

./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix \
/usr/local/qt -little-endian -webkit -no-qt3support -no-cups -no-largefile \
-optimized-qmake -no-openssl -nomake tools -qt-mouse-tslib -qt-kbd-linuxinput

Now, this configuration is what I needed, for example for my network enabled device I needed a webkit based application so I provided -webkit option. You can drop in or add whatever you want. Some handy options that you may (or may not require) are :

Enable touchscreen library support : -qt-mouse-tslib

Enable USB keyboard support : -qt-kbd-linuxinput

The above options affect the QtGui library so you need to replace only QtGui.so.x.x file on your root filesystem if you are planning to make changes.

Step 5

So more or less you are done. Its time to do some creative stuff (blah!) just do

make

Wait for a couple of hours or so and find your cross compiled freshly baked libraries in /usr/local/qt/lib/

Setting up Qt 4.6 libs on mini2440

So now, its time to put the libs on your mini machine! You may choose to create a separate filesystem using busybox too. Elaborate tutorials on that are available on the web. Just Google it up. What I will do is, modify the rootfs that came with my mini and remove all unnecessary stuff from it. Create a dir /usr/local/qt on your mini2440’s stock root filesystem and copy the complete lib directory from step 5 to that location using a USB stick/SD Card or something. Remember to do a df on the mini beforehand to see the free NAND you have got. In case the memory is low, delete some stock data – the small video file, mp3 file and some sample images that are present on it.Also remove unnecessary applications viz konqueror and old qt 2.2.0 libraries from the system.

Environment Variables

To make the mini understand the new Qt libs, we’ll add some variables

On your mini2440, edit /etc/inint.d/rcS and add the following line to it

source /etc/qt46profile

Now create the /etc/qt46profile file and the following text to it :

export LD_LIBRARY_PATH=/usr/local/qt/lib
export QTDIR=/usr/local/qt
export QWS_MOUSE_PROTO=IntelliMouse:/dev/input/event0
export QWS_DISPLAY=LinuxFB:mmWidth=310:mmHeight=190

Remember that these variables may change according to your qt libs location and mouse/touchscreen drivers. Go to /dev/input/ and see which file is responsible for which device. For eg. if tslib is configured on your device then the QWS_MOUSE_PROTO  variable will have the value something like

QWS_MOUSE_PROTO=Tslib:/dev/input/event1

So, you are done at last and have your system ready with Qt 4.6.2 libs. Try running a simple application (viz a Analog Clock from the cross-compiled qt examples at /usr/local/qt/examples/widgets/analogclock/analogclock by giving the -qws option on the mini2440 shell as

./analogclock -qws

Thats it! Do tell me if you are able to reach here. In the next two posts I shall be discussing about rapidly developing a GUI application for your mini using Qt Creator and compiling and configuring Tslib for mini2440.