Difference between revisions of "Qt5Creator"

From ESS-WIKI
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 48: Line 48:
 
#;[[File:RK3399 Qt Remote device setting.png|RTENOTITLE]]
 
#;[[File:RK3399 Qt Remote device setting.png|RTENOTITLE]]
 
#Specify proper settings and click "Next>"
 
#Specify proper settings and click "Next>"
#;[[File:RK3288 Qt ssh device.png|RTENOTITLE]]<br/>
+
#;[[File:RK3399 Qt Remote device setting 002.png|RTENOTITLE]]
 
#Click "Finish"
 
#Click "Finish"
 
#Device test finished successfully. Click "Close".
 
#Device test finished successfully. Click "Close".
#;[[File:RK3288 Qt ssh connect.png|RTENOTITLE]]<br/>
+
#;[[File:RK3399 Qt Remote device setting 003.png|RTENOTITLE]]
 
#;<br/>
 
#;<br/>
 
#;If device test failed, please go back to specify proper settings.
 
#;If device test failed, please go back to specify proper settings.
Line 62: Line 62:
 
#Select the "Build & Run" page on the left, switch to "Compilers" tab, drop down "Add" menu and choose "GCC-->C++".
 
#Select the "Build & Run" page on the left, switch to "Compilers" tab, drop down "Add" menu and choose "GCC-->C++".
 
#Name the compiler as "RK G++"
 
#Name the compiler as "RK G++"
#Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-g++"
+
#Click "Browse..." to select "/opt/rk3399_risc/buildroot/output/rockchip_rk3399/host/bin/aarch64-buildroot-linux-gnu-g++"
 
#Click "Apply"
 
#Click "Apply"
#;[[File:RK3288 Qt g++.png|RTENOTITLE]]<br/>
+
#;[[File:RK3399 Qt GCC setting002.png|RTENOTITLE]]
 
#Switch to the "Debuggers" tab
 
#Switch to the "Debuggers" tab
 
#Click "Add"
 
#Click "Add"
 
#Name the debugger as "RK GDB"
 
#Name the debugger as "RK GDB"
#Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-gdb"
+
#Click "Browse..." to select "/opt/rk3399_risc/buildroot/output/rockchip_rk3399/host/bin/aarch64-buildroot-linux-gnu-gdb"
 
#Click "Apply"
 
#Click "Apply"
#;[[File:RK3288 Qt GDB.png|RTENOTITLE]]<br/>
+
#;[[File:RK3399 Qt setting GDB.png|RTENOTITLE]]
 
#Switch to the "Qt Versions" tab.
 
#Switch to the "Qt Versions" tab.
#Check if the "Qt 5.9.4&nbsp;(host)" is auto detected in "Manual" item&nbsp;?
+
#Check if the "Qt 5.12.2&nbsp;(host)" is auto detected in "Manual" item&nbsp;?
#;[[File:RK3288 Qt version.png|RTENOTITLE]]<br/>
+
#;[[File:RK3399 Qt setting qmake.png|RTENOTITLE]]<br/>
 
#;If not, click "Add..." to choose the proper qmake.
 
#;If not, click "Add..." to choose the proper qmake.
 
#Click "Apply"
 
#Click "Apply"
Line 80: Line 80:
 
#Name the kit as "RK&nbsp;toolchain"
 
#Name the kit as "RK&nbsp;toolchain"
 
#Specify the correct "Device Tpye", "Compiler", "Debugger" and "Qt version"
 
#Specify the correct "Device Tpye", "Compiler", "Debugger" and "Qt version"
#Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/arm-buildroot-linux-gnueabihf/sysroot" as sysroot
+
#Click "Browse..." to select "/opt/rk3399_risc/buildroot/output/rockchip_rk3399/host/aarch64-buildroot-linux-gnu/sysroot" as sysroot
 
#Click Apply
 
#Click Apply
#;[[File:RK3288 Qt toolchain.png|RTENOTITLE]]<br/>
+
#;[[File:RK3399 setting kits.png|RTENOTITLE]]
 
#Click OK to finalize the configuration.
 
#Click OK to finalize the configuration.
 
#Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit.
 
#Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit.
Line 92: Line 92:
 
#Click "Choose..."
 
#Click "Choose..."
 
#;[[File:RK3399 Project 001.png|RTENOTITLE]]
 
#;[[File:RK3399 Project 001.png|RTENOTITLE]]
#Use "hello_qt" as name
+
#Use "Hello" as name
#Create in "/mnt/sda1/work/qt/PJ"
+
#Create in "/mnt/sda1/work/qt/qt_PJ"
 
#Click "Next"
 
#Click "Next"
#;[[File:RK3288 Qt project name local.PNG]]<br/>
+
#;[[File:RK3399 Qt Project local.png|RTENOTITLE]]
#Check "RK3288 toolchain"
+
#Check "RK toolchain"
 
#Click "Next".
 
#Click "Next".
#;[[File:RK3288 Qt project kit select.png]]<br/>
+
#;[[File:RK3399 Qt Project toolchain.png|RTENOTITLE]]
 
#Use default settings for "Class Information"
 
#Use default settings for "Class Information"
 
#Click "Next"
 
#Click "Next"
#;[[File:RK3399 QT Project last.png|RTENOTITLE]]<br/>
+
#;[[File:RK3399 QT Project last.png|RTENOTITLE]]
 
