調試記錄
文章目錄
- 調試記錄
- 進展
- 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做界面了