Difference between revisions of "Getting Started With Qt Creator"

From wiki.emacinc.com
Jump to: navigation, search
Line 38: Line 38:
 
After installing EMAC SDK, launch the EMAC Qt Creator desktop icon.
 
After installing EMAC SDK, launch the EMAC Qt Creator desktop icon.
  
1. Press the Windows key and search for '''Qt Creator EMAC'''
+
1. Press the Start key or Alt + F2 and search for Qt Creator EMAC
  
 
2. Put the Qt Creator EMAC icon on the Launcher for easy access.
 
2. Put the Qt Creator EMAC icon on the Launcher for easy access.
Line 76: Line 76:
  
 
9. The next step is to setup your device which you'll be using for the Qt Creator examples. Click Tools -> Options
 
9. The next step is to setup your device which you'll be using for the Qt Creator examples. Click Tools -> Options
{{note|The board being used will be the iPac-9x25. The iPac-9x25 is a 32-bit ARM architecture.}}
+
{{note|The board being used will be the iPac-9x25. The iPac-9x25 is a 32-bit ARM architecture. Make sure to connect power, Ethernet, and serial to the board.}}
  
 
10. Select '''Devices''' from the left pane.
 
10. Select '''Devices''' from the left pane.
  
[[File:Options_devices.png|600px|left|thumb|Figure 8: Qt Creator Device Option]]
+
[[File:Options_devices.png|600px|left|thumb|Figure 8: Qt Creator Device Option]]  
 
<br clear=all>
 
<br clear=all>
  
11. Press the '''Add''' button
+
11. Click the '''Add''' button  
  
12. Select Generic Linux Device, then press '''Start Wizard'''.
+
12. Select Generic Linux Device, then click '''Start Wizard'''.
  
 
[[File:Generic_linux.png|600px|left|thumb|Figure 9: Qt Creator Wizard Selection]]
 
[[File:Generic_linux.png|600px|left|thumb|Figure 9: Qt Creator Wizard Selection]]
Line 130: Line 130:
 
  ''-DARCH:STRING=arm''
 
  ''-DARCH:STRING=arm''
  
[[File:Arm_argument_string.png|600px|left|thumb|Figure 14: Qt Creator Argument String]]
+
[[File:Arm_argument_string.png|600px|left|thumb|Figure 14: Qt Creator Argument String]]  
 
<br clear=all>
 
<br clear=all>
  
Line 138: Line 138:
 
22. Once the arguments string is pasted in the box, click '''Run CMake''' and the output should be similar to Figure 15 below. Click '''Finish''' to add the arm kit to the current project.
 
22. Once the arguments string is pasted in the box, click '''Run CMake''' and the output should be similar to Figure 15 below. Click '''Finish''' to add the arm kit to the current project.
  
[[File:Run_arm_cmake.png|600px|left|thumb|Figure 15: Qt Creator Run CMake]]
+
[[File:Run_arm_cmake.png|600px|left|thumb|Figure 15: Qt Creator Run CMake]]  
 
<br clear=all>
 
<br clear=all>
  
 
23. To confirm if the kits installed correctly, click on the '''Kit Selector''' tab (Monitor symbol) on the left hand side of the Qt Creator window as shown in Figure 16. Both '''Desktop''' and '''OE 5.0 arm''' kit will be present.
 
23. To confirm if the kits installed correctly, click on the '''Kit Selector''' tab (Monitor symbol) on the left hand side of the Qt Creator window as shown in Figure 16. Both '''Desktop''' and '''OE 5.0 arm''' kit will be present.
  
[[File:Arm_kit.jpg|600px|left|thumb|Figure 16: Qt Creator Kits Installed]]
+
[[File:Arm_kit.jpg|600px|left|thumb|Figure 16: Qt Creator Kits Installed]]  
 
<br clear=all>
 
<br clear=all>
  

Revision as of 09:44, 16 March 2015

