时间:2023-11-05 08:44
人气:
作者:admin
Qt在工业上的使用场景包括工业自动化、嵌入式系统、汽车行业、航空航天、医疗设备、制造业和物联网应用。Qt被用来开发工业设备的用户界面、控制系统、嵌入式应用和其他工业应用,因其跨平台性和丰富的功能而备受青睐。
Qt能够为工业领域带来什么好处:
本次开发教程的测试板卡来自创龙科技的TLT113-EVM国产工业评估板,基于全志科技T113-i双核ARM Cortex-A7 + 玄铁C906 RISC-V + HiFi4 DSP异构多核处理器设计,ARM Cortex-A7处理器单元主频高达1.2GHz。
评估板由核心板和评估底板组成,核心板CPU、ROM、RAM、电源、晶振等所有元器件均采用国产工业级方案,国产化率100%。同时,评估底板大部分元器件亦采用国产工业级方案。核心板经过专业的PCB Layout和高低温测试验证,稳定可靠,可满足各种工业应用环境。

T113-i国产工业评估板硬件资源图解
此外,T113-i国产工业开发板的接口资源丰富,能够支持引出双路网口、双路CAN、双路USB、双路RS485、RS232等通信接口,同时引出LVDS LCD、TFT LCD、MIPI LCD、HDMI OUT、CVBS IN/OUT、LINE IN、MIC IN、H/P OUT等音视频多媒体接口,板载WIFI、4G(选配)模块,支持1080P@60fps JPEG/MJPEG视频硬件编码,支持4K@30fps H.265、4K@24fps H.264视频硬件解码,方便用户快速进行产品方案评估与技术预研。
创龙科技的这款T113-i国产工业开发板它提供了Qt的运行环境,可以让我们快速的部署工业领域的用户交互界面,控制系统。
接下来我们来聊聊如何在创龙科技T113-i工业开发板上部署Qt应用。
rice@rice:~$mkdirt113//创建t113工作目录,然后将压缩包拷贝到此目录
rice@rice:~$cdt113
....
rice@rice:~/t113$tar-zxvfSDK-T113-i_v1.0.tar.gz
rice@rice:~/t113$cdT113-i_v1.0/
rice@rice:~/t113/T113-i_v1.0$ls
brandybuildrootdeviceinstall_tools.shoutrtos-dsptools
buildbuild.shkernelplatformtest
rice@rice:~/t113/T113-i_v1.0$./install_tools.sh
[sudo]passwordforrice:
Readingpackagelists...Done
Buildingdependencytree
Readingstateinformation...Done
texinfoisalreadythenewestversion(6.5.0.dfsg.1-2).
0upgraded,0newlyinstalled,0toremoveand121notupgraded.
Readingpackagelists...Done
Buildingdependencytree
Readingstateinformation...Done
pkg-configisalreadythenewestversion(0.29.1-0ubuntu2).
0upgraded,0newlyinstalled,0toremoveand121notupgraded.
Readingpackagelists...Done
......
rice@rice:~/t113$tar-xvfdl.tar.gz-C~/t113/buildroot/buildroot-201902/
rice@rice:~/t113/T113-i_v1.0$./build.shdistclean
rice@rice:~/t113/T113-i_v1.0$./build.shconfig
Welcometomkscriptsetupprogress
Allavailableplatform:
0.linux
Choice[linux]:0
Allavailablelinux_dev:
0.bsp
1.dragonboard
2.longan
3.tinyos
Choice[longan]:2
Allavailablekern_ver:
0.linux-5.4
Choice[linux-5.4]:0
Allavailableic:
0.t113
1.t113_i
Choice[t113_i]:1
Allavailableboard:
0.evb1
1.evb1_auto
2.evb1_auto_nand
3.evb1_auto_nor
4.tlt113-evm-emmc
5.tlt113-evm-nand
6.tlt113-minievm-emmc
7.tlt113-minievm-nand
Choice[tlt113-evm-nand]:5
Allavailableoutput_configs:
0.hdmi
1.lvds-lcd
2.mipi-lcd
3.tft-lcd
4.cvbs
Choice[hdmi]:0
Allavailableflash:
0.default
1.nor
Choice[default]:0
Allavailablebuild_root:
0.buildroot-201902
1.ubuntu
Choice[buildroot-201902]:0
Allavailablegnueabi:
0.gnueabi
1.gnueabihf
Choice[gnueabi]:0
rice@rice:~/t113/T113-i_v1.0$source./build/envsetup.sh
rice@rice:~/t113/T113-i_v1.0$./build.sh
ACTIONList:mklichee;========
Executecommand:mklichee
INFO:----------------------------------------
INFO:buildlichee...
INFO:chip:sun8iw20p1
INFO:platform:linux
INFO:kernel:linux-5.4
INFO:board:tlt113-evm-nand
INFO:output:/home/rice/t113/T113-i_v1.0/out/t113_i/tlt113-evm-nand/longan
INFO:----------------------------------------
INFO:buildbuildroot...
Preparebrtoolchaingcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabi.tar.xz...
make:Enteringdirectory'/home/rice/t113/T113-i_v1.0/buildroot/buildroot-201902'
...
rice@rice:~/t113/T113-i_v1.0$./build.shqt
ACTIONList:mkqt;========
Executecommand:mkqt
INFO:buildQt...
INFO:buildarm-linux-gnueabiversion'sQt
/home/rice/t113/T113-i_v1.0/platform/framework/qt/qt-everywhere-src-5.12.5
Usingbuilt-inspecs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target:x86_64-linux-gnu
Configuredwith:../src/configure-v--with-pkgversion='Ubuntu7.5.0-3ubuntu1~18.04'--with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++--prefix=/usr--with-gcc-major-version-only--program-suffix=-7--program-prefix=x86_64-linux-gnu---enable-shared--enable-linker-build-id--libexecdir=/usr/lib--without-included-gettext--enable-threads=posix--libdir=/usr/lib--enable-nls--enable-bootstrap--enable-clocale=gnu--enable-libstdcxx-debug--enable-libstdcxx-time=yes--with-default-libstdcxx-abi=new--enable-gnu-unique-object--disable-vtable-verify--enable-libmpx--enable-plugin--enable-default-pie--with-system-zlib--with-target-system-zlib--enable-objc-gc=auto--enable-multiarch--disable-werror--with-arch-32=i686--with-abi=m64--with-multilib-list=m32,m64,mx32--enable-multilib--with-tune=generic--enable-offload-targets=nvptx-none--without-cuda-driver--enable-checking=release--build=x86_64-linux-gnu--host=x86_64-linux-gnu--target=x86_64-linux-gnu
Threadmodel:posix
.....
rice@rice:~/t113/T113-i_v1.0$./build.shpack
ACTIONList:mkpack;========
Executecommand:mkpack
INFO:packingfirmware...
INFO:UseBIN_PATH:/home/rice/t113/T113-i_v1.0/device/config/chips/t113_i/bin
copyingtoolsfile
copyingconfigsfile
copyingproductconfigsfile
/home/rice/t113/T113-i_v1.0/out/pack_out/aultls32.fex
/home/rice/t113/T113-i_v1.0/out/pack_out/aultools.fex
/home/rice/t113/T113-i_v1.0/out/pack_out/boot_package.cfg
/home/rice/t113/T113-i_v1.0/out/pack_out/boot_package.fex
......
dsp0.fexLen:0x3fc78
Vdsp0.fexLen:0x4
BuildImg0
Dragonexecuteimage.cfgSUCCESS!
----------imageisat----------
size:613M/home/rice/t113/T113-i_v1.0/out/t113_i_linux_tlt113-evm-nand-sdboot_uart0.img
packfinish

