Part Number:TDA4VM
Hi, TI engineer
In Desay TDA4VM mass production board (not TDA4 EVM development board), which the board environment is qnx710/aarch64 (A72), I calls opencv4.3.0 libraries enabled NEON and compiled with qnx710 toolchain. But errors are reported as follows: This opencv build doesn't support current CPU/HW configuration. ID=100(NEON) – NOT AVAILABLE。 What are the possible reasons?
The tests I have done are as follows:
- I used the demo program to call the opencv library that enables neon running in the Qualcomm SA8155 QNX board, it’s OK and no error. But the same program will report an error in the tda4 QNX board.: This opencv build doesn't support current CPU/HW configuration. NEON – NOT AVAILABLE
- I recompiled the opencv source code with qnx710 and added the compilation option:-DENABLE_NEON=OFF, turn off neon actively. And then I use the same program to run in TDA44 qnx710 board. it’s OK and no error.
Analysis: The opencv Library enabled neon can run in Qualcomm sa8155 qnx board, but it cannot run in tda4 qnx board. However, The opencv Library not enabled neon can run in tda4 qnx board. Then we suspect that the running environment in tda4 board may cause the bug. Possible reasons are as follows:
- Maybe there is a problem with TDA4 SOC BSP?
- Or there is a problem with the customized qnx710 system running on the tda4 board. One of the two reasons does not enable neon, so the opencv library with neon cannot run on tda4 SOC.
I want to know what are the possible reasons?
The demo program is as follows: opencv_neon_test.cpp
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
int main(int argc, char const *argv[])
{
cv::Mat src_img = cv::imread("./01.jpg", IMREAD_COLOR);
// cv::imshow("src", src_img);
// cv::waitKey(0);
cv::imwrite("src.jpg", src_img);
printf("OPENCV API TEST SUCCESS");
return 0;
}
Annie Liu:
由于春节假期,为更加有效地解决您的问题,我们已经将您的问题发布在E2E英文技术论坛上,将由资深的工程师为您提供帮助。您也可以查看下帖关注进展:
https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1073445/tda4vm-the-opencv-library-enabled-neon-runnig-in-tda4-qnx710-board-and-reporting-an-error
,
Annie Liu:
请您参考这个帖子:https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1063850/tda4vm-opencv-run-error-in-qnx-platform/3945038#3945038
,
Guohui Zhang:
谢谢liu工,帖子的回复我看了,提交该帖子的工程师也是我团队里的,TI回复那个帖子的建议是:让问下黑莓。跟黑莓的工程师联系过了,黑莓的工程师也解决不了。
现在的问题是这样子的:
同样的opencv库(打开了NEON),在高通SA8155 qnx板子上是可以运行的,但是在TI TDA4VM qnx板子是不能运行的。
同样的opencv库(关闭了NEON),是可以在TI TDA4VM qnx板子上运行的。
黑莓说opencv的库(打开了NEON)是没有问题的,为啥单独在TDA4VM qnx板子上是无法运行的,他们怀疑是TDA4相关的问题的。
所示,想问下,TDA4VM SOC上要运行QNX system,那么需要板载开发包BSP等相关的东西,有没有可能是BSP没有支持NEON?或者是TDA4VM定制的QNX系统,有没有使能NEON?毕竟opencv库是运行在QNX系统上的,也就是运行在A72上的,QNX系统再往底层找就是BSP,我的理解是TDA4 SOC中,先是A72核,上层是BSP,再上层是QNX,最上面就是opencv库。不知道是否这样子的?A72核肯定是没问题的,已经验证它支持NEON指令集,openCV库也是没问题的,所以问题可能出现在BSP或者QNX SDP上?
麻烦liu工再帮我跟踪一下这个问题?比较着急,让TI相关的工程师帮忙分析下原因,指明下方向,非常感谢,盼复!
,
Annie Liu:
在之前E2E英文论坛的关联帖子中(https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1063850/tda4vm-opencv-run-error-in-qnx-platform/3945038#3945038)曾指出:"I wrote some code with NEON instructions, it also ran as well ."
基于该陈述,假设如下:
NEON 可在带有 QNX SDP 7.1 的 A72 上运行
QNX-Blackberry BSP 用于引导板
NEON 测试代码已运行,并且可以正常运行这个测试中唯一缺少的就是 OpenCV 库。
我的理解是,被测的库来自黑莓,TI没有这个库的源代码访问权限。如果这种理解不正确,请告知我。
客户是否知道导致错误生成的逻辑检查是什么?例如,它可能是缺少compile flag,导致不同的代码路径吗?
请注意,OpenCV 支持不是 TI PSDK QNX 交付的一部分。
进行了一些测试,请查阅这个帖子:(+) [FAQ] TDA4VM: NEON Support in PSDK QNX – Processors forum – Processors – TI E2E support forums
如果这解决了 OpenCV 出现的问题,请查看并提供反馈。
,
Guohui Zhang:
hi 谢谢刘工的回复。
KB的帖子:https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1075898/faq-tda4vm-neon-support-in-psdk-qnx 指明了方向和问题所在。
在TDA4 板子启动的时候,QNX BSP会读取ARM寄存器ID_AA64PFR0_EL1来确定NEON是否被底层平台支持。我们在板子中运行指令:pidin syspage=cpuinfo,log信息如下:
J7EVM@QNX:/# pidin syspage=cpuinfo
Header size=0x00000108, Total Size=0x00000950, #Cpu=2, Type=257
Section:cpuinfo offset:0x00000340 size:0x00000040 elsize:0x00000020
0) cpu:411fd080 flg:c0000c3a spd:2000 hwid:80000000 cache i/d:0/1 name:99
history:0000000000000004
1) cpu:411fd080 flg:c0000c3a spd:2000 hwid:80000001 cache i/d:0/1 name:99
history:0000000000000003
J7EVM@QNX:/#
从log可知,我们手里的TDA4板子中的cpu和flag信息是:cpu:411fd080 flg:c0000c3a。KB的帖子说:支持NEON正确的flag应该是:cpu:411fd080 flg:c0000c7a,所以可以确定是我们板子中的qnx bsp没有设置正确,导致不支持NOEN。
想确认一下,为了让TDA4 QNX板子支持NEON,是否只需要修改BSP File: ./src/hardware/startup/lib/aarch64/init_cpuinfo.c的如下内容即可,不需要修改其他代码了吧?
#define AA64PFR0_SIMD(x) ((((x) >> 20) & 0xfUL) != 0xfUL)
#define AA64PFR0_FP(x) ((((x) >> 16) & 0xfUL) != 0xfUL)
我先按照上述建议来修改BSP文件,后续我会继续跟踪此问题直到问题解决。
非常感谢liu工和TI工程师的大力支持!
,
Annie Liu:
谢谢您的更新。
Guohui Zhang 说:为了让TDA4 QNX板子支持NEON,是否只需要修改BSP File: ./src/hardware/startup/lib/aarch64/init_cpuinfo.c
上面显示的来自 init_cpuinfo.c 的逻辑,在 BSP 中会更新一个 syspage 条目,表明支持 NEON。 OpenCV 库可能会检查此flag,并生成最初在帖中报告的错误,但没有源代码访问权限,TI 无法验证这一点。
建议更改 BSP,或根据FAQ下载包含更新的更新 BSP。
(+) [FAQ] TDA4VM: NEON Support in PSDK QNX – Processors forum – Processors – TI E2E support forums.
,
Guohui Zhang:
hi 刘工好,
我已经在TDA4 QNX板子中验证通过了,只需要修改 ./src/hardware/startup/lib/aarch64/init_cpuinfo.c文件中的两个宏定义即可!重新编译BSP,将生成的.image文件推送到板子中,重启下板子,该TDA4板子就可以支持NEON加速了!
非常感谢这两周的支持!此问题得到完美解决!THANKS
best regards
zhang