Saturday 6 February 2016

Qt Application in Beagle Bone Black using Fedora(host) and Angstrom(target)


So, you might be thinking how can we run a GUI application in an embedded platform. Well, most of the GUI applications were made by using Qt. In Qt we can add buttons, edit box, dialog boxes, .. etc. However, if you could learn the basics of qt , you can make application on your linux system. But this tutorial shows how to compile and make an application for Beagle Bone Black Board. I was totally a newbie about the necessary things required for cross compilation like: Linux, Qt and Cross compiler/Toolchain. With 0% knowledge about all the above important stuffs, I started my journey of cross compilation.

Basic Requirements:
Host System: Laptop, core i5, x86.
1. OS : Fedora 22.
2. Qt 5.5.1.
3. ToolChain: angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2.

Target System: Beagle Bone Black, AM335x 1GHz ARM® Cortex-A8
1. OS : Angstrom OS.
2. PC Connectivity cable

Steps :-



  1. Get the toolchain from here
  2. Install qt creator

    sudo dnf install qt-creator
  3. Download toolchain to your fedora and extract it into a folder, then follow this command

    sudo tar -C / -xjf angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2
  4. After installed Qt Creator please don't open, read the following words and then operate.


    Qt Creator cross compiler that is running process: when you click on the "run" button, Qt Creator automatically complete the following operations. First automatically using the qmake command and linux-gnueabi-oe-g++ compiler generated Makefile using the make command, and then automatically generate executable file, and then automatically put the executable file with the SFTP to the BBB, and then automatically run.
    This process uses some tools, thus the first step in using the Qt Creator to create a Qt project, is designated to use "toolbox" of Kit, because of the different platform for compile time, should use different qmake and different g++ settings, the settings together is called a Kit.


    In order to enable the Qt Creator to find the location of these tools, you must set the environment variable. The toolchain has written to set environment variables of the script, we only need to perform the following:
    ./usr/local/angstrom/arm/environment-setup



    If the executive can not add execute permissions
    chomd +x /usr/local/angstrom/arm/environment-setup


    Note, to set environment variables for the environment-setup file is the export. Don't forget to set the environment variable export is only valid for the current open shell. So we installed Qt Creator although can see an application icon, but we will not simply double-click the icon to open it, but should be in the implementation of the above set the environment variable terminal to find and open the qtcreator program. For the sake of convenience, I put environment-setup a copy of the document to the home directory, and then at the end of the QC program location file, the environment-setup file and add a line of (modified according to installation position for you):
    ./user/bin/qtcreator


    After the file is added to execute permissions
    chomd +x environment-setup


    After the implementation of the file./environment-setup can automatically configure the environment variables and open the Qt Creator.


    (if the environment variable not set, compile time error message will appear":-1: error: execvp: ../projectname/mainwindow.ui: Permission denied") unfortunately, I have got this error when i compiled for first time!!!
  5. If you did not understand above step (me too did not get what actually I have to do), To set up environment what I have done is,

    i went to the directory
    /usr/local/angstrom/arm/
    and opened file named
    environment-setup 

    copied the text in it and pasted into terminal!!!
    and pressed enter, now the environment has set up.
  6. Do not close the above opened  terminal, you just set up environment so if you close it , again you have to repeat step 5.

    In that opened terminal go to user/bin/ using cd command,
    then type ./qtcreator
  7. Now qt will be opened in your environment.
  8. Make a qt application using tutorial(search google, you will get sample projects) 
  9. Now you have to set up compiler inside qt application, for that I have followed below youtube video.

    Part 1:



    Part 2 :



  10. There is an error in this video, they have selected GCC compiler, but you have to select compiler Beaglebone-GCC

  11. That's it, You are done your application will be created in beagle bone. now run that application in beagle bone black board.
     
    Sometimes you might come up with an issue that when you run your application you cannot see your Application gui but it runs in background.
    for that you have to disable gdm 
    
    "systemctl disable gdm.service"
    
     
     then run your application, you might mess up with another error :- your mouse pointer disappears!!!!
    for that type 
    
    "export QWS_MOUSE_PROTO=linuxinput:/dev/input/event1"
    
     

Setting up of Arm linux gcc (cross compiler for arm 9 ) in Fedora and Making Application

Hi, I had come up with many errors when I used ARM926 innovate solution board. My host system is fedora Linux. I wanted to make a simple C Program that has to be run on the ARM9 Board. I was not familiar with tool chain and cross compiler. Then I have done hundreds of google search. Then I found solution for that. So this post might help those who have the same issue.

Basic Requirements:
1. Host System     : A laptop with Fedora Linux or Any other Linux
2. Target System  : ARM926 
3. Tool Chain        : arm-linux-gcc-3.4.1.rar



Step 1 : you need the package arm-linux-gcc-3.4.1.rar , can be downloaded from repos, On your fedora , extract files in arm-linux-gcc-3.4.1.rar , now you will get a file named arm-linux-gcc-3.4.1.tar.bz2

Step 2 : Open terminal and go to the folder where  arm-linux-gcc-3.4.1.tar.bz2 is extracted and type
                           "sudo tar jxvf arm-linux-gcc-3.4.1.tar.bz2 -C /"
this is to install arm tool chain in your fedora.

Step 3 :  then type
                  "export PATH=$PATH:/usr/local/arm/3.4.1/bin/"
This is to set up environment variable in your fedora.
(Note You have to repeat this step whenever you want to compile your c program for arm  )

Step 4: you have to create a c program, in my case hello.c which is saved in Documents folder. Then compile using following command

"arm-linux-gcc -o /home/Sajith/Documents/hello /home/Sajith/Documents/hello.c"
Step 5: Now, you will be successfully made an executable file now in the same folder as in hello.c

Step 6 : copy this executable binary file to your arm 9 board either usb drive or SSH.
(Note: In my case Arm926 board is preloaded with icewm OS, so i used a pen drive to copy executable file and plugged it into the board)

Step 7 : run this file  in arm9 board.
             (Note: in Icewm OS, you have to mount pen drive by start-> Flash drive -> Mount, and then open its terminal then go to \root\mnt\usb , you can view your pen drive files)
 ".\hello "


Thank You,
Feel free to contact me sajithp.mec@gmail.com