rice@rice:~/t113/qt-demos/led_control/bin$scpled_controlroot@ip:~/
root@T113-Tronlong:~#killallLauncher
root@T113-Tronlong:~#source/etc/qtenv.sh
add/dev/input/event1toQtApplication.
findqt5installeddone
root@T113-Tronlong:~#./led_control






staticQStringledPath="/sys/class/leds/user-led0";
voidrice::ledInit()
{
setLedStatus(0);
ui->ledPushButton->setText("LEDOFF");
ui->ledPushButton->setStyleSheet("border-width:1px;"
"border-style:solid;"
"border-color:white;"
"background-color:rgba(88,88,88,200)");
}
voidrice::ledDeinit()
{
}
boolrice::setLedStatus(intstatus)
{
QStringcmd="echo"+QString::number(status)+">"+ledPath+"/brightness";
if(system(cmd.toStdString().c_str())==-1){
printf("setledstatusfailed!n");
returnfalse;
}
returntrue;
}
intrice::getLedStatus(void)
{
QStringcmd="cat"+ledPath+"/brightness";
FILE*fp=popen(cmd.toStdString().c_str(),"r");
if(fp==nullptr){
return-1;
}
charled_status[32];
if(fgets(led_status,sizeof(led_status),fp)==nullptr){
printf("fgetserror:%sn",cmd.toStdString().c_str());
pclose(fp);
return-1;
}
pclose(fp);
returnatoi(led_status);
}
voidrice::on_ledPushButton_clicked()
{
intledStatus=getLedStatus();
if(ledStatus==0){
setLedStatus(1);
ui->ledPushButton->setText("LEDON");
ui->ledPushButton->setStyleSheet("border-width:1px;"
"border-style:solid;"
"border-color:white;"
"background-color:rgba(00,205,00,255)");
}
else{
setLedStatus(0);
ui->ledPushButton->setText("LEDOFF");
ui->ledPushButton->setStyleSheet("border-width:1px;"
"border-style:solid;"
"border-color:white;"
"background-color:rgba(88,88,88,200)");
}
}
voidrice::keyInit()
{
keyFd=open(keyPath.toUtf8().data(),O_RDONLY);
if(keyFd==-1)
{
printf("Cannotopenfile(%s)",keyPath.toUtf8().data());
return;
}
ui->keyTextEdit->append("KeyMonitor!n");
ui->keyTextEdit->append("Keyuser0pressed!");
keyNotify=newQSocketNotifier(this->keyFd,QSocketNotifier::Read,this);
connect(this->keyNotify,SIGNAL(activated(int)),this,SLOT(keyHandler()));
}
voidrice::keyDeinit()
{
}
voidrice::keyHandler()
{
structinput_eventbuf;
if(read(keyFd,&buf,sizeof(structinput_event))>0)
{
if(buf.code==KEY_PROG1&&buf.value==1)
{
ui->keyTextEdit->append("Keyuser0pressed!");
}
}
}
voidrice::dateInit()
{
structrtc_timertc_tm_temp;
dateFd=open(datePath.toUtf8().data(),O_RDONLY);
if(dateFd==-1)
{
printf("Cannotopenfile(%s)",keyPath.toUtf8().data());
return;
}
if(ioctl(dateFd,RTC_RD_TIME,&rtc_tm_temp)< 0)
{
printf("Getdatefailed");
return;
}
ui->yearLineEdit->setText(QString::number(rtc_tm_temp.tm_year+1900));
ui->monthLineEdit->setText(QString::number(rtc_tm_temp.tm_mon+1));
ui->dayLineEdit->setText(QString::number(rtc_tm_temp.tm_mday));
}
voidrice::dateDeint()
{
}
voidrice::netInit()
{
server=newQTcpServer();
socket=newQTcpSocket();
}
voidrice::netDeint()
{
}
voidrice::netNewClientConnect()
{
socket=server->nextPendingConnection();
connect(socket,&QTcpSocket::readyRead,this,&rice::netNewRcve);
}
voidrice::on_netPushButton_clicked()
{
intport=ui->portLineEdit->text().toInt();
if(ui->netPushButton->text()==tr("Open"))
{
if(ui->typeComboBox->currentText()==tr("Server"))
{
connect(server,&QTcpServer::newConnection,this,&rice::netNewClientConnect);
if(!server->listen(QHostAddress::Any,port))
{
printf("Listenfailedn");
return;
}
}
elseif(ui->typeComboBox->currentText()==tr("Client"))
{
QStringip=ui->ipComboBox->currentText();
socket->abort();
socket->connectToHost(ip,port);
if(!socket->waitForConnected(3000))
{
printf("Connectserverfailed");
return;
}
connect(socket,&QTcpSocket::readyRead,this,&rice::netNewRcve);
}
ui->netPushButton->setText("Close");
}
elseif(ui->netPushButton->text()==tr("Close"))
{
if(ui->typeComboBox->currentText()==tr("Server"))
{
socket->abort();
server->close();
}
elseif(ui->typeComboBox->currentText()==tr("Client"))
{
socket->disconnectFromHost();
}
ui->netPushButton->setText("Open");
}
}
voidrice::on_sendPushButton_clicked()
{
if(socket->isOpen())
{
socket->write(ui->sendLineEdit->text().toUtf8().data());
}
}
voidrice::netNewRcve()
{
ui->recvTextEdit->append(socket->readAll());
}
voidrice::on_typeComboBox_currentIndexChanged(constQString&arg1)
{
if(arg1==tr("Server"))
{
ui->ipComboBox->setEditable(false);
}
else
{
ui->ipComboBox->setEditable(true);
}
}








关于创龙科技
创龙科技(Tronlong)始创于2013年,是国内领先的嵌入式产品平台提供商,业务主要涵盖工业核心板、工业评估板、工业单板机、项目服务,总部位于广州科学城,下设独立运营的教仪事业部,在北京、天津、上海、南京、深圳、西安、成都等地设有业务及技术服务中心。
创龙科技10多年来一直专注于ARM、FPGA、DSP异构多核技术开发,坚持“国产 + 进口”双引擎产品战略,是全志、瑞芯微金牌合作伙伴,以及TI、NXP、Xilinx、紫光同创中国官方合作伙伴,为实时系统、现场总线、物联网、人工智能等技术提供应用平台,产品广泛应用于工业自动化、能源电力、仪器仪表、医疗、通信、安防等行业。
