Embedded module TQMa8MxNL - YOCTO Linux BSP documentation
Setup Eclipse IDE for STKa8MxNL
Prerequisites
- BSP built according to quickstart guide
- Built Yocto SDK based on the current RootFS configuration, installed on the development host. See Build Yocto SDK how to build it.
- Configured SSH login on target. See setup ssh connection
- Configured Network connection to the development host
Additional Yocto Packages
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"
Additional Packages on Development Host
The Eclipse IDE requires the packages listed below 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
Download and Install Eclipse
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
Eclipse Startup
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.5/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.5/source /opt/dumpling-wayland-nxp/4.0.5/environment-setup-cortexa53-crypto-tq-linux\n~/eclipse/eclipse" > eclipse_tqma8mxnl.sh chmod +x eclipse_tqma8mxnl.sh
Now you can simply execute the ./eclipse_tqma8mxnl.sh
script to setup the environment properly start the Eclipse IDE for tqma8mxnl-development.
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}
.
In Cross GCC Compiler → Miscellaneous change Other flags to: ${CFLAGS} -c
.
Now move into Cross GCC Assembler and change the Command field to: ${AS}
.
only for C Projects:
Move into Cross GCC Linker and change the Command field to: ${CC}
.
In Cross GCC Linker → Miscellaneous change Other flags to: ${LDFLAGS}
.
only for C++ Projects:
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.
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<stdio.h> 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
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
- 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
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.