Difference between revisions of "RK3288 qt5Creator"

From ESS-WIKI
Jump to: navigation, search
(Created page with "<p><span class="fck_mw_template"><span class="fck_mw_template">{{DISPLAYTITLE:Setting-up QtCreator to cross compile for RK3288}}</span></span> </p> <table align="right"> <tr>...")
 
Line 1: Line 1:
<p><span class="fck_mw_template"><span class="fck_mw_template">{{DISPLAYTITLE:Setting-up QtCreator to cross compile for RK3288}}</span></span>
+
{{DISPLAYTITLE:Setting-up QtCreator to cross compile for RK3399}}
</p>
+
 
<table align="right">
+
{| align="right"
 +
|-
 +
| __TOC__
 +
|}
  
<tr>
 
<td> <span class="fck_mw_magic">_</span>
 
</td></tr></table>
 
 
<!--
 
<!--
 
-->
 
-->
  
<h1> Prerequisites </h1>
+
= Prerequisites =
<p>All operations in this guide are based on Ubuntu 18.04 LTS 64bit only.<br />First please install Ubuntu 18.04 LTS 64bit<sup><span style="color: red;">*</span></sup> with minimum 2GB memory.
+
 
</p>
+
All operations in this guide are based on Ubuntu 18.04 LTS 64bit only.<br/>First please install Ubuntu 18.04 LTS 64bit<sup>*</sup> with minimum 2GB memory.
<h2> Installing required packages </h2>
+
 
<p>Please login and perform the following commands:
+
== Installing required packages ==
</p>
+
 
<pre class="_fck_mw_lspace">$ sudo apt-get install build-essential
+
Please login and perform the following commands:
 +
<pre>$ sudo apt-get install build-essential
 
$ sudo apt-get install qtcreator
 
$ sudo apt-get install qtcreator
 
$ sudo apt-get install qt5-default
 
$ sudo apt-get install qt5-default
Line 22: Line 23:
 
$ sudo apt-get install qtbase5-examples
 
$ sudo apt-get install qtbase5-examples
 
</pre>
 
</pre>
<h2> Installing cross toolchain </h2>
+
 
<p>Please download &lt;a href="<a href="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag" alt="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag" title="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag">https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag</a>" alt="<a href="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag" alt="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag" title="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag">https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag</a>" title="<a href="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag" alt="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag" title="https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag">https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag</a>"&gt;cross compiler toolchain&lt;/a&gt;&#160;(Password: 0kkn)first. Then execute the following command to unzip the cross compiler tool to the /opt directory
+
== Installing cross toolchain ==
</p>
+
 
<h3> </h3>
+
Please download [https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag cross compiler toolchain]&nbsp;(Password: 0kkn)first. Then execute the following command to unzip the cross compiler tool to the /opt directory
<p><dl><dd><code>$ sudo tar -zxf rk3399_toolchain_Qt_V5.12.2.tar.gz -C /opt</code><br />
+
 
</p>
+
=== ===
</dd></dl><h1> Working within QtCreator </h1>
+
 
<h2> Starting the QtCreator </h2>
+
:<code>$ sudo tar -zxf rk3399_toolchain_Qt_V5.12.2.tar.gz -C /opt</code><br/>
<pre class="_fck_mw_lspace">$ qtcreator
+
 
 +
= Working within QtCreator =
 +
 
 +
== Starting the QtCreator ==
 +
<pre>$ qtcreator
 
</pre>
 
</pre>
<ol><li>The QtCreator's main window shows up.
+
 
<dl><dt>&lt;img src="/wiki/images/6/62/RK3399_Qt_start_init.png" _fck_mw_filename="RK3399 Qt start init.png" _fck_mw_upright="1" _fck_mw_origimgwidth="1306" _fck_mw_origimgheight="737" alt="RK3399 Qt start init.png" title="RK3399 Qt start init.png" style="vertical-align:middle;" /&gt;
+
#The QtCreator's main window shows up.
</dt></dl></li>
+
#;[[File:RK3399 Qt start init.png|upright|RK3399 Qt start init.png]]
<li>Check QtCreator's version by using "Help" -&gt; "About Qt Creator".
+
#Check QtCreator's version by using "Help" -> "About Qt Creator".
<dl><dt>&lt;img src="/wiki/images/7/7a/RK3399_QtCreator_version.png" _fck_mw_filename="RK3399 QtCreator version.png" _fck_mw_origimgwidth="527" _fck_mw_origimgheight="269" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
#;[[File:RK3399 QtCreator version.png|RTENOTITLE]]
</dt></dl></li></ol><h2> Configuring the Cross-Compiler Options </h2>
+
 
<ol><li>Bring up the options dialog using "Tools" -&gt; "Options..."
+
== Configuring the Cross-Compiler Options ==
</li>
+
 
<li>Select the "Devices" page on the left, and click "Add..."
+
#Bring up the options dialog using "Tools" -> "Options..."
</li>
+
#Select the "Devices" page on the left, and click "Add..."
<li>Select "Generic Linux Device" and click "Start Wizard".
+
#Select "Generic Linux Device" and click "Start Wizard".
<dl><dt>&lt;img src="/wiki/images/9/95/RK3399_Qt_Remote_device_setting.png" _fck_mw_filename="RK3399 Qt Remote device setting.png" _fck_mw_origimgwidth="1366" _fck_mw_origimgheight="904" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
#;[[File:RK3399 Qt Remote device setting.png|RTENOTITLE]]
</dt></dl></li>
+
#Specify proper settings and click "Next>"
<li>Specify proper settings and click "Next&gt;"
+
#;[[File:RK3288 Qt ssh device.png|RTENOTITLE]]<br/>
<dl><dt>&lt;img src="/wiki/images/4/4f/RK3288_Qt_ssh_device.png" _fck_mw_filename="RK3288 Qt ssh device.png" _fck_mw_origimgwidth="1361" _fck_mw_origimgheight="902" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#Click "Finish"
</dt></dl></li>
+
#Device test finished successfully. Click "Close".
<li>Click "Finish"
+
#;[[File:RK3288 Qt ssh connect.png|RTENOTITLE]]<br/>
</li>
+
#;<br/>
<li>Device test finished successfully. Click "Close".
+
#;If device test failed, please go back to specify proper settings.
<dl><dt>&lt;img src="/wiki/images/2/28/RK3288_Qt_ssh_connect.png" _fck_mw_filename="RK3288 Qt ssh connect.png" _fck_mw_origimgwidth="607" _fck_mw_origimgheight="610" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#;:[[File:2015-02-24 113504.png|RTENOTITLE]]
</dt>
+
#:(It is necessary to set a blank password at least, null password does not work.)
<dt><br />
+
#:<br/>
</dt>
+
#:[[File:2015-02-24 113635.png|RTENOTITLE]]
<dt>If device test failed, please go back to specify proper settings.
+
#:(It means device's IP is incorrect or some network issues occured.)
</dt></dl><dl><dt><dl><dd>&lt;img src="/wiki/images/b/b4/2015-02-24_113504.png" _fck_mw_filename="2015-02-24 113504.png" _fck_mw_origimgwidth="616" _fck_mw_origimgheight="125" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
#Click "Apply"
&lt;/dt&gt;</dl>&lt;/dd&gt;
+
#Select the "Build & Run" page on the left, switch to "Compilers" tab, drop down "Add" menu and choose "GCC-->C++".
<dd>(It is necessary to set a blank password at least, null password does not work.)
+
#Name the compiler as "RK G++"
</dd>
+
#Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-g++"
<dd><br />
+
#Click "Apply"
</dd>
+
#;[[File:RK3288 Qt g++.png|RTENOTITLE]]<br/>
<dd>&lt;img src="/wiki/images/c/c8/2015-02-24_113635.png" _fck_mw_filename="2015-02-24 113635.png" _fck_mw_origimgwidth="616" _fck_mw_origimgheight="123" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
#Switch to the "Debuggers" tab
</dd>
+
#Click "Add"
<dd>(It means device's IP is incorrect or some network issues occured.)
+
#Name the debugger as "RK GDB"
</dd>&lt;/dl&gt;</li>
+
#Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-gdb"
<li>Click "Apply"
+
#Click "Apply"
</li>
+
#;[[File:RK3288 Qt GDB.png|RTENOTITLE]]<br/>
<li>Select the "Build &amp; Run" page on the left, switch to "Compilers" tab, drop down "Add" menu and choose "GCC--&gt;C++".
+
#Switch to the "Qt Versions" tab.
</li>
+
#Check if the "Qt 5.9.4&nbsp;(host)" is auto detected in "Manual" item&nbsp;?
<li>Name the compiler as "RK G++"
+
#;[[File:RK3288 Qt version.png|RTENOTITLE]]<br/>
</li>
+
#;If not, click "Add..." to choose the proper qmake.
<li>Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-g++"
+
#Click "Apply"
</li>
+
#Switch to the "Kits" tab.
<li>Click "Apply"
+
#Click "Add".
<dl><dt>&lt;img src="/wiki/images/2/2f/RK3288_Qt_g%2B%2B.png" _fck_mw_filename="RK3288 Qt g++.png" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#Name the kit as "RK&nbsp;toolchain"
</dt></dl></li>
+
#Specify the correct "Device Tpye", "Compiler", "Debugger" and "Qt version"
<li>Switch to the "Debuggers" tab
+
#Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/arm-buildroot-linux-gnueabihf/sysroot" as sysroot
</li>
+
#Click Apply
<li>Click "Add"
+
#;[[File:RK3288 Qt toolchain.png|RTENOTITLE]]<br/>
</li>
+
#Click OK to finalize the configuration.
<li>Name the debugger as "RK GDB"
+
#Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit.
</li>
+
 
<li>Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-gdb"
+
== Creating the Project ==
</li>
+
 
<li>Click "Apply"
+
#Bring up "New" dailog using "File" -> "New File or Project..."
<dl><dt>&lt;img src="/wiki/images/b/b4/RK3288_Qt_GDB.png" _fck_mw_filename="RK3288 Qt GDB.png" _fck_mw_origimgwidth="1363" _fck_mw_origimgheight="907" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#Select "Applications" -> 'Qt Widgets Application"
</dt></dl></li>
+
#Click "Choose..."
<li>Switch to the "Qt Versions" tab.
+
#;[[File:RK3399 Project 001.png|RTENOTITLE]]
</li>
+
#Use "hello_qt" as name
<li>Check if the "Qt 5.9.4&#160;(host)" is auto detected in "Manual" item&#160;?
+
#Create in "/mnt/sda1/work/qt/PJ"
<dl><dt>&lt;img src="/wiki/images/d/d3/RK3288_Qt_version.png" _fck_mw_filename="RK3288 Qt version.png" _fck_mw_origimgwidth="1363" _fck_mw_origimgheight="907" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#Click "Next"
</dt>
+
#;[[File:RK3288 Qt project name local.PNG|RTENOTITLE]]<br/>
<dt>If not, click "Add..." to choose the proper qmake.
+
#Check "RK3288 toolchain"
</dt></dl></li>
+
#Click "Next".
<li>Click "Apply"
+
#;[[File:RK3288 Qt project kit select.png|RTENOTITLE]]<br/>
</li>
+
#Use default settings for "Class Information"
<li>Switch to the "Kits" tab.
+
#Click "Next"
</li>
+
#;[[File:RK3399 QT Project last.png|RTENOTITLE]]<br/>
<li>Click "Add".
+
#Use default settings for "Project Management"
</li>
+
#Click "Finish"
<li>Name the kit as "RK&#160;toolchain"
+
#;[[File:RK3288 Qt project finish.png|RTENOTITLE]]<br/>
</li>
+
#Double click "hello_qt.pro" to switch to editor window
<li>Specify the correct "Device Tpye", "Compiler", "Debugger" and "Qt version"
+
#In new project it is necessary to add following two lines into qt project file.
</li>
+
#:<code>target.path = ./<br/>INSTALLS += target</code><br/>
<li>Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/arm-buildroot-linux-gnueabihf/sysroot" as sysroot
+
#;[[File:RK3288 Qt code pro.png|RTENOTITLE]]<br/>
</li>
+
#Press "Ctrl+S" to save file.
<li>Click Apply
+
#Double click "mainwindow.ui" to switch to Design mode
<dl><dt>&lt;img src="/wiki/images/a/ab/RK3288_Qt_toolchain.png" _fck_mw_filename="RK3288 Qt toolchain.png" _fck_mw_origimgwidth="1363" _fck_mw_origimgheight="907" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#Drag & drop one Label widget on main form, use property editor on the right side to change text and font size
</dt></dl></li>
+
#;[[File:2015-01-30 174418.png|RTENOTITLE]]<br/>
<li>Click OK to finalize the configuration.
+
#;[[File:RK3288 Qt code window size.png|RTENOTITLE]]<br/>
</li>
+
#Save all project files using "File" -> "Save All"
<li>Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit.
+
 
</li>&lt;/ol&gt;<h2> Creating the Project </h2>
+
== Building the Project ==
<ol><li>Bring up "New" dailog using "File" -&gt; "New File or Project..."
+
 
</li>
+
#Switch to "Projects" mode
<li>Select "Applications" -&gt; 'Qt Widgets Application"
+
#Check if "build configuration" is set to "Debug".
</li>
+
#;[[File:RK3288 Qt debug setting.png|RTENOTITLE]]<br/>
<li>Click "Choose..."
+
#Check if "Files to deploy" is correct
<dl><dt>&lt;img src="/wiki/images/4/4b/RK3399_Project_001.png" _fck_mw_filename="RK3399 Project 001.png" _fck_mw_origimgwidth="1308" _fck_mw_origimgheight="733" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
#;[[File:RK3288 Qt debug run.png|RTENOTITLE]]<br/>
</dt></dl></li>
+
#Set environment variable DISPLAY in QtCreator -> Projects -> Run -> Run Environment. The value of DISPLAY is obtained from the rk3288. For example, execute instruction '''''echo $DISPLAY''''' on RK3288.
<li>Use "hello_qt" as name
+
#;[[File:RK3288 Qt debug DISPLAY.png|RTENOTITLE]]<br/>
</li>
+
#Switch to "Edit" mode
<li>Create in "/mnt/sda1/work/qt/PJ"
+
#Click "Build" using context menu of project "Hello"
</li>
+
#;[[File:RK3288 Qt code build.png|RTENOTITLE]]<br/>
<li>Click "Next"
+
#The green "Build" bar means no error occured.
<dl><dt>&lt;img src="/wiki/images/9/92/RK3288_Qt_project_name_local.PNG" _fck_mw_filename="RK3288 Qt project name local.PNG" _fck_mw_origimgwidth="731" _fck_mw_origimgheight="130" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#;
</dt></dl></li>
+
#Press "Alt+4" to show "Compile Output".
<li>Check "RK3288 toolchain"
+
#;;<br/>
</li>
+
#;;<br/>
<li>Click "Next".
+
 
<dl><dt>&lt;img src="/wiki/images/6/69/RK3288_Qt_project_kit_select.png" _fck_mw_filename="RK3288 Qt project kit select.png" _fck_mw_origimgwidth="1398" _fck_mw_origimgheight="735" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
== Deploying the Application ==
</dt></dl></li>
+
 
<li>Use default settings for "Class Information"
+
#Click "Deploy" using context menu of project hello_qt
</li>
+
#;<br/>
<li>Click "Next"
+
#The green "Deploy" bar indicates no error occured.
<dl><dt>&lt;img src="/wiki/images/7/7c/RK3399_QT_Project_last.png" _fck_mw_filename="RK3399 QT Project last.png" _fck_mw_origimgwidth="1304" _fck_mw_origimgheight="731" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#;;[[File:RK3288 Qt deploy output.png|RTENOTITLE]]<br/>
</dt></dl></li>
+
 
<li>Use default settings for "Project Management"
+
== Debugging the Application ==
</li>
+
 
<li>Click "Finish"
+
#Click debug icon to start debugging.
<dl><dt>&lt;img src="/wiki/images/d/db/RK3288_Qt_project_finish.png" _fck_mw_filename="RK3288 Qt project finish.png" _fck_mw_origimgwidth="1399" _fck_mw_origimgheight="737" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#;[[File:RK3288 Qt debug icon.png|RTENOTITLE]]<br/>
</dt></dl></li>
+
#Press "Alt+3" to show "Application Output"
<li>Double click "hello_qt.pro" to switch to editor window
+
#;;[[File:RK3288 Qt debug output.png|RTENOTITLE]]<br/>
</li>
+
#The "hello_qt" shows up on primary display.
<li>In new project it is necessary to add following two lines into qt project file.
+
#;[[File:RK3399 Qt result show.png|RTENOTITLE]]
<dl><dd><code>target.path = ./<br />INSTALLS += target</code><br />
+
#Click "stop" to stop debugging.
</dd>
+
#;[[File:RK3288 Qt debug stop.png|RTENOTITLE]]<br/>
<dt>&lt;img src="/wiki/images/5/5b/RK3288_Qt_code_pro.png" _fck_mw_filename="RK3288 Qt code pro.png" _fck_mw_origimgwidth="1400" _fck_mw_origimgheight="740" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#The deafult desktop returns back.
</dt></dl></li>
+
#;;[[File:RK3399 Qt default Desktop.png|RTENOTITLE]]
<li>Press "Ctrl+S" to save file.
+
 
</li>
+
:
<li>Double click "mainwindow.ui" to switch to Design mode
+
 
</li>
+
#:
<li>Drag &amp; drop one Label widget on main form, use property editor on the right side to change text and font size
+
 
<dl><dt>&lt;img src="/wiki/images/3/31/2015-01-30_174418.png" _fck_mw_filename="2015-01-30 174418.png" _fck_mw_origimgwidth="279" _fck_mw_origimgheight="338" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
*
</dt>
+
 
<dt>&lt;img src="/wiki/images/b/b6/RK3288_Qt_code_window_size.png" _fck_mw_filename="RK3288 Qt code window size.png" _fck_mw_origimgwidth="1400" _fck_mw_origimgheight="740" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
#;;;
</dt></dl></li>
+
<li>Save all project files using "File" -&gt; "Save All"
+
</li></ol><h2> Building the Project </h2>
+
<ol><li>Switch to "Projects" mode
+
</li>
+
<li>Check if "build configuration" is set to "Debug".
+
<dl><dt>&lt;img src="/wiki/images/c/c5/RK3288_Qt_debug_setting.png" _fck_mw_filename="RK3288 Qt debug setting.png" _fck_mw_origimgwidth="1400" _fck_mw_origimgheight="740" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl></li>
+
<li>Check if "Files to deploy" is correct
+
<dl><dt>&lt;img src="/wiki/images/5/5e/RK3288_Qt_debug_run.png" _fck_mw_filename="RK3288 Qt debug run.png" _fck_mw_origimgwidth="1400" _fck_mw_origimgheight="740" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl></li>
+
<li>Set environment variable DISPLAY in QtCreator -&gt; Projects -&gt; Run -&gt; Run Environment. The value of DISPLAY is obtained from the rk3288. For example, execute instruction <i><b>echo $DISPLAY</b></i> on RK3288.
+
<dl><dt>&lt;img src="/wiki/images/3/3b/RK3288_Qt_debug_DISPLAY.png" _fck_mw_filename="RK3288 Qt debug DISPLAY.png" _fck_mw_origimgwidth="1372" _fck_mw_origimgheight="740" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl></li>
+
<li>Switch to "Edit" mode
+
</li>
+
<li>Click "Build" using context menu of project "Hello"
+
<dl><dt>&lt;img src="/wiki/images/4/47/RK3288_Qt_code_build.png" _fck_mw_filename="RK3288 Qt code build.png" _fck_mw_origimgwidth="1375" _fck_mw_origimgheight="747" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl></li>
+
<li>The green "Build" bar means no error occured.
+
<dl><dt>&lt;img src="/wiki/images/5/5c/RK3399_Qt_build_status.png" _fck_mw_filename="RK3399 Qt build status.png" _fck_mw_origimgwidth="996" _fck_mw_origimgheight="28" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
</dt></dl></li>
+
<li>Press "Alt+4" to show "Compile Output".
+
<dl><dt><dl><dt>&lt;img src="/wiki/images/b/b1/RK3288_Qt_build_output.png" _fck_mw_filename="RK3288 Qt build output.png" _fck_mw_origimgwidth="1372" _fck_mw_origimgheight="740" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt>
+
<dt><br />
+
</dt></dl>&lt;/dd&gt;&lt;/dl&gt;</li>&lt;/ol&gt;<h2> Deploying the Application </h2>
+
<ol><li>Click "Deploy" using context menu of project hello_qt
+
<dl><dt>&lt;img src="/wiki/images/7/75/RK3288_Qt_deploy_start.png" _fck_mw_filename="RK3288 Qt deploy start.png" _fck_mw_origimgwidth="1375" _fck_mw_origimgheight="743" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl></li>
+
<li>The green "Deploy" bar indicates no error occured.
+
<dl><dt><dl><dt>&lt;img src="/wiki/images/3/32/RK3288_Qt_deploy_output.png" _fck_mw_filename="RK3288 Qt deploy output.png" _fck_mw_origimgwidth="1065" _fck_mw_origimgheight="403" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl>&lt;/dd&gt;&lt;/dl&gt;</li>&lt;/ol&gt;<h2> Debugging the Application </h2>
+
<ol><li>Click debug icon to start debugging.
+
<dl><dt>&lt;img src="/wiki/images/3/36/RK3288_Qt_debug_icon.png" _fck_mw_filename="RK3288 Qt debug icon.png" _fck_mw_origimgwidth="72" _fck_mw_origimgheight="213" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl></li>
+
<li>Press "Alt+3" to show "Application Output"
+
<dl><dt><dl><dt>&lt;img src="/wiki/images/0/06/RK3288_Qt_debug_output.png" _fck_mw_filename="RK3288 Qt debug output.png" _fck_mw_origimgwidth="1061" _fck_mw_origimgheight="399" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl>&lt;/dd&gt;&lt;/dl&gt;</li>
+
<li>The "hello_qt" shows up on primary display.
+
<dl><dt>&lt;img src="/wiki/images/a/ac/RK3399_Qt_result_show.png" _fck_mw_filename="RK3399 Qt result show.png" _fck_mw_origimgwidth="404" _fck_mw_origimgheight="327" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
</dt></dl></li>
+
<li>Click "stop" to stop debugging.
+
<dl><dt>&lt;img src="/wiki/images/8/8d/RK3288_Qt_debug_stop.png" _fck_mw_filename="RK3288 Qt debug stop.png" _fck_mw_origimgwidth="461" _fck_mw_origimgheight="61" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;<br />
+
</dt></dl></li>
+
<li>The deafult desktop returns back.
+
<dl><dt><dl><dt>&lt;img src="/wiki/images/6/60/RK3399_Qt_default_Desktop.png" _fck_mw_filename="RK3399 Qt default Desktop.png" _fck_mw_origimgwidth="1280" _fck_mw_origimgheight="720" alt="RTENOTITLE" title="RTENOTITLE" style="vertical-align:middle;" /&gt;
+
</dt></dl>&lt;/dd&gt;&lt;/dl&gt;</li>&lt;/ol&gt;
+

Revision as of 02:04, 9 November 2020



Prerequisites

All operations in this guide are based on Ubuntu 18.04 LTS 64bit only.
First please install Ubuntu 18.04 LTS 64bit* with minimum 2GB memory.

Installing required packages

Please login and perform the following commands:

$ sudo apt-get install build-essential
$ sudo apt-get install qtcreator
$ sudo apt-get install qt5-default
$ sudo apt-get install qt5-doc
$ sudo apt-get install qt5-doc-html qtbase5-doc-html
$ sudo apt-get install qtbase5-examples

Installing cross toolchain

Please download cross compiler toolchain (Password: 0kkn)first. Then execute the following command to unzip the cross compiler tool to the /opt directory

$ sudo tar -zxf rk3399_toolchain_Qt_V5.12.2.tar.gz -C /opt

Working within QtCreator

Starting the QtCreator

$ qtcreator
  1. The QtCreator's main window shows up.
    RK3399 Qt start init.png
  2. Check QtCreator's version by using "Help" -> "About Qt Creator".
    RTENOTITLE

Configuring the Cross-Compiler Options

  1. Bring up the options dialog using "Tools" -> "Options..."
  2. Select the "Devices" page on the left, and click "Add..."
  3. Select "Generic Linux Device" and click "Start Wizard".
    RTENOTITLE
  4. Specify proper settings and click "Next>"
    RTENOTITLE
  5. Click "Finish"
  6. Device test finished successfully. Click "Close".
    RTENOTITLE

    If device test failed, please go back to specify proper settings.
    RTENOTITLE
    (It is necessary to set a blank password at least, null password does not work.)

    RTENOTITLE
    (It means device's IP is incorrect or some network issues occured.)
  7. Click "Apply"
  8. Select the "Build & Run" page on the left, switch to "Compilers" tab, drop down "Add" menu and choose "GCC-->C++".
  9. Name the compiler as "RK G++"
  10. Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-g++"
  11. Click "Apply"
    RTENOTITLE
  12. Switch to the "Debuggers" tab
  13. Click "Add"
  14. Name the debugger as "RK GDB"
  15. Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-gdb"
  16. Click "Apply"
    RTENOTITLE
  17. Switch to the "Qt Versions" tab.
  18. Check if the "Qt 5.9.4 (host)" is auto detected in "Manual" item ?
    RTENOTITLE
    If not, click "Add..." to choose the proper qmake.
  19. Click "Apply"
  20. Switch to the "Kits" tab.
  21. Click "Add".
  22. Name the kit as "RK toolchain"
  23. Specify the correct "Device Tpye", "Compiler", "Debugger" and "Qt version"
  24. Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/arm-buildroot-linux-gnueabihf/sysroot" as sysroot
  25. Click Apply
    RTENOTITLE
  26. Click OK to finalize the configuration.
  27. Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit.

Creating the Project

  1. Bring up "New" dailog using "File" -> "New File or Project..."
  2. Select "Applications" -> 'Qt Widgets Application"
  3. Click "Choose..."
    RTENOTITLE
  4. Use "hello_qt" as name
  5. Create in "/mnt/sda1/work/qt/PJ"
  6. Click "Next"
    RTENOTITLE
  7. Check "RK3288 toolchain"
  8. Click "Next".
    RTENOTITLE
  9. Use default settings for "Class Information"
  10. Click "Next"
    RTENOTITLE
  11. Use default settings for "Project Management"
  12. Click "Finish"
    RTENOTITLE
  13. Double click "hello_qt.pro" to switch to editor window
  14. In new project it is necessary to add following two lines into qt project file.
    target.path = ./
    INSTALLS += target

    RTENOTITLE
  15. Press "Ctrl+S" to save file.
  16. Double click "mainwindow.ui" to switch to Design mode
  17. Drag & drop one Label widget on main form, use property editor on the right side to change text and font size
    RTENOTITLE
    RTENOTITLE
  18. Save all project files using "File" -> "Save All"

Building the Project

  1. Switch to "Projects" mode
  2. Check if "build configuration" is set to "Debug".
    RTENOTITLE
  3. Check if "Files to deploy" is correct
    RTENOTITLE
  4. Set environment variable DISPLAY in QtCreator -> Projects -> Run -> Run Environment. The value of DISPLAY is obtained from the rk3288. For example, execute instruction echo $DISPLAY on RK3288.
    RTENOTITLE
  5. Switch to "Edit" mode
  6. Click "Build" using context menu of project "Hello"
    RTENOTITLE
  7. The green "Build" bar means no error occured.
  8. Press "Alt+4" to show "Compile Output".


Deploying the Application

  1. Click "Deploy" using context menu of project hello_qt

  2. The green "Deploy" bar indicates no error occured.
    RTENOTITLE

Debugging the Application

  1. Click debug icon to start debugging.
    RTENOTITLE
  2. Press "Alt+3" to show "Application Output"
    RTENOTITLE
  3. The "hello_qt" shows up on primary display.
    RTENOTITLE
  4. Click "stop" to stop debugging.
    RTENOTITLE
  5. The deafult desktop returns back.
    RTENOTITLE