调试记录
文章目录
- 调试记录
- 进展
- 1.开发板相关
- 1.1百问网乌班图
- 密码
- 1.2 换设备开发环境搭建
- 串口调试
- 网络互通
- nfs文件系统挂载
- 1.3网络问题
- 1.4系统启动
- 1.5进程操作
- 2.QT
- 2.1tslib
- 1.获取源码
- 2.安装依赖文件
- 3.编译
- 2.2qt移植
- 1.获取qt源码
- 2.配置编译器
- 3.编译
- 2.3拷贝到开发板
- 1.拷贝
- 2.修改开发板配置文件
- qt
- tslib
- 3.验证是否生效
- 2.4安装Qt Creator
- 1.获取安装包
- 2.执行安装程序
- 3.删除版本不对的IDE(选做)
- 4.配置qtIDE环境
- 2.5移除自带qtgui
- 2.6添加字库
- 1.本地字库
- 2.中文乱码问题
- 2.7运行qt程序
- 3.QT编程
- 3.1窗口大小
进展
下一步,qt实现一个自制工具程序自定义标题栏实现Qicon 涉及到的控件笔记,然后使用component组件框架重新整合两个驱动程序调试验证,测试c和c++混合编程,将摄像头模块添加进去几个重要模块优先调试: eeprom DMA iic相关
环境
开发板: 百问网imx6ullpro
1.开发板相关
1.1百问网乌班图
密码
book: 123456
1.2 换设备开发环境搭建
串口调试
黑色的usb+typec串口线插拔前后注意设备管理器中端口的变化,新增端口即为要使用的端口
注意:找到端口后需要连接数据线然后重启开发板,这样串口才会正常打印调试
网络互通
看指导手册配置下面内容
学习笔记——韦东山Imx6ul pro环境搭建_韦东山repo-CSDN博客
保证开发板 windows 虚拟机在同一网段
开发板 192.168.5.9
windows 192.168.5.10
虚拟机 192.168.5.11
配置完成后测试
三者互ping正常即可,另虚拟机需要ping 外网保证正常上网
nfs文件系统挂载
mount -t nfs -o nolock,vers=3 192.168.5.11:/home/book/nfs_rootfs /mnt && cd /mnt
1.3网络问题
nfs网络失效,调试过程
日志查看网络报错
[root@imx6ull:/etc/network]# dmesg | grep -i eth
[ 2.331430] 20b4000.ethernet supply phy not found, using dummy regulator
[ 2.411339] fec 20b4000.ethernet eth0: registered PHC device 0
[ 2.418876] 2188000.ethernet supply phy not found, using dummy regulator
[ 2.483570] fec 2188000.ethernet eth1: registered PHC device 1
[ 2.550222] usbcore: registered new interface driver cdc_ether
[ 3.842954] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 67.458100] Generic PHY 20b4000.ethernet-1:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=20b4000.ethernet-1:01, irq=-1)
[ 67.470533] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[root@imx6ull:/etc/network]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:01:3F:2D:3E:4Dinet addr:192.168.5.9 Bcast:0.0.0.0 Mask:255.255.255.0UP BROADCAST MULTICAST MTU:1500 Metric:1RX packets:0 errors:0 dropped:0 overruns:0 frame:0TX packets:0 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)lo Link encap:Local Loopbackinet addr:127.0.0.1 Mask:255.0.0.0inet6 addr: ::1/128 Scope:HostUP LOOPBACK RUNNING MTU:65536 Metric:1RX packets:502 errors:0 dropped:0 overruns:0 frame:0TX packets:502 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1RX bytes:37456 (36.5 KiB) TX bytes:37456 (36.5 KiB)
网络接口没有连接到物理网络
[root@imx6ull:/etc/network]# ip link show eth0
3: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000link/ether 00:01:3f:2d:3e:4d brd ff:ff:ff:ff:ff:ff
总结:
网络连接问题:
网线下方闪烁灯不闪烁,说明硬件连接有问题,需要调整
调整好的软件log打印:
[root@imx6ull:/etc/network]# [ 801.735462] fec 20b4000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 801.746055] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
1.4系统启动
启动动画相关:
探究IMX6ULL启动原理并学会优雅关闭GUI和启动动画(适用韦东山、正点原子、野火)_正点原子imx6出厂开机动画-CSDN博客
1.5进程操作
查看进程
ps auxtop找到对应的pid号kill pid号 ----------停掉该进程kill -9 pid号 ----------强制停掉
2.QT
移植参考:QT移植到imx6ull ARM板子上面_qml移植到arm-CSDN博客
2.1tslib
tslib是触控相关的
1.获取源码
链接: https://pan.baidu.com/s/1YQ3QKRJiZajrYvvD_ODBIA 提取码: eiq7
这里面都有
2.安装依赖文件
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
3.编译
/home/book/temp/Qt/tslib-1.21
./configure --host=arm-buildroot-linux-gnueabihf ac_cv_func_malloc_0_nonnull=yes --cache-file=arm-buildroot-linux-gnueabihf.cache -prefix=/home/book/temp/Qt/tslib-1.21/arm-tslibmake
make installcd arm-tslib/
file bin/ts_calibrate
tslib编译输出路径/home/book/temp/Qt/tslib-1.21/arm-tslib
2.2qt移植
1.获取qt源码
Index of / (qt.io)
编写代码的版本和移植时的版本要一致
2.配置编译器
#
# qmake configuration for building with arm-linux-gnueabi-g++
#MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublibQT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hardinclude(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)# modifications to g++.conf
QMAKE_CC = arm-buildroot-linux-gnueabihf-gcc
QMAKE_CXX = arm-buildroot-linux-gnueabihf-g++
QMAKE_LINK = arm-buildroot-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-buildroot-linux-gnueabihf-g++# modifications to linux.conf
QMAKE_AR = arm-buildroot-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-buildroot-linux-gnueabihf-objcopy
QMAKE_NM = arm-buildroot-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-buildroot-linux-gnueabihf-strip
load(qt_config)
主要修改编译器名字就行,其他的除非使用的板子差异很大不是ARMV7的要改一下
3.编译
编译配置脚本
这是我的qt源码路径:
/home/book/temp/Qt/qt-everywhere-src-5.12.9
tslib源码路径:/home/book/temp/Qt/tslib-1.21
./configure -prefix /home/book/temp/Qt/qt-everywhere-src-5.12.9/arm-qt \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/home/book/temp/Qt/tslib-1.21/arm-tslib/include \
-L/home/book/temp/Qt/tslib-1.21/arm-tslib/lib \
-recheck-all
编译
make -j16
注意:之前编译过的这里可能会出错,需要make clean清除中间文件后再make
安装
make install
2.3拷贝到开发板
编译生成的arm平台qt环境目录:arm-qt
编译生成的arm平台tslib环境目录:tslib-arm
准备工作:
确保虚拟机和开发板可以通过nfs互传文件
或者使用u盘之类的去拷贝也行,我没搞,不介绍
1.拷贝
将生成的文件拷贝到nfs文件目录下
将开发板/mnt下的arm-qt 和 arm-tslib文件复制到 /usr/lib下面cp -r arm-tslib/ /usr/lib/
cp -r arm-qt/ /usr/lib/
2.修改开发板配置文件
qt
配置开发板qt的环境变量: vi /etc/profile
export QT_ROOT=/usr/lib/arm-qt
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event4
export QT_QPA_FONTDIR=/usr/share/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export QML2_IMPORT_PATH=$QT_ROOT/qml
export QT_QPA_FB_TSLIB=1
保存,执行source /etc/profile
使其生效
tslib
vi /etc/profile
export TSLIB_ROOT=/usr/lib/arm-tslib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export LD_PRELOAD=$TSLIB_ROOT/lib/libts.so
电阻屏请加上
export TSLIB_CALIBFILE=/etc/pointercal
3.验证是否生效
qt测试
cd /usr/lib/arm-qt/examples/widgets/animation/animatedtiles
./animatedtiles
tslib测试
cd /usr/lib/arm-tslib/bin
./ts_test
ok,移植成功
2.4安装Qt Creator
1.获取安装包
安装包:
链接: https://pan.baidu.com/s/1YQ3QKRJiZajrYvvD_ODBIA 提取码: eiq7
拷贝到虚拟机中
2.执行安装程序
chmod u+x qt-opensource-linux-x64-5.12.9.run
sudo ./qt-opensource-linux-x64-5.12.9.run // 建议加sudo,否则安装在当前目录下。
按照指引安装就好,一般都是默认,第一次安装的话,建议搜个博客
3.删除版本不对的IDE(选做)
找到安装目录删除就是
4.配置qtIDE环境
配置编译器
Arm-GCC
这个是我的开发板用的编译器
gcc:
/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/arm-buildroot-linux-gnueabihf-gcc
g++:
/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/arm-buildroot-linux-gnueabihf-g++
正点原子教程里面的编译器,搞混会导致编译出错
/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
配置qmake
按照上面给的那个博客搞就好了,这里不写了,不做重复工作
2.5移除自带qtgui
启动动画相关:
探究IMX6ULL启动原理并学会优雅关闭GUI和启动动画(适用韦东山、正点原子、野火)_正点原子imx6出厂开机动画-CSDN博客
把启动目录里面文件换地方
mv /etc/init.d/S99myirhmi2 /root &&reboot
建议备份
恢复
mv /root/S99myirhmi2 /etc/init.d &&reboot
2.6添加字库
1.本地字库
C:\Windows\Fonts
将字库文件cp到nfs目录
再cp到 /usr/share/fonts注意:使用中文的话,建议找一个支持中文的字库文件进行拷贝
2.中文乱码问题
main函数中添加头文件
#include <QTextCodec>QTextCodec *codec = QTextCodec::codecForName("utf-8");
QTextCodec::setCodecForLocale(codec);忽略不计,试过了不生效
2.7运行qt程序
点击构建
在对应的构建目录下有生成的arm程序
cp到nfs目录中
./执行
cd /home/book/QT/projects/build-button_test-Arm_Qt5_12_9-Debugcp button_test ~/nfs_rootfs/cd /home/book/QT/projects/build-work_tools-Arm_Qt5_12_9-Debugcp /home/book/QT/projects/build-work_tools-Arm_Qt5_12_9-Debug/work_tools ~/nfs_rootfs/目前问题:最大最小功能无法使用
3.QT编程
3.1窗口大小
窗口完全适应不同的屏幕大小
#include <QGuiApplication>
#include <QScreen>QList <QScreen *> list_screen = QGuiApplication::screens();/* 重设大小 */this->resize(list_screen.at(0)->geometry().width(),list_screen.at(0)->geometry().height());
./执行
cd /home/book/QT/projects/build-button_test-Arm_Qt5_12_9-Debug
cp button_test ~/nfs_rootfs/
cd /home/book/QT/projects/build-work_tools-Arm_Qt5_12_9-Debug
cp /home/book/QT/projects/build-work_tools-Arm_Qt5_12_9-Debug/work_tools ~/nfs_rootfs/
目前问题:最大最小功能无法使用
暂不更新,后续使用qml做界面了