{{template>en:templates:tabs_yocto_bootstrap|product_type="Embedded module"|lang="en"|mod_name="tqma6ulx"|mod_name_head="TQMa6ulx"|mod_arch="arm"|bsp_name="linux"|build_system="yocto"|build_system_head="YOCTO"|bsp_name_head="Linux"}}
===== Setup Eclipse IDE for STKa6ULx =====
Cross compilation for STKa6ULx is only supported on a Linux based developement host!
===Prerequisites===
* BSP built according to [[en:arm:tqma6ulx:linux:yocto:quickstart_yocto| quickstart guide]]
* Built Yocto SDK based on the current RootFS configuration, installed on the development host. See [[en:arm:tqma6ulx:linux:yocto:how_to:development_host#build_yocto_sdk|Build Yocto SDK]] how to build it.
* Configured SSH login on target. See [[en:arm:tqma6ulx:linux:yocto:how_to:target#ssh-connection|setup ssh connection]]
* Configured Network connection to the development host
==== Additional Yocto Packages ====
The following has to be added to the local.conf file in the build directory or to your custom image recipe:
EXTRA_IMAGE_FEATURES = " eclipse-debug"
IMAGE_INSTALL_append = " openssh-sftp-server"
==== Setup Development Host ====
The Eclipse IDE requires the following packages installed on the development host:
* build-essential
* gdb
* gdb-multiarch
* git
* default-jre
On a Ubuntu based development host, they can be installed by the following commands:
sudo apt install build-essential gdb gdb-multiarch git default-jre
\\
You may download the latest //Eclipse for Embedded C/C%%++%% Developers// from the [[https://www.eclipse.org/downloads/packages/|offial download page]] (Linux). The steps for this manual were directly tested with version [[https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2022-12/R/eclipse-embedcpp-2022-12-R-linux-gtk-x86_64.tar.gz|2022-R12]].\\
\\
Afterwards extract the Eclipse tarball e.g. to your home directory, by default the folder is named eclipse.
cd ~
tar -xf ~/Downloads/eclipse-embedcpp-2022-12-R-linux-gtk-x86_64.tar.gz
==== Eclipse Startup ====
Now Eclipse can be started from a terminal. However for the Cross Compiler to work properly, you will need to source ''/opt/dumpling-wayland/4.0.5/environment-setup-cortexa7t2hf-neon-tq-linux-gnueabi'' beforehand.
\\ \\
Since you would need to do that every time before starting the IDE, you might want to create a short launch script to source the environment variables and open Eclipse with only one command instead:
echo -e "source /opt/dumpling-wayland/4.0.5/environment-setup-cortexa7t2hf-neon-tq-linux-gnueabi\n~/eclipse/eclipse" > eclipse_emb_tqma6ulx.sh
chmod +x eclipse_emb_tqma6ulx.sh
Now you can simply execute your ''./eclipse_emb_tqma6ulx.sh'' everytime to start the IDE for tqma6ulx-developement.
==== Create a new C or C++ Project ====
Select **File → New → C/C%%++%% Project**\\
then select eighter //C// or //C%%++%% Managed Build// and click Next.\\
===Important Notes:===
* Make sure to select //Cross GCC// in the toolchain field
* //Cross compiler prefix// and //Cross compiler path// configuration should be left empty!
====Cross Compiler Configuration====
What is left now, is to tell the Cross Compiler to read the variables that you just sourced before starting the IDE.\\
Open the Project-Properties (Right click project -> properties)
\\ \\
First select **All configurations** in the configuration field, then select **C/C%%++%% Build → Settings → Cross GCC Compiler** and enter the following into the Command-field: ''${CC}''. \\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:1.png?800|}}
\\ \\
In **Cross GCC Compiler → Miscellaneous** change //Other flags// to: ''${CFLAGS} -c''.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:2.png?800|}}
\\ \\
Now move into **Cross GCC Assembler** and change the //Command// field to: ''${AS}''.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:3.png?800|}}
\\
====only for C Projects:====
Move into **Cross GCC Linker** and change the //Command// field to: ''${CC}''.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:c1.png?800|}}
\\ \\
In **Cross GCC Linker → Miscellaneous** change //Other flags// to: ''${LDFLAGS}''.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:c2.png?800|}}
\\
====only for C++ Projects:====
Move into **Cross G%%++%% Compiler** and enter the following into the Command-field: ''${CXX}''. \\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:c_1.png?800|}}
\\ \\
In **Cross G%%++%% Compiler → Miscellaneous** change //Other flags// to: ''${CXXFLAGS} -c''.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:c_2.png?800|}}
\\ \\
Move into **Cross G%%++%% Linker** and change the //Command// field to: ''${CXX}''.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:c_3.png?800|}}
\\ \\
In **Cross G%%++%% Linker → Miscellaneous** change //Other flags// to: ''${LDFLAGS}''.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:c_4.png?800|}}
\\ \\
Click //Apply and Close// to leave the properties menu.
==== Add your first programm ====
In case you created an empty project, you now might want to fill it with something, be it something arbitrary like a "hello world" to get started.\\
Create a new //Source File// inside your project structure, name it ''main.c'' and fill it with the following:
#include
int main() {
printf("Hello TQ-Starterkit\n");
return 0;
}
==== Remote Debug Configuration ====
* Setup the SSH Connection Starterkit for further information see the section SSH Connection
* Setup the Network Connection on the Starterkit
Select Run → Debug Configurations \\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d1.png?1000|}}
Double Click **C/C%%++%% Remote Application** and click on New to create a new connection to the target \\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d2.png?1000|}}
Select SSH in the drop down menu and click OK \\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d3.png?400|}}
* Select a Connection nam
* Enter the IP address of the Target
* Enter the user name that is used to login on the target
* Select Password based authentication and enter the password for the user that is used to login on the target
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d4.png?600|}}
Specify a path and name for your C/C%%++%% Application on the target.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d5.png?1000|}}
Switch to the Debugger tab and enter the path to GDB debugger file from the yokto sdk.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d6.png?1000|}}
Click apply and close to leave the Debug Configuration or start debugging immediately by hitting //Debug//.\\
You can now start remote debugging by selecting the debug configuration you just created.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d7.png?400|}}
You will be prompted to switch to the Debug View, press "Switch". Inside the Debugview you will most likely find the programm halted at a breakpoint at the start of main. Hit resume to run the programm.\\
{{:en:arm:tqma6ulx:linux:yocto:how_to:development_host:d8.png?2000|}}