Additional packages have to be installed in the Yocto image. The following lines can be added to the local.conf file in the build directory or to a custom image recipe:
EXTRA_IMAGE_FEATURES = " eclipse-debug" IMAGE_INSTALL_append = " openssh-sftp-server"
The Eclipse IDE requires the packages listed below installed on the development host:
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 offial download page (Linux). This tutorial was tested with Eclipse version 2022-R12.
After downloading 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
Now Eclipse can be started from a terminal. However for the Cross Compiler to work properly, you will need to source the Yocto SDK environment script beforehand., if the SDK has been install in the default path the script is located in /opt/dumpling-wayland-nxp/4.0.14/environment-setup-cortexa53-crypto-tq-linux
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-nxp/4.0.14/source /opt/dumpling-wayland-nxp/4.0.14/environment-setup-cortexa53-crypto-tq-linux\n~/eclipse/eclipse" > eclipse_TQMa93xxCA.sh chmod +x eclipse_TQMa93xxCA.sh
Now you can simply execute the ./eclipse_TQMa93xxCA.sh
script to setup the environment properly start the Eclipse IDE for TQMa93xxCA-development.
Select File → New → C/C++ Project
then select eighter C or C++ Managed Build and click Next.
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}
.
In Cross GCC Compiler → Miscellaneous change Other flags to: ${CFLAGS} -c
.
Now move into Cross GCC Assembler and change the Command field to: ${AS}
.
Move into Cross GCC Linker and change the Command field to: ${CC}
.
In Cross GCC Linker → Miscellaneous change Other flags to: ${LDFLAGS}
.
Move into Cross G++ Compiler and enter the following into the Command-field: ${CXX}
.
In Cross G++ Compiler → Miscellaneous change Other flags to: ${CXXFLAGS} -c
.
Move into Cross G++ Linker and change the Command field to: ${CXX}
.
In Cross G++ Linker → Miscellaneous change Other flags to: ${LDFLAGS}
.
Click Apply and Close to leave the properties menu.
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<stdio.h> int main() { printf("Hello TQ-Starterkit\n"); return 0; }
Select Run → Debug Configurations
Double Click C/C++ Remote Application and click on New to create a new connection to the target
Select SSH in the drop down menu and click OK
Specify a path and name for your C/C++ Application on the target.
Switch to the Debugger tab and enter the path to GDB debugger file from the yokto sdk.
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.
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.