“Imx-4.1.15 Yocto-2.1 系统使用”的版本间的差异

来自ARM Wiki
跳转至: 导航搜索
使用终端命令行编译运行qt程序
 
(未显示同一用户的1个中间版本)
第22行: 第22行:
 
./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh
 
./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh
 
</syntaxhighlight>
 
</syntaxhighlight>
默认安装在/opt/fsl-imx-x11/4.1.15-2.1.0,可自定义修改。
+
默认安装在/opt/fsl-imx-x11/4.1.15-2.1.0,可自定义修改。<br />
 
可下载qt示例程序[http://norcord.com:8070/f/6080a212fc55499f8ac8/?dl=1 examples],并解压到任意路径。
 
可下载qt示例程序[http://norcord.com:8070/f/6080a212fc55499f8ac8/?dl=1 examples],并解压到任意路径。
 
===使用终端命令行编译运行qt程序===
 
===使用终端命令行编译运行qt程序===
第48行: 第48行:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ sudo apt-get install qtcreator
 
$ sudo apt-get install qtcreator
 +
</syntaxhighlight>
 +
<br />
 +
'''导入终端环境变量,启动qtcreator'''<br />
 +
<syntaxhighlight lang="bash">
 +
$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
 +
$ /usr/bin/qtcreator.sh
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<br />
 
<br />
 
'''添加Qt Versions'''<br />
 
'''添加Qt Versions'''<br />
 
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply<br />
 
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply<br />
[[文件:Qtcreator1 Qt Versions.png]]<br />
+
qmake路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake<br />
 +
[[文件:Screenshot from 2022-01-19 09-19-10.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''添加Compilers'''<br />
 
'''添加Compilers'''<br />
 
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply<br />
 
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply<br />
注意:选中g++路径,并修改ABI一栏明确指示平台架构为arm<br />
+
g++路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++<br />
[[文件:Qtcreator1 Compilers.png]]<br />
+
[[文件:Screenshot from 2022-01-19 09-21-31.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''添加Devices(可选项)'''<br />
 
'''添加Devices(可选项)'''<br />
 
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard<br />
 
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard<br />
[[文件:Qtcreator1 Devices.png]]<br />
+
[[文件:Screenshot from 2022-01-19 09-24-23.png]]<br />
 
<br />
 
<br />
 
并点击"Test"测试设备联通'''<br />
 
并点击"Test"测试设备联通'''<br />
[[文件:Device Test.png]]<br />
+
[[文件:Screenshot from 2022-01-19 09-24-28.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''添加Kits'''<br />
 
'''添加Kits'''<br />
 
Tools --> Options --> Build & Run --> Kits --> Add --> Apply<br />
 
Tools --> Options --> Build & Run --> Kits --> Add --> Apply<br />
[[文件:Qtcreator1 Kits.png]]<br />
+
sysroot路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi<br />
 +
[[文件:Screenshot from 2022-01-19 09-29-31.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''打开 hellowindow 工程并选择Kits'''<br />
 
'''打开 hellowindow 工程并选择Kits'''<br />
Welcome --> Open Porject --> 选择工程路径 /home/lin/trash/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/qt/examples/opengl/hellowindow/hellowindow.pro --> Configure Project<br />
+
Welcome --> Open Porject --> 选择工程路径 --> Configure Project<br />
[[文件:Qtcreator1 Configure Project.png]]<br />
+
工程路径示例:/opt/data/qt/examples/opengl/hellowindow/hellowindow.pro<br />
 +
[[文件:Screenshot from 2022-01-19 09-39-34.png]]<br />
 +
<br />
 +
<br />
 +
'''配置编译参数'''<br />
 +
Projects --> Build --> Build Steps --> Additional arguments:<br />
 +
编译参数:-spec linux-oe-g++<br />
 +
[[文件:Screenshot from 2022-01-19 09-44-01.png]]<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
'''编译运行 hellowindow'''<br />
 
'''编译运行 hellowindow'''<br />
Build --> Build Project "hellowindow" --> 重启qtcreator --> Build --> Run<br />
+
Build --> Build Project "hellowindow"<br />
[[文件:Projects 1.png|1560px]]<br />
+
Build --> Run<br />
 +
[[文件:Screenshot from 2022-01-19 09-47-00.png]]<br />
 
<br />
 
<br />
[[文件:Projects 2.jpg|1560px]]<br />
+
[[文件:541562654.jpg|800px]]<br />
 
<br />
 
<br />
 
<br />
 
<br />

2022年1月19日 (三) 10:53的最新版本

该yocto系统是基于x11显示协议的嵌入式系统。系统集成的qt支持x11显示插件。

基础信息

用户密码

系统默认使用root用户登录,并支持root用户ssh远程登录,免密码。

QT开发

搭建qt开发环境

x86主机或虚拟机的系统用Ubuntu16.0或Ubuntu18.04进行交叉编译开发,开发环境配置参考如下:
Ubuntu16.04系统主机编译环境建议安装

sudo apt-get install repo git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu mtools parted libudev-dev libusb-1.0-0-dev python-linaro-image-tools linaro-image-tools autoconf autotools-dev libsigsegv2 m4 intltool libdrm-dev curl sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio python unzip rsync file bc wget libncurses5 libqt4-dev libglib2.0-dev libgtk2.0-dev libglade2-dev cvs git mercurial rsync openssh-client subversion asciidoc w3m dblatex graphviz python-matplotlib libc6:i386 libssl-dev texinfo liblz4-tool genext2fs expect patchelf gawk

Ubuntu18.04系统主机编译环境建议安装

sudo apt-get install asciidoc autoconf autotools-dev bash bc binfmt-support binutils bison build-essential bzip2 chrpath cmake cpio curl cvs dblatex device-tree-compiler diffstat expect fakeroot file flex g++ gawk gcc genext2fs git git-gui gitk g++-multilib graphviz gzip intltool libdrm-dev libglade2-dev libglib2.0-dev libgtk2.0-dev liblz4-tool libncurses5 libqt4-dev libsigsegv2 libssl-dev libudev-dev libusb-1.0-0-dev linaro-image-tools live-build m4 make mercurial mtools ncurses-dev openssh-client parted patch patchelf perl python python-linaro-image-tools python-matplotlib python-pip qemu-user-static repo rsync sed ssh subversion tar texinfo u-boot-tools unzip w3m wget libdb1-compat python3-pyelftools

主机PC端环境以Ubuntu16.04为例,目标板系统为yocto嵌入式系统。 下载qt开发SDK,SDK中包含交叉编译工具链、qmake、sysroot等,终端执行命令进行安装:

./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0.sh

默认安装在/opt/fsl-imx-x11/4.1.15-2.1.0,可自定义修改。
可下载qt示例程序examples,并解压到任意路径。

使用终端命令行编译运行qt程序

qt程序使用SDK中的qt5 examples例程,通过qmake、make命令进行编译

$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
$ cd /opt/data/qt/examples/opengl/hellowindow
$ qmake
$ make

生成hellowindow程序,可通过scp拷贝到目标板中直接运行

$ scp hellowindow root@10.168.1.151:
$ ssh root@10.168.1.151
$ export DISPLAY=:0.0
$ ./hellowindow

541562654.jpg

使用qtcreator开发调试qt程序

qtcreator集成编辑、编译、运行、调试环境于一体,提升开发效率

安装qtcreator

$ sudo apt-get install qtcreator


导入终端环境变量,启动qtcreator

$ source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
$ /usr/bin/qtcreator.sh


添加Qt Versions
Tools --> Options --> Build & Run --> Qt Versions --> Add --> 选中qmake路径 --> Apply
qmake路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
Screenshot from 2022-01-19 09-19-10.png


添加Compilers
Tools --> Options --> Build & Run --> Compilers --> Add --> GCC -- 选中g++路径 --> Apply
g++路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
Screenshot from 2022-01-19 09-21-31.png


添加Devices(可选项)
Tools --> Options --> Devices --> Add --> General Linux Device --> start Wizard
Screenshot from 2022-01-19 09-24-23.png

并点击"Test"测试设备联通
Screenshot from 2022-01-19 09-24-28.png


添加Kits
Tools --> Options --> Build & Run --> Kits --> Add --> Apply
sysroot路径:/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi
Screenshot from 2022-01-19 09-29-31.png


打开 hellowindow 工程并选择Kits
Welcome --> Open Porject --> 选择工程路径 --> Configure Project
工程路径示例:/opt/data/qt/examples/opengl/hellowindow/hellowindow.pro
Screenshot from 2022-01-19 09-39-34.png


配置编译参数
Projects --> Build --> Build Steps --> Additional arguments:
编译参数:-spec linux-oe-g++
Screenshot from 2022-01-19 09-44-01.png


编译运行 hellowindow
Build --> Build Project "hellowindow"
Build --> Run
Screenshot from 2022-01-19 09-47-00.png

541562654.jpg