Difference between revisions of "Getting Started With Qt Creator"

From wiki.emacinc.com
Jump to: navigation, search
(Updated to the 2019 edit with addition of links)
 
(17 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{todo| NotStarted (02.03.2015-10:42->BS+)|Brian Serrano| project=OE 5.0,BS }}
+
{{todo| Complete (02.03.2015-10:42->BS+);(06.18.2015-14:25->BS+);(06.18.2015-15:48->KY+);(11.16.2015-11:35->MD+);(11.16.2015-12:15->MG+);(11.16.2015-12:20->KY+)|Brian Serrano| project=OE 5.0,BS,KY,MD,MG,Complete}}
 
{{#seo:
 
{{#seo:
 
|title=Getting Started with Qt Creator
 
|title=Getting Started with Qt Creator
 
|titlemode=append
 
|titlemode=append
|keywords=
+
|keywords=Qt Creator, Tutorial, Qt Creator Examples
 
|description=The following page can be used to get familiarized with EMAC Qt Creator.
 
|description=The following page can be used to get familiarized with EMAC Qt Creator.
 
}}
 
}}
Line 10: Line 10:
 
<!-- /****************************************  Page Description Text  ****************************************/ -->
 
<!-- /****************************************  Page Description Text  ****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
<span style="background:#00FF00;color:#FF0000;font-size:300%">'''''The following page describes the process of getting familiar with EMAC Qt Creator.'''''</span>
+
<span style="background:#00FF00;color:#FF0000;font-size:300%"></span>
 
+
The following page demonstrates the process of getting familiar with EMAC Qt Creator and running it on the target machine.
 
__TOC__
 
__TOC__
  
Line 17: Line 17:
 
<!-- /***************************************** Background Information ****************************************/ -->
 
<!-- /***************************************** Background Information ****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 +
 +
=== Video Series ===
 +
<youtube>https://www.youtube.com/watch?v=tlHZOxhxAfo</youtube>
 +
 
{{:Templateimpl:bg | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
{{:Templateimpl:bg | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
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.
+
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.  
 +
 
 +
For more information visit the Qt Project site http://qt-project.org/wiki/Category:Tools::QtCreator.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************  General Information  *****************************************/ -->
 
<!-- /*****************************************  General Information  *****************************************/ -->
Line 24: Line 30:
 