#Use default settings for "Project Management"
 
#Use default settings for "Project Management"
 
#Click "Finish"
 
#Click "Finish"
#;[[File:RK3288 Qt project finish.png]]<br/>
+
#;[[File:RK3399 Qt Project last2.png|RTENOTITLE]]
#Double click "hello_qt.pro" to switch to editor window
+
#Double click "Hello.pro" to switch to editor window
 
#In new project it is necessary to add following two lines into qt project file.
 
#In new project it is necessary to add following two lines into qt project file.
#:<code>target.path = ./<br/>INSTALLS += target</code><br/>
+
#:<code>target.path = .<br/>INSTALLS += target</code>
#;[[File:RK3288 Qt code pro.png]]<br/>
+
#;[[File:RK3399 Qt Project code002.png|RTENOTITLE]]
 
#Press "Ctrl+S" to save file.
 
#Press "Ctrl+S" to save file.
 
#Double click "mainwindow.ui" to switch to Design mode
 
#Double click "mainwindow.ui" to switch to Design mode
 
#Drag & drop one Label widget on main form, use property editor on the right side to change text and font size
 
#Drag & drop one Label widget on main form, use property editor on the right side to change text and font size
#;[[File:2015-01-30 174418.png|RTENOTITLE]]<br/>
+
#;[[File:2015-01-30 174418.png|RTENOTITLE]]
#;[[File:RK3288 Qt code window size.png]]<br/>
+
#;[[File:RK3399 Qt Project code003.png|RTENOTITLE]]
 
#Save all project files using "File" -> "Save All"
 
#Save all project files using "File" -> "Save All"
  
Line 120: Line 120:
 
#Switch to "Projects" mode
 
#Switch to "Projects" mode
 
#Check if "build configuration" is set to "Debug".
 
#Check if "build configuration" is set to "Debug".
#;[[File:RK3288 Qt debug setting.png]]<br/>
+
#;[[File:RK3399 Qt debug setting.png|RTENOTITLE]]
 
#Check if "Files to deploy" is correct
 
#Check if "Files to deploy" is correct
#;[[File:RK3288 Qt debug run.png]]<br/>
+
#;[[File:RK3399 Qt run setting.png|RTENOTITLE]]
#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.
+
#Set environment variable DISPLAY in QtCreator -> Projects -> Run -> Run Environment. The value of DISPLAY is obtained from the rk3399. For example, execute instruction '''''echo $DISPLAY''''' on RK3399.
#;[[File:RK3288 Qt debug DISPLAY.png]]<br/>
+
#;[[File:RK3399 Qt ENV Display.png|RTENOTITLE]]
 
#Switch to "Edit" mode
 
#Switch to "Edit" mode
 
#Click "Build" using context menu of project "Hello"
 
#Click "Build" using context menu of project "Hello"
#;[[File:RK3288 Qt code build.png]]<br/>
+
#;[[File:RK3399 Qt build start.png|RTENOTITLE]]
 
#The green "Build" bar means no error occured.
 
#The green "Build" bar means no error occured.
 
#;[[File:RK3399 Qt build status.png|RTENOTITLE]]
 
#;[[File:RK3399 Qt build status.png|RTENOTITLE]]
 
#Press "Alt+4" to show "Compile Output".
 
#Press "Alt+4" to show "Compile Output".
#;;[[File:RK3288 Qt build output.png]]<br/>
+
#;;[[File:RK3399 Qt build output.png|RTENOTITLE]]
#;;<br/>
 
  
 
== Deploying the Application ==
 
== Deploying the Application ==
  
#Click "Deploy" using context menu of project hello_qt
+
#Click "Deploy" using context menu of project Hello
#;[[File:RK3288 Qt deploy start.png]]<br/>
+
#;[[File:RK3399 Qt deploy start.PNG|RTENOTITLE]]
 
#The green "Deploy" bar indicates no error occured.
 
#The green "Deploy" bar indicates no error occured.
#;;[[File:RK3288 Qt deploy output.png]]<br/>
+
#;;[[File:RK3399 Qt deploy output.png|RTENOTITLE]]
  
 
== Debugging the Application ==
 
== Debugging the Application ==

Latest revision as of 03:13, 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/rk3399_risc/buildroot/output/rockchip_rk3399/host/bin/aarch64-buildroot-linux-gnu-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/rk3399_risc/buildroot/output/rockchip_rk3399/host/bin/aarch64-buildroot-linux-gnu-gdb"
  16. Click "Apply"
    RTENOTITLE
  17. Switch to the "Qt Versions" tab.
  18. Check if the "Qt 5.12.2 (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/rk3399_risc/buildroot/output/rockchip_rk3399/host/aarch64-buildroot-linux-gnu/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" as name
  5. Create in "/mnt/sda1/work/qt/qt_PJ"
  6. Click "Next"
    RTENOTITLE
  7. Check "RK 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.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 rk3399. For example, execute instruction echo $DISPLAY on RK3399.
    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.
    RTENOTITLE
  8. Press "Alt+4" to show "Compile Output".
    RTENOTITLE

Deploying the Application

  1. Click "Deploy" using context menu of project Hello
    RTENOTITLE
  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" shows up on primary display.
    RTENOTITLE
  4. Click "stop" to stop debugging.
    RTENOTITLE
  5. The deafult desktop returns back.
    RTENOTITLE