Linux App Qt Creator¶
Objective¶
This wiki page will describe how to setup Qt Creator so it can be used to build and run an ARM Linux user-level program on the AM62 platform.
References¶
- https://www.youtube.com/watch?v=QYzdBbwY4dM
- https://yocto.yoctoproject.narkive.com/XZjqjf60/rocko-cmake-buld-cstdlib-75-15-fatal-error-stdlib-h-no-such-file-or-directory
General Setup¶
- Install and launch Qt Creator: https://download.qt.io/official_releases/qtcreator/latest/
- Download and install Ti's processor sdk: TI processor SDK (v10.01.10.04)
Qt Creator CMake Hello_World example¶
Source the toolchain and launch Qt Creator
* /<SDK_INSTALL_DIR>/ti-processor-sdk-linux-am62xx-evm-10.01.10.04/linux-devkit/environment-setup * /<QT_CREATOR_INSTALL_DIR>/qtcreator-16.0.0/bin/qtcreatorCreate a kit SDK 10.01
- Navigate to toolbar: Edit->Preferences
- Select the "Kits" category
- On the Kits tab hit "Add"
- Name: "arm64 qt 5 10.1 sdk"
- Build device: Type: "Desktop"
- Run device: Type: "Remote Linux Device"
- Compiler: C/C++: GCC (C, arm 64bit at /<SDK_INSTALL_DIR>/ti-processor-sdk-linux-am62xx-evm-10.01.10.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc)
- Debugger: System GDB at /<SDK_INSTALL_DIR>/ti-processor-sdk-linux-am62xx-evm-10.01.10.04/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gdb
- Sysroot: /<SDK_INSTALL_DIR>/ti-processor-sdk-linux-am62xx-evm-10.01.10.04/linux-devkit/sysroots/aarch64-oe-linux
- Qt version: "None"
- CMake Tool" "System CMake at /usr/bin/cmake (Default)
- CMake Configuration select "Change" and add the following lines
-DOE_QMAKE_PATH_EXTERNAL_HOST_BINS:STRING=%{Env:OE_QMAKE_PATH_HOST_BINS} -DCMAKE_NO_SYSTEM_FROM_IMPORTED:UNINITIALIZED=1
- Select the "Kits" category
- Click "Apply" then "Ok"
Note: If the Compiler or Debugger are not automatically detected select their respective tab and add the paths above.
Create a kit SDK 11
TODO
- Navigate to toolbar: Edit->Preferences
- Select the "Device" category
- In the "Devices" tab select Add->Remote Linux Device->Start Wizard
- The name to identify this configuration: "Devkit"
- The device's host name or IP address: <DEVKIT_IP_ADDRESS>
- The username to log into the device: "root"
- Hit "Next" until it prompts to "Finish" the creating the device
- Device test should finish successfully
- In the "Devices" tab select Add->Remote Linux Device->Start Wizard
- Click "Apply" then "Ok"
- Select the "Device" category
- Navigate to toolbar: File->New Project
- The following window should appear. Select "Qt Widgets Application"
- Name: "hello_world_gui"
- Next
- Build System: "CMake"
- Select "Next" until it prompts to "Finish" the project
- The following window should appear. Select "Qt Widgets Application"
- Navigate to the newly created project
- Select hello_world_gui->hello_world_gui->Froms->mainwindow.ui
- The "Design" Tab should now be open
- Drag and drop a "Push Button" into the window
- Navigate to "Object Inspector" on the right hand side of the screen
- right click on "pushButton" and select "go to slots"
- Hit "ok" in the pop up window
- right click on "pushButton" and select "go to slots"
- Update mainwindow.cpp to have the following code:
#include "mainwindow.h" #include "./ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); color = 0; ui->pushButton->setStyleSheet("QPushButton {background-color: purple;}\n"); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { QString colors[4] = {"orange", "yellow", "green", "red"}; color = (color + 1) & 0x3; ui->pushButton->setStyleSheet("QPushButton {background-color: " + colors[color] + ";}\n"); }
- Update main.cpp to have the following code:
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.setWindowTitle("Hello QT App"); w.show(); return a.exec(); }
- Update mainwindow.h to have the following code:
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_pushButton_clicked(); private: Ui::MainWindow *ui; int color; }; #endif // MAINWINDOW_H
Build the project by selecting the hammer in the bottom left hand side of the screen.
The project should build without any issues
Add Environment Variables- Qt Creator needs to know the following Environmental variables in order to launch on the Devkit
- In the toolbar on the left hand side of the screen select "Project"
- Under "Build and Run" select arm64 qt 5 10.1 sdk->Run
- In "Run Settings" find "Environment"
- Select Details and add the following
WAYLAND_DISPLAY=/run/wayland-0 XDG_RUNTIME_DIR=/run/user/0
- Select Details and add the following
- In "Run Settings" find "Environment"
- Under "Build and Run" select arm64 qt 5 10.1 sdk->Run
- In the toolbar on the left hand side of the screen navigate to the monitor icon with "Debug" below it
- Double check that the correct kit is selected
- Double check that the correct kit is selected
- Select the green launch icon below the monitor icon
The GUI window should now appear on the Devkit. Make sure the HDMI display is connected.
Try plugging a mouse into the USB on J6 and clicking the push button in the GUI.
It should change colors.
Go to top