加入星計劃,您可以享受以下權益:

  • 創(chuàng)作內容快速變現(xiàn)
  • 行業(yè)影響力擴散
  • 作品版權保護
  • 300W+ 專業(yè)用戶
  • 1.5W+ 優(yōu)質創(chuàng)作者
  • 5000+ 長期合作伙伴
立即加入
  • 正文
    • 1 編譯安裝SDK
    • 2 交叉編譯Qt
    • 3 在板子中運行Qt
    • 4 總結
  • 推薦器件
  • 相關推薦
  • 電子產業(yè)圖譜
申請入駐 產業(yè)圖譜

STM32MP157D-DK1 Qt程序交叉編譯與運行測試

01/02 13:55
2667
閱讀需 19 分鐘
加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點資訊討論

上篇文章介紹了STM32MP157D-DK1開發(fā)板Qt鏡像的構建,通過在Ubuntu中重新編譯帶有Qt功能的系統(tǒng)來實現(xiàn)。

本篇在上篇的基礎上,繼續(xù)搭建Qt的交叉編譯環(huán)境,實現(xiàn)Qt程序在Ubuntu中編譯,在STM32MP157板子中運行。

1 編譯安裝SDK

在上篇編譯系統(tǒng)鏡像的基礎上,繼續(xù)編譯和安裝SDK。

1.1 編譯SDK

執(zhí)行如下執(zhí)指令編譯帶有Qt功能的SDK:

bitbake st-example-image-qtwayland -c populate_sdk

中途如果報do_fetch失敗的錯誤,可參考上篇編譯鏡像時的do_fetch失敗的解決方法。

最終編譯成功的結果如下:

對應的打印如下:

xxpcb@xxpcb-ubuntu20:~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1$ bitbake st-example-image-qtwayland -c populate_sdk
NOTE: Started PRServer with DBfile: /home/xxpcb/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1/cache/prserv.sqlite3, Address: 127.0.0.1:36533, PID: 2974644
Loading cache: 100% |###############################################################################################################################################################| Time: 0:00:01
Loaded 4879 entries from dependency cache.
Parsing recipes: 100% |#############################################################################################################################################################| Time: 0:00:01
Parsing of 3068 .bb files complete (3067 cached, 1 parsed). 4879 targets, 562 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "2.4.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-ostl-linux-gnueabi"
MACHINE              = "stm32mp1"
DISTRO               = "openstlinux-weston"
DISTRO_VERSION       = "4.2.1-snapshot-20231224"
TUNE_FEATURES        = "arm vfp cortexa7 neon vfpv4 thumb callconvention-hard"
TARGET_FPU           = "hard"
DISTRO_CODENAME      = "mickledore"
ACCEPT_EULA_stm32mp1 = "1"
GCCVERSION           = "12.%"
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
meta-python          
meta-oe              
meta-gnome           
meta-initramfs       
meta-multimedia      
meta-networking      
meta-webserver       
meta-filesystems     
meta-perl            = "HEAD:c032fd0b1a9d444711103c2703dfa8e2964a3865"
meta-st-stm32mp      = "HEAD:931b3f5be2c00f55d114c8f9122082a9d229b776"
meta-qt5             = "HEAD:cf6ffcbad5275a3428f6046468a0c9d572e813d1"
meta-st-openstlinux  = "HEAD:8c780facff81d3c3878c5fdcd18bdd24fc36478d"
meta                 = "HEAD:20cd64812d286c920bd766145ab1cd968e72667e"

Initialising tasks: 100% |##########################################################################################################################################################| Time: 0:00:07
Sstate summary: Wanted 363 Local 353 Mirrors 0 Missed 10 Current 2412 (97% match, 99% complete)
Removing 4 stale sstate objects for arch stm32mp1: 100% |###########################################################################################################################| Time: 0:00:00
NOTE: Executing Tasks
WARNING: nativesdk-cmsis-svd-0.4-r0 do_install: Can not find STMicro in /home/xxpcb/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1/tmp-glibc/work/x86_64-nativesdk-ostl_sdk-linux/nativesdk-cmsis-svd/0.4-r0/cmsis-svd/data
Setscene tasks: 2775 of 2775
NOTE: Tasks Summary: Attempted 7874 tasks of which 7856 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 8 seconds

Summary: There was 1 WARNING message.
xxpcb@xxpcb-ubuntu20:~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1$

執(zhí)行成功后,會下deploy目錄生成sdk目錄,如下:

1.2 安裝SDK

執(zhí)行sdk中的腳本,來安裝SDK到指定目錄,我的是安裝到Developer-Package/SDK目錄

./tmp-glibc/deploy/sdk/st-example-image-qtwayland-openstlinux-weston-stm32mp1-x86_64-toolchain-4.2.1-snapshot.sh -y -d /home/xxpcb/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK

對應的打印如下:

xxpcb@xxpcb-ubuntu20:~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1$ ls
bitbake-cookerdaemon.log  buildhistory	cache  conf  downloads	sstate-cache  tmp-glibc
xxpcb@xxpcb-ubuntu20:~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1$ 
xxpcb@xxpcb-ubuntu20:~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1$ ./tmp-glibc/deploy/sdk/st-example-image-qtwayland-openstlinux-weston-stm32mp1-x86_64-toolchain-4.2.1-snapshot.sh -y -d /home/xxpcb/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK
ST OpenSTLinux - Weston - (A Yocto Project Based Distro) SDK installer version 4.2.1-snapshot
=============================================================================================
You are about to install the SDK to "/home/xxpcb/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK". Proceed [Y/n]? Y
Extracting SDK.................................................................................................................................................................................................................................................................................................................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /home/xxpcb/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
xxpcb@xxpcb-ubuntu20:~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Distribution-Package/build-openstlinuxweston-stm32mp1$

安裝完成后,可以在對應的目錄中看到相關的文件:

2 交叉編譯Qt

在剛才指定安裝SDK的目錄中,自帶了許多Qt的例子,可以使用交叉編譯器來編譯一個Qt程序試一下,比如:

cd ~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/usr/share/examples/gui
. ~/myTest/STM32MP157/STM32MPU-Ecosystem-v5.0.0/Developer-Package/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
qmake && make

編譯成功的打印如下:

最后編譯出analogclock可執(zhí)行文件,可以用file指令看下文件類型。

3 在板子中運行Qt

將analogclock文件拷貝到了STM32MP157D-DK1開發(fā)板中,運行程序,可以看到一個時鐘的顯示效果,如下圖:

4 總結

本篇介紹了STM32MP157D-DK1開發(fā)板Qt程序交叉編譯環(huán)境的搭建過程,并通過一個實際的Qt程序,編譯后在板子中實際運行測試,驗證Qt編譯環(huán)境的可用性。

 

推薦器件

更多器件
器件型號 數(shù)量 器件廠商 器件描述 數(shù)據(jù)手冊 ECAD模型 風險等級 參考價格 更多信息
HFBR-57E5APZ 1 Broadcom Limited Transceiver, 1270nm Min, 1380nm Max, LC Connector, Surface Mount, ROHS COMPLIANT PACKAGE
$70.48 查看
ABM3-24.000MHZ-D2Y-T 1 Abracon Corporation CRYSTAL 24.0000MHZ 18PF SMD
$1.61 查看
ABM3-10.000MHZ-D2Y-T 1 Abracon Corporation CRYSTAL 10.0000MHZ 18PF SMD

ECAD模型

下載ECAD模型
$1.1 查看

相關推薦

電子產業(yè)圖譜

控制科學與工程碩士,日常分享單片機、嵌入式、C/C++、Linux等學習經驗干貨~