目前的程序是这样的:
void ModbusProc::modbusPoll()
{
while (true)
{
foreach (int index, readList)
{
uint8_t funcR = dataPoint[index].funcR;
uint16_t addr = dataPoint[index].addr;
uint8_t dataLen = dataPoint[index].dataLen;
uint8_t slave = dataPoint[index].slave;
if (dataLen == 0)
dataLen = 1;
if (slave == 0)
slave = 1;
if (funcR == 1 || funcR == 2 || funcR == 3 || funcR == 4)
{
uint8_t readType;
if (funcR == 1)
readType = QModbusDataUnit::Coils;
else if (funcR == 2)
readType = QModbusDataUnit::DiscreteInputs;
else if (funcR == 3)
readType = QModbusDataUnit::HoldingRegisters;
else if (funcR == 4)
readType = QModbusDataUnit::InputRegisters;
else
{
continue;
}
QModbusDataUnit readData((QModbusDataUnit::RegisterType)readType, addr, dataLen);
QModbusReply *reply = modbusDevice->sendReadRequest(readData, slave);
if (reply)
{
if (!reply->isFinished())
{
qDebug() << "modbus reply is not finished." << endl;
QEventLoop loop;
QObject::connect(reply, &QModbusReply::finished, &loop, &QEventLoop::quit);
loop.exec();
}
if (reply->error() == QModbusDevice::NoError)
{
qDebug() << "modbus reply is finished." << endl;
currentIndex = index;
delete reply;
}
}
else
{
qDebug() << "Read request failed";
delete reply;
}
}
QCoreApplication::processEvents();
QThread::msleep(10);
}
QCoreApplication::processEvents();
QThread::msleep(10);
}
}
现在设置的modbus的超时时间是50ms,每发送一次后有个线程的延时10ms,算下来应该是60ms一帧数据。实际pc端收到的数据,大概是110ms左右。
一帧8个字节。
设置超时时间为100ms,结果pc端收到数据的间隔,大概是160ms左右。
用的qt的Modbus库,想在子线程里不停地进行modbus读操作,写了这么个函数。
如果只执行一次的话,串口能输出正确的数据,或者用定时器定时调用这个函数,串口也能不停地输出数据。
但是如果在while循环里不停的调用这个函数的话,则串口只会输出第一个字节。
void ModbusProc::modbusPoll()
{
while (true)
{
readDataPoint();
QCoreApplication::processEvents();
QThread::msleep(1000);
}
}
void ModbusProc::readDataPoint()
{
if (!modbusDevice)
return;
QModbusDataUnit readData(QModbusDataUnit::InputRegisters, 10, 2);
QModbusReply *reply = modbusDevice->sendReadRequest(readData, 01);
if (reply){
if (!reply->isFinished())
{
qDebug() << "modbus reply is finished." << endl;
// delete reply;
}
else
{
qDebug() << "modbus reply is not finished." << endl;
delete reply;
}
}
else
{
qDebug() << "read request failed" << endl;
}
QThread::msleep(100);
}
按gpt的回答,加了QEventLoop事件循环,算是死等发送完成,可以正常工作了。
void ModbusProc::readDataPoint()
{
if (!modbusDevice)
return;
QModbusDataUnit readData(QModbusDataUnit::InputRegisters, 10, 2);
QModbusReply *reply = modbusDevice->sendReadRequest(readData, 01);
if (reply){
if (!reply->isFinished())
{
qDebug() << "modbus reply is finished." << endl;
// delete reply;
QEventLoop loop;
QObject::connect(reply, &QModbusReply::finished, &loop, &QEventLoop::quit);
loop.exec();
}
else
{
qDebug() << "modbus reply is not finished." << endl;
delete reply;
}
}
else
{
qDebug() << "read request failed" << endl;
}
QThread::msleep(100);
}
请教,单次执行时不需要死等,为什么连续循环就需要死等?除此之外还有其他办法吗?
看到了friendly,就去友善搜了下,貌似是H5。
http://friendlyelec.com.cn/nanopi-neo-plus2.asp
-----------------------------------------------------------------------------
看错了,多了网口,usb也变成2个了。
汇报下今天的进展。
感谢坑网群里的吴师、周师两位群友,给了我很多指导。
在次把吴师在群里的部分回复汇总下。
1. 可以看到灯亮! tx, rx , 25M 不用看;
2. 可以抓到芯片 mdc, mdio 不用看;
3. 所以只要看 rmii 的 txd, rxd, txen , rxdv , clk;
工作正常! mdc, mdio 可以读寄存器, rst 不用看;
1. pc 和 版子 都设置固定 ip;
2. 使用 版子来 ping pc 的 ip , 此时在 pc 端,打 arp;
3. 再反向,pc 去 ping 版子,板子打 arp ,看看有没有 pc 的 mac 地址
若是有一边有! 一边没有,那就只要解决 tx 或 rx 即可;
例如! pc 看不到版子的 mac , 但是板子可以看到 pc 的!
这样就是 rx 是正常的! 只要解决 tx 的就行!
经测试,pc ping arm板,arm板可看到pc地址,反之不行。结论,arm板rmii发送有问题,集中在了txd0、txd1、txen三条线上。
用示波器测量,发现txd0、txd1上有波形,txen一直低电平。所以是txen有问题,可能和想临的焊盘短路了。暂时还未确定是哪个位置。
t113-s3 + sr8201,网口部分抄的jlc上开源的的板子。总共做了5块,4块网络正常,就1块网络总是连不同。
一开始是网口灯都不亮,后来发现25M晶振有个管脚和外壳GND连了。重新焊接晶振后,有25M晶振波形了,网口link灯能闪烁。
但是如果执行udhcpc,则报错:
sunxi-gmac 4500000.eth eth0: Initialize hardware error
然后linkled灯就停止闪烁了。
以为是sr8201坏了,然后手头也没多余的8201了,就和另一块位网络正常的板子,对掉了sr8201。
结果对掉后,原来网络正常的板子,网络还是正常。
而这块有问题的板子,执行udhcpc后,不再报哪个错误了,linkled灯也始终保持闪烁。但是就是获取不了ip。
root@TinaLinux:/# udhcpc
udhcpc: started, v1.27.2
[ 502.500278] libphy: 4500000.eth: probed
[ 502.504630] sunxi-gmac 4500000.eth eth0: eth0: Type(7) PHY ID 001cc816 at 0 IRQ poll (4500000.eth-0:00)
udhcpc: sending discover
udhcpc: sending discover
[ 506.766651] sunxi-gmac 4500000.eth eth0: Link is Up - 100Mbps/Full - flow control off
[ 506.775419] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
udhcpc: sending discover
依照群友的建议,用ifconfig直接设置ip,然后和pc互ping,pc找不到arm板,arm板也ping连接不上。
8201的1脚RSET管脚应该接2.49K电阻,手头没有,之前是并联了4.7K和5.1K,算了下大约2.45K。怀疑是这个电阻阻值的问题,直接并联了4个10K电阻,应该是2.5K左右了。但问题依旧。
测量了1.0V输出,有1.1V左右电压。也是正常的。
可能的原因:
1, sr8201焊接问题,但是吹下来过三次了... 不过还是这个问题最大,因为对掉过一次8201后,不再出现“Initialize hardware error”这个错误了。
2, sr8201坏了?对掉过一次8201,以为有问题的8201焊接换到其他板子上能正常工作联网。
3, t113-s3 坏了?
4, 晶振坏了?目前测试有25M波形。
5, 网络端口坏了?用的是HR913129AE,看到的例子是911105A,不过库房里有这个就用了,其他还有两块也是用的这个型号,网络正常。 而且查拔网线有link is down或link is up提示。
6, 周边阻容虚焊?在不通电的情况下测试了周围的电阻组织,主要是4.7K和1.5K,都正常,2.5K也近似。而且,也手动重新焊了一边阻容两端。
想改为rsync方式,结果下载rsync源码下来,configure --host=arm-linux CC=XXX,结果有4个库文件及头文件找不到,ssl,lbmz4等。也不知道该怎么指定,暂时放弃rsync方式。
尝试板子运行gdbserver,pc运行gdb,然后target remote=xxx,可以运行及调试,就是不知道如何设置断点。可以break main,在main函数处设置了断点,但是想在main.cpp其他行设置断点,break main.cpp:43,结果报错,找不到main.cpp。
qtcrator可以通过remote方式连上板子运行程序,就是设置的断点无法停止。
kit构建套件里,设备类型选为 remote linux device的话,如果编译器这里选交叉编译器,则pro文件就不能正常打开,出现qmake_cxx找不到compile_macros定义。
但是,保持设备类型不变,改为pc上用的gcc和gc++,则就能正常打开工程。
于是怀疑是交叉编译器的问题,就又建立个kit,设备类型选为 桌面,仍用交叉编译器,结果pro文件可以正常打开,可以构建生成可执行文件。
------------------------------------------------------------
run选项里有个build device,这里应该选local pc,我之前选的是remote linux devce。改了这里后就没那三个报错了。
我看的是原子的教程,到这里后,该通过ssh和scp命令往板子里拷贝程序,是在qtcreator里的自定义的部署命令里实现的:
ssh -p %{Device:SshPort} %{Device:UserName}@%{Device:H
ostAddress} 'mkdir -p %{CurrentRun:Executable:Path}'
可是qtcreator里没有CurrentRun这个参数,所以又卡到这里了。
------------------------------------------------------------
记录以下qtcreator使用gdb遇到的问题,pc上的gdb和板子上的gdbserver是用同一份原文件编译出来的。结果qtcreator里按f10进入单步调试,提示gdb不支持python脚本。网上搜了说编译时要加--with-python,结果编译时报错,make distclean后,又删了gdb/cache啥的,报错改变了,找不到python,我板子上python默认时python2,改为指向python3后,报错又变了,提示有些python库快要遗弃了,然后又报错找不到python。继续搜,说要安装python-dev。现在用的是python3.10,就安装了python3.10-dev。通过编译了。然后make install。
但是qtcreator里无论用f5还是f10,貌似都不在设置的断点地方停下来...
现在先用的是qt的一个例程,modbus master例程。如果kit套件里,不选择为远程linux设备,而选择本地编译,仍选择交叉编译的gcc,则可以生成可执行文件,拷贝到arm上可以运行。
kit套件里,设置为远程linux设备,则应该是无法正常打开工程,左侧工程列表里只有pro文件,而看不到头文件、源文件等。
-----------------------------------------
arm板子启动sshd时有这个警告:
/sshd start
root@TinaLinux:/etc/init.d# /etc/rc.common: line 128: procd_add_mdns: not found
不过pc上用ssh可以登陆这个板子。
----------------------------------------
qtcreator里设备这里点击测试,有如下:
Sending echo to device...
Device replied to echo with expected contents.
Checking kernel version...
Linux 5.4.61 armv7l
检查指定端口是否可用...
所有指定的端口都可用。
Checking whether "sftp" works...
"sftp" failed with exit code 255:
Connection closed.
Connection closed
Checking whether "rsync" works...
"rsync" failed with exit code 127: ash: rsync: not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(231) [Receiver=3.2.7]
Deployment to this device will not work out of the box.
设备测试失败。
虽然有stfp和rsync报错,但是没打算用这两个。
show running process也可以显示板子上运行的进程。
open remote shell也可以打开终端并链接。
-------------------------------------------------------
板子上没装gdb server,pc上也没有交叉编译的gdb。正在装。
-------------------------------------------------------
tina sdk里勾选了gdb和gdb server,编译后也生成了对应的程序。不过不知道怎么用,现在qt creator还是提示原来的错误。
-------------------------------------------------------
其实板子上只用gdb server就行了。我之前以为pc上需要用到交叉编译的gdb,其实是不行的,得用pc版的gdb。我尝试用ubuntu自带的gdb,结果版本太高,链接后,出现了个too long的错误。在pc上重新源码编译gdb,让gdb和gdbserver用的是同一份源码,就没那个问题了。
arm板上:gdbserver :1234 ./test
pc端:arm-linux-gdb ./test 注意这个arm-linux-gdb只是个名字,并不表示这是交叉编译出来的gdb。
然后gdb命令行中,target remote 192.168.1.xxx:1234
开始执行程序后,按c是直接运行程序了。其他还在研究。
而帖子里一开始的报错,和gdb貌似无关。现在还没解决。
板子已经打开sshd服务了,pc上终端可以通过ssh登陆板子了。
qtcreator打开选项-设备,选择remote linux设备,输入ip地址相关,旁边有个按钮,可以打开shell登陆板子。说明这部分没问题。
但是kid设置后,工程里,选择run,结果总是报错。
/xxx/AllWinner/t113s3/qt-everywhere-opensource-src-5.12.9/t113-qt/mkspecs/features/toolchain.prf:76: error: Variable QMAKE_CXX.COMPILER_MACROS is not defined.
:-1: error: Project ERROR: failed to parse default search paths from compiler output
/XXX/Qt5/t113-s3/modbusmaster/master.pro:-1: error: 分析文件/XXX/Qt5/t113-s3/modbusmaster/master.pro时发生错误,放弃中。
硬件源文件 imx6ull-v3.zip
好东西,感谢分享。
请教个问题,交叉编译个源码工程,报错找不到FILE结构体定义。
搜了下,说这个一般是需要#include <stdio.h>
看了下ubuntu系统里的/usr/include/stdio.h,里面是包含了多个bit/目录下的头文件,其中就有types/FILE.h。
我在t113-s3的tina sdk里搜FILE.h,只在两个risv目录下搜到了,但是prebuild/gcc/的arm目录下没有。
tinasdkv21/tina-d1-h$ find . -name FILE.h
./lichee/brandy-2.0/tools/toolchain/riscv64-linux-x86_64-20200528/sysroot/usr/include/bits/types/FILE.h
./prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/sysroot/usr/include/bits/types/FILE.h
搜到的两个,都是在sysroot目录下,但是arm工具链目录下没sysroot目录。
Winston 说:wupaul2001 说:电源问题,换个好点的电源就没事了,我的产品也遇到
ok谢谢!目前也是打算换电源.
最近又遇到了,把设备树usb_otg设为disabled好了
没找到usb_otg这个变量,在内核设备树里关于usb0的是这样的,usb_port_type = 0已经算是device了,但调适口还是有那些信息。
0 &usbc0 { │ sys_config.fex*
1 device_type = "usbc0"; │ sys_partition.fex*
2 usb_port_type = <0x0>; │ uboot-board.dts*
3 usb_detect_type = <0x0>; │~
4 /* usb_detect_mode = <0>; │~
5 usb_id_gpio = <&pio PB 8 GPIO_ACTIVE_HIGH>; │~
6 enable-active-high; │~
7 usb_det_vbus_gpio = <&pio PB 9 GPIO_ACTIVE_HIGH>; */ │~
8 usb_wakeup_suspend = <0>; │~
9 usb_serial_unique = <0>; │~
10 usb_serial_number = "20080411"; │~
11 rndis_wceis = <1>; │~
12 status = "okay"; │~
13 };
linux-5.4/drivers/clk/sunxi-ng/ccu-sun8iw20.c
该文件里, 缺少这几行:
static SUNXI_CCU_GATE(bus_can0_clk, "bus-can0", "apb1", 0x92c, BIT(0), 0);
static SUNXI_CCU_GATE(bus_can1_clk, "bus-can1", "apb1", 0x92c, BIT(1), 0);
&bus_can0_clk.common,
&bus_can1_clk.common,
在mango sdk里,是默认就有这些的。
注意,修改后,再mp,结果还是会报同样的错误,但是在linux目录下make clean后,然后顶层目录下mp就没事了。
按aw-ol的这个帖子修改的。
之前用的mango sdk,也是按这个修改后,can功能可以正常使用。这次用了tina linux 2.1,结果按帖子配置后,配置can波特率失败。
https://bbs.aw-ol.com/topic/1383/t113-s3-can%E6%A8%A1%E5%9D%97%E4%BD%BF%E7%94%A8%E7%9A%84%E5%85%A8%E9%83%A8%E4%BF%A1%E6%81%AF
root@TinaLinux:/# ip link set can0 type can bitrate 100000
[77081.499110] sunxi_can 2504400.can can0: 0-3343301252-0
[77081.504850] sunxi_can 2504400.can can0: bitrate error 100.0% too high
RTNETLINK answers: Domain error
在drive/net/can/dev.c里的
static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, const struct can_bittiming_const *btc)
函数里找到了对应报错信息:
188 if (bitrate_error > CAN_CALC_MAX_ERROR) {
1 netdev_err(dev, "%u-%u-%u\n", bitrate, bt-bitrate, priv->clock.freq); //any
2 netdev_err(dev,
3 "bitrate error %d.%d%% too high\n",
4 bitrate_error / 10, bitrate_error % 10);
5 return -EDOM;
6 }
结果priv->clock.freq是0.
我觉得可能是没打开can时钟,那么,在哪里打开呢?
交叉编译qt源码时,增加了openssl选项,结果报错。
我选的时-openssl-linked,这是静态连接openssl吧?报错找不到libcrypto.so,提示用-rpath或-rpath-link。
我直接用了-R 库路径,竟然通过编译了。于是好奇 -rpath, -rpath-link, -R的作用。
configure -h时发现有-rpath和-R的选项,看描述,两者相似。没找到-rpath-link描述。
而看描述,前两者是用来制定动态链接库的路径的,而我这里是静态连接库,为何也能其作用?
qt warning: libcrypto.so.1.1, not found (try using -rpath or -rpath-link)
-R <string> .......... Add an explicit runtime library path to the Qt
libraries. Supports paths relative to LIBDIR.
-rpath ............... Link Qt libraries and executables using the library
install path as a runtime library path. Similar to
-R LIBDIR. On Apple platforms, disabling this implies
using absolute install names (based in LIBDIR) for
dynamic libraries and frameworks. [auto]
加了个新的硬盘,在新硬盘上重新安装了ubuntu22.04,尝试官方的tina sdk 2.1版本。
从aw-ol上下载了t113的补丁。
https://bbs.aw-ol.com/topic/2027/%E4%B8%80%E4%B8%AA%E8%A1%A5%E4%B8%81-%E8%AE%A9d1-h%E7%9A%84sdk%E6%94%AF%E6%8C%81t113%E8%8A%AF%E7%89%87
https://github.com/YuzukiHD/TinaAddons
这样d1-h的sdk就支持t113-s3了。make时报错,c-stack错误,搜了下,说要升级m4版本,或者打补丁。
https://bbs.aw-ol.com/topic/171/%E6%9E% … 8518359186
遇到个问题,在这里反馈一下。在ubuntu22.04上,m4编译会报一个错:
c-stack.c:55:26: error: missing binary operator before token "("
55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
|
这里可以去https://toolchains.bootlin.com/downloads/releases/sources/m4-1.4.18/ 下载0003-c-stack-stop-using-SIGSTKSZ.patch
然后拷贝package/m4目录下重新编译即可。
补丁放到了out/compile/xxx/m4目录下,执行patch -p1 < xxx.patch。则该问题解决。
------------------------------------------------------
再记录一下,qt程序modbus做从机,设置数据点,一种类型只能设置一次,多次设置的话只有最后一次有效。比如定义04功能码读输入寄存器,如果地址不连续,有4300, 5300两个地址,那么不能设置两次,只能设置一次,设初始地址为4300,数量为1000个。
---------------------------------------------------------------------------
上个楼层里说的那个加延时,也是没必要的。尝试把延时去掉了,modbus超时时间设为最小的50ms,重试次数设为0,也就是只发一次,波特率9600的情况下,收发正常。如果超时时间设为100ms, 9600波特率下,大该两次正常通讯后就有一次通讯超时,500ms,大部分情况下出错,应该是发送被分帧了。还没明白其中原因。
---------------------------------------------------------------------------
在reply收到数据后,调用下一次poll前,加的这个延时,尝试减小,由50ms减小到了5ms,只要这个延时存在,超时时间设大也没事,设置成500ms超时,重试2次,仍能正常通讯。但是这个延时时间再小,就又出现通讯错误了。是不是需要等待发送完成,发送目前的8个字节需要一定时间?有这个可能,9600波特率下发送一个字节大该833us,8个字节大该是6.6ms。如果是这样的话,那发送数据较长时,这个延时也该变化,不好整啊。
--------------------------------------------------------------------------
群里一位朋友解释了,modbusrtu通讯本身就需要发送间隔大于3.5个字符间隔。9600波特率下对应差不多4ms。这么说,应该是发送粘包了...
这阵子在用qt的modbus库,记录一下。
modbusdevice有两个设置,超时时间和重试次数。超时时间最小值是50,如果小于这个值,可能会按一个比较大的值处理。
另,发送时间,需要大于处理时间,最好是考虑到设备未返回数据的情况,也就是发送周期间隔,最好大与超时时间*重试次数,否则reply还未delete就会重新创建,内存占用会越来越大。
我是在子程序里进行modbus读写处理的,在收到返回数据后,reply->deleteLater(),然后再重新下个读写。发现经常出现超时的情况。加了个QThread::msleep(50),则不会出现读取超时了。尝试小于50的值,也是会出现读取超时的问题。观测slave端,感觉想是slave收到的数据被分成了两帧,所以没有返回,然后就超时了。感觉还是reply处理影响了串口发送?
t113-s3有uart0,所以uart3才是对应的/dev/ttyS3,uart4(pb2/3)对应的是/dev/ttyS4。难道是在dts中把uart4的uart4_port改成了3,强行把uart4映射为/dev/ttyS3?这种方式我原来有试过,导致类似问题出现
谢谢,我写错了。
目前打开了uart1,3,4,5,对应的ttys1, s3, s4, s5都能找到。
我用板上串口发送,确实是用的s4。
昨天一位朋友帮我试了,同样在mq_r的sdk上修改,他将s4作为了调试口,用的PG2,PG3,有调试信息...
我比对了下我的board.dts和sun8iw20p1.dtsi,已经将can部分全部注释掉了。结果仍是不行。
在make kernel_menuconfig里将can部分关掉。结果仍是不行。
将sunxi-uart.c还原成不带485控制的版本。结果仍是不行。
-----------------------------------------------------------------------------------------
问题找到了,设备树里pinctrl-names少写了个s。
-----------------------------------------------------------------------------------------
本来PB2/3 4/5为can0, can1管脚。
现在将PB2/3设为uart4,同时打开can1功能,结果进入系统后ifconfig -a发现打开的是can0。
感觉can1自动变成can0了...
-----------------------------------------------------------------------------------------
设备树里就按can1设置打开PB4/5管脚,进系统后显示是can0,程序按can0处理,竟然可以通讯。
在设备树里设置pb2/3为uart4的管脚,编译并烧录后,可以找到/dev/ttyS3了,但是用qt的serial例程通过ttyS3发送数据,在PB2管脚上并没有测量到波形。改设备树pg2/3为uart4管脚,同样测量不出波形。
qt例程没问题,通过/dev/ttyS1发送数据,在对应管脚上可以测到波形。
目前打开了uart1,uart3,uart4.uart3作为调试口。
PB2/3 4/5同时作为了can0,1的管脚,我打开了can1功能,can通讯正常。
为了排除can功能的影响,将can0, 1都关闭,结果仍是在PB2上测不到波形。
将PB4/5设为uart5管脚,运行程序后发现PB4上,有非常小的凹陷,不确定是不是波形。
在设备树里搜索PB2/3,发现PB2/3还作为电容屏的RST及中断管脚,注释掉这两句,结果依旧。
PB2/3也是rgb24的信号管脚,但是我没用rgb24,用的是rgb16。
rgb红蓝对调:
内核设备树:
fb0_formate = <1>,则红蓝对调,但是看注释里的描述,这个变量不是管这个功能的啊。
uboot设备树:
lcd_rb_swap = <1>,红蓝对调,但是uboot红蓝对掉后,进内核后则又变为不对调了...
--------------------------------------------------------
恢复内核设备树,不启动红蓝对掉功能,只保留uboot设备树的红蓝对掉。结果启动后,无论uboot还是内核,都是红蓝对掉了。
看样子,之前是uboot时对掉了一次,内核时又对掉了一次,结果又返回来了。
uboot和内核设备树修改红蓝对掉的方法,竟然不一样!
关于将自己的应用打包的问题:
target/xxxx/busybox-init目录下的文件打包时会覆盖掉rootfs/目录下的文件,所以放到该目录下即可。然后执行mp。
但是mp时发现,我交叉编译的程序,会报错找不到依赖的库。
还有就是,有的我明明复制到该目录了,也通过编译了,但是烧录到板子上有就是没有。
尤其是usr/lib目录下的libQt5DBus.so和libdbus-1.so。
ubuntu下烧录软件是Livesuite,不是phonixsuit了。可以从github上下载。里面主要是个脚本和一些.dll文件。需要先编译awusb,编译会报错,需要修改Makefile文件。我是用的群友提供的。
这样,就不用来回切换ubuntu和win了。
void InfoNES_LoadFrame()
{
int x,y, i;
int line_width;
WORD wColor;
//修正 即便没有 LCD 也可以出声
if(0 < fb_fd)
{
for (y = 0; y < lcd_height; y++ )
{
line_width = zoom_y_tab[y] * NES_DISP_WIDTH;
for (x = 0; x < lcd_width; x++ )
{
wColor = WorkFrame[line_width + zoom_x_tab[x]];
lcd_fb_display_px(wColor, x, y);
printf("x:%d, y:%d, color:%d, index:%d\r\n", x, y, wColor, line_width + zoom_x_tab[x]);
// for (i = 0; i < 255; i++)
// {
// printf("%d\r\n", WorkFrame[i]);
// }
}
}
}
}
InfoNES_LoadFrame()这个函数里,我将每个像素点的wColor打印出来,结果都是0。
甚至将WorkFrame[]数组的前255个成员打印出来,结果也是0。
这是哪里出错了?
Gentlepig 说:群里有朋友说全志显示驱动不支持,好坑啊...
不是不支持,可能fb默认是32bit的,但是fbtest只操作了24bit,透明通道值是0,所以就不显示了。
试一试 cat /dev/urandom > /dev/fb0
请问,该如何修改透明通道值呢?
-------------------------------------------------------------
尝试论坛里帖子里讨论的那个nes模拟器,编译后运行也是黑屏,看源码,也是操作/dev/fb0。
网上找来个通过/dev/fb0在屏幕上画圆的程序,编译后在板子上运行,同样是黑屏。
在全志群里问了,群友说是有多个图层的问题。
通过cat /sys/class/disp/disp/attr/sys,可以看到有4个图层,我将前三个enable改为disable,则重启后那些disable对应的行消失了。
但是,运行画圆程序或nes模拟器程序,屏幕仍是黑屏,qt例程正常。
screen 0:
de_rate 300000000 hz, ref_fps:60
mgr0: 800x480 fmt[rgb] cs[0x204] range[full] eotf[0x4] bits[8bits] err[0] force_sync[0] unblank direct_show[false] iommu[1]
dmabuf: cache[0] cache max[0] umap skip[0] umap skip max[12]
lcd output backlight( 50) fps:60.2 800x 480
err:0 skip:104 irq:106539 vsync:0 vsync_skip:0
BUF enable ch[1] lyr[0] z[16] prem[N] a[pixel 255] fmt[ 0] fb[ 800, 480; 800, 480; 800, 480] crop[ 0, 0, 800, 480] frame[ 0depth[ 0]
-----------------------------
确实,写像素点时,抄的程序只有后24bit有数据,前8bit是0x00,现在改为0xffxxxxxx,则屏幕上就有输出了。感谢。
*(mem_p + 800*y + x) = 0xFFFFFFFF;
附完整代码:
#include <stdio.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <linux/input.h>
#define LCD_PATH "/dev/fb0"
int main()
{
int midlex = 400;
int midley = 240;
int R = 50;
unsigned int *mem_p;
int x = 0;
int y = 0;
int i = 0;
int lcd_fd;
int biaozhix = 1;
int biaozhiy = 1;
lcd_fd = open(LCD_PATH, O_RDWR);
mem_p = (unsigned int*)mmap(NULL, 800*480*480*4,
PROT_READ | PROT_WRITE,
MAP_SHARED, lcd_fd, 0);
while (1)
{
for (y = 0; y < 480; y++)
{
for (x = 0; x < 800; x++)
{
i = ((x - midlex) * (x - midlex)) + ((y - midley) * (y - midley));
if ((i < R * R))
{
*(mem_p + 800*y + x) = 0x00FFFF00;
}
else
{
*(mem_p + 800*y + x) = 0xFFFFFFFF;
}
}
}
if ((midley + R) > 479)
{
biaozhiy = 2;
}
if ((midlex + R) > 779)
{
biaozhix = 2;
}
if ((midley - R) < 0)
{
biaozhiy = 1;
}
if ((midlex - R) < 0)
{
biaozhix= 1;
}
if (biaozhix == 1)
{
midlex++;
}
if (biaozhix == 22)
{
midlex--;
}
if (biaozhiy == 1)
{
midley++;
}
if (biaozhiy == 2)
{
midley--;
}
}
munmap(mem_p, 800*480*4);
close(lcd_fd);
return 0;
}
运行arm-oenwrt-linux-gcc -v,发现configrued with后面跟的很多路径,不是我电脑上的,不知道这个会不会有影响。
$ arm-openwrt-linux-gcc -v
Reading specs from /home/any/MPU/AllWinner/T113-s3/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/../lib/gcc/arm-openwrt-linux-muslgnueabi/6.4.1/specs
COLLECT_GCC=arm-openwrt-linux-muslgnueabi-gcc.bin
COLLECT_LTO_WRAPPER=/home/any/MPU/AllWinner/T113-s3/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/../libexec/gcc/arm-openwrt-linux-muslgnueabi/6.4.1/lto-wrapper
Target: arm-openwrt-linux-muslgnueabi
Configured with: /home/xuqiang/workspace/tina-old/out/v853-perf1/compile_dir/toolchain/gcc-linaro-6.4-2017.11/configure --with-bugurl=https://dev.openwrt.org/ --with-pkgversion='OpenWrt/Linaro GCC 6.4-2017.11 2017-11' --prefix=/home/xuqiang/workspace/tina-old/out/v853-perf1/staging_dir/toolchain --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-openwrt-linux-muslgnueabi --with-gnu-ld --enable-target-optspace --enable-libgomp --disable-libmudflap --disable-multilib --disable-nls --without-isl --without-cloog --with-host-libstdcxx=-lstdc++ --with-gmp=/home/xuqiang/workspace/tina-old/out/host --with-mpfr=/home/xuqiang/workspace/tina-old/out/host --with-mpc=/home/xuqiang/workspace/tina-old/out/host --disable-decimal-float --with-diagnostics-color=auto-if-env --disable-libssp --enable-__cxa_atexit --with-cpu=cortex-a7 --with-fpu=neon --with-float=hard --with-headers=/home/xuqiang/workspace/tina-old/out/v853-perf1/staging_dir/toolchain/include --disable-libsanitizer --enable-languages=c,c++ --enable-shared --enable-threads --with-slibdir=/home/xuqiang/workspace/tina-old/out/v853-perf1/staging_dir/toolchain/lib --enable-lto --with-libelf=/home/xuqiang/workspace/tina-old/out/host
Thread model: posix
gcc version 6.4.1 (OpenWrt/Linaro GCC 6.4-2017.11 2017-11)
------------------------------------
问题好像解决了。
在autoconfigure.sh里,之前有 -I 头文件路径 -L 库文件路径,现在又加了个-R库文件路径,结果可以通过编译了。
感觉 -L 对应 -linked, -R 对应-runtime。
搜-R,说是和-rpaht等效。但是之前我是过修改-L 库文件路径 为: -L“库文件路径 Wl,-rpaht=库文件路径",结果报错还是没效果来着...
--------------------------------
感觉理解的还是不对。
libudev.so可能是libQt5SerialPort.so动态引用的。
但是openssl这里我选的是-openssl-linked,这应该是静态链接啊。
修改了autconfigure.sh,make时报错:
Qt error: one or more PCH files were found, but they were invalid
往上搜了下,说有以前配置文件的残留,需要make distclean。
make distclean -j16,结果报错:
/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile qtimageformats.pro
/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtdeclarative/.qmake.conf:1: Cannot find feature qt_build_config
Cannot find feature spec_pre.prf
Error processing project file: qtdeclarative.pro
make[1]: *** [Makefile:408:Makefile] 错误 3
make[1]: 离开目录“/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtdeclarative”
make: *** [Makefile:168:module-qtdeclarative-distclean] 错误 2
make: *** 正在等待未完成的任务....
/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtimageformats/.qmake.conf:1: Cannot find feature qt_build_config
Cannot find feature spec_pre.prf
Error processing project file: qtimageformats.pro
make[1]: *** [Makefile:354:Makefile] 错误 3
make[1]: 离开目录“/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtimageformats”
make: *** [Makefile:143:module-qtimageformats-distclean] 错误 2
make[1]: 进入目录“/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtserialport”
/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile qtserialport.pro
/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtserialport/.qmake.conf:1: Cannot find feature qt_build_config
Cannot find feature spec_pre.prf
Error processing project file: qtserialport.pro
make[1]: *** [Makefile:382:Makefile] 错误 3
make[1]: 离开目录“/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtserialport”
make: *** [Makefile:93:module-qtserialport-distclean] 错误 2
再次make distclean,则报错变成:
/home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile qt.pro -- -prefix ./t113-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/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/ -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/allwinner/ -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/allwinner/include/ -L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/ -recheck-all
Could not find qmake spec ''.
Error processing project file: qt.pro
make: *** [Makefile:652:Makefile] 错误 3
----------------------------------------------------------------
将libudev.so放到了arm-gcc/lib目录下,结果编译通过了。
然后将autoconfigure.sh里的ssl功能打开,改为-openssl-linked,将同样报错找不到的libssl.so,libcrypto.so放到了arm-gcc/lib目录下,编译也通过了。
那么,问题大概有点明白了,autoconfigure.sh里用-I -L指定了第三方库的链接位置,没有起作用。
-I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/ \
-L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/ \
那么,到底该如何引入第三方链接库呢?
我修改linux目录下的makefile,想在t113-s3板上运行。
# CC = arm-linux-gcc
CC = arm-openwrt-linux-gcc
TARBALL = InfoNES08J
# InfoNES
.CFILES = ./../K6502.cpp \
./../InfoNES.cpp \
./../InfoNES_Mapper.cpp \
./../InfoNES_pAPU.cpp \
./InfoNES_System_Linux.cpp joypad_input.cpp
.OFILES = $(.CFILES:.cpp=.o)
CCFLAGS = -O2 -fsigned-char -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include
LDFILGS = -lstdc++ # gcc3.x.x
LIBS += -L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/lib -lpthread -lm
LIBS += -L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib -lasound -lz
all: InfoNES
InfoNES: $(.OFILES)
$(CC) $(INCLUDES) -o $@ $(.OFILES) $(LDFILGS) $(LIBS)
# $(CC) $(INCLUDES) -o $@ $(.OFILES) $(LDFILGS) -L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-glibc/toolchain/lib -lm -lpthread -L-L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib -lz -lasound
.cpp.o:
$(CC) $(INCLUDES) -c $(CCFLAGS) $*.cpp -o $@
clean:
rm -f $(.OFILES) ../*~ ../*/*~ core
cleanall:
rm -f $(.OFILES) ../*~ ../*/*~ core InfoNES
release: clean all
tar:
( cd ..; \
tar cvf $(TARBALL).tar ./*; \
gzip $(TARBALL).tar \
)
install:
install ./InfoNES /usr/local/bin
结果在板子上运行后有如下提示,然后屏幕黑屏。
# ./InfoNES
/dev/joypad dev not found
/dev/input/js0 dev not found
fb width:800 height:480
晕,发现-openssl-runtime其实可能没成功:
libudev.so.1 not found
make -j4时,出现这个错误编译并没有停下,不容易察觉到。
如果是单make,就容易看到这个了。
------------------------------------------
感觉最后的-L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/ \没起作用。
#!/bin/sh
export PATH=$PATH:/home/any/MPU/AllWinner/T113-s3/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/
export STAGING_DIR=/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir
./configure -prefix ./t113-qt \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++11 \
-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 \
-ssl \
-openssl-runtime \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/ \
-I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/allwinner/ \
-I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/allwinner/include \
-L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/ \
-recheck-all
configure时,除了-ssl,还要选-openssl-runtime或-openssl-linked。
一开始指定了-openssl-runtime,这应该算动态加载openssl库了吧?
编译倒是顺利,然后往上找了几句想输出下qt支持的openssl版本:
// 查詢Qt支持的版本
bool bSupp = QSslSocket::supportsSsl();
QString buildVersion = QSslSocket::sslLibraryBuildVersionString();
QString version = QSslSocket::sslLibraryVersionString();
qDebug() << bSupp << buildVersion << version;
// 查看当前网络请求支持协议
QNetworkAccessManager *accessManager = new QNetworkAccessManager(this);
qDebug() << accessManager->supportedSchemes();
结果会提示找不到QSslSocket,虽然#include了,pro文件里也QT+=network了。
然后就在pro文件里用LIBS += -L XXX -lssl -lcrypto指定交叉编译后的openssl库位置。INLUCEPATH+=对应头文件。
结果还是报错:
main.cpp: In function 'int main(int, char**)':
main.cpp:12:18: error: 'QSslSocket' has not been declared
bool bSupp = QSslSocket::supportsSsl();
^~~~~~~~~~
----------------------------------
尝试用-openssl-linked方式,配置脚本里,-L openssl库路径 -I openssl库头文件路径
结果配置后make时报错:
libssl.so和libcrypto.so找不到。
-L 库路径 后如果直接加 -lssl -lcrypto,则配置脚本时就直接报错,报语法错误。
后看到往上帖子说,配置OPENSSL_LIBS变量,然后-L里加上-Wl,rpaht。
OPENSSL_LIBS='-L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib -lssl -lcrypto' \
./conigrua ...
...
-ssl \
-openssl-linked \
-I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include \
-L'/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib -Wl,-rpath=home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib' \
改成这样后,最后还是报同样的错误。
sdk自带qt编译后产生的qmake不能用的问题,还没找到解决办法。目前是用单独编译qt产生的qmake,不过板子上还是用sdk产生的qt库。编译个例程可以通过,下载到板子上运行后板子没反应,以为是环境变量的问题,又折腾了一阵子。后经群友提醒,设置个环境变量,打开了插件加载错误输出功能,这才看到显示没找到libQt5DBus.so,去sdk里搜了下,staging/target/usr/lib目录下是有的,可arm板上确实没有。手动复制过去后,继续报错libdubs-1.so没找到,继续从staging/target/usr/lib目录下复制过去。这次知道为何烧录用的img文件这么小,原来很多库没拷贝进去。
后来需要用到ssl功能,发现sdk里staging/target/usr/lib下也没有libQt5Ssl.so,在qt的makefile里,我设置了-ssl和-openssl,按说应该是默认动态加载openssl库了,但是就是没有产生libQt5Ssl.so,于是我改成-openssl -linked,然后设置了-I -L指定了openssl库路径。结果编译后还是没libQt5Ssl.so。
群友帮搜到这篇文章,需要在makefile里指定depengd依赖。
https://stackoverflow.com/questions/19184631/package-is-missing-dependencies-for-libraries-openwrt
于是我加了+libssl,结果还是原样,报错,QNetWork找不到libssl.so和libcrypto.so。
继续搜。https://blog.csdn.net/hexf9632/article/details/105976747
这里说明了,需要+的名字是make menuconfig里的库名字,在这里应该是+libopenssl。有点坑啊...
define Package/qt5-network │~
$(call Package/qt5/Default) │~
TITLE+=network │~
DEPENDS+=+qt5-core +libopenssl │~
endef
-----------------------------
晕,高兴的早了,虽然编译通过了,但是仍没有libQt5Ssl.so
-----------------------------
哈,本就没这个libQt5Ssl.so。
我现在编译报错,是因为我编译的是sdk自带的qt,而使用的qmake是单独编译的qt且没选ssl。
我经历过这样的问题,t113-s3,板载spi nand。我在win下用phoenixsuit烧录没问题,后来不想来回切换win和ubuntu,就想在ubuntu下烧录,发现xfel可以直接向spi nand读写,就用xfel向spi nand烧录tina linux打包好的img文件,结果发现烧录完成后还是处于fel状态,我当时也是怀疑板子硬件坏了。后来用xfel读取spi nand内容,读出来的和写进去的文件对比了下,是一致的。
又发现切换到win下用phoenixsuit烧录后板子又可以启动起来了,然后再用xfel读出内容来,发现和img文件内容不一致。
才明白phoenixsuit并不是简单的直接将img文件烧录进去了。
我记得运行后,屏幕上应该是分为红蓝绿三块区域,还有交叉白线。
现在运行后屏幕倒是刷了一下,变成全黑。
https://github.com/ponty/fb-test-app
fb-test 1.1.0 (rosetta)
Failed to set graphics mode on tty1
fb res 800x480 virtual 800x480, line_len 3200, bpp 32
https://blog.csdn.net/sjygqz/article/details/129407477
根据这个帖子,对比了下我使用的sun4i-ts.c和sunxi-ts.c,发现sunxi-ts.c和帖子里的参数比较接近。
于是,就关闭CONFIG_TOUCHSCREEN_SUN4I,保留CONFIG_TOUCHSCREEN_SUNXI。
发现效果好些,但和预想的比还差一点。
用的mango的sdk,可能默认用的是电容屏,但是我想用电阻屏。做了一下修改:
make kernel_menuconfig里,选了CONFIG_TOUCHSCREEN_SUNXI和CONFIG_TOUSHSCREEN_SUN4I。
以下是设备树,使能了rtp,但是不知道tpadc应该是否也使能。ctp没管,仍处于okay状态。
&rtp {
allwinner,tp-sensitive-adjust = <0xf>;
allwinner,filter-type = <0x1>;
allwinner,ts-attached;
status = "okay";
};
&tpadc {
key_cnt = <5>;
key1 = <420 115>;
key2 = <870 114>;
key3 = <1290 119>;
key4 = <1630 373>;
key5 = <1950 28>;
status = "disabled";
};
&gpadc {
channel_num = <1>;
channel_select = <0x01>;
channel_data_select = <0>;
channel_compare_select = <0x01>;
channel_cld_select = <0x01>;
channel_chd_select = <0>;
channel0_compare_lowdata = <1600000>;
channel0_compare_higdata = <1200000>;
channel1_compare_lowdata = <460000>;
channel1_compare_higdata = <1200000>;
key_cnt = <5>;
key0_vol = <210>;
key0_val = <0x19c>;
key1_vol = <410>;
key1_val = <0x197>;
key2_vol = <590>;
key2_val = <158>;
key3_vol = <750>;
key3_val = <28>;
key4_vol = <880>;
key4_val = <28>;
status = "disabled";
wakeup-source;
};
现象就是运行ts_calibrate后,点击屏幕无反映,不停的随即点击屏幕,偶尔会成功一次,非常小的概率。
/etc/profile里,做的如下设置:
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
# getevent
add device 1: /dev/input/event1
name: "audiocodec sunxi Audio Jack"
add device 2: /dev/input/event0
name: "2009c00.rtp"
才发现,不是点击失灵,是点击后维持几秒以后才能松开,这时点击才有效果...
可以考虑根据晶振引脚和常用单片机引脚对比下,看是否符合。
好奇只焊接了32768晶振,没焊接另一个...
我看360猴王摄像头和这个外形差不多,但是看拆解里面要比这个复杂多了,这个更像是单片机?
像360猴王有wifi功能,也有更多按键实现比较多的设置功能。
还有,比如论坛里常见的f1c100s这类芯片,供电至少有3路,3.3V, 1.8/1.5V, 0.9V。
这个只看到了1个较大的功率电感。不过也没准呢,看到板子上有3.3V,2.8V,1.2V丝印。
不过你这个电池外形怎么这么大?
自己参考mq_r画的t113-s3板,之前没焊lcd部分电路,板子能正常工作。
昨天把背光和pfc40pin座也焊上了,接上屏幕,加电,发现背光部分有冒烟。(此时没注意是否能进入linux,但此时屏没亮,也无背光)
分析电路,背光升压电路我用的电源芯片是250mV反馈电压的,R4是电流采样电阻,这样电流肯能就是125mA,可能过大了。
R16、R17两个电阻是1/10W的75R电阻,过125mA电流也超其功率了,群友指出这两个电阻无用。
将R4电阻由2R改为10R,去掉R16、R17两个电阻,在其中一个位置补上0R电阻。不确定二极管及电源芯片是否损坏,直接换新。
不敢接lcd,光给板子加电(USB提供5V)。发现板子无法正常启动了。
测量3路DC/DC电压,3.3V,1.5V,0.9V正常。
用示波器测量波形,发现24M晶振是启动的。
复位电路是用IMP809然后上拉个3.3V接到RESET管脚的,测量RESET管脚,发现是2.8V。另一块正常的板子,RESET管脚是3.3V。
SOC自带两路LDO,其中LDOA应该是1.8V,结果是2.1V多一点。
然后接上LCD,发现此时背光亮了。测量此时升压电压为19V多一些。
想分析之前损坏的原因。
有群友指出电感10uH太大,产生这么大电流时电压过高。
有群友指出升压部分有可能达到30V电压,有可能碰到其他电路造成损坏。
但我不明白高压传递到soc的路径。
PCB部分,升压电路离其他信号线也太近了,空间干扰过去?
以太网口验证了吗?
我画了个板子,网口部分是参照这个原理图的网口部分。
https://pro.lceda.cn/editor#id=5133835294354c21ad5657691270ef3c,tab=*4b1386a708b64b9c8b43045527a13fed
设备树部分参考的是:
https://whycan.com/files/202108/d1/D1_Tina_Linux_%E4%BB%A5%E5%A4%AA%E7%BD%91_%E5%BC%80%E5%8F%91%E6%8C%87%E5%8D%97.pdf
不过我板子是用的百兆网口,设备树部分略有区别。
现在可以通过网口连上网了,就是两个网口灯都没亮,其中有一个确定是我接反了,另一个不知道为什么也不亮。
我尝试将package/gui/qt/qt5/files/qmake.conf里最后加上
# modifications to g++.conf
1 QMAKE_CC = arm-openwrt-linux-gcc
2 QMAKE_CXX = arm-openwrt-linux-gcc
3 QMAKE_LINK = arm-openwrt-linux-gcc
4 QMAKE_LINK_SHLIB = arm-openwrt-linux-gcc
5
6 # modifications to linux.conf
7 QMAKE_AR = arm-openwrt-linux-ar cqs
8 QMAKE_OBJCOPY = arm-openwrt-linux-objcopy
9 QMAKE_NM = arm-openwrt-linux-nm -P
10 QMAKE_STRIP = arm-openwrt-linux-strip
11
12 load(qt_config)
目的是将QMAKE_CC这些变量重新定义为固定的arm-openwrt-linux-gcc,结果编译通不过,报错:
ERROR: Qt requires a compliant STL library.
感觉像是qtbas/mkspecs/linux-openwrt-g++/qmake内容有问题,可能有些变量没有正确传进来。
比如
QMAKE_CC = $$(TARGET_CC)
如何将这个TARGET_CC打印出来查看一下?
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = eglfs
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# QMAKE_{INC,LIB}DIR_QT needs to be overridden,
# as they're set to $$[QT_INSTALL_{HEADERS,LIBS}] by default
# which are compiled into the qmake binary statically
QMAKE_INCDIR_QT = $$(TARGET_INCDIRS)
QMAKE_LIBDIR_QT = $$(TARGET_LIBDIRS)
QMAKE_INCDIR = $$(TARGET_INCDIRS)
QMAKE_LIBDIR = $$(TARGET_LIBDIRS)
QMAKE_MOC = $$(STAGING_DIR_HOST)/bin/moc
QMAKE_UIC = $$(STAGING_DIR_HOST)/bin/uic
QMAKE_RCC = $$(STAGING_DIR_HOST)/bin/rcc
QMAKE_CC = $$(TARGET_CC)
QMAKE_CXX = $$(TARGET_CXX)
QMAKE_AR = $$(TARGET_AR)
QMAKE_OBJCOPY = $$(TARGET_OBJCOPY)
QMAKE_RANLIB = $$(TARGET_RANLIB)
QMAKE_CFLAGS = $$(TARGET_CFLAGS)
QMAKE_CXXFLAGS = $$(TARGET_CXXFLAGS)
QMAKE_NM =
QMAKE_LINK = $$(TARGET_CXX)
QMAKE_LINK_SHLIB = $$(TARGET_CXX)
QMAKE_LINK_C = $$(TARGET_CC)
QMAKE_LFLAGS = $$(TARGET_LDFLAGS) # this will end up in redundant "-L"-strings, as they're already in $QMAKE_LIBDIR_QT, however TARGET_LDFLAGS may contain not only directories but special linker options
#unset vars which would intefere with vars/flags passed over by OpenWrt
QMAKE_STRIP = # do not strip
QMAKE_STRIPFLAGS_LIB = # do not strip
QMAKE_CFLAGS_WARN_ON =
QMAKE_CFLAGS_WARN_OFF =
QMAKE_CFLAGS_RELEASE =
QMAKE_CFLAGS_DEBUG =
QMAKE_CFLAGS_PRECOMPILE =
QMAKE_CFLAGS_USE_PRECOMPILE =
QMAKE_CXXFLAGS_WARN_ON =
QMAKE_CXXFLAGS_WARN_OFF =
QMAKE_CXXFLAGS_RELEASE =
QMAKE_CXXFLAGS_DEBUG =
QMAKE_CXXFLAGS_PRECOMPILE =
QMAKE_CXXFLAGS_USE_PRECOMPILE =
QMAKE_LFLAGS_RELEASE =
load(qt_config)
------------------------------------
Makefile里加入$(warning, &(TARGET_CC));将Makefile里的make -jx注释掉,使其不进行qt源码编译;用mm 1>&1|tee xxx.log将编译信息保存到xxx.log。
从xxx.log里找到了TARGET_CC,果然只是个arm-openwrt-linux-muslgnueabi-gcc ,没有路径。
还有CONFIGURE_PREFIX, 是/usr。
试了下arm-openwrt-linux-muslgnueabi-gcc -v,是可以看到信息的,其路径已经加到PATH环境变量里了。
-----------------------------
只在这里赋值了,感觉预安装
build/package-defaults.mk:77:CONFIGURE_PREFIX:=/usr
实际libQt5*.so是放到了../out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/ipkg-install/usr/lib/目录下。
而这个ipkg-install不知道是什么时候加进来的。
@10*****231
这不是我想要的解决办法。
你这是将sdk的qt编译了一遍,又单独下载编译了一遍qt。
之前试过,单独编译qt源码,生成的qmake可以用,交叉编译的qt程序放到板子上,板子上只有sdk自带qt编译的库,也可以正常运行。
我是想搞明白为什么sdk自带qt生成的qmake,不能用。
----------------------------------------------------------------
发现qmke并不是编译qt源码make时产生的,而是在这之前,执行configure脚本时产生的。
tina sdk自带的qt并没有单独的configure脚本文件,而是在package/gui/qt/qt5/Makefile里有些configure语句。
就是这个帖子里我在22楼贴的那部分。
-----------------------------------------------------------------
sdk自带qt编译生成的qmake:
./qmake -v
QMake version 3.1
Using Qt version 5.12.9 in /usr/lib
手动生成autoconfigure.sh单独编译qt生成的qmake:
./qmake -v
QMake version 3.1
Using Qt version 5.12.9 in /home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/t113-qt/lib
可以看到sdk自带qt生成的qmake,并不能正确引用到lib所在位置。
@Gentlepig
感谢补丁,自带的编译过了,明天上板子
qt通过编译了,那么交叉编译的qmake能否编译工程?
我这里用交叉编译的qmake生成的Makefile文件,CC总是空的。
--------------------------------------------
发现package/gui/qt/qt5目录下的Makefile里,有qt配置文件,但是里面没有-optimized-qmake选项,不知道和这个有没有关系。
手动加上了,正在重新编译一遍试试。
这个Makefile一旦修改,qt源码就又会重新解压一遍,qt有重新编译一遍,真是麻烦啊。
./configure \
-prefix $(CONFIGURE_PREFIX) \
-bindir $(CONFIGURE_PREFIX)/bin \
-headerdir $(CONFIGURE_PREFIX)/include \
-libdir $(CONFIGURE_PREFIX)/lib \
-datadir $(CONFIGURE_PREFIX)/share/qt5 \
-qmldir $(CONFIGURE_PREFIX)/lib/qt5/qml \
-plugindir $(CONFIGURE_PREFIX)/lib/qt5/plugins \
-release \
-xplatform linux-openwrt-g++ \
-optimized-qmake \
-opensource \
-confirm-license \
-c++std c++14 \
-shared \
-accessibility \
-no-qml-debug \
-no-sse2 \
-no-sse3 \
-no-ssse3 \
-no-sse4.1 \
-no-sse4.2 \
-no-avx \
-no-avx2 \
-no-mips_dsp \
-no-mips_dspr2 \
-pkg-config \
-system-zlib \
-mtdev \
-no-journald \
-syslog \
-system-libpng \
-system-libjpeg \
-system-freetype \
-no-sql-db2 \
-no-sql-ibase \
-no-sql-mysql \
-no-sql-oci \
-no-sql-odbc \
-no-sql-psql \
-sql-sqlite \
-sqlite \
-no-sql-tds \
-qt-harfbuzz \
-openssl \
-no-libproxy \
-qt-pcre \
-no-xcb \
-no-xcb-xinput \
-no-xcb-xlib \
-no-glib \
-no-pulseaudio \
-alsa \
-no-gtk \
-no-opengl \
-gui \
-widgets \
-no-cups \
-iconv \
-evdev \
-tslib \
-no-icu \
-fontconfig \
-strip \
-no-pch \
-no-ltcg \
-dbus-linked -L$(STAGING_DIR)/usr/lib -I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/dbus-1.0 -I$(STAGING_DIR)/usr/lib/dbus-1.0/include \
-no-use-gold-linker \
-no-eglfs \
-no-kms \
-no-gbm \
-no-directfb \
-linuxfb \
-no-mirclient \
-no-libinput \
-no-gstreamer \
-nomake tests \
-skip qtdoc \
-skip qtwayland \
-ssl \
哈,加了optimized-qmake也没用。
我又重新编译了sdk自带的qt,结果通不过编译了,尴尬。
make[7]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtconnectivity/examples/nfc/corkboard'
make[7]: Nothing to be done for 'first'.
make[7]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtconnectivity/examples/nfc/corkboard'
make[6]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtconnectivity/examples/nfc'
make[5]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtconnectivity/examples'
make[4]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtconnectivity'
arm-openwrt-linux-muslgnueabi-g++ -c -Os -pipe -march=armv7-a -mtune=cortex-a7 -mfpu=neon -fno-caller-saves -Wno-unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fPIC -fstack-protector -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/freetype2 -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/include -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../../../include/QtMultimedia/5.12.9 -I../../../include/QtMultimedia/5.12.9/QtMultimedia -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include/QtGui/5.12.9 -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include/QtGui/5.12.9/QtGui -I../../../include -I../../../include/QtMultimedia -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include/QtGui -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include/QtCore/5.12.9 -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include/QtCore/5.12.9/QtCore -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include/QtNetwork -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/include/QtCore -I.moc -isystem /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include -isystem /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/dbus-1.0 -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/dbus-1.0/include -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/include\ -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include -I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/mkspecs/linux-openwrt-g++ -o .obj/qalsaaudiodeviceinfo.o qalsaaudiodeviceinfo.cpp
make[8]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/qmlsensorgestures'
make[8]: Nothing to be done for 'first'.
make[8]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/qmlsensorgestures'
make[7]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/qmlsensorgestures'
cd qmlqtsensors/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/qmlqtsensors/qmlqtsensors.pro ) && make -f Makefile
make[7]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtxmlpatterns/examples/xmlpatterns/schema'
make[7]: Nothing to be done for 'first'.
make[7]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtxmlpatterns/examples/xmlpatterns/schema'
make[6]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtxmlpatterns/examples/xmlpatterns'
make[5]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtxmlpatterns/examples'
make[4]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtxmlpatterns'
cd qttools/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/qttools.pro ) && make -f Makefile
make[7]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/qmlqtsensors'
make[7]: Nothing to be done for 'first'.
make[7]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/qmlqtsensors'
cd sensor_explorer/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer/sensor_explorer.pro ) && make -f Makefile
make[4]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools'
cd src/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/src.pro ) && make -f Makefile
make[7]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer'
cd import/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer/import/import.pro ) && make -f Makefile
make[5]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src'
cd assistant/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/assistant/assistant.pro ) && make -f Makefile
make[8]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer/import'
make[8]: Nothing to be done for 'first'.
make[8]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer/import'
( test -e Makefile.qml || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile.qml /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer/qml.pro ) && make -f Makefile.qml
make[6]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/assistant'
cd help/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/assistant/help/help.pro ) && make -f Makefile
In file included from qalsaplugin.cpp:41:0:
qalsaaudiodeviceinfo.h:113:5: error: 'snd_pcm_t' does not name a type
snd_pcm_t* handle;
^~~~~~~~~
qalsaaudiodeviceinfo.h:114:5: error: 'snd_pcm_hw_params_t' does not name a type
snd_pcm_hw_params_t *params;
^~~~~~~~~~~~~~~~~~~
In file included from qalsaplugin.cpp:42:0:
qalsaaudioinput.h:127:5: error: 'snd_pcm_t' does not name a type
snd_pcm_t* handle;
^~~~~~~~~
qalsaaudioinput.h:159:5: error: 'snd_pcm_uframes_t' does not name a type
snd_pcm_uframes_t buffer_frames;
^~~~~~~~~~~~~~~~~
qalsaaudioinput.h:160:5: error: 'snd_pcm_uframes_t' does not name a type
snd_pcm_uframes_t period_frames;
^~~~~~~~~~~~~~~~~
qalsaaudioinput.h:161:5: error: 'snd_pcm_access_t' does not name a type
snd_pcm_access_t access;
^~~~~~~~~~~~~~~~
qalsaaudioinput.h:162:5: error: 'snd_pcm_format_t' does not name a type
snd_pcm_format_t pcmformat;
^~~~~~~~~~~~~~~~
qalsaaudioinput.h:163:5: error: 'snd_pcm_hw_params_t' does not name a type
snd_pcm_hw_params_t *hwparams;
^~~~~~~~~~~~~~~~~~~
In file included from qalsaplugin.cpp:43:0:
qalsaaudiooutput.h:124:5: error: 'snd_pcm_uframes_t' does not name a type
snd_pcm_uframes_t buffer_frames;
^~~~~~~~~~~~~~~~~
qalsaaudiooutput.h:125:5: error: 'snd_pcm_uframes_t' does not name a type
snd_pcm_uframes_t period_frames;
^~~~~~~~~~~~~~~~~
qalsaaudiooutput.h:139:5: error: 'snd_pcm_t' does not name a type
snd_pcm_t* handle;
^~~~~~~~~
qalsaaudiooutput.h:140:5: error: 'snd_pcm_access_t' does not name a type
snd_pcm_access_t access;
^~~~~~~~~~~~~~~~
qalsaaudiooutput.h:141:5: error: 'snd_pcm_format_t' does not name a type
snd_pcm_format_t pcmformat;
^~~~~~~~~~~~~~~~
qalsaaudiooutput.h:142:5: error: 'snd_pcm_hw_params_t' does not name a type
snd_pcm_hw_params_t *hwparams;
^~~~~~~~~~~~~~~~~~~
make[8]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer'
make[8]: Nothing to be done for 'first'.
make[8]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer'
make[7]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/sensor_explorer'
cd shakeit/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/shakeit/shakeit.pro ) && make -f Makefile
In file included from qalsaaudiodeviceinfo.cpp:51:0:
qalsaaudiodeviceinfo.h:113:5: error: 'snd_pcm_t' does not name a type
snd_pcm_t* handle;
^~~~~~~~~
qalsaaudiodeviceinfo.h:114:5: error: 'snd_pcm_hw_params_t' does not name a type
snd_pcm_hw_params_t *params;
^~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp: In constructor 'QAlsaAudioDeviceInfo::QAlsaAudioDeviceInfo(QByteArray, QAudio::Mode)':
qalsaaudiodeviceinfo.cpp:59:5: error: 'handle' was not declared in this scope
handle = 0;
^~~~~~
qalsaaudiodeviceinfo.cpp: In member function 'bool QAlsaAudioDeviceInfo::open()':
qalsaaudiodeviceinfo.cpp:168:28: error: 'handle' was not declared in this scope
err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
^~~~~~
qalsaaudiodeviceinfo.cpp:168:65: error: 'SND_PCM_STREAM_PLAYBACK' was not declared in this scope
err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
^~~~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:168:90: error: 'snd_pcm_open' was not declared in this scope
err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
^
qalsaaudiodeviceinfo.cpp:170:28: error: 'handle' was not declared in this scope
err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
^~~~~~
qalsaaudiodeviceinfo.cpp:170:65: error: 'SND_PCM_STREAM_CAPTURE' was not declared in this scope
err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
^~~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:170:89: error: 'snd_pcm_open' was not declared in this scope
err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
^
qalsaaudiodeviceinfo.cpp:173:9: error: 'handle' was not declared in this scope
handle = 0;
^~~~~~
qalsaaudiodeviceinfo.cpp: In member function 'void QAlsaAudioDeviceInfo::close()':
qalsaaudiodeviceinfo.cpp:181:8: error: 'handle' was not declared in this scope
if(handle)
^~~~~~
qalsaaudiodeviceinfo.cpp:182:29: error: 'snd_pcm_close' was not declared in this scope
snd_pcm_close(handle);
^
qalsaaudiodeviceinfo.cpp:183:5: error: 'handle' was not declared in this scope
handle = 0;
^~~~~~
qalsaaudiodeviceinfo.cpp: In member function 'bool QAlsaAudioDeviceInfo::testSettings(const QAudioFormat&) const':
qalsaaudiodeviceinfo.cpp:191:5: error: 'snd_pcm_t' was not declared in this scope
snd_pcm_t* pcmHandle;
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:191:16: error: 'pcmHandle' was not declared in this scope
snd_pcm_t* pcmHandle;
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:192:5: error: 'snd_pcm_hw_params_t' was not declared in this scope
snd_pcm_hw_params_t *params;
^~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:192:26: error: 'params' was not declared in this scope
snd_pcm_hw_params_t *params;
^~~~~~
qalsaaudiodeviceinfo.cpp:202:5: error: 'snd_pcm_stream_t' was not declared in this scope
snd_pcm_stream_t stream = mode == QAudio::AudioOutput
^~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:205:65: error: 'stream' was not declared in this scope
if (snd_pcm_open(&pcmHandle, dev.toLocal8Bit().constData(), stream, 0) < 0)
^~~~~~
qalsaaudiodeviceinfo.cpp:205:74: error: 'snd_pcm_open' was not declared in this scope
if (snd_pcm_open(&pcmHandle, dev.toLocal8Bit().constData(), stream, 0) < 0)
^
qalsaaudiodeviceinfo.cpp:208:34: error: 'snd_pcm_nonblock' was not declared in this scope
snd_pcm_nonblock(pcmHandle, 0);
^
qalsaaudiodeviceinfo.cpp:209:37: error: 'snd_pcm_hw_params_alloca' was not declared in this scope
snd_pcm_hw_params_alloca(¶ms);
^
qalsaaudiodeviceinfo.cpp:210:44: error: 'snd_pcm_hw_params_any' was not declared in this scope
snd_pcm_hw_params_any(pcmHandle, params);
^
qalsaaudiodeviceinfo.cpp:213:76: error: 'snd_pcm_hw_params_set_channels' was not declared in this scope
snd_pcm_hw_params_set_channels(pcmHandle, params, format.channelCount());
^
qalsaaudiodeviceinfo.cpp:214:73: error: 'snd_pcm_hw_params_set_rate' was not declared in this scope
snd_pcm_hw_params_set_rate(pcmHandle, params, format.sampleRate(), 0);
^
qalsaaudiodeviceinfo.cpp:216:5: error: 'snd_pcm_format_t' was not declared in this scope
snd_pcm_format_t pcmFormat = SND_PCM_FORMAT_UNKNOWN;
^~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:220:13: error: 'pcmFormat' was not declared in this scope
pcmFormat = SND_PCM_FORMAT_S8;
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:220:25: error: 'SND_PCM_FORMAT_S8' was not declared in this scope
pcmFormat = SND_PCM_FORMAT_S8;
^~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:222:13: error: 'pcmFormat' was not declared in this scope
pcmFormat = SND_PCM_FORMAT_U8;
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:222:25: error: 'SND_PCM_FORMAT_U8' was not declared in this scope
pcmFormat = SND_PCM_FORMAT_U8;
^~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:226:13: error: 'pcmFormat' was not declared in this scope
pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:227:25: error: 'SND_PCM_FORMAT_S16_LE' was not declared in this scope
? SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_S16_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:227:49: error: 'SND_PCM_FORMAT_S16_BE' was not declared in this scope
? SND_PCM_FORMAT_S16_LE : SND_PCM_FORMAT_S16_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:229:13: error: 'pcmFormat' was not declared in this scope
pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:230:25: error: 'SND_PCM_FORMAT_U16_LE' was not declared in this scope
? SND_PCM_FORMAT_U16_LE : SND_PCM_FORMAT_U16_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:230:49: error: 'SND_PCM_FORMAT_U16_BE' was not declared in this scope
? SND_PCM_FORMAT_U16_LE : SND_PCM_FORMAT_U16_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:235:13: error: 'pcmFormat' was not declared in this scope
pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:236:25: error: 'SND_PCM_FORMAT_S32_LE' was not declared in this scope
? SND_PCM_FORMAT_S32_LE : SND_PCM_FORMAT_S32_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:236:49: error: 'SND_PCM_FORMAT_S32_BE' was not declared in this scope
? SND_PCM_FORMAT_S32_LE : SND_PCM_FORMAT_S32_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:238:13: error: 'pcmFormat' was not declared in this scope
pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:239:25: error: 'SND_PCM_FORMAT_U32_LE' was not declared in this scope
? SND_PCM_FORMAT_U32_LE : SND_PCM_FORMAT_U32_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:239:49: error: 'SND_PCM_FORMAT_U32_BE' was not declared in this scope
? SND_PCM_FORMAT_U32_LE : SND_PCM_FORMAT_U32_BE;
^~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:241:13: error: 'pcmFormat' was not declared in this scope
pcmFormat = format.byteOrder() == QAudioFormat::LittleEndian
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:242:25: error: 'SND_PCM_FORMAT_FLOAT_LE' was not declared in this scope
? SND_PCM_FORMAT_FLOAT_LE : SND_PCM_FORMAT_FLOAT_BE;
^~~~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:242:51: error: 'SND_PCM_FORMAT_FLOAT_BE' was not declared in this scope
? SND_PCM_FORMAT_FLOAT_LE : SND_PCM_FORMAT_FLOAT_BE;
^~~~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:246:9: error: 'pcmFormat' was not declared in this scope
if (pcmFormat != SND_PCM_FORMAT_UNKNOWN)
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:246:22: error: 'SND_PCM_FORMAT_UNKNOWN' was not declared in this scope
if (pcmFormat != SND_PCM_FORMAT_UNKNOWN)
^~~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:247:72: error: 'snd_pcm_hw_params_set_format' was not declared in this scope
err = snd_pcm_hw_params_set_format(pcmHandle, params, pcmFormat);
^
qalsaaudiodeviceinfo.cpp:254:87: error: 'snd_pcm_hw_params_test_channels' was not declared in this scope
err = snd_pcm_hw_params_test_channels(pcmHandle, params, format.channelCount());
^
qalsaaudiodeviceinfo.cpp:260:84: error: 'snd_pcm_hw_params_test_rate' was not declared in this scope
err = snd_pcm_hw_params_test_rate(pcmHandle, params, format.sampleRate(), 0);
^
qalsaaudiodeviceinfo.cpp:265:21: error: 'pcmFormat' was not declared in this scope
if (err >= 0 && pcmFormat != SND_PCM_FORMAT_UNKNOWN)
^~~~~~~~~
qalsaaudiodeviceinfo.cpp:265:34: error: 'SND_PCM_FORMAT_UNKNOWN' was not declared in this scope
if (err >= 0 && pcmFormat != SND_PCM_FORMAT_UNKNOWN)
^~~~~~~~~~~~~~~~~~~~~~
qalsaaudiodeviceinfo.cpp:266:72: error: 'snd_pcm_hw_params_set_format' was not declared in this scope
err = snd_pcm_hw_params_set_format(pcmHandle, params, pcmFormat);
^
qalsaaudiodeviceinfo.cpp:269:50: error: 'snd_pcm_hw_params' was not declared in this scope
err = snd_pcm_hw_params(pcmHandle, params);
^
qalsaaudiodeviceinfo.cpp:271:28: error: 'snd_pcm_close' was not declared in this scope
snd_pcm_close(pcmHandle);
^
qalsaaudiodeviceinfo.cpp: In member function 'void QAlsaAudioDeviceInfo::updateLists()':
qalsaaudiodeviceinfo.cpp:286:9: error: 'handle' was not declared in this scope
if(!handle)
^~~~~~
qalsaaudiodeviceinfo.cpp:289:9: error: 'handle' was not declared in this scope
if(!handle)
^~~~~~
make[7]: *** [Makefile:1517: .obj/qalsaplugin.o] Error 1
make[7]: *** Waiting for unfinished jobs....
cd designer/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/designer/designer.pro ) && make -f Makefile
make[7]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/assistant/help'
make[7]: Nothing to be done for 'first'.
make[7]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/assistant/help'
make[6]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qttools/src/assistant'
cd accelbubble/ && ( test -e Makefile || /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake -o Makefile /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/accelbubble/accelbubble.pro ) && make -f Makefile
make[7]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/shakeit'
make[7]: Nothing to be done for 'first'.
make[7]: Leaving directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtsensors/examples/sensors/shakeit'
搜了下,是
./qtmultimedia/src/plugins/alsa/qalsaaudiodeviceinfo.cpp
这个文件报错的,但是为何还是会编译qtmultimedia?
-----------------------------------------------
还有这个tina linux,每次修改Makefile后再m,qt都会重新解压覆盖一次qt源码,之前编译报错添加的#include <limits>又需要从新添加一遍,甚是麻烦。
--------------------------------------------------
make menuconfig时,上次把alsa驱动部分关了,所以会一直报这个错误,加上后没事了。
@10*****231
感谢,我对比了下autoconfigure.sh,发现了问题。
-xplatform linux-arm-gnueabi-g++ \
这句后面多了几个空格,应该是反斜杠后面不能跟任何字符,否则按新的命令处理了。
-xplatform linux-arm-gnueabi-g++ \
--------------------------------------------------
另,为什么autoconfigure.sh里需要配置STAGING_DIR这个环境变量,而且配置的是交叉编译器的路径?不是有个staging_dir目录么?不明白这个环境变量是干什么用的?
--------------------------------------------------
哈,看到了,帖子后面将到遇到报错后,又配置了一遍STAGING_DIR这个环境变量。
@Gentlepig
Tina下编译的qt库,最后应用可以跑起来么?
编译完qt后看到根文件里有libQt5相关库就没再继续了,当时板子上也缺元件没有接屏幕。
前天想尝试用qt编译个hello,world,结果才发现交叉编译过不去...
----------------------------
在这里做个记录吧。
基于D1s的QT5移植
这个帖子里有补丁文件可编译tina sdk自带的qt.
尝试单独编译qt源码,网上教程挺多,仍用qt5.12.9。解压后,修改qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf。
将里面的QMAKE_CC等修改为arm-openwrt-linux-gcc,因为sdk里交叉编译器名字就是这个,并且将交叉编译器路径加到PATH路径里了。
AKEFILE_GENERATOR = UNIX │ qmake.conf
1 CONFIG += incremental │ qplatformdefs.h
2 QMAKE_INCREMENTAL_STYLE = sublib │~
3 │~
4 include(../common/linux.conf) │~
5 include(../common/gcc-base-unix.conf) │~
6 include(../common/g++-unix.conf) │~
7 │~
8 # modifications to g++.conf │~
9 QMAKE_CC = arm-openwrt-linux-gcc │~
10 QMAKE_CXX = arm-openwrt-linux-g++ │~
11 QMAKE_LINK = arm-openwrt-linux-g++ │~
12 QMAKE_LINK_SHLIB = arm-openwrt-linux-g++ │~
13 │~
14 # modifications to linux.conf │~
15 QMAKE_AR = arm-openwrt-linux-ar cqs │~
16 QMAKE_OBJCOPY = arm-openwrt-linux-objcopy │~
17 QMAKE_NM = arm-openwrt-linux-nm -P │~
18 QMAKE_STRIP = arm-openwrt-linux-strip │~
19 load(qt_config)
然找参考网上的autoConfigure.sh,然后执行source ./autoCoonfigure.sh。
结果却报错:
$ source ./autoConfigure.sh
+ cd qtbase
+ /home/any/MPU/AllWinner/T113-s3/qt-everywhere-opensource-src-5.12.9/qtbase/configure -top-level -prefix ./t113-qt -opensource -confirm-license -release -strip -shared -xplatform linux-openwrt-g++
Creating qmake...
.Done.
ERROR: Invalid command line parameter ' '.
-optimized-qmake:未找到命令
autoConfigure.sh内容如下:
#export PATH=$PATH:/home/any/MPU/AllWinner/T113-s3/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/
./configure -prefix ./t113-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/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/ \
-I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/allwinner/ \
-I/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include//allwinner/include/ \
-L/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/ \
-recheck-all
--------------------------------------------
确定是qmake.conf里这句出了问题。
-xplatform linux-arm-gnueabi-g++ \
但还不知道原因。
现在尝试qmake交叉编译个qt程序,才发现qmake报错。
搜索目录下的qmake,发现如下几个:
$ find ../../ -name qmake
../../Tina-Linux/out/t113-mq_r/staging_dir/target/host/bin/qmake
../../Tina-Linux/out/t113-mq_r/staging_dir/target/usr/bin/qmake
../../Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/ipkg-install/usr/bin/qmake
../../Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/bin/qmake
../../Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/examples/qmake
../../Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/qmake
../../Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/qmake/qmake
../../Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/qmake/doc/snippets/qmake
../../Tina-Linux/out/t113-mq_r/compile_dir/target/qt-everywhere-opensource-src-5.12.9/qtbase/tests/auto/tools/qmake
使用 ../../Tina-Linux/out/t113-mq_r/staging_dir/target/host/bin/qmake 这个时报错:
$ qmake-t113-qt5 -project -o t113
/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/mkspecs/features/resolve_config.prf:25: 'addExclusiveBuilds' is not a recognized test function.
/home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/mkspecs/features/resolve_config.prf:37: 'addExclusiveBuilds' is not a recognized test function.
使用 ../../Tina-Linux/out/t113-mq_r/staging_dir/target/usr/bin/qmake 时报错:
$ qmake-t113-qt5 -project -o t113
Could not find qmake spec 'linux-openwrt-g++'.
Cannot find feature default_pre.prf
Cannot find feature default_post.prf
--------------------------------------------------------
使用host/bin/qmake报错会找不到几个文件,但是在usr/目录下能找到。
于是就用usr/bin/qmake,然后忽略2个报错,因为可以生成.pro文件及makefile文件。但是make时又报错:
[2] 15916
c -std=gnu++11 -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I../../../Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include -I../../../Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/QtGui -I../../../Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/QtCore -I. -I../../../Tina-Linux/out/t113-mq_r/staging_dir/target/usr/mkspecs/linux-openwrt-g++ -o main.o ../main.cpp
make: c: 没有那个文件或目录
make: [Makefile:500:main.o] 错误 127 (已忽略)
Wl,-rpath,/usr/lib -o t113 main.o /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/libQt5Gui.so /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/libQt5Core.so -lpthread
make: Wl,-rpath,/usr/lib: 没有那个文件或目录
make: [Makefile:192:t113] 错误 127 (已忽略)
[2]+ 已完成 $T/tools/build/buildserver --path $T 2> /dev/null 1>&2
#### make completed successfully (1 seconds) ####
-------------------------------
打开Makefile,发现CC为空。
MAKEFILE = Makefile
1
2 EQ = =
3
4 ####### Compiler, tools and options
5
6 CC =
7 CXX =
8 DEFINES = -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
9 CFLAGS = -D_REENTRANT -fPIC $(DEFINES)
10 CXXFLAGS = -std=gnu++11 -D_REENTRANT -fPIC $(DEFINES)
11 INCPATH = -I. -I. -I../../../out/t113-mq_r/staging_dir/target/usr/include -I../../../out/t113-mq_r/staging_dir/target/usr/incl
12 QMAKE = /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/bin/qmake
13 DEL_FILE = rm -f
14 CHK_DIR_EXISTS= test -d
15 MKDIR = mkdir -p
16 COPY = cp -f
17 COPY_FILE = cp -f
18 COPY_DIR = cp -f -R
phonixsuit 有linux版本,用那个就行
找到了phoenixsuit-linux。
但是安装后启动时报错:
any@Any-Desktop:~/Bin/phoenixsuit$ ls
common_fun.lua liblua.so luaeFex.dll regdecode.lua
imgdec_fun.lua LiveProc.Plg phoenixsuit regdemo.lua
ini_fun.lua luaBase.dll plgvector.dll
LangPlg.dll luadec.dll regbasefun.lua
any@Any-Desktop:~/Bin/phoenixsuit$ ./phoenixsuit
library file path: /home/any/Bin/phoenixsuit/plgvector.dll
library file path: /home/any/Bin/phoenixsuit/LiveProc.Plg
library file path: /home/any/Bin/phoenixsuit/plgvector.dll
library file path: /home/any/Bin/phoenixsuit/luaeFex.dll
段错误 (核心已转储)
看到win下phonixsuit烧录时,是先输出这些信息:
[612]fes begin commit:adaf1174cc
[615]set pll start
[621]periph0 has been enabled
[624]set pll end
[626][pmu]: bus read error
[628]board init ok
[630]beign to init dram
[632]ZQ value = 0x2f
[634]get_pmu_exist() = -1
[637]ddr_efuse_type: 0xa
[639]trefi:7.8ms
[642][AUTO DEBUG] single rank and full DQ!
[646]ddr_efuse_type: 0xa
[648]trefi:7.8ms
[650][AUTO DEBUG] rank 0 row = 13
[653][AUTO DEBUG] rank 0 bank = 8
[657][AUTO DEBUG] rank 0 page size = 2 KB
[661]DRAM BOOT DRIVE INFO: V0.33
[664]DRAM CLK = 936 MHz
[666]DRAM Type = 3 (2:DDR2,3:DDR3)
[669]DRAMC read ODT off.
[672]DRAM ODT value: 0x42.
[674]ddr_efuse_type: 0xa
[677]DRAM SIZE =128 M
[679]dram_tpr4:0x0
[681]PLL_DDR_CTRL_REG:0xf8004d00
[684]DRAM_CLK_REG:0xc0000000
[687][TIMING DEBUG] MR2= 0x20
[691]DRAM simple test OK.
[693]rtc standby flag is 0x0, super standby flag is 0x0
[698]init dram ok
按教程编译的tina linux,最后pack生成了个tina_t113-mq_r_uart3.img文件。在win下可以用phonixsuit烧写。
不想两个系统来回切换,想找个ubuntu下烧写t113的方法。
sunxi-fel貌似不能向t113-s3的spi nand读写。
xfel可以读写t113-s3的spi nand。
我尝试将tina_t113-mq_r_uart3.img通过xfel spinand 0 tina_t113-mq_r_uart3.img烧写进去。结果系统起不来。可以通过xfel spinand read读出来,发现和烧写文件一致。
先通过phonixsuit将该img文件烧进去并确定系统可以去来,然后用xfel spinand read读出来,发现读出来的内容和烧写文件不一样了。不过貌似大小是一样的。
看到win下phonixsuit烧录时,是先输出这些信息:
[612]fes begin commit:adaf1174cc
[615]set pll start
[621]periph0 has been enabled
[624]set pll end
[626][pmu]: bus read error
[628]board init ok
[630]beign to init dram
[632]ZQ value = 0x2f
[634]get_pmu_exist() = -1
[637]ddr_efuse_type: 0xa
[639]trefi:7.8ms
[642][AUTO DEBUG] single rank and full DQ!
[646]ddr_efuse_type: 0xa
[648]trefi:7.8ms
[650][AUTO DEBUG] rank 0 row = 13
[653][AUTO DEBUG] rank 0 bank = 8
[657][AUTO DEBUG] rank 0 page size = 2 KB
[661]DRAM BOOT DRIVE INFO: V0.33
[664]DRAM CLK = 936 MHz
[666]DRAM Type = 3 (2:DDR2,3:DDR3)
[669]DRAMC read ODT off.
[672]DRAM ODT value: 0x42.
[674]ddr_efuse_type: 0xa
[677]DRAM SIZE =128 M
[679]dram_tpr4:0x0
[681]PLL_DDR_CTRL_REG:0xf8004d00
[684]DRAM_CLK_REG:0xc0000000
[687][TIMING DEBUG] MR2= 0x20
[691]DRAM simple test OK.
[693]rtc standby flag is 0x0, super standby flag is 0x0
[698]init dram ok
我板子上焊接的是spi nand,没用ft卡。
spi的cs、miso都有10k上拉电阻,mosi是有10k下拉电阻,且留了个直接对地短路的地方。
一开始用win下的phonixsuit,还挺顺利的。后来想在ubuntu下烧录,就下载了sunxi-fel,最后发现现在的版本不能直接向spi nand烧录。发现xfel可以,就用sudo xfel spinand earse,然后再sudo xfel spinand write 0 xxx.img。发现可以擦除,也可以烧写,再读出来,貌似和写进去的一致。但是烧写完后,板子还是处于fel状态,再次复位或重新上电,板子仍是fel状态。
这和win下phonixsuit烧录可不一样,当时我烧录完就自动重启进正常状态了。
让我怀疑是不是不该烧录到0地址?
我尝试手动将mosi管脚拉到3.3V,结果仍不行。暂时没找到好的办法,每次都是转到win下烧录。
------------------------------------------------
用xfel spinand命令将xxx.img文件烧录到spi nand,读出来后和源文件一样。
用phonixsuit将相同的xxx.img文件烧录到spi nand,系统可以启动。然后用xfel将spinand的内容读出来,竟然和原文件完全不一样,除了大小一样外。
can部分,参考https://debugdump.com/topic/1926/t113-s3-can-linux-%E4%B8%8B%E5%B7%B2%E8%B0%83%E9%80%9A?lang=zh-CN
结果编译过程中报错找不到几个函数的定义,发现明明包含了对应的头文件了。
群友admin指点,说kconfig里新增的内容,不该放在can部分的总目录下,放到了那个if条件里,再编译就可以了。
另mangos的sdk里,自带了个sunxi_can.c,但是选这个的话会报错找不到 #include <sunxi_can_asm.h>这个头文件。虽然同目录下有个sunxi_can_asm.s,但是不知道怎么用。最后还是换回了sun4i_can.c。
记录一下,群友Extraterrestrial提供了一个qt的makefile,替换掉tina linux的packages/gui/qt/qt5目录下的makefile即可。
对比了下,主要是屏蔽掉了gpu相关的一些部分。
另,无论这个makefile还是旧的自带的makefile,编译时都会从网上下载qt源码,但会失败。看了下,qt提供下载的地址里的文件变了。现在文件名中不带opensource这个词了。
尝试修改makefile中下载地址中的文件名,去掉opensource,目录变量也去掉opensource。还有文件的md5,也改成下载网址提供的。
再make,倒是很快能下载,但是解压目录到了不带opensource的目录,继续编译,等了很久,报了些错误。没解决得了,就想可能还需要改回默认文件明,就重新命名了下载得到的压缩文件,结果不行。于是编辑压缩文件里的目录名才解决。
网友提供的makefile里,有make -j32,结果造成编译过程中我电脑总是失去响应。我后来改成了-j4。
继续make,遇到几个和std::limits相关的报错,搜了下,可能是编译器过新,可能把个什么的默认包含去掉了。找到报错文件,手动加入#include <limits>解决,总共4个文件。
对了,还有个nss啥的,我去makefile里找到那一行,屏蔽了那两个库。
终于编译完了,结果发现根目录下没有libqt*.so。热心的群友又解释说,openwrt make menuconfig里有个strip选项,默认时strip,其他还有no strip和sstrip。选strip时貌似会把不用的库优化掉。试了改成no strip,结果再次编译还是一样的结果。后来又提醒我勾选个qt程序试试,make menuconfig的gui/qt5目录下有三个演示程序,选了个qt-easing。再次编译,根文件系统里终于有了qt库了。
其实aw-ol论坛里还有个朋友提供的qt补丁,不过是好几个文件,我就没用那个。
试过串口助手向air724的串口发送数据,发送周期试过50ms,就是上边的结果发送600帧左右,mqtt再发出来,丢失10帧左右。
如果发送周期调整为25ms,则发送600帧,丢失300帧左右。
发送周期调整为100ms,发送600帧,丢失1帧。
感觉像是消息传递的问题,消耗速度慢于生产速度。
我是这样传递数据的,串口任务里将数据作为消息的参数发送出去,这样操作是不是会额外占用了过多开销?
想过该成消息里不带参数,串口发消息前,将接收数据存入全局列表里,mqtt任务收到消息再从全局列表里取。但是感觉这样顺序是不是可能会乱?本来打算是做应答通讯的。
试过irt固件,配置为串口透传,测试结果也是会丢数据,在50ms的发送周期下。
勾选了qt-core、qt-widgets,然后编译,结果报错
make[3]: Entering directory '/home/any/MPU/AllWinner/T113-s3/Tina-Linux/package/libs/libgpu'
Makefile:80: /fbdev/include
rm -rf /home/any/MPU/AllWinner/T113-s3/Tina-Linux/tmp/stage-libgpu
mkdir -p /home/any/MPU/AllWinner/T113-s3/Tina-Linux/tmp/stage-libgpu/host /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/staging_dir/target/packages /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/host/packages
mkdir -p /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/libgpu/ipkg-install
install -d -m0755 /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/libgpu/ipkg-install/usr/lib
cp -fpR -uvd /fbdev/"musl"/lib/* /home/any/MPU/AllWinner/T113-s3/Tina-Linux/out/t113-mq_r/compile_dir/target/libgpu/ipkg-install/usr/lib
cp: cannot stat '/fbdev/musl/lib/*': No such file or directory
编译libgpu库时找不到/fbdev/musl/lib目录。
热心群友回复说sdk自带的qt是配置了gpu渲染的,t113-s3不可用。只能单独下载qt再编译。
去make menuconfig里看了,确实勾选了libgpu,且不可取消状态。我试着取消其他qt勾选,只保留qt-core勾选,发现library选项下的gpu libraray就取消勾选状态了,但是我再make,还是报上边的错误,还是会编译libgpu。
请教个问题,air724,目前主要运行两个任务:
1,串口任务,不停的读取一个字节数据进行处理,空闲超时后将收到的字符串作为参数发送消息;
2,mqtt任务,mqtt接收等待,等到串口任务发送过来的消息后,将得到的参数通过mqtt发送出去。
发送频率低的情况下没问题。发送频率高,就有丢的现象。在9600波特率,50ms自动发送的情况下,每次发送15个字节,发送几百条可能就丢一条。
尝试串口任务里收到数据,空闲超时后,不发送消息,只是将串口接收累计条数打印出来。发现,这种情况下,串口接收是没问题的。发送频率再高一倍也没事。
搞不清问题出在哪里,是串口任务发送消息太频繁,mqtt任务没处理过来?还是说mqtt任务发送时,影响了串口任务的接收,使串口任务少接收了?
--------------------------
刚测试的数据,每50ms发送15字节,发送了12180字节,计812帧。看了下mqtt服务器统计,只收到了810帧。
另一个mqtt客户端总计收到了12150字节,就是少了2帧。
用string.byte()可以将单个字符转换为number类型,然后判断其大小,再做处理。
现在想串口一次读多个字节的字符串,一次性处理。
打算
for i=1, i < #data then
data1 = string.byte(data, i, i)
if data1 > 127 then
data2 = data1 - 128
else
data2 = data1
end
end
这样来获得每个字符对应的数字进行处理,但是不知道该如何再组合成字符串进行发送。
--------------------------------------
目前这么处理的:
data = uart.read(1, "*l")
if not data or string.len(data) == 0 then
break
end
s = ""
for i = 1, #data do
data1 = string.byte(data, i, i)
if data1 > 127 then
data2 = data1 - 128
else
data2 = data1
end
s1 = string.char(data2)
s = s..s1
end
今天在ubunt22.04编译最新的sunxi-tools也遇到了这个问题。
已经通过apt安装libusb-1.0-dev了,但还是报这个错误,fel_lib.c文件里报错找不到libusb.h。
向上翻,找到这些提示:
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ `pkg-config --cflags libusb-1.0` `pkg-config --cflags zlib` -o sunxi-fel \
fel.c fit_image.c progress.c soc_info.c fel_lib.c fel-spiflash.c `pkg-config --libs libusb-1.0` `pkg-config --libs zlib` -lfdt
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libusb-1.0', required by 'world', not found
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libusb-1.0', required by 'world', not found
手动执行pkg-config --libs libusb-1.0也是报错,按提示找PKG_CONFIG_PATH。
echo $PKG_CONFIG_PATH
发现是空的,搜pkgconfig,搜到多个目录,有一个目录下有上边提示的libusb-1.0.pc,将PKG_CONFIG_PATH设为该目录。
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/
再make,发现没上边那个提示了,但是仍报错找不到libusb.h。编辑fel_lib.c文件,找到报错那行,修改为:
#include <libusb-1.0/libusb.h>
再次编译就通过了。
哪吒是D1S吧,和T113-S3啥关系呀,是一个DIE?马甲
https://whycan.com/t_7808.html
https://oshwhub.com/kirin1874/quan-zhi-d1s-kai-fa-ban-yuan-chang-evb
运行例程,且修改json文件为指定的网址,确实可以下载指定文件,且下载前先删除了应用程序文件,但应用仍可执行。
遇到了些问题,下载后的文件默认没有可执行权限,调用chmod +x给了权限。
qsimpleupdater代码里是通过qdesktopservices()打开下载的本地文件的,打开时报错:没有应用程序注册为处理此文件的。
182 void Downloader::openDownload()
1 {
2 if (!m_fileName.isEmpty())
3 QDesktopServices::openUrl(QUrl::fromLocalFile(m_downloadDir.filePath(m_fileName)));
4
5 else
6 {
7 QMessageBox::critical(this, tr("Error"), tr("Cannot find downloaded update!"), QMessageBox::Close);
8 }
9 }
在考虑qt应用程序自升级的问题。
搜到了QSimpleUpdater这个库,https://github.com/alex-spataru/QSimpleUpdater
没明白其原理,主要是3个.cpp文件,现在理解如下:
Downloader: 下载器,删除旧文件,下载新文件,重命名文件;
Updater: 下载json文件,获取版本信息,下载文件地址,创建Downloader对象进行文件下载;
QSimpleUpdater: 静态类,可以创建多个Updater对象来进行多个不同文件下载;
不明白的地方:
程序运行过程中,可以删除本应用程序可执行文件?
受群里两位朋友指点,改成这样可以了。
int ret; │ ▶ bin/
1 uint8_t count = 0; │ ▶ x86/
2 while (write(can1Socket, &can1SendFrame, sizeof(can1SendFrame)) < 0 && count < 100) │ aescrypto.cpp
3 { │ can.c
4 qDebug() << "socketcan write failed, delay"; │ cantest*
5 count++; │ main.cpp*
6 delayMs(1); │ nuvotoncan.cpp*
7 }
请教,socketcan,用write()发送,连续发送多条数据时,容易返回-1错误。
write加一句qDebug()打印发送的数据后,可以了,但偶尔还是会出,概率极小。感觉是相当于加了个延时等待。
socketcan有没有判断是否可写的功能?
oid NuvotonCan::socketCanSend(uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
1 {
2 memset(&can1SendFrame, 0, sizeof(struct can_frame));
3 can1SendFrame.can_id = (0x1b60f5f4 & CAN_EFF_MASK) | CAN_EFF_FLAG;
4 can1SendFrame.can_dlc = 8;
5 can1SendFrame.data[0] = d0;
6 can1SendFrame.data[1] = d1;
7 can1SendFrame.data[2] = d2;
8 can1SendFrame.data[3] = d3;
9 can1SendFrame.data[4] = d4;
10 can1SendFrame.data[5] = d5;
11 can1SendFrame.data[6] = d6;
12 can1SendFrame.data[7] = d7;
13
14 int ret;
15 ret = write(can1Socket, &can1SendFrame, sizeof(can1SendFrame));
16 if (ret == -1)
17 {
18 qDebug() << "write error!" << ret << endl;
19 }
20 else
21 {
qDebug("socketcan send ok: %x, %02x, %02x, %02x, %02x, %02x, %02x, %02x, %02x", can1SendFrame.can_id, can1SendFrame.data[0]
7 }
6 }
环境是,nuc972 arm板,qt5.6,socketcan数据收发。
先是主线程里通过can发送数据,对方设备收到数据后返回,接收线程里很快就收到数据。从时间看,can发送数据后,1秒就收到对方返回的数据。然后将数据作为信号的参数,发送信号。数据是个can_frame结构体变量,好像是13字节。
主线程里对应的槽函数,大概19秒后才触发,有时候好像是11秒。为什么会这么慢呢?
:/mnt# ./cantest3
nuc970-can1 nuc970-can1 can1: setting BTR=1b13 BRPE=0000
main thread socketid is 4
can recv thread is begin.
"[1970-01-01 04:34:07]"
socketcan write ok: 9b60f5f4, 00, 10, 03, 00, d4, c3, b2, a1
"[1970-01-01 04:34:08]"
recv thread received: 9b00f4f5, 08, 03, 10, 05, 00, 82, 00, 00, 00
main thread recv signal.
"[1970-01-01 04:34:27]"
device online
---------------------------------
晕死,主线程里加了个sleep(20),阻塞在这里了。
版主看到的话,麻烦删了这个帖子吧。
折腾了一天,qztest还是没通过编译。
在pc上的ubuntu里,引用quazip生成的动态库,可以解压带密码的文件。
抄的这个网址的:https://blog.csdn.net/kenfan1647/article/details/116619267
编译ubuntu上用的quazip,没有指定zlib版本及目录,直接cmake,make完成的。
接下来该编译arm板上用的quazip了,不知道在cmake下该如何指定arm板用的zlib路径。
------------------------------------------------------------------
在cmakelists.txt里设置了交叉编译用到的gcc,指定了zlib路径。
结果编译到最后,提示qt库错误,是ubuntu上的qt库,不知道如何设置为arm板上的qt库了...
[ 11%] Linking CXX shared library libquazip1-qt5.so
/opt/Qt/5.13.2/gcc_64/lib/libQt5Core.so.5.13.2: file not recognized: 不可识别的文件格式
collect2: 错误:ld 返回 1
make[2]: *** [quazip/CMakeFiles/QuaZip.dir/build.make:324:quazip/libquazip1-qt5.so.1.4] 错误 1
make[1]: *** [CMakeFiles/Makefile2:99:quazip/CMakeFiles/QuaZip.dir/all] 错误 2
make: *** [Makefile:136:all] 错误 2
-----------------------------------------
我应该找个旧版本的quazip,能用qmake编译的...
-------------------------------------------
下载了0.7.3版本的quazip,交叉编译通过了,烧录到板子上,可以解压带密码的文件。还是qmake熟悉。
cmake编译quazip,倒是直接编译通过了。
想编译下quazip目录里的qztest,直接编译报错,找不到QtCore,修改了CMakeLists.txt文件,指定QtCore位置及目录,可以往下进行。
但是貌似最后链接阶段又报错:
Desktop:~/Qt5/quazipx86/qztest$ make
[ 6%] Automatic MOC and UIC for target qztest
[ 6%] Built target qztest_autogen
Consolidate compiler generated dependencies of target qztest
[ 13%] Linking CXX executable qztest
/usr/bin/ld: 找不到 -lQuaZip::QuaZip: 没有那个文件或目录
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/qztest.dir/build.make:282:qztest] 错误 1
make[1]: *** [CMakeFiles/Makefile2:85:CMakeFiles/qztest.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
搜了下,最先搜到的是qzipreader,qt自带的,不用再编译。尝试解压一个带密码的zip文件,结果不知道该如何设置解压密码。
https://dreamswork.github.io/qt4/classQZipReader.html
在这个网址上,也没找到设置解压密码的方法。
quazip,还得再编译,用法貌似也没qzipreader简单...
在qt线程里进行socketcan::read(),发现在这里死等了。
去网上搜socketcan非阻塞接收,搜到这个:
https://blog.csdn.net/qq_32419593/article/details/119729266
主要是这句:
fcntl(can1Socket, F_SETFL, FNDELAY);
发现接收线程里调用recv()时会有警告:
socketcan read:: Resource temporarily unavailable
搜相关含义,说是在非阻塞模式下,使用了阻塞操作。
那么,就是说阻塞模式下,不能用read()函数了?
那用什么函数呢?select?
又搜到一个帖子:
https://cloud.tencent.com/developer/ask/sof/999494
像是机翻的外国帖子。
里面没用fcntl()那个函数,而是用如下语句:
canfd_enabled = 1;
error_code = setsockopt(socketNum, SOL_CAN_RAW, CAN_RAW_FD_FRAMES, &canfd_enabled, sizeof(int));
加进去试了,倒是不会阻塞在接收线程里,可发现程序主要在主线程里走,接收线程里的qDebug()无输出了...
再记录下,之前在ubunt18.04上跑这个程序,https下载正常。复制到ubunt22.04后,有提示ssl:
qt.network.ssl:QSslSocket: cannot resolve EVP_PKEY_base_id
qt.netwrok.ssl:QSslSocket: cannot resolve SSL_get_peer_certificate
查看sll版本,发现ubuntu22.04用的是openssl3.0.2,qt5.13.2构建用的是openssl1.1.1b。
下载了openssl1.1.1,解压后,设为动态库编译,make后得到的libcrypto和libssl,复制到qt目录下的/gcc_64/lib目录下,再运行程序就不报错了。
注释掉_device_table.txt里/dev/conslole那一行,再编译,遇到了LD_PRELOAD 里找不到libfakroot.so的报错,在output/target里搜了下,确实没有。
感觉fakeroot编译可能有问题。昨天编译fakeroot遇到个问题,有个宏定义没有,去git.buildroot.org找到fakeroot这个文件,看到002xxx.patch是解决这个问题的,就下载了这个,编译通过。
除了001,002.patch,还有003-005.patch,今天索性全下载下来,放到buidlroot/package/fakeroot目录下。再次编译,居然通过了。
总结一下,新塘提供的nuc972 bsp在ubuntu18.04下编译很顺利。
在ubunt22.04下编译,遇到了几个问题,基本大都是通过在git.buildroot.org下找对应的patch解决的。
那个c++17下bool变量不能用++运算符是手动改成类似 a = a+1 来解决的。
手动输入报错前的命令,先是fakeroot,执行后,命令提示符由$变为#。
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/fakeroot
再执行_fakeroot.fs,结果报错,打开_fakeroot.fs,从后往前以此注释掉再运行,发现是这一行引起的报错:
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/makedevs -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
搜makedevs用法, makdevs -d 文件 -r 路径,那么就是在buildroot/output/target目录下,创建_device_table.txt文件里写好的目录。
创建节点需要root权限,可上一步执行的fakeroot,就是为了避免用ubuntu系统的root权限啊。那么这里为何又提示权限不够?
Desktop:~/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot$ make
>>> Finalizing target directory
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc
echo "buildroot" > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/hostname
/usr/bin/sed -i -e '$a \127.0.1.1\tbuildroot' -e '/^127.0.1.1/d' /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/hosts
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/issue
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/network/interfaces
/usr/bin/sed -i -e s,^root:[^:]*:,root:"*":, /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/shadow
ln -sf busybox /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/bin/sh
/usr/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/inittab
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/locales.nopurge; done
for dir in /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/locale; do for langdir in $dir/*; do if [ -e "${langdir}" ]; then grep -qx "${langdir##*/}" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/locales.nopurge || rm -rf $langdir; fi done; done
if [ -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/X11/locale ]; then for lang in C en_US; do if [ -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/X11/locale/$lang/XLC_LOCALE ]; then echo "$lang/XLC_LOCALE: $lang"; fi done > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/X11/locale/locale.dir; fi
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/include /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/aclocal \
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/lib/pkgconfig /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/pkgconfig \
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/lib/cmake /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/cmake
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/lib/ /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/lib/ /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/libexec/ \
\( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find: ‘/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/libexec/’: 没有那个文件或目录
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/gdb
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/bash-completion
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/zsh
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/man /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/man
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/info /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/info
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/doc /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/doc
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/gtk-doc
rmdir /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share 2>/dev/null
make[1]: [Makefile:650:target-finalize] 错误 1 (已忽略)
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name 'ld-*.so*' -o -name '*.ko' \) -print0 | xargs -0 /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/lib/ -type f -name 'libpthread*.so*' | \
xargs -r /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-strip --remove-section=.comment --remove-section=.note --strip-debug
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/lib/ -type f -name 'ld-*.so*' | \
xargs -r /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-strip --remove-section=.comment --remove-section=.note --strip-debug
test -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/ld.so.conf && \
{ echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true
test -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/ld.so.conf.d && \
{ echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit 1; } || true
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc
( \
echo "NAME=Buildroot"; \
echo "VERSION=2016.11.1-gfaa664b"; \
echo "ID=buildroot"; \
echo "VERSION_ID=2016.11.1"; \
echo "PRETTY_NAME=\"Buildroot 2016.11.1\"" \
) > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/os-release
>>> Generating root filesystem image rootfs.cpio
if [ ! -e /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/init ]; then /usr/bin/install -m 0755 fs/cpio/init /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/init; fi
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_users_table.txt
echo '#!/bin/sh' > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
echo "set -e" >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
echo "chown -h -R 0:0 /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target" >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
printf ' \n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_users_table.txt
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/support/scripts/mkusers /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_users_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
cat system/device_table.txt > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt
printf ' /bin/busybox f 4755 0 0 - - - - -\n /dev/console c 622 0 0 5 1 - - -\n\n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt
echo "/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/makedevs -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target" >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
printf ' cd /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target && find . | cpio --quiet -o -H newc > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio\n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
chmod a+x /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/fakeroot -- /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt'
makedevs: line 23: can't create node /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/dev/console: Operation not permitted
make[1]: *** [fs/cpio/cpio.mk:58:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio] 错误 1
make: *** [Makefile:76:_all] 错误 2
完整的make记录,可以看到是make时创建了_fakeroot.fs和_device_table.txt文件,并往里输入了内容。
报错信息:
printf ' cd /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target && find . | cpio --quiet -o -H newc > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio\n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
chmod a+x /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/fakeroot -- /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt'
makedevs: line 23: can't create node /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/dev/console: Operation not permitted
make[1]: *** [fs/cpio/cpio.mk:58:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio] 错误 1
make: *** [Makefile:76:_all] 错误 2
_fakeroot.fs内容:
!/bin/sh
set -e
chown -h -R 0:0 /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/makedevs -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
cd /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target && find . | cpio --quiet -o -H newc > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio
_device_table.txt内容:
# See package/makedevs/README for details
#
# This device table is used to assign proper ownership and permissions
# on various files. It doesn't create any device file, as it is used
# in both static device configurations (where /dev/ is static) and in
# dynamic configurations (where devtmpfs, mdev or udev are used).
#
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/dev d 755 0 0 - - - - -
/tmp d 1777 0 0 - - - - -
/etc d 755 0 0 - - - - -
/root d 700 0 0 - - - - -
/var/www d 755 33 33 - - - - -
/etc/shadow f 600 0 0 - - - - -
/etc/passwd f 644 0 0 - - - - -
/etc/network/if-up.d d 755 0 0 - - - - -
/etc/network/if-pre-up.d d 755 0 0 - - - - -
/etc/network/if-down.d d 755 0 0 - - - - -
/etc/network/if-post-down.d d 755 0 0 - - - - -
# uncomment this to allow starting x as non-root
#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - -
/bin/busybox f 4755 0 0 - - - - -
/dev/console c 622 0 0 5 1 - - -
一开始编译时没给root权限,直接make,执行到这里报错:
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/build/_device_table.txt'
makedevs: line 23: can't create node /home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/target/dev/console: Operation not permitted
make[1]: ***
然后给root权限,结果 sudo make还是报错,
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/build/_device_table.txt'
makdev : line23: can't creat node /home/buidlroot/output/target/dev/console file exists.
搜到了这个帖子:
http://fuqiang1986.com/2022/07/22/%E5%85%A8%E5%BF%97%E5%93%AA%E5%90%92d1%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%A3%E7%A0%81%E4%B8%8B%E8%BD%BD%E7%BC%96%E8%AF%91%E4%B8%8E%E8%B0%83%E8%AF%95/
buildroot提供了003xxxxxxx.pathc,打上这个补丁就可以解决这个问题。
我是下载到了output/build/host-m4xxx/这个目录下,然后git apply xxxx.patch。
然后就是我在3#遇到的那个问题,还未解决:
../../gcc/reload1.c: In function ‘void init_reload()’:
../../gcc/reload1.c:89:24: error: use of an operand of type ‘bool’ in ‘operator++’ is forbidden in C++17
89 | (this_target_reload->x_spill_indirect_levels)
--------------------------------------------------------------------
在gcc/reload1.c里的443行,找到了对应的x_spill_indirect_levels++那一行,改成这样:
while (memory_address_p (QImode, tem))
{
// spill_indirect_levels++;
spill_indirect_levels = spill_indirect_levels + 1;
tem = gen_rtx_MEM (Pmode, tem);
}
-----------------------------------------
又遇到找不到 _STAT_VER 定义。
error: '_STAT_VER' undeclared (first use in this function)99 | #define INT_NEXT_STAT(a,b) NEXT_STAT64(_STAT_VER,a,b
和上上个问题类似,找fakeroot的002xxx.patch补丁。
https://git.buildroot.org/buildroot/tree/package/fakeroot?id=5a9504831f3fa1ef3be334036c93da30150fde55
之前的代码没有设置QSslConfigruation相关,又搜了个例程加上去,貌似能连上了,虽然最后不知道为何又多了个“Unkonwn error"
14 void httpStart(const QUrl &requestedUrl)
13 {
12 this->url = requestedUrl;
11 QNetworkRequest request(this->url);
10 QSslConfiguration config; //该行之前没有;
9 config.setPeerVerifyMode(QSslSocket::VerifyNone); //该行之前没有;
8 config.setProtocol(QSsl::TlsV1_0); //该行之前没有;
7 request.setSslConfiguration(config); //该行之前没有;
6 this->reply = qnam.get(request);
5 // this->reply = qnam.get(QNetworkRequest(this->ur↷
4
3 connect(this->reply, &QNetworkReply::finished, th↷
2 connect(this->reply, &QIODevice::readyRead, this,↷
1 connect(this->reply, &QNetworkReply::downloadProg↷
243 }
:/mnt# ./qmqtt_example
true "OpenSSL 1.0.2j 26 Sep 2016" "OpenSSL 1.0.2j 26 Sep 2016"
("ftp", "file", "qrc", "http", "https", "data")
""
http ready to read.
"<html>\r\n<head>\r\n\t<script>\r\n\t\tlocation.replace(location.href.replace(\"https://\",\"http://\"));\r\n\t</script>\r\n</head>\r\n<body>\r\n\t<noscript><meta http-equiv=\"refresh\" content=\"0;url=http://www.baidu.com/\"></noscript>\r\n</body>\r\n</html>"
227 227
227 227
http finished.
("Accept-Ranges", "Cache-Control", "Connection", "Content-Length", "Content-Type", "Date", "P3p", "Pragma", "Server", "Set-Cookie", "Strict-Transport-Security", "Traceid", "X-Frame-Options", "X-Ua-Compatible")
""
"Unknown error"
^C
借帖子问一下,nuc972的rgb如何整组调换?我也是为了方便走线将RGB顺序画成了GBG。
看了nuc972 datasheet的lcd的DEVICE_CONTROL寄存器里的17,18位好像和rgb有关。
[18:17]
[LCD_ODD :
SEL_ODD]
Control LCD Line Data Out
00 = First line data is RGB, second line data is GBR.
01 = First line data is BGR, second line data is RBG.
10 = First line data is GBR, second line data is RGB.
11 = First line data is RBG, second line data is BGR.
但是不明白什么是first line,什么是second line?
在牛卧堂论坛问过,有人回复说是nuc972有两个framebuffer.
我修改buildroot/output/build/linux-master/drivers/video的nuc970fb.c文件里nuc970fb_activate_var()函数里的这部分:
fbi->regs.lcd_device_ctrl = ((fbi->regs.lcd_device_ctrl & 0xFFF9FFFF) | 0x00020000);
writel(fbi->regs.lcd_device_ctrl, regs + REG_LCM_DEV_CTRL);
分别试过0x00020000、0x00040000、0x00060000,都没有效果。
问题找到了,libqt5script.dll和libqtprintsupport.dll没有拷进来。
奇怪,windeployqt.exe没查到这两个库的依赖。
-------------------------------------
感谢网友推荐的软件:dependencies,挺好用的。
https://github.com/lucasg/Dependencies
以下是qtcreator.sh的全部内容:
#! /bin/sh
# Use this script if you add paths to LD_LIBRARY_PATH
# that contain libraries that conflict with the
# libraries that Qt Creator depends on.
makeAbsolute() {
case $1 in
/*)
# already absolute, return it
echo "$1"
;;
*)
# relative, prepend $2 made absolute
echo `makeAbsolute "$2" "$PWD"`/"$1" | sed 's,/\.$,,'
;;
esac
}
me=`which "$0"` # Search $PATH if necessary
if test -L "$me"; then
# Try GNU readlink(1)
nme=`readlink -nf "$me" 2>/dev/null`
if test -n "$nme"; then
me=$nme
else
# No GNU readlink(1), so let's try ls -l
base=`dirname "$me"`
me=`ls -l "$me" | sed 's/^.*-> //'`
me=`makeAbsolute "$me" "$base"`
fi
fi
bindir=`dirname "$me"`
libdir=`cd "$bindir/../lib" ; pwd`
# Add path to deployed Qt libraries in package
qtlibdir=$libdir/Qt/lib
if test -d "$qtlibdir"; then
qtlibpath=:$qtlibdir
fi
# Add Qt Creator library path
_ORIGINAL_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
LD_LIBRARY_PATH=$libdir:$libdir/qtcreator$qtlibpath${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
exec "$bindir/qtcreator" -user-library-path "$_ORIGINAL_LD_LIBRARY_PATH" ${1+"$@"}
试过注释掉以下这几句,这运行qtcreator.sh也会报错:
# Add path to deployed Qt libraries in package
qtlibdir=$libdir/Qt/lib
if test -d "$qtlibdir"; then
qtlibpath=:$qtlibdir
fi
sudo apt install --reinstall libxcb-xinerama0
试过的,没效果。
目前的状况是,qt编写的gui程序,可以运行,不报错。
会有这么个警告:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
而/opt/qt/5.13.2/Tools/QtCreator/bin目录下,有qtcreator和qtcreator.sh两个文件。
运行qtcreator会报错:
./qtcreator
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
已放弃 (核心已转储)
而运行qtcreator.sh脚本,则能运行。
./qtcreator.sh
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Failed to load color scheme: "/opt/Qt5.13.0/Tools/QtCreator/share/qtcreator/styles/dark.xml"
Cannot update Qt version information: /home/any/imx6ul/qt5.13.0-arm/bin/qmake cannot be run.
才发现,重新安装qt后,自己编写的qt应用程序,可以启动了,虽然有提示:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
但是qtcreator直接运行,还是报错:
/opt/Qt/Tools/QtCreator/bin$ ./qtcreator
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
已放弃 (核心已转储)
ubunt22.04, qt是5.13.0,原来能用的,有阵子没登陆这个系统了。现在发现运行qt带界面的程序,包括qtcreator,都会报下面这个错误。
运行qt/Toos/qtcreator/bin/qtcreator.sh这个脚本倒是能打开qtcreator。
运行qt/Toos/qtcreator/bin/qtcreator就报错。运行其他qt编写的gui也报这个错。
qt maintentools倒是能运行。
以为重装能解决问题,就删除了qt5.13.0,装了qt5.13.2,倒是真能运行,但是一重启电脑后,就又报这个错了。
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
已放弃 (核心已转储)
往下继续,报错还是挺多:
../../gcc/reload1.c: In function ‘void init_reload()’:
../../gcc/reload1.c:89:24: error: use of an operand of type ‘bool’ in ‘operator++’ is forbidden in C++17
89 | (this_target_reload->x_spill_indirect_levels)
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/reload1.c:443:7: note: in expansion of macro ‘spill_indirect_levels’
443 | spill_indirect_levels++;
---------------------------------------------------
没搜到解决办法,gcc4.8.5换gcc4.9.0,暂时能往下进行。就是有个问题,我板子上的根文件系统,是用gcc4.8.5制作的,现在PC上交叉编译器环城gcc4.9.0,不知道会遇到什么问题。
-------------------------------------------------
晕,换gcc4.9.0,最后还是会报上边那个错误。
-----------------------------------------------------------
换gcc5,报同样错误。
换gcc6,报以下错误:
../../gcc/ubsan.c: In function ‘bool ubsan_use_new_style_p(location_t)’:
../../gcc/ubsan.c:1472:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
1472 | || xloc.file == '\0' || xloc.file[0] == '\xff'
修改package/m4下的m4.mk和m4.hash
感谢。修改后:
m4.mk:
################################################################################
#
# m4
#
################################################################################
M4_VERSION = 1.4.19
M4_SOURCE = m4-$(M4_VERSION).tar.xz
M4_SITE = $(BR2_GNU_MIRROR)/m4
M4_LICENSE = GPL-3.0+
M4_LICENSE_FILES = COPYING
$(eval $(host-autotools-package))
m4.hash:
# Locally calculated after checking pgp signature
sha256 63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96 m4-1.4.19.tar.xz
# License files, locally calculated
sha256 3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986 COPYING
手动下载m4-1.4.19.tar.xz放到dl目录下,能正确解压了,但是后续还是会有报错:
Applying 0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch using patch:
Error: duplicate filename '0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch'
Conflicting files are:
already applied: /home/xxx/NUC970_Buildroot/package/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
to be applied : /home/xxx/NUC970_Buildroot/package/m4/0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch
make[1]: *** [package/pkg-generic.mk:184:/home/any/MPU/nuc970bsp/20200318/NUC970_Buildroot/output/build/host-m4-1.4.19/.stamp_patched] 错误 1
make: *** [Makefile:76:_all] 错误 2
意思三0001--fflush-adjust-to-glibc-2.28-libio.h-removal.pathch文件重复了?但是我搜了当前目录,只有一个文件。
-------------------------------------------------
不对,第一次报错时是这个错误:
Applying 0002-fflush-be-more-paranoid-about-libio.h-change.patch using patch:
patching file lib/fflush.c
Reversed (or previously applied) patch detected! Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file lib/fflush.c.rej
patching file lib/fpending.c
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/fpending.c.rej
patching file lib/fpurge.c
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/fpurge.c.rej
patching file lib/freadahead.c
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/freadahead.c.rej
patching file lib/freading.c
Reversed (or previously applied) patch detected! Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file lib/freading.c.rej
patching file lib/fseeko.c
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file lib/fseeko.c.rej
再次make时才会报文件名重复这个错误。
-------------------------------------------------------------
手动把报错的那个文件删除,再次make,又有个类似的报错,但文件名不一样,再删再make,貌似可以了。
在ubuntu22.04上打算编译下nuc972的bsp,结果报错:
c-stack.c:55:26: error: missing binary operator before token "("
55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
网上搜了下,搜到这个:
https://blog.csdn.net/weixin_45647912/article/details/123768601
提示升级host-m4版本即可,由m4-1.4.18升级为m4-1.4.19即可。
但是,如何升级这个host-m4呢?我删除dl目录下的m4-1.4.18.tar.xz,下载m4-1.4.19.tar.xz放进去,结果make时还是会自动下载1.4.18。
也不知道这个是在哪里指定版本的?
哈,两年半后再次编译nuc972 buildroot,又遇到了同样的问题,竟然搜到了之前的求助帖。
关于第二个问题,现在还是修改/etc/profile文件,/u显示用户名,/h显示主机明,/w显示路径。
其实,如果能在buildroot里设置修改完就好了。
现在又多了个问题。发现之前构建的根文件系统里/sbin目录下有reboot命令,这次我构建的根文件系统里,没有reboot这个命令。
群友说这个是busybox实现的,但我在make busybox-menuconfig里搜reboot,没搜到相关。
那么,如何增加reboot命令呢?
-------------------------------------
哈,不知道动了哪里,现在有reboot命令了。
同遇到这个问题,为了拉线方便画的BGR,看手册RGB可以调换,但看不懂啥是first line data,啥是second line data。
Publication Release Date: Oct. 15, 2018
- 1123 - Revision V1.46
NUC970 TECHNICAL REFERENCE MANUAL
[18:17]
[LCD_ODD :
SEL_ODD]
Control LCD Line Data Out
00 = First line data is RGB, second line data is GBR.
01 = First line data is BGR, second line data is RBG.
10 = First line data is GBR, second line data is RGB.
11 = First line data is RBG, second line data is BGR.
如果能从内核驱动层改过来最好了,不想绘图程序时改。
那么先将跟文件系统烧录到0x16000000吧,结果kernel panic...
U-Boot 2016.11 (Jan 12 2023 - 15:23:13 +0800)
CPU: NUC972
Board: NUC972
DRAM: 64 MiB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0
Loading from nand0, offset 0x200000
Image Name: Linux-3.10.108
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1948600 Bytes = 1.9 MiB
Load Address: 00008000
Entry Point: 00008000
## Booting kernel from Legacy Image at 00007fc0 ...
Image Name: Linux-3.10.108
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1948600 Bytes = 1.9 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
XIP Kernel Image ... OK
StartiBooting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.108 (user@ubuntu) (gcc version 4.8.5 (Buildroot 2016.11.1-g7116cea) ) #4 PREEMPT Thu Jan 12 15:33:11 CST 2023
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: NUC970
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 rootflags=inband-tags console=tty0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M mtdparts=nand0:0x200000@0x0(u-boot)ro,0x800000@0x200000(kernel)ro,-(user)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60812k/60812k available, 4724k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc4800000 - 0xff000000 ( 936 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0376eec (3516 kB)
.init : 0xc0377000 - 0xc03943b4 ( 117 kB)
.data : 0xc0396000 - 0xc03cdf60 ( 224 kB)
.bss : 0xc03cdf60 - 0xc0400b08 ( 203 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:625
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
console [tty0] enabled
console [ttyS0] enabled
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys perf_event
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc02c1df8 - 0xc02c1e34
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
msgmni has been set to 118
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
[nuc970fb_probe] 10
fb0: nuc970fb frame buffer device
nuc970-uart.0: ttyS0 at I/O 0x0 (irq = 36) is a NUC970
brd: module loaded
nuc970 mtd nand driver version: 20160331
NAND device: Manufacturer ID: 0xef, Chip ID: 0xf1 (Winbond NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
nand: SMRA size 64, 32
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
3 cmdlinepart partitions found on MTD device nand0
Creating 3 MTD partitions on "nand0":
0x000000000000-0x000000200000 : "u-boot"
0x000000200000-0x000000a00000 : "kernel"
0x000000a00000-0x000008000000 : "user"
fmi-sm: registered successfully! mtdid=nand0
CAN device driver interface
nuc970-can0 nuc970-can0: nuc970_can0_platform device registered (regs=f800b000, irq=58)
nuc970-can1 nuc970-can1: nuc970_can1_platform device registered (regs=f800b400, irq=59)
libphy: nuc970_rmii0: probed
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci_nuc970_probe() - name: nuc970-ehci
nuc970-ehci nuc970-ehci: Nuvoton NUC970/N9H30 EHCI Host Controller
nuc970-ehci nuc970-ehci: new USB bus registered, assigned bus number 1
nuc970-ehci nuc970-ehci: irq 23, io mem 0xb0005000
nuc970-ehci nuc970-ehci: USB 2.0 started, EHCI 0.95
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
nuc970-ohci nuc970-ohci: Nuvoton NUC970/N9H30 OHCI Host Controller
nuc970-ohci nuc970-ohci: new USB bus registered, assigned bus number 2
nuc970-ohci nuc970-ohci: irq 24, io mem 0xb0007000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
usbcore: registered new interface driver usb-storage
TCP: cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags "inband-tags"
VFS: Mounted root (yaffs2 filesystem) on device 31:2.
devtmpfs: mounted
Freeing unused kernel memory: 116K
Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108 #4
Backtrace:
[<c0011f44>] (dump_backtrace+0x0/0x10c) from [<c0012158>] (show_stack+0x18/0x1c)
r6:00000000 r5:c039fb88 r4:c032f8cc r3:00000000
[<c0012140>] (show_stack+0x0/0x1c) from [<c02bed68>] (dump_stack+0x20/0x28)
[<c02bed48>] (dump_stack+0x0/0x28) from [<c02bc9f0>] (panic+0xa4/0x1fc)
[<c02bc94c>] (panic+0x0/0x1fc) from [<c02bc46c>] (kernel_init+0x130/0x158)
r3:00000000 r2:00000001 r1:000002ff r0:c032f8cc
r7:00000000
[<c02bc33c>] (kernel_init+0x0/0x158) from [<c000ecf8>] (ret_from_fork+0x14/0x3c)
r5:c02bc33c r4:00000000
我想将kernel分区大小设为0x800000,所以环境变量里的mtdparts里设成0x800000了,但是启动内核后找不到mtd/block2分区,然后就去uboot里用mtdparts命令查看nand分区,结果kernel分区还是0x1400000大小。
请问,应该在编译linux内核时做哪些修改?
=> mtdparts
device nand0 <nand0>, # parts = 3
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: kernel 0x01400000 0x00200000 0
2: user 0x06a00000 0x01600000 0
active partition: nand0,0 - (u-boot) 0x00200000 @ 0x00000000
defaults:
mtdids : nand0=nand0
mtdparts: mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)
=> printenv
baudrate=115200
bootargs=noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 rootflags=inband-tags console=tty0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M mtdparts=nand0:0x200000@0x0(u-boot)ro,0x800000@0x200000(kernel)ro,-(user)
bootcmd=nboot 0x7fc0 0 0x200000; bootm 0x7fc0
bootdelay=1
ethact=emac
ethaddr=00:00:00:11:66:88
ipaddr=192.168.1.11
mtddevname=u-boot
mtddevnum=0
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)
partition=nand0,0
serverip=192.168.1.99
stderr=serial
stdin=serial
stdout=serial
内核make menuconfig时的这个选项是勾选了的。
Command line partition table parsing
AT32F413RCT7
为例,内部闪存存储器和SRAM可以设置为以下三种配置:
- ZW: 96 K字节, NZW: 160 K字节, SRAM: 32 K字节 (出厂默认);
- ZW: 64 K字节, NZW: 192 K字节, SRAM: 64 K字节;
- ZW: 112 K字节, NZW: 144 K字节, SRAM: 16 K字节。
比如上边这个例子,那么该芯片,其实有128K RAM, 256K NZW ROM?
ZW ROM是指的读取时零等待吧,写入时,应该和NZW一样吧?
ZW 和 NZW 区别大吗?有必要ZW吗?
-------------------------------------
搜到了这个。
Questions:闪存零等待区(ZW)和非零等待区(NZW)有何区别?请说明。
Answer:
1. 零等待(ZW)是指 MCU 内核,以零等待周期从 FLASH 内取指令(取指无等待周期);
非零等待(NZW)是指 MCU 内核,以非零等待周期从 FLASH 内取指令(取指要等待周期)。
2. 零等待(ZW)和非零等待(NZW)的区域位置不同:
零等待(ZW)在 FLASH 前部分区域,非零等待(NZW)在 FLASH 后部分区域。
以 AT32F403AVGT7 为例:
零等待(ZW)大小区域为 256 KB, 是从 0X0800 0000 - 0X0803 FFFF;
非零等待(NZW)大小区域为 768 KB,是从 0X0804 0000 - 0X080F FFFF。
3. 零等待(ZW)和非零等待(NZW)的区域大小会随着 SRAM 区域大小的调整而改变。
以 AT32F403AVGT7 为例:
SRAM: 96 KB, ZW: 256 KB, NZW: 768 KB (默认配置)
SRAM: 224 KB, ZW: 128 KB, NZW: 896 KB。
4. 零等待(ZW)和非零等待(NZW)的运行速度有差别,非零等待(NZW)的执行速率约为零等待(ZW)的
0.4 倍。
以 AT32F403AVGT7 为例:
当系统时钟 240MHz,SRAM 默认为 96KB , 零等待(ZW) 默认为 256KB ,FW 大小为 512KB bin 文件,前
部分零等待(ZW)区域的 256KB 以 240MHz 速率执行,后部分 256KB bin 文件存放在非零等待(NZW)
区域,执行速率约为 96MHz。
-------------------------------------
那么,好奇,stm32f103的flash读取是零等待吗?gd32呢?air32呢?
----------------------------------------
https://www.zhihu.com/question/574579916?utm_medium=social&utm_oi=31853956300800&utm_psn=1590961286078148608&utm_source=qq
正好再知乎上看到这个问题,提问者问为何国内mcu大都是嵌入式spi flash。
用过雅特力的at32f413,RAM也是可以配置的,比如CB,默认是32K,可以配置为64K/32K/16K。
(1) ZW = 零等待(zero wait-state),可达SYSCLK 200 MHz
NZW = 非零等待(non-zero wait-state)
(2) 除了AT32F413C8T7外,其他型号透过选择字节设置支持内部闪存存储器和SRAM分配使用。以AT32F413RCT7
为例,内部闪存存储器和SRAM可以设置为以下三种配置:
- ZW: 96 K字节, NZW: 160 K字节, SRAM: 32 K字节 (出厂默认);
- ZW: 64 K字节, NZW: 192 K字节, SRAM: 64 K字节;
- ZW: 112 K字节, NZW: 144 K字节, SRAM: 16 K字节。