We offer many ready-to-use apps, among them a serial-over-IP (SoI) app and Modbus Gateway app.
Tibbo > Linux Ecosystem > C++ API
Qt Creator is a C++ integrated development environment (IDE) which is a part of the SDK for the Qt GUI application development framework. It includes a visual debugger, an integrated GUI layout and a forms designer. The editor's features include syntax highlighting and autocompletion.
LTPS SDK works with free or commercial versions of Qt Creator.
If you already have a commercial or new free version running on your PC, you may skip this step.
Open http://download.qt.io/official_releases/qtcreator/ and choose the directory with the latest version name.
Download qt-creator-opensource-linux-x86_64-<X.Y.Z>.run
Make the file executable and run it:
[dv@dvpc Downloads]$ chmod 0755 ./qt-creator-opensource-linux-x86_64-4.5.0.run [dv@dvpc Downloads]$ ./qt-creator-opensource-linux-x86_64-4.5.0.run
It's a good practice to run the Qt Creator Istallation Wizard under non-privileged user account and install it into your user home directory.
Follow Installation Wizard instructions, choose the destination folder (say, /home/yourusername/qtcreator-4.5.0), continue, next, next... Finish setup.
If you installed Qt Creator under a non-privileged user account into the default recommended directory, then Qt Creator path prefix will be ~/qtcreator-4.5.0/. In this case, you may run it directly from the CLI:
[dv@dvpc ~]$ ~/qtcreator-4.5.0/bin/qtcreator
Or use any method you like.
Device will be the target for builds, runs and debug sessions.
My LTPS has IP: 192.168.75.218 and default user/password SSH pair: root/123.
Select in the menu Tools->Options. In the dialog "Options", select Devices in the left menu.
Click the Add button. Choose Generic Linux Device, click the Start Wizard button.
In the New Generic Linux Device Configuration Setup window (see "New Device Wizard" screenshot) set:
The name ...: "LTPS -208" The device host...: "192.168.75.208" Username: "root" Auth type: * Password The password: "123"
Click the Next button. Click the Finish button.
Qt Creator will immediately check for device accessibility. Close the accessibility test window.
Your current device settings window will be activated (see "Device Settings" screenshot).
Click Apply.
Select Build & Run option in the left menu.
Choose the Compilers tab. Click the Add button, choose GCC in the drop-down menu, choose C in the drop-down submenu.
Set Name to "LTPS GCC".
Compiler Path: click the "Browse" button, find your SDK folder (~/klmsdk/ in my case), go to sysroots/x86_64-tpssdk-linux/usr/bin/arm-tps-linux-gnueabi/ and choose "arm-tps-linux-gnueabi-gcc". The file dialog will be closed.
Choose "arm-linux-generic-elf-32bit" in the first popup menu of the ABI field.
Click Apply.
Click the Add button on top of the window, choose GCC in the drop-down menu, choose C++ in the drop-down submenu.
Set Name to "LTPS C++".
Repeat selection for the Compiler Path, choose "arm-tps-linux-gnueabi-g++" in the file dialog.
Click Apply.
Select the Build & Run option in the left menu.
Choose the Debuggers tab. Click the Add button.
Set Name to "LTPS GDB".
Path: click the "Browse" button, find your SDK folder (~/klmsdk/ in my case), go to sysroots/x86_64-tpssdk-linux/usr/bin/arm-tps-linux-gnueabi/ and choose "arm-tps-linux-gnueabi-gdb". The file dialog will be closed.
Click Apply.
Select the Build & Run option in the left menu.
Choose the CMake tab. Click the Add button.
Set Name to "LTPS CMAKE".
Path: click "Browse" button, find your SDK folder (~/klmsdk/ in my case), go to sysroots/x86_64-tpssdk-linux/usr/bin/ and choose "cmake". File dialog will be closed.
Click Apply.
Select the Build & Run option in the left menu.
Choose the Qt Versions tab. Click the Add button.
qmake location: click the "Browse" button, find your SDK folder (~/klmsdk/,in our case), go to sysroots/x86_64-tpssdk-linux/usr/bin/qt5/ and choose "qmake". The file dialog will be closed.
Click Apply.
Select the Build & Run option in the left menu.
Choose the Kits tab. Click the Add button.
Set Name to "LTPS".
Set File system name to "LTPS".
Set Device type to "Generic Linux Device".
Set Device to "LTPS .218".
For Sysroot click "Browse", find your SDK installation path (~/klmsdk/ in my case), go to sysroots/cortexa8hf-neon-tps-linux-gnueabi/ , click "Choose".
Set Compiler C to "LTPS GCC".
Set Compiler C++ to "LTPS C++".
Set Debugger to "LTPS GDB".
Set Qt version to qmake from SDK.
Set Qt mkspec to "(SDKPATH)/sysroots/cortexa8hf-neon-tps-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++" (/home/dv/klmsdk/sysroots/cortexa8hf-neon-tps-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++ in my case).
Set CMake Tool to "LTPS CMake".
Find CMake Configuration below. Click "Change" button. New popup window "Edit CMake Configuration" will be opened. Add the new line:
CMAKE_TOOLCHAIN_FILE:STRING=(yourSDKpath)/sysroots/x86_64-tpssdk-linux/usr/share/cmake/qtcreator.cmake
Click OK to save and close the popup window.
Find the Environment field, click "Change". Open a console window for the command-line (CLI) on your PC, load your SDK settings. Run the "env" command to print all console environment variables. Copy-paste all the variables into the "Change environment" pop-up window. Click the "OK" button.
Click Apply.
Overview the settings. Warning notes are to be observed (if they are any).
Click Apply and then OK if everything looks OK.
Click File, New file or project.
Select Non-Qt Project in the Projects pane, Plain C Application in Application Type pane. Click the Choose button.
Set the Name for the project and choose the folder where it will be created ("test_qtc_ltps_c" and /home/dv/erer/0000 in my case).
Click Next.
Select qmake as the Build system (CMake is possible if it has been configured).
Click Next.
Select LTPS kit. Deselect Desktop kit. Click Next. Click Finish.
Newly created project with "Hello World!" test program will be shown in the Qt Creator editor panes. Update the program source, add:
syslog( 3, "Hello journal!");
In line #6 press Ctrl+S to save project changes.
Right-click on line #6 and set the breakpoint.
Click Debug on top menu - Start Debugging - Start Debugging (F5)**.
In a couple of seconds, an error message may appear on the screen: "You forgot to setup target settings in your project file!"
No remote executable could be determined from your build system files. In case you use qmake, consider adding target.path = /tmp/your_executable # path on device INSTALLS += target into your .pro file.
Yes, we're using QMake. Click the Stop Debugging button, click OK in the popup message.
Go to the Projects pane. Double-click "test_qtc_ltps_c.pro" file and edit its text. Add:
target.path = /tmp/0000 INSTALLS += target
At the end of the file text, press Ctrl+S to save it.
/tmp/0000 is the directory on LTPS device where your program will be uploaded to before execution.
Click Debug - Start Debugging - Start Debugging (F5).
Project will be uploaded into LTPS with IP ...218, run and stopped at the breakpoint.
Open SSH connection for your LTPS and run the journal to see the system logs:
[dv@dvpc ~]$ ssh root@192.168.75.218
root@192.168.75.218 password:
root@tpp:~# journalctl -lf
-- Logs begin at Tue 2018-01-30 12:20:56 UTC. --
Feb 02 08:19:57 tpp systemd[1]: dev-mmcblk1p1.device: Job dev-mmcblk1p1.device/start failed with result 'timeout'.
... skipped some output ...
Go back to IDE editor and press F5 to step over your breakpoint having a look at the console window...
Bingo!