瑞芯微RK3506开发板必备攻略之Qt应用开发手册(下),触觉智能工控嵌入式方案商

    科创经济 朗峰江湖 2025-06-21 3481 次浏览
    wKgZPGhT3G6AUKGZAAVuTNuaMbU600.png

    本文基于触觉智能RK3506星闪开发板Buildroot系统进行演示,配套RK3506核心板(3核A7+M0多核异构)宽温级59元/工业级68元

    Buildroot SDK安装与环境搭建

    • SDK安装

    网盘下载路径:Linux>4.软件资料>QT-SDK/Buildroot资料链接请进入触觉智能官网

    注意:1. QT-SDK采用交叉编译,所以要在X86_64电脑上使用SDK,不要将 SDK 下载到板子上。2. 编译环境请使用 Ubuntu22.04(真机或docker容器),如果使用其他版本可能导致编译出错。3. 不要在虚拟机共享文件夹以及非英文目录存放、解压QT-SDK。下载SDK后,首先校验MD5值,命令如下:

    $md5sumarm-buildroot-linux-gnueabihf_sdk-buildroot.tar.gz

    解压QT-SDK,命令如下:

    $tar -xvf arm-buildroot-linux-gnueabihf_sdk-buildroot.tar.gz -C ./

    • 交叉编译环境搭建

    进入qt sdk目录下,执行install_sdk.sh脚本,进行安装和搭建交叉编译环境,具体如下:

    $cd./arm-buildroot-linux-gnueabihf_sdk-buildroot $ ./relocate-sdk.sh

    搭建环境后,查看qmake版本和交叉编译工具链版本:

    $ ./bin/arm-buildroot-linux-gnueabihf-gcc -v 使用内建 specs。 COLLECT_GCC=/mnt//rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/images/tmp/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/arm-buildroot-linux-gnueabihf-gcc.br_real COLLECT_LTO_WRAPPER=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/images/tmp/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/../libexec/gcc/arm-buildroot-linux-gnueabihf/12.4.0/lto-wrapper 目标:arm-buildroot-linux-gnueabihf 配置为:./configure --prefix=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/host --sysconfdir=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/host/etc --enable-static --target=arm-buildroot-linux-gnueabihf --with-sysroot=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/host/arm-buildroot-linux-gnueabihf/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --enable-plugins --enable-lto --with-gmp=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/host --with-mpc=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/host --with-mpfr=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/host --with-pkgversion='Buildroot -g0b15601a4-dirty' --with-bugurl=https://gitlab.com/buildroot.org/buildroot/-/issues --without-zstd --disable-libquadmath --disable-libquadmath-support --enable-tls --enable-threads --without-isl --without-cloog --with-abi=aapcs-linux --with-cpu=cortex-a7 --with-fpu=neon-vfpv4 --with-float=hard --with-mode=arm --enable-languages=c,c++ --with-build-time-tools=/mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/host/arm-buildroot-linux-gnueabihf/bin --enable-shared --disable-libgomp 线程模型:posix Supported LTO compression algorithms: zlib gcc 版本 12.4.0 (Buildroot -g0b15601a4-dirty) $ ./bin/qmake -v QMake version 3.1 Using Qt version 5.15.11 in /mnt/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/images/tmp/arm-buildroot-linux-gnueabihf/sysroot/usr/lib

    注意:根据安装路径的不同,导致qmake和arm-none-linux-gnueabihf-gcc的路径也是不同的。

    Qt交叉编译

    • Qt源码demo

    将Qt demo 解压到当前路径下,命令如下:

    $ mkdir -p ./qt-demo && tar -xvf moveblocks.tar.gz -C ./qt-demo $ cd qt-demo $ ls main.cpp moveblocks.pro

    • 交叉编译

    命令如下:

    $ /home/rk3506/rk3506_linux-250211/rk3506_linux6.1/buildroot/output/rockchip_rk3506-emmc/images/tmp/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/qmake ./ $ make $ make install $ ls main.cpp Makefile moveblocks moveblocks.pro

    由此可见编译后生成moveblocks可执行程序,可以通过ssh等方式将可执行程序传到开发板中运行。

    Qt验证

    将demo传到开发板上,命令如下:

    $adb push Z:\moveblocks /tmp

    运行demo,命令如下:

    $chmod a+x /tmp/moveblocks $ /tmp/moveblocks

    结果展示: