瑞芯微Rockchip开发者社区
直播中

李桂兰

7年用户 1474经验值
私信 关注
[问答]

请教大神怎样在RV1126&RV1109 buildroot上添增加QT程序呢

请教大神怎样在RV1126&RV1109 buildroot上添增加QT程序呢?

回帖(1)

马念

2022-2-21 14:22:05
1、先看效果

2、上代码发送

From 08f234148d543a546e6f64ebbba31e379424322a Mon Sep 17 00:00:00 2001
From: rockemd
Date: Wed, 18 Nov 2020 18:19:02 +0800
Subject: [PATCH] qhellotest

---
app/qhellotest/main.cpp                            | 11 ++++++
app/qhellotest/mainwindow.cpp                      | 15 ++++++++
app/qhellotest/mainwindow.h                        | 21 ++++++++++
app/qhellotest/mainwindow.ui                       | 45 ++++++++++++++++++++++
app/qhellotest/qhellotest.pro                      | 28 ++++++++++++++
.../rockchip_rv1126_rv1109_facial_gate_defconfig   |  1 +
buildroot/package/rockchip/Config.in               |  1 +
buildroot/package/rockchip/qhellotest/Config.in    |  4 ++
.../package/rockchip/qhellotest/qhellotest.mk      | 23 +++++++++++
9 files changed, 149 insertions(+)
create mode 100755 app/qhellotest/main.cpp
create mode 100755 app/qhellotest/mainwindow.cpp
create mode 100755 app/qhellotest/mainwindow.h
create mode 100755 app/qhellotest/mainwindow.ui
create mode 100755 app/qhellotest/qhellotest.pro
mode change 100644 => 100755 buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
mode change 100644 => 100755 buildroot/package/rockchip/Config.in
create mode 100755 buildroot/package/rockchip/qhellotest/Config.in
create mode 100755 buildroot/package/rockchip/qhellotest/qhellotest.mk

diff --git a/app/qhellotest/main.cpp b/app/qhellotest/main.cpp
new file mode 100755
index 0000000..aff48df
--- /dev/null
+++ b/app/qhellotest/main.cpp
@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+
+#include
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+    return a.exec();
+}
diff --git a/app/qhellotest/mainwindow.cpp b/app/qhellotest/mainwindow.cpp
new file mode 100755
index 0000000..79c64b9
--- /dev/null
+++ b/app/qhellotest/mainwindow.cpp
@@ -0,0 +1,15 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent)
+    , ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
diff --git a/app/qhellotest/mainwindow.h b/app/qhellotest/mainwindow.h
new file mode 100755
index 0000000..934b0f3
--- /dev/null
+++ b/app/qhellotest/mainwindow.h
@@ -0,0 +1,21 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget *parent = nullptr);
+    ~MainWindow();
+
+private:
+    Ui::MainWindow *ui;
+};
+#endif // MAINWINDOW_H
diff --git a/app/qhellotest/mainwindow.ui b/app/qhellotest/mainwindow.ui
new file mode 100755
index 0000000..0b7ae14
--- /dev/null
+++ b/app/qhellotest/mainwindow.ui
@@ -0,0 +1,45 @@
+
+
+ MainWindow
+
+  
+   
+    0
+    0
+    364
+    293
+   

+  

+  
+   MainWindow
+  

+  
+   
+   
+     
+      0
+      100
+      361
+      131
+     

+   

+   
+     rockemd QT!
+   

+   

+  

+  
+   
+   
+     0
+     0
+     364
+     23
+   

+   

+  

+  
+

+
+
+

diff --git a/app/qhellotest/qhellotest.pro b/app/qhellotest/qhellotest.pro
new file mode 100755
index 0000000..4ec32ea
--- /dev/null
+++ b/app/qhellotest/qhellotest.pro
@@ -0,0 +1,28 @@
+QT += widgets
+
+CONFIG += c++11 console
+
+TARGET = qhellotest
+TEMPLATE = app
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+#DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES +=
+    main.cpp
+    mainwindow.cpp
+
+HEADERS +=
+    mainwindow.h
+
+FORMS +=
+    mainwindow.ui
+
diff --git a/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig b/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
old mode 100644
new mode 100755
index 71e9632..e325a85
--- a/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
+++ b/buildroot/configs/rockchip_rv1126_rv1109_facial_gate_defconfig
@@ -24,6 +24,7 @@ BR2_PACKAGE_RKMEDIA_ANR=y
BR2_PACKAGE_RKMEDIA_AEC=y
BR2_PACKAGE_RKMEDIA_EXAMPLES=y
BR2_PACKAGE_QFACIALGATE=y
+BR2_PACKAGE_QHELLOTEST=y
# BR2_PACKAGE_MINIGUI_SOFTWARE_SCALE is not set
BR2_PACKAGE_RKNPU_USE_MINI_DRIVER=y
BR2_PACKAGE_RKFACIAL_USE_WEB_SERVER=y
diff --git a/buildroot/package/rockchip/Config.in b/buildroot/package/rockchip/Config.in
old mode 100644
new mode 100755
index 6735cdc..8cb643b
--- a/buildroot/package/rockchip/Config.in
+++ b/buildroot/package/rockchip/Config.in
@@ -180,6 +180,7 @@ source "package/rockchip/carmachine/Config.in"
source "package/rockchip/gallery/Config.in"
source "package/rockchip/QLauncher/Config.in"
source "package/rockchip/QFacialGate/Config.in"
+source "package/rockchip/qhellotest/Config.in"
source "package/rockchip/settings/Config.in"
source "package/rockchip/qcamera/Config.in"
source "package/rockchip/qfm/Config.in"
diff --git a/buildroot/package/rockchip/qhellotest/Config.in b/buildroot/package/rockchip/qhellotest/Config.in
new file mode 100755
index 0000000..7b18811
--- /dev/null
+++ b/buildroot/package/rockchip/qhellotest/Config.in
@@ -0,0 +1,4 @@
+config BR2_PACKAGE_QHELLOTEST
+        bool "qhellotest"
+        help
+                rockemd qt test
No newline at end of file
diff --git a/buildroot/package/rockchip/qhellotest/qhellotest.mk b/buildroot/package/rockchip/qhellotest/qhellotest.mk
new file mode 100755
index 0000000..8a9dbc4
--- /dev/null
+++ b/buildroot/package/rockchip/qhellotest/qhellotest.mk
@@ -0,0 +1,23 @@
+################################################################################
+#
+# qhellotest
+#
+################################################################################
+
+QHELLOTEST_VERSION = 1.0
+QHELLOTEST_SITE = $(TOPDIR)/../app/qhellotest
+QHELLOTEST_SITE_METHOD = local
+
+QHELLOTEST_LICENSE = Apache V2.0
+QHELLOTEST_LICENSE_FILES = NOTICE
+define QHELLOTEST_CONFIGURE_CMDS
+cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/bin/qmake
+endef
+define QHELLOTEST_BUILD_CMDS
+$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
+endef
+
+define QHELLOTEST_INSTALL_TARGET_CMDS
+$(INSTALL) -D -m 0755 $(@D)/qhellotest $(TARGET_DIR)/usr/bin/qhellotest
+endef
+$(eval $(generic-package))
--
2.7.4

3、开发调试步骤


3.1、在PC机上安装QT开发环境,新建工程(这里不详细介绍),可参考rockchip官方文档 《docsLinuxApplicationNoteRockchip_Developer_Guide_Linux_Qt_CN.pdf》


3.2、移植QT工程(见补丁)


3.3、编译调试如下:


source build/envsetup.sh

72. rockchip_rv1126_rv1109
73. rockchip_rv1126_rv1109_facial_gate
74. rockchip_rv1126_rv1109_libs
75. rockchip_rv1126_rv1109_ramboot_uvcc
76. rockchip_rv1126_rv1109_recovery
77. rockchip_rv1126_rv1109_sl
78. rockchip_rv1126_rv1109_spi_nand
79. rockchip_rv1126_rv1109_systemd
80. rockchip_rv1126_rv1109_toolchain
81. rockchip_rv1126_rv1109_uvcc
82. rockchip_rv1126_rv1109_uvcc_spi_nand
Which would you like? [0]: 73   <--------------------------------------

make qhellotest-rebuild

编译成功生成可执行程序目录:rv1126_rv1109/buildroot/output/rockchip_rv1126_rv1109_facial_gate/target/usr/bin/qhellotest


adb push Z:rv1126_rv1109buildrootoutputrockchip_rv1126_rv1109_facial_gatetargetusrbinqhellotest usrbin

adb shell
[root@ROCKEMD:/]#  chmod 777 /usr/bin/qhellotest
[root@ROCKEMD:/]#  export QT_QPA_FB_DRM=1
[root@ROCKEMD:/]#  export QT_QPA_PLATFORM=linuxfb:rotation=0
[root@ROCKEMD:/]#  qhellotest &
举报

更多回帖

发帖
×
20
完善资料,
赚取积分