TODO: {{#todo: NotStarted (02.03.2015-10:42->BS+)|Brian Serrano|OE 5.0,BS}}

The following page describes the process of getting familiar with EMAC Qt Creator.

Background

Qt Creator is a cross-platform Open Source Integrated Development Environment (IDE) that can be used to develop software for many different languages. It includes a visual debugger and an integrated GUI layout and forms designer. See the Qt Project site for more information http://qt-project.org/wiki/Category:Tools::QtCreator.

General Information

Tools Required

  • EMAC OE SDK 5.0
  • EMAC Qt Creator
  • GNU make
  • cmake

Setup

  1. Make sure the system is configured for the correct target machine and that the IP and user/password are set.
  2. Launch EMAC Qt Creator.

Getting Started with Qt Creator

After installing EMAC SDK, launch the EMAC Qt Creator desktop icon.

1. Press the Start key or Alt + F2 and search for Qt Creator EMAC

2. Put the Qt Creator EMAC icon on the Launcher for easy access.

Figure 1: Qt Launcher Icon


3. To generate a new project from Qt Creator, select New Project on the opening splash window. The examples being used are all written in C programming language.

Figure 2: Qt Creator GUI


4. After selecting New Project a new window will pop up. To run a C programming example using EMAC hardware, select EMAC Project under the Projects tab. Then select EMAC C Project (CMake Build). Click the Choose button on the bottom right of window to continue to the next page as shown in Figure 3.

Figure 3: Qt Creator EMAC Project


5. The next page will be Introduction and Project Location. Select a name for the C project. Once the project name is given, choose a a directory to store the project. Note: It is highly recommended to store your project other than the default location. For this example, we used /home/developer/Projects.

Figure 4: Qt Creator Project Location


6. The next page summarizes the EMAC C Project. Click Finish to continue.

Figure 5: Qt Creator Project Summary


7. Next, it will prompt you to the CMake Wizard Build Location. Click Next to continue. Note: It is highly recommended to use the default build directory as stated below in Figure 6.

Figure 6: Qt Creator Build Location


8. CMake Wizard will then prompt you to Run CMake. For setting up the Desktop Kit, click Run CMake and the output should be similar to Figure 7 below. Click Finish to start new project.

Figure 7: Qt Creator Run CMake


9. The next step is to setup your device which you'll be using for the Qt Creator examples. Click Tools -> Options



NOTE
The board being used will be the iPac-9x25. The iPac-9x25 is a 32-bit ARM architecture. Make sure to connect power, Ethernet, and serial to the board.


10. Select Devices from the left pane.

Figure 8: Qt Creator Device Option


11. Click the Add button

12. Select Generic Linux Device, then click Start Wizard.

Figure 9: Qt Creator Wizard Selection


13. Type in a name, the IP address, user name and password for the device. Use the credentials below to sign in.

Table 4: Default Login Credentials
Username Password
root emac_inc
Figure 10: Qt Creator Configuration Setup


14. Click Next.

15. Click Finish.

16. A connection will be established with the target device.

Figure 11: Qt Creator Device Test


17. Click Close.

18. Click Apply.

19. Once the Desktop Kit is configured, and the device is setup the hardware architecture kit needs to be installed. Navigate to Add Kit in the Projects tab. Under Add Kit select the architecture for the board being used. Click EMAC OE 5.0 arm.


Figure 12: Qt Creator Add Kit


20. As previously stated in step 7 it will prompt you to the CMake Wizard Build Location. Click Next to continue. Note: It is highly recommended to use the default build directory as stated below in Figure 13.

Figure 13: Qt Creator Add Kit Build Location


21. CMake Wizard will then prompt you to Run CMake. For setting up the iPac-9x25 arm kit, click the box next to Arguments. Copy and paste the string below:

-DARCH:STRING=arm
Figure 14: Qt Creator Argument String


EMAC SDK provides another architectural kit for x86 hardware. If using an x86 architecture, copy and paste the argument string below in the Arguments box.

-DARCH:STRING=x86  

22. Once the arguments string is pasted in the box, click Run CMake and the output should be similar to Figure 15 below. Click Finish to add the arm kit to the current project.

Figure 15: Qt Creator Run CMake


23. To confirm if the kits installed correctly, click on the Kit Selector tab (Monitor symbol) on the left hand side of the Qt Creator window as shown in Figure 16. Both Desktop and OE 5.0 arm kit will be present.

Figure 16: Qt Creator Kits Installed


24. To run the example projects on the target board remotely, you'll need to add it to the Run Configuration. Click on Projects.

25. Select Run under the OE 5.0 arm tab.

26. Next to Run Configuration, click on Add and select your project name (on Remote Generic Linux Host). In this case, our project name is Prime_Numbers (on Remote Generic Linux Host).

Figure 17: Qt Creator Run Configuration


You are now all set up to run the examples below on Qt Creator.

Examples

This section will show how to run C programming examples through the Qt Creator IDE. The example board will be the iPac-9x25.

The first example is a basic hello c example project.

1. After creating a new project and installing the necessary kits for the target board, navigate to the Edit tab on Qt Creator. Qt Creator will automatically have the hello c example uploaded as shown in Figure 18.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char * argv[])
{
    printf("Hello EMAC OE!\n");
   
    exit(EXIT_SUCCESS);
}
Figure 18: Qt Creator Edit Window


2. Before executing the example, you must build the program first. Click on the build icon (hammer symbol) on the bottom left of Qt Creator. If the build was successful, a green bar will fill on the bottom right of the window.

3. Once the program successfully builds, you can now run the program. Click on the run icon (green arrow symbol) on the left hand side of Qt Creator. The program prints Hello EMAC OE! in the Application Output terminal.

Figure 19: Qt Creator Edit Window


The second example will show how to run a c programming project on a target board. This example will show all prime numbers from 1 - 100 and output it on Qt Creator remote terminal.

1. Create a new project and install the necessary kits for the target board just as shown before. Call this project Prime_Numbers . Then Navigate to the Edit tab on Qt Creator. Copy and paste the following code below to the Qt Creator terminal.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char * argv[])
{ 
  int i;
  int j;

  for (i = 2; i <= 100; i++)
  {
    for (j = 2; j <= i; j++)
    {
      if (i%j==0)
      {
        break;
      }
    }
    if (i == j)
    {
      printf ("%d is a prime number. \n", i);
    }
  }
  return 0;
}
Figure 210: Qt Creator Edit Window


2. Click on the build icon (hammer symbol) on the bottom left of the Qt Creator. If the build was successful, a green bar will fill on the bottom right of Qt Creator.

3. Click on the run icon (green arrow symbol) on the left hand side of Qt Creator. The program prints all prime numbers from 1 - 100 in the Application Output terminal.

Figure 21: Qt Creator Edit Window


Conclusion

This page is a quick getting started tutorial on how to use EMAC Qt Creator for the first time. It shows you how to create an EMAC C Project, set up the necessary kits for your target board, setup your target board, and how to build and run example projects.

Further Information

Where to Go Next
  • TBD
Pages with Related Content
  • TBD