Setting-up QtCreator to cross compile for RK3288
_ |
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 <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>">cross compiler toolchain</a> (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
</p> </dl>- The QtCreator's main window shows up.
- <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;" />
- Check QtCreator's version by using "Help" -> "About Qt Creator".
- <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;" />
- 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".
- <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;" />
- Specify proper settings and click "Next>"
- <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;" />
- <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;" />
- Click "Finish"
- Device test finished successfully. Click "Close".
- <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;" />
- If device test failed, please go back to specify proper settings.
- <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;" /> </dt>
- (It is necessary to set a blank password at least, null password does not work.)
- <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;" />
- (It means device's IP is incorrect or some network issues occured.) </dl></li>
- <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;" />
- 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"
- <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;" />
- <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;" />
- 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"
- <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;" />
- <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;" />
- Switch to the "Qt Versions" tab.
- Check if the "Qt 5.9.4 (host)" is auto detected in "Manual" item ?
- <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;" />
- If not, click "Add..." to choose the proper qmake.
- <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;" />
- 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
- <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;" />
- <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;" />
- Click OK to finalize the configuration.
- Invoke the options dialog again to make sure the "iMX6 toolchain" is default kit. </ol>
- Bring up "New" dailog using "File" -> "New File or Project..."
- Select "Applications" -> 'Qt Widgets Application"
- Click "Choose..."
- <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;" />
- Use "hello_qt" as name
- Create in "/mnt/sda1/work/qt/PJ"
- Click "Next"
- <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;" />
- <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;" />
- Check "RK3288 toolchain"
- Click "Next".
- <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;" />
- <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;" />
- Use default settings for "Class Information"
- Click "Next"
- <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;" />
- <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;" />
- Use default settings for "Project Management"
- Click "Finish"
- <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;" />
- <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;" />
- 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.
target.path = ./
INSTALLS += target
- <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;" />
- 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
- <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;" />
- <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;" />
- <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;" />
- Save all project files using "File" -> "Save All"
- Switch to "Projects" mode
- Check if "build configuration" is set to "Debug".
- <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;" />
- <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;" />
- Check if "Files to deploy" is correct
- <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;" />
- <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;" />
- 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.
- <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;" />
- <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;" />
- Switch to "Edit" mode
- Click "Build" using context menu of project "Hello"
- <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;" />
- <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;" />
- The green "Build" bar means no error occured.
- <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;" />
- Press "Alt+4" to show "Compile Output".
- <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;" />
- Click "Deploy" using context menu of project hello_qt
- <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;" />
- <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;" />
- The green "Deploy" bar indicates no error occured.
- <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;" />
- Click debug icon to start debugging.
- <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;" />
- <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;" />
- Press "Alt+3" to show "Application Output"
- <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;" />
- <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;" />
- The "hello_qt" shows up on primary display.
- <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;" />
- Click "stop" to stop debugging.
- <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;" />
- <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;" />
- The deafult desktop returns back.
- <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;" />
Debugging the Application
- <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;" />
Deploying the Application
- <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;" />
Working within QtCreator
Starting the QtCreator
$ qtcreator
Configuring the Cross-Compiler Options
Creating the Project
Building the Project