{{:Templateimpl:geninfo | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
{{:Templateimpl:geninfo | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
=== Tools Required ===
 
=== Tools Required ===
* EMAC OE SDK 5.0
+
These tools should already be installed if you installed the EMAC SDK using the automatic installer.
 +
* [[Getting_Started_with_the_EMAC_OE_SDK | EMAC OE 5.X SDK]]
 
* EMAC Qt Creator
 
* EMAC Qt Creator
* GNU ''make''
+
* GNU <code>make</code>
* ''cmake''
+
* CMake
 
=== Setup ===  
 
=== Setup ===  
# Make sure the system is [[Configuring_Qt_Creator | configured]] for the correct target machine and that the IP and user/password are set.
+
# Make sure the system has the [[Getting_Started_with_the_EMAC_OE_SDK | EMAC OE 5.X SDK and tools installed. ]]
 
# Launch EMAC Qt Creator.
 
# Launch EMAC Qt Creator.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
Line 35: Line 42:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:using | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
{{:Templateimpl:using | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
{{note|Until there is a working desktop icon to use, the user should still do steps 1 and 2 to run Qt Creator.}}
 
1. Change directory to ''/opt/emac/5.0/EMAC-Qt-Creator/bin'', enter the following command into terminal.
 
{{cli | cd /opt/emac/5.0/EMAC-Qt-Creator/bin | username=developer | hostname=ldc}}
 
  
2. To initiate the Qt Creator GUI as shown in Figure 1 below, run the application with the following command.
+
1. Launch Qt Creator using one of the following methods:
{{cli | ./qtcreator | username=developer | hostname=ldc | pwd=home/user/opt/emac/5.0/EMAC-QtCreator/bin}}  
+
* Click the Qt Creator icon on the the desktop
 +
* In the terminal, execute the following commands:
 +
{{cli | username=developer | hostname=ldc | cd ~/EMAC-SDK/emac-QtCreator/bin }}
 +
{{cli | username=developer | hostname=ldc | pwd=~/EMAC-SDK/emac-QtCreator/bin | ./qtcreator.sh }}
 +
 
 +
 
 +
2. To generate a new project from Qt Creator, select '''New Project''' on the opening splash window. The examples being used are all written in the <code>C programming</code> language.
  
[[File:qtcreator_gui.png|600px|left|thumb|Figure 1: Qt Splash Window]]
+
[[File:QtCreatorGUInew.png|600px|left|thumb|Figure 1: Qt Creator GUI]]
 
<br clear=all>
 
<br clear=all>
  
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 <code> C programming </code> language.
+
3. After selecting '''New Project''' a new window will pop up. To run a <code>C programming</code> 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 the window to continue to the next page as shown in Figure 3.
 
 
4. After selecting "New Project" a new window will pop up. To run a <code> C programming </code> 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 2.
 
  
 
[[File:EMAC_C_Project.png|600px|left|thumb|Figure 2: Qt Creator EMAC Project]]
 
[[File:EMAC_C_Project.png|600px|left|thumb|Figure 2: Qt Creator EMAC Project]]
 
<br clear=all>
 
<br clear=all>
  
5. The next page will be "Introduction and Project Location". Select a name for the <code> C </code> 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''.
+
4. The next page will be '''Introduction and Project Location'''. Select a name for the <code> C </code> project. Once the project name is given, choose a directory to store the project. Note: It is highly recommended to store your project somewhere other than the default location. For this example, we used <code>/home/developer/Projects</code>.
  
 
[[File:Project_location1.png|600px|left|thumb|Figure 3: Qt Creator Project Location]]
 
[[File:Project_location1.png|600px|left|thumb|Figure 3: Qt Creator Project Location]]
 
<br clear=all>
 
<br clear=all>
  
6. The next page summarizes the '''EMAC C Project'''. Click "Finish" to continue.
+
5. The next page summarizes the '''EMAC C Project'''. Click '''Finish''' to continue.
  
 
[[File:Project_summary1.png|600px|left|thumb|Figure 4: Qt Creator Project Summary]]
 
[[File:Project_summary1.png|600px|left|thumb|Figure 4: Qt Creator Project Summary]]
 
<br clear=all>
 
<br clear=all>
  
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 5.  
+
6. The next step is to set up the device you will be using for the Qt Creator examples. Click Tools -> Options
 +
{{note|The board used for this example is the iPac-9x25. The iPac-9x25 is a 32-bit ARM architecture. Make sure to connect power, Ethernet, and serial to the board.}}
  
[[File:Build_location.png|600px|left|thumb|Figure 5: Qt Creator Build Location]]  
+
7. Select '''Devices''' from the left pane.
 +
 
 +
[[File:Options_devices.png|600px|left|thumb|Figure 5: Qt Creator Device Option]]  
 
<br clear=all>
 
<br clear=all>
  
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 6 below. Click "Finish" to start new project.
+
8. Click the '''Add''' button
  
[[File:Run_cmake1.png|600px|left|thumb|Figure 6: Qt Creator Run CMake]]
+
9. Select Generic Linux Device, then click '''Start Wizard'''.
<br clear=all
 
  
>9. Once the Desktop Kit is configured, 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 armv5te". 
+
[[File:Generic_linux.png|600px|left|thumb|Figure 6: Qt Creator Wizard Selection]]
{{note|The board being used will be the iPac-9x25. The iPac-9x25 is a 32-bit architecture armv5te. }}
+
<br clear=all>
  
[[File:Add_kit_armv5.png|600px|left|thumb|Figure 7: Qt Creator Add Kit]]
+
10. Type in a name, the IP address, the user name, and the password for the device. Use the credentials below to sign in.
<br clear=all>
 
  
10. 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 8.
+
{| class="wikitable"
 +
!colspan="2"|Table 4: Default Login Credentials
 +
|-
 +
! Username !! Password
 +
|-
 +
| root || emac_inc
 +
|}
  
[[File:Build_location_arm5v.png|600px|left|thumb|Figure 8: Qt Creator Add Kit Build Location]]
+
[[File:Device_connection.png|600px|left|thumb|Figure 7: Qt Creator Configuration Setup]]
 
<br clear=all>
 
<br clear=all>
  
11. "CMake Wizard" will then prompt you to "Run CMake". For setting up the iPac-9x25 armv5 kit, click the box next to "Arguments". Copy and paste the string below: 
+
11. Click '''Next'''.
''-DARCH:STRING=armv5''
 
  
[[File:Argument_string.png|600px|left|thumb|Figure 9: Qt Creator Argument String]]
+
12. Click '''Finish'''.
<br clear=all>
 
  
EMAC SDK provides three other architectural kits. If using one of these other architectures below, Copy and paste the argument string in the "Arguments" box.
+
13. A connection will be established with the target device.
''-DARCH:STRING=armv7'' 
 
''-DARCH:STRING=core2'' 
 
''-DARCH:STRING=i586''
 
  
12. Once the arguments string is pasted in the box, click "Run CMake" and the output should be similar to Figure 10 below. Click "Finish" to add the armv5 kit to the current project.
+
[[File:Device_test.png|600px|left|thumb|Figure 8: Qt Creator Device Test]]
 
 
[[File:Run_cmake_arm5v.png|600px|left|thumb|Figure 10: Qt Creator Run CMake]]
 
 
<br clear=all>
 
<br clear=all>
  
13. To confirm if the kits installed correctly, click on the "All" tab on the left hand side of the Qt Creator window as shown in Figure 11. Both "Desktop" and "EMAC OE 5.0 armv5te" kit will be present.
+
14. Click '''Close'''.
  
[[File:Armv5_kit.png|600px|left|thumb|Figure 11: Qt Creator Kits Installed]]
+
15. Click '''Apply'''.
<br clear=all>
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*****************************************      Examples        *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:examples | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
This section will show how to run <code> C programming </code> examples through the Qt Creator IDE.  The example board will be the iPac-9x25.  
 
  
The first example is a basic <code> hello c </code> example project.  
+
16. Navigate to the '''Projects''' tab. Here, Qt Creator will ask you to select which kits you will be using with the project. For this example,  we made sure the '''arm''' kit was selected. Then click '''Configure 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 <code> hello c </code> example uploaded as shown in Figure 12.
+
[[File:Configproject.png|600px|left|thumb|Figure 9: Configureing Qt Project]]
 +
<br clear=all>
  
<syntaxhighlight lang="c">
+
17. Now, on the left side of Qt Creator, you will see the project icon, which looks like a monitor. Click this and make sure '''Arm''' is selected under '''Kit''', '''Default''' is selected under '''Build''', and the project is set to be run on the remote device under '''Run'''.
#include <stdio.h>
 
#include <stdlib.h>
 
  
int main(int argc, char * argv[])
+
[[File:Kitselection.png|600px|left|thumb|Figure 10: Selecting Qt Kit]]
{
+
<br clear=all>
    printf("Hello EMAC OE!\n");
 
 
 
    exit(EXIT_SUCCESS);
 
}
 
</syntaxhighlight>
 
  
[[File:Edit_window.png|600px|left|thumb|Figure 12: Qt Creator Edit Window]]
+
18. Now, simply press the green play button. The program should run on the target device and yield an output.
<br clear=all>
 
  
2. Before executing the example, you must build the program first. 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 the Qt Creator.
 
  
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 <code> Hello EMAC OE! </code> in the "Application Output" terminal.
 
  
[[File:Final_output.png|600px|left|thumb|Figure 13: Qt Creator Edit Window]]
+
[[File:Qtoutput.png|900px|left|thumb|Figure 11: Successfully running Qt Project]]
 
<br clear=all>
 
<br clear=all>
  
The second example will show how to run a <code> c programming </code> 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 <code> Prime_Numbers </code>. Then Navigate to the "Edit" tab on Qt Creator. Copy and paste the following code below to the Qt Creator terminal.  
+
==Adding Source Files==
 +
To add source files .c/.h
 +
<ol>
 +
<li>Right click on '''CMakeLists.txt''' and select '''Show Containing Folder''' to open the project directory.</li>
 +
<li>Create and name files within this directory. For example we'll create Example.c and Example.h</li> 
 +
<li>Back in Qt Creator right click on the project folder and select '''Run CMake''' to add the files to the project.</li><br />
 +
The files are now visible and directly editable from within the Qt Creator IDE.
 +
</ol>
 +
<br />
 +
<ol>
 +
Alternatively, files can be added by
 +
<li>Clicking '''File->New File or Project'''. This will open the New File or Project Window.</li>
 +
<li>In the New File or Project window select '''General''' under Files and Classes, and then select '''Empty File''' in the middle column. Select '''Choose...'''. This will open the Location Window.</li>
 +
<li>On the location window give the file a name (Example.c), and ensure the Path field contains the project directory. Select ''Next>''', to advance to the Summary Window.</li>
 +
<li>On the Summary Window select '''Finish'''. The Window will close.</li>
 +
<li>Back in Qt Creator right click on the project folder and select '''Run CMake''' to add the files to the project.</li><br />
 +
The files are now visible and directly editable from within the Qt Creator IDE.
 +
</ol>
  
<syntaxhighlight lang="c">
 
#include <stdio.h>
 
#include <stdlib.h>
 
  
int main(int argc, char * argv[])
+
==Changing the Remote Directory==
{
+
The remote directory where the executable is uploaded on the target device can be changed as follows:
  int i;
+
<ol>
  int j;
+
<li>Right click on '''CMakeLists.txt''' and select '''Show Containing Folder''' to open the project directory.</li>
 +
<li> Within the project directory is a file called '''QtCreatorDeployment.txt''', open it.</li>
  
  for (i = 2; i <= 100; i++)
+
'''QtCreatorDeployment.txt''' just holds the directory path where the executable will be uploaded. Simply replace the current path (in this case '''/tmp''') with a path of your choosing.  
  {
 
    for (j = 2; j <= i; j++)
 
    {
 
      if (i%j==0)
 
      {
 
        break;
 
      }
 
    }
 
    if (i == j)
 
    {
 
      printf ("%d is a prime number. \n", i);
 
    }
 
  }
 
  return 0;
 
}
 
</syntaxhighlight>
 
  
[[File:Prime_Numbers_edit.png|600px|left|thumb|Figure 14: Qt Creator Edit Window]]
+
{{note | Changing the target directory to a directory outside of ''tmp'' will require remounting the file system to read-write mode. This can be done by entering the command, ''oemntrw'' on the target device terminal. This will only change the root filesystem to read-write for the current boot.  When the system is rebooted, the root filesystem will once again be mounted read-only.}}
<br clear=all>
 
  
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 the Qt Creator.
+
</ol>
  
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.
 
 
[[File:Final_Prime_Numbers.png|600px|left|thumb|Figure 14: Qt Creator Edit Window]]
 
<br clear=all>
 
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************    Conclusion      ******************************************/ -->  
 
<!-- /******************************************    Conclusion      ******************************************/ -->  
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
{{:Templateimpl:conclusion | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
 
{{:Templateimpl:conclusion | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
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, and how to build and run example projects.  
+
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, how to set up the necessary kits for your target board, how to set up your target board, and how to build and run example projects.
 +
 
 +
 
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************  More Information  *****************************************/ -->
 
<!-- /******************************************  More Information  *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
{{:Templateimpl:moreinfo | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
+
{{:Templateimpl:moreinfo | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}
* '''TBD'''
+
* [[Creating_a_New_EMAC_OE_SDK_Project_with_qmake_in_Qt_Creator | Creating a New EMAC OE SDK Project with qmake in Qt Creator]]
  
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with Qt Creator | desc=The following page can be used to get familiarized with EMAC Qt Creator. | project=OE 5.0 }}
+
{{:Templateimpl:whatnext | initials=BS | title=Getting Started with the EMAC OE SDK | desc=Basic tutorial for using the EMAC OE SDK. | project=OE 5.0 }}
* '''TBD'''
+
* [[Getting_Started_with_the_EMAC_OE_SDK | Getting Started with the EMAC OE SDK ]]
 +
* [[EMAC_Example_Projects | EMAC Example Projects]]

Latest revision as of 14:05, 8 September 2020

TODO: {{#todo: Complete (02.03.2015-10:42->BS+);(06.18.2015-14:25->BS+);(06.18.2015-15:48->KY+);(11.16.2015-11:35->MD+);(11.16.2015-12:15->MG+);(11.16.2015-12:20->KY+)|Brian Serrano|OE 5.0,BS,KY,MD,MG,Complete}}

The following page demonstrates the process of getting familiar with EMAC Qt Creator and running it on the target machine.


Video Series

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.

For more information visit the Qt Project site http://qt-project.org/wiki/Category:Tools::QtCreator.

General Information

Tools Required

These tools should already be installed if you installed the EMAC SDK using the automatic installer.

Setup

  1. Make sure the system has the EMAC OE 5.X SDK and tools installed.
  2. Launch EMAC Qt Creator.

Getting Started with Qt Creator

1. Launch Qt Creator using one of the following methods:

  • Click the Qt Creator icon on the the desktop
  • In the terminal, execute the following commands:
developer@ldc:~# cd ~/EMAC-SDK/emac-QtCreator/bin
developer@ldc:~/EMAC-SDK/emac-QtCreator/bin# ./qtcreator.sh


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

File:QtCreatorGUInew.png
Figure 1: Qt Creator GUI


3. 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 the window to continue to the next page as shown in Figure 3.

Figure 2: Qt Creator EMAC Project


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

Figure 3: Qt Creator Project Location


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

Figure 4: Qt Creator Project Summary


6. The next step is to set up the device you will be using for the Qt Creator examples. Click Tools -> Options



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


7. Select Devices from the left pane.

Figure 5: Qt Creator Device Option


8. Click the Add button

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

Figure 6: Qt Creator Wizard Selection


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

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


11. Click Next.

12. Click Finish.

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

Figure 8: Qt Creator Device Test


14. Click Close.

15. Click Apply.

16. Navigate to the Projects tab. Here, Qt Creator will ask you to select which kits you will be using with the project. For this example, we made sure the arm kit was selected. Then click Configure Project.

Figure 9: Configureing Qt Project


17. Now, on the left side of Qt Creator, you will see the project icon, which looks like a monitor. Click this and make sure Arm is selected under Kit, Default is selected under Build, and the project is set to be run on the remote device under Run.

Figure 10: Selecting Qt Kit


18. Now, simply press the green play button. The program should run on the target device and yield an output.


Figure 11: Successfully running Qt Project



Adding Source Files

To add source files .c/.h

  1. Right click on CMakeLists.txt and select Show Containing Folder to open the project directory.
  2. Create and name files within this directory. For example we'll create Example.c and Example.h
  3. Back in Qt Creator right click on the project folder and select Run CMake to add the files to the project.

  4. The files are now visible and directly editable from within the Qt Creator IDE.


    Alternatively, files can be added by
  1. Clicking File->New File or Project. This will open the New File or Project Window.
  2. In the New File or Project window select General under Files and Classes, and then select Empty File in the middle column. Select Choose.... This will open the Location Window.
  3. On the location window give the file a name (Example.c), and ensure the Path field contains the project directory. Select Next>', to advance to the Summary Window.
  4. On the Summary Window select Finish. The Window will close.
  5. Back in Qt Creator right click on the project folder and select Run CMake to add the files to the project.

  6. The files are now visible and directly editable from within the Qt Creator IDE.


Changing the Remote Directory

The remote directory where the executable is uploaded on the target device can be changed as follows:

  1. Right click on CMakeLists.txt and select Show Containing Folder to open the project directory.
  2. Within the project directory is a file called QtCreatorDeployment.txt, open it.
  3. QtCreatorDeployment.txt just holds the directory path where the executable will be uploaded. Simply replace the current path (in this case /tmp) with a path of your choosing.



    NOTE
    Changing the target directory to a directory outside of tmp will require remounting the file system to read-write mode. This can be done by entering the command, oemntrw on the target device terminal. This will only change the root filesystem to read-write for the current boot. When the system is rebooted, the root filesystem will once again be mounted read-only.


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, how to set up the necessary kits for your target board, how to set up your target board, and how to build and run example projects.


Further Information

Where to Go Next
Pages with Related Content