TS-4900 QT5 IDE Setup: Difference between revisions

From embeddedTS Manuals
No edit summary
m (Links auto-updated for 2022 re-branding ( https://files.embeddedarm.com/ts-arm-sbc/ts-7990-linux/distributions/yocto/zeus/toolchain/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9t2hf-neon-tsimx6-toolchain-3.0.2.sh →‎ https://files.embeddedTS.com/ts-arm-sbc/ts-7990-linux/distributions/yocto/zeus/toolchain/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9t2hf-neon-tsimx6-toolchain-3.0.2.sh))
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Note|This guide is intended for our stock image using systemd, but you are using a custom images the directions should apply if you rebuild with your own yocto toolchain (meta-toolchain-qt5), and update the paths if you are using a different distribution.}}
{{Note|This guide is intended for our stock Yocto image using systemd.  On custom images, the same instructions should apply if a cross toolchain is built. This can be built through Yocto with <source lang=bash inline>bitbake meta-toolchain-qt5</source>. Be sure to update the paths if using a different distribution.}}


Install qtcreator.  The version from a recent Linux distribution should be fineIn a debian/Ubuntu desktop, run:
 
Install the qtcreator tool on a host Linux PCAny recent version from a modern Linux distribution should be sufficient and work without issueOn a Debian/Ubuntu desktop, run:
<source lang=bash>
<source lang=bash>
sudo apt-get update && sudo apt-get install qtcreator -y
sudo apt-get update && sudo apt-get install qtcreator -y
</source>
</source>


