Difference between revisions of "RK3288 qt5Creator"
From ESS-WIKI
(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: | ||
− | + | {{DISPLAYTITLE:Setting-up QtCreator to cross compile for RK3399}} | |
− | + | ||
− | + | {| align="right" | |
+ | |- | ||
+ | | __TOC__ | ||
+ | |} | ||
− | |||
− | |||
− | |||
<!-- | <!-- | ||
--> | --> | ||
− | + | = Prerequisites = | |
− | + | ||
− | + | 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. | |
− | + | ||
− | + | == Installing required packages == | |
− | + | ||
− | <pre | + | 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> | ||
− | + | ||
− | + | == Installing cross toolchain == | |
− | + | ||
− | + | Please download [https://pan.baidu.com/s/1OEzbJsgBSo3n5DdwRY2Rag cross compiler toolchain] (Password: 0kkn)first. Then execute the following command to unzip the cross compiler tool to the /opt directory | |
− | + | ||
− | + | === === | |
− | + | ||
− | + | :<code>$ sudo tar -zxf rk3399_toolchain_Qt_V5.12.2.tar.gz -C /opt</code><br/> | |
− | <pre | + | |
+ | = Working within QtCreator = | ||
+ | |||
+ | == Starting the QtCreator == | ||
+ | <pre>$ qtcreator | ||
</pre> | </pre> | ||
− | + | ||
− | + | #The QtCreator's main window shows up. | |
− | + | #;[[File:RK3399 Qt start init.png|upright|RK3399 Qt start init.png]] | |
− | + | #Check QtCreator's version by using "Help" -> "About Qt Creator". | |
− | + | #;[[File:RK3399 QtCreator version.png|RTENOTITLE]] | |
− | </ | + | |
− | + | == Configuring the Cross-Compiler Options == | |
− | + | ||
− | + | #Bring up the options dialog using "Tools" -> "Options..." | |
− | </ | + | #Select the "Devices" page on the left, and click "Add..." |
− | + | #Select "Generic Linux Device" and click "Start Wizard". | |
− | + | #;[[File:RK3399 Qt Remote device setting.png|RTENOTITLE]] | |
− | + | #Specify proper settings and click "Next>" | |
− | + | #;[[File:RK3288 Qt ssh device.png|RTENOTITLE]]<br/> | |
− | < | + | #Click "Finish" |
− | + | #Device test finished successfully. Click "Close". | |
− | + | #;[[File:RK3288 Qt ssh connect.png|RTENOTITLE]]<br/> | |
− | </ | + | #;<br/> |
− | + | #;If device test failed, please go back to specify proper settings. | |
− | + | #;:[[File:2015-02-24 113504.png|RTENOTITLE]] | |
− | + | #:(It is necessary to set a blank password at least, null password does not work.) | |
− | + | #:<br/> | |
− | + | #:[[File:2015-02-24 113635.png|RTENOTITLE]] | |
− | + | #:(It means device's IP is incorrect or some network issues occured.) | |
− | + | #Click "Apply" | |
− | + | #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++" | |
− | + | #Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-g++" | |
− | + | #Click "Apply" | |
− | + | #;[[File:RK3288 Qt g++.png|RTENOTITLE]]<br/> | |
− | + | #Switch to the "Debuggers" tab | |
− | + | #Click "Add" | |
− | + | #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 "Apply" | |
− | + | #;[[File:RK3288 Qt GDB.png|RTENOTITLE]]<br/> | |
− | + | #Switch to the "Qt Versions" tab. | |
− | </ | + | #Check if the "Qt 5.9.4 (host)" is auto detected in "Manual" item ? |
− | + | #;[[File:RK3288 Qt version.png|RTENOTITLE]]<br/> | |
− | </ | + | #;If not, click "Add..." to choose the proper qmake. |
− | + | #Click "Apply" | |
− | </ | + | #Switch to the "Kits" tab. |
− | + | #Click "Add". | |
− | < | + | #Name the kit as "RK toolchain" |
− | + | #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 Apply | |
− | + | #;[[File:RK3288 Qt toolchain.png|RTENOTITLE]]<br/> | |
− | </ | + | #Click OK to finalize the configuration. |
− | < | + | #Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit. |
− | + | ||
− | + | == Creating the Project == | |
− | + | ||
− | + | #Bring up "New" dailog using "File" -> "New File or Project..." | |
− | + | #Select "Applications" -> 'Qt Widgets Application" | |
− | </ | + | #Click "Choose..." |
− | + | #;[[File:RK3399 Project 001.png|RTENOTITLE]] | |
− | + | #Use "hello_qt" as name | |
− | + | #Create in "/mnt/sda1/work/qt/PJ" | |
− | + | #Click "Next" | |
− | + | #;[[File:RK3288 Qt project name local.PNG|RTENOTITLE]]<br/> | |
− | + | #Check "RK3288 toolchain" | |
− | </ | + | #Click "Next". |
− | + | #;[[File:RK3288 Qt project kit select.png|RTENOTITLE]]<br/> | |
− | </ | + | #Use default settings for "Class Information" |
− | + | #Click "Next" | |
− | + | #;[[File:RK3399 QT Project last.png|RTENOTITLE]]<br/> | |
− | + | #Use default settings for "Project Management" | |
− | </ | + | #Click "Finish" |
− | + | #;[[File:RK3288 Qt project finish.png|RTENOTITLE]]<br/> | |
− | </ | + | #Double click "hello_qt.pro" to switch to editor window |
− | + | #In new project it is necessary to add following two lines into qt project file. | |
− | </ | + | #:<code>target.path = ./<br/>INSTALLS += target</code><br/> |
− | + | #;[[File:RK3288 Qt code pro.png|RTENOTITLE]]<br/> | |
− | </ | + | #Press "Ctrl+S" to save file. |
− | + | #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 | |
− | + | #;[[File:2015-01-30 174418.png|RTENOTITLE]]<br/> | |
− | + | #;[[File:RK3288 Qt code window size.png|RTENOTITLE]]<br/> | |
− | + | #Save all project files using "File" -> "Save All" | |
− | + | ||
− | + | == Building the Project == | |
− | + | ||
− | + | #Switch to "Projects" mode | |
− | + | #Check if "build configuration" is set to "Debug". | |
− | + | #;[[File:RK3288 Qt debug setting.png|RTENOTITLE]]<br/> | |
− | + | #Check if "Files to deploy" is correct | |
− | + | #;[[File:RK3288 Qt debug run.png|RTENOTITLE]]<br/> | |
− | + | #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. | |
− | + | #;[[File:RK3288 Qt debug DISPLAY.png|RTENOTITLE]]<br/> | |
− | + | #Switch to "Edit" mode | |
− | + | #Click "Build" using context menu of project "Hello" | |
− | + | #;[[File:RK3288 Qt code build.png|RTENOTITLE]]<br/> | |
− | + | #The green "Build" bar means no error occured. | |
− | + | #; | |
− | + | #Press "Alt+4" to show "Compile Output". | |
− | + | #;;<br/> | |
− | + | #;;<br/> | |
− | + | ||
− | + | == Deploying the Application == | |
− | + | ||
− | + | #Click "Deploy" using context menu of project hello_qt | |
− | + | #;<br/> | |
− | + | #The green "Deploy" bar indicates no error occured. | |
− | + | #;;[[File:RK3288 Qt deploy output.png|RTENOTITLE]]<br/> | |
− | + | ||
− | + | == Debugging the Application == | |
− | + | ||
− | + | #Click debug icon to start debugging. | |
− | + | #;[[File:RK3288 Qt debug icon.png|RTENOTITLE]]<br/> | |
− | + | #Press "Alt+3" to show "Application Output" | |
− | + | #;;[[File:RK3288 Qt debug output.png|RTENOTITLE]]<br/> | |
− | + | #The "hello_qt" shows up on primary display. | |
− | + | #;[[File:RK3399 Qt result show.png|RTENOTITLE]] | |
− | + | #Click "stop" to stop debugging. | |
− | + | #;[[File:RK3288 Qt debug stop.png|RTENOTITLE]]<br/> | |
− | + | #The deafult desktop returns back. | |
− | + | #;;[[File:RK3399 Qt default Desktop.png|RTENOTITLE]] | |
− | + | ||
− | + | : | |
− | + | ||
− | + | #: | |
− | + | ||
− | + | * | |
− | + | ||
− | + | #;;; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 02:04, 9 November 2020
Contents |
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
- The QtCreator's main window shows up.
- Check QtCreator's version by using "Help" -> "About Qt Creator".
Configuring the Cross-Compiler Options
- Bring up the options dialog using "Tools" -> "Options..."
- Select the "Devices" page on the left, and click "Add..."
- Select "Generic Linux Device" and click "Start Wizard".
- Specify proper settings and click "Next>"
- Click "Finish"
- Device test finished successfully. Click "Close".
- Click "Apply"
- 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++"
- Click "Browse..." to select "/opt/rk3288_risc/buildroot/output/rockchip_rk3288/host/bin/arm-buildroot-linux-gnueabihf-g++"
- Click "Apply"
- Switch to the "Debuggers" tab
- Click "Add"
- 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 "Apply"
- Switch to the "Qt Versions" tab.
- Check if the "Qt 5.9.4 (host)" is auto detected in "Manual" item ?
- Click "Apply"
- Switch to the "Kits" tab.
- Click "Add".
- Name the kit as "RK toolchain"
- 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 Apply
- Click OK to finalize the configuration.
- Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit.
Creating the Project
- Bring up "New" dailog using "File" -> "New File or Project..."
- Select "Applications" -> 'Qt Widgets Application"
- Click "Choose..."
- Use "hello_qt" as name
- Create in "/mnt/sda1/work/qt/PJ"
- Click "Next"
- Check "RK3288 toolchain"
- Click "Next".
- Use default settings for "Class Information"
- Click "Next"
- Use default settings for "Project Management"
- Click "Finish"
- Double click "hello_qt.pro" to switch to editor window
- In new project it is necessary to add following two lines into qt project file.
- Press "Ctrl+S" to save file.
- 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
- Save all project files using "File" -> "Save All"
Building the Project
- Switch to "Projects" mode
- Check if "build configuration" is set to "Debug".
- Check if "Files to deploy" is correct
- 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.
- Switch to "Edit" mode
- Click "Build" using context menu of project "Hello"
- The green "Build" bar means no error occured.
- 
- Press "Alt+4" to show "Compile Output".
- 
- 
Deploying the Application
- Click "Deploy" using context menu of project hello_qt
- 
- 
- The green "Deploy" bar indicates no error occured.
Debugging the Application
- Click debug icon to start debugging.
- Press "Alt+3" to show "Application Output"
- The "hello_qt" shows up on primary display.
- Click "stop" to stop debugging.
- The deafult desktop returns back.