You will also need to download the SDK which includes the QT support (Right click and save as):
The SDK which includes the Qt support will also need to be downloaded. The cross toolchain is only available for 64-bit Linux host PCs:
* [ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/yocto/jethro/toolchains/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-2.0.2.sh x86_64]
* [https://files.embeddedTS.com/ts-arm-sbc/ts-7990-linux/distributions/yocto/zeus/toolchain/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9t2hf-neon-tsimx6-toolchain-3.0.2.sh poky-glibc-x86_64-meta-toolchain-qt5-cortexa9t2hf-neon-tsimx6-toolchain-3.0.2.sh]
* [ftp://ftp.embeddedarm.com/ts-socket-macrocontrollers/ts-4900-linux/distributions/yocto/jethro/toolchains/poky-glibc-i686-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-2.0.2.sh i686]


You can install these with:
In order to install the toolchain, use the following commands to run the installation script:
<source lang=bash>
<source lang=bash>
sudo bash ./poky-*.sh
chmod a+x poky-*.sh
sudo ./poky-*.sh
</source>
</source>


These instructions assume the path will be default at "/opt/poky/2.0.2/".
These instructions assume the installation path will be the default at <source lang=bash inline>/opt/poky/3.0.2/</source>


Once the SDK is installed, an environment script has to be sourced ***every time*** before launching qtcreator.
 
{{Note|An environment script has to be sourced before ''every'' execution of qtcreator. Without this, builds will fail.}}
<source lang=bash>
<source lang=bash>
source /opt/poky/2.0.2/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
source /opt/poky/3.0.2/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi
qtcreator
qtcreator
</source>
</source>


{{Note|QtCreator needs to be launched with this sourced every time the cross toolchain is used or it will fail with compile errors.}}


Next we need to configure QT Creator to build using this toolchain.  When QT creator launches and go to Tools->Options, and select Devices. Click "Add" and select "Generic Linux Device" and click "Start Wizard".
Qt Creator needs to be configured to build using this toolchain.  Once Qt Creator is launched, select <source lang=bash inline>Tools->Options->Devices</source> Click <source lang=bash inline>Add</source>, select <source lang=bash inline>Generic Linux Device</source>, and then click <source lang=bash inline>Start Wizard</source>
{|  
{|  
| [[File:qtdeviceconfiguration.png|300px|right|QT Device Configuration]]  
| [[File:qtdeviceconfiguration.png|300px|right|Qt Device Configuration]]  
|}
|}
On the next page you will need to specify the ip address or hostname to the system.  This could potentially change depending on your network, so if it fails to deploy code later this may need to be updated to point at a new IP for your TS board.  In this example, my TS-4900 has a dhcp address of 192.168.2.45. The default Yocto image will use "root" with no password to connect. Set the name to TS-IMX6.
On the next page specify the IP address or hostname of the device running Yocto.  In this example, the unit has an IP address of <source lang=bash inline>192.168.2.45</source> obtained via DHCP. The default Yocto image will use the user <source lang=bash inline>root</source> with no password to connect. Set the name to <source lang=bash inline>TSIMX6</source>


{|  
{|  
| [[File:qtnewdevice.png|300px|right|QT Device Configuration]]  
| [[File:qtnewdevice.png|300px|right|Qt Device Configuration]]  
|}
|}
It will then verify connectivity.  You can click close and continue.
It will then verify connectivity.  Click close and continue.
{|  
{|  
| [[File:qtdevicetest.png|300px|right|QT Device Test]]  
| [[File:qtdevicetest.png|300px|right|Qt Device Test]]  
|}
|}


{{Note|The paths given in the images may not match the latest toolchain, but are meant to show where these values would go.  Follow the text appropriate to your host pc for the correct values}}
{{Note|The paths given in the images below may not match the latest toolchain, but are meant to show where these values would go.  Follow the text appropriate to the architecture of your host PC for the correct values}}
 
 
In the left column of the <source lang=bash inline>Options</source> menu, select <source lang=bash inline>Build & Run</source>.  On the <source lang=bash inline>Qt Versions</source> tab, click <source lang=bash inline>Add</source> in the upper right to configure the TS Kit.  Qt Creator may see the <source lang=bash inline>qmake</source> binary added to your path from the sourced environment script.  If this is detected, add in the string <source lang=bash inline>TSIMX6</source> to the title as shown in the photo below. If it is not autodetected, add the full path and ensure the version name is set to <source lang=bash inline>TSIMX6 Qt 5.13.2</source>.  This will allow it to be recognized when setting the right binary for the kit.
 
<source lang=bash>/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/qmake</source>


Next, in the left column of the Options menu, select "Build & Run".  Start with the "QT Versions" tab, and click "Add" in the upper right to configure the TS Kit.  Some versions of QT creator will automatically see the "qmake" binary added to your path from the sourced environment script.  Either use this, or add it in manually, but change the version string to include "TS-IMX6" so it can be recognized when setting the right binary for the kit.
{|  
{|  
| i686
| [[File:qtversions.png|300px|right|Qt Versions tab]]
| <source lang=bash>/opt/poky/2.0.2/sysroots/x86-pokysdk-linux/usr/bin/qt5/qmake</source>
|-
| x86_64
| <source lang=bash>/opt/poky/2.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake</source>
|}
|}


{|
| [[File:qtversions.png|300px|right|QT Versions tab]]
|}


Next go to the "Compilers" tab, and click "Add", and select "GCC".  Set the Name to "TS-IMX6 GCC".  For the "Compiler Path":
On the <source lang=bash inline>Compilers</source> tab click <source lang=bash inline>Add</source>, select <source lang=bash inline>GCC</source> then <source inline>C</source>.  Set the Name to <source lang=bash inline>TSIMX6 GCC</source>.  For the <source lang=bash inline>Compiler Path</source> use the following:
{|
<source lang=bash>/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc</source>
| i686
 
| <source lang=bash>/opt/poky/2.0.2/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++</source>
Repeat the above steps for the g++ compiler; click <source inline>Add</source>, select <source inline>GCC</source> then <source inline>C++</source>. Set the name to <source inline>TSIMX6 G++</source>. And for the <source inline>Compiler Path</source> use the following:
|-
<source lang=bash>/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++</source>
| x86_64
| <source lang=bash>/opt/poky/2.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++</source>
|}


{|
{|
| [[File:qtcompiler.png|300px|right|QT Compiler tab]]  
| [[File:qtcompiler.png|300px|right|Qt Compiler tab]]  
|}
|}


Next, go to the Debuggers tab, and click "Add".  For name, specify "TS-IMX6 GDB".  For the paths, specify the location of gdb:
On the <source lang=bash inline>Debuggers</source> tab click <source lang=bash inline>Add</source>.  For name, specify <source lang=bash inline>TSIMX6 GDB</source>.  For the path, specify the location of gdb with the following:
{|
 
| i686
<source lang=bash>/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb</source>
| <source lang=bash>/opt/poky/2.0.2/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb</source>
|-
| x86_64
| <source lang=bash>/opt/poky/2.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb</source>
|}


{|
{|
| [[File:qtdebugger.png|300px|right|QT Debugger tab]]  
| [[File:qtdebugger.png|300px|right|Qt Debugger tab]]  
|}
|}


Next, go to the "Kits" tab and click add.  For Name, enter "TS-IMX6".  Set device type to "Generic Linux Device".  Set the device to "TS-IMX6 (default for Generic Linux)".  Set the sysroot to:
On the <source lang=bash inline>Kits</source> tab click <source lang=bash inline>Add</source>.  For <source lang=bash inline>Name</source>, enter <source lang=bash inline>TSIMX6</source>.  Set device type to <source lang=bash inline>Generic Linux Device</source>.  Set the device to <source inline>TSIMX6 (default for Generic Linux)</source>.  Set <source lang=bash inline>Qt mkspec</source> to the following (make sure there is no space at the end):
<source lang=bash> /opt/poky/2.0.2/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi</source>
 
Set the compiler to "TS-IMX6 GCC".  Set Debugger to "TS-IMX6 GDB".  Set the QT version to "Qt 5.4.3 (TS-IMX6)". Finally, click Apply.
<source lang=bash>/opt/poky/3.0.2/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/mkspecs/linux-oe-g++</source>
 
 
Set <source inline>C Compiler</source> to <source inline>TSIMX6 GCC</source> and <source inline>C++ Compiler</source> to <source inline>TSIMX6 G++</source>.  Set <source inline>Debugger</source> to <source inline>TSIMX6 GDB</source>.  Set the <source inline>Qt version</source> to <source inline>TSIMX6 QT 5.13.2</source>. Finally, click Apply.
{|
{|
| [[File:qtkit.png|300px|right|QT Kit tab]]  
| [[File:qtkit.png|300px|right|Qt Kit tab]]  
|}
|}


At this point QT Creator is set up to begin your first project.
{{Note|If there is a red exclamation point over the kits icon, it indicates that the compiler ABI does not match.  In this case, you will need to revisit the "Compiler", "Debugger", and "Qt Versions" tabs, and browse the host PC for these files manually rather than copy/pasting the paths from these instructions.  This is a bug in Ubuntu 16.04's Qt Creator, and may be in later versions as well.}}
 
At this point Qt Creator is set up to begin a hello world project.

Latest revision as of 16:57, 17 January 2022

Note: This guide is intended for our stock Yocto image using systemd. On custom images, the same instructions should apply if a cross toolchain is built. This can be built through Yocto with bitbake meta-toolchain-qt5. Be sure to update the paths if using a different distribution.


Install the qtcreator tool on a host Linux PC. Any recent version from a modern Linux distribution should be sufficient and work without issue. On a Debian/Ubuntu desktop, run:

sudo apt-get update && sudo apt-get install qtcreator -y

The SDK which includes the Qt support will also need to be downloaded. The cross toolchain is only available for 64-bit Linux host PCs:

In order to install the toolchain, use the following commands to run the installation script:

chmod a+x poky-*.sh
sudo ./poky-*.sh

These instructions assume the installation path will be the default at /opt/poky/3.0.2/


Note: An environment script has to be sourced before every execution of qtcreator. Without this, builds will fail.
source /opt/poky/3.0.2/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi
qtcreator


Qt Creator needs to be configured to build using this toolchain. Once Qt Creator is launched, select Tools->Options->Devices Click Add, select Generic Linux Device, and then click Start Wizard

Qt Device Configuration

On the next page specify the IP address or hostname of the device running Yocto. In this example, the unit has an IP address of 192.168.2.45 obtained via DHCP. The default Yocto image will use the user root with no password to connect. Set the name to TSIMX6

Qt Device Configuration

It will then verify connectivity. Click close and continue.

Qt Device Test
Note: The paths given in the images below may not match the latest toolchain, but are meant to show where these values would go. Follow the text appropriate to the architecture of your host PC for the correct values


In the left column of the Options menu, select Build & Run. On the Qt Versions tab, click Add in the upper right to configure the TS Kit. Qt Creator may see the qmake binary added to your path from the sourced environment script. If this is detected, add in the string TSIMX6 to the title as shown in the photo below. If it is not autodetected, add the full path and ensure the version name is set to TSIMX6 Qt 5.13.2. This will allow it to be recognized when setting the right binary for the kit.

/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/qmake
Qt Versions tab


On the Compilers tab click Add, select GCC then C. Set the Name to TSIMX6 GCC. For the Compiler Path use the following:

/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc

Repeat the above steps for the g++ compiler; click Add, select GCC then C++. Set the name to TSIMX6 G++. And for the Compiler Path use the following:

/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
Qt Compiler tab

On the Debuggers tab click Add. For name, specify TSIMX6 GDB. For the path, specify the location of gdb with the following:

/opt/poky/3.0.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb
Qt Debugger tab

On the Kits tab click Add. For Name, enter TSIMX6. Set device type to Generic Linux Device. Set the device to TSIMX6 (default for Generic Linux). Set Qt mkspec to the following (make sure there is no space at the end):

/opt/poky/3.0.2/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/mkspecs/linux-oe-g++


Set C Compiler to TSIMX6 GCC and C++ Compiler to TSIMX6 G++. Set Debugger to TSIMX6 GDB. Set the Qt version to TSIMX6 QT 5.13.2. Finally, click Apply.

Qt Kit tab
Note: If there is a red exclamation point over the kits icon, it indicates that the compiler ABI does not match. In this case, you will need to revisit the "Compiler", "Debugger", and "Qt Versions" tabs, and browse the host PC for these files manually rather than copy/pasting the paths from these instructions. This is a bug in Ubuntu 16.04's Qt Creator, and may be in later versions as well.

At this point Qt Creator is set up to begin a hello world project.