UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
838 Views
Registered: ‎09-19-2017

A HOWTO on linking your Xilinx SDK to petalinux with attached bitbake recipe.

I am enclosing a bitbake recipe that will build your SDK application from petalinux.  The link between the two is a SVN repo, but git would work as well.  This recipe also works with target libraries and not just the pre-built ones.  In my example I am linking against the readline library.  Change this as necessary.

 

All I did was add an app that was the same name as my SDK app using petalinux-create and then dropped this recipe into that bitbake file.  You set your SVN location, the location of your SDK, the build configuration you are using in the SDK, the output binary of the SDK, and the location you want it deployed in your image.

 

Let me know what your questions are.  It might make a good AR after some peer review.

 

If you like this, send me a 'Kudo'.

 

#
# This file is the mySDKapp recipe.
#

#this assumes you have a SDK app called mySDKapp and it is sync'ed to the SVN server listed at the SRC_URI location

SUMMARY = "Simple mySDKapp application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "svn://<your svn URL>;module=mySDKapp;protocol=https"

#this example uses a post-build library. Its why we are also passing the "--sysroot...." option to the linker
#Xilinux has an AR describing the setup in the SDK, which we need to override
#https://www.xilinx.com/support/answers/69159.html
DEPENDS += "readline"

S = "${WORKDIR}/mySDKapp"
SRCREV = "${AUTOREV}"

#the location of my SDK install is in /opt/Xilinx/SDK/2017.4  Change this as necessary on your machine.
XILINX_ROOT = "/opt/Xilinx/"
SDK_ROOT = "SDK/2017.4/"
ECLIPSE_ROOT = "eclipse/lnx64.o/eclipse"
JRE_ROOT = "tps/lnx64/jre/bin/"

#set up the environment
DOC_NAV = "DocNav/.settings64-DocNav.sh"
CORE_SCRIPT = ".settings64-XSDK_Core_Tools.sh"

ECLIPSE_PROJECT = "mySDKapp"
#this is the build configuration you want to use from the SDK, typically Debug or Release
ECLIPSE_BUILD_CONFIG = "Debug"
#this is set in the SDK, but defaults to mySDKapp.elf and I typically set it to drop the .elf
ECLIPSE_BINARY = "mySDKapp"

do_compile() {
	${XILINX_ROOT}${DOC_NAV}
	${XILINX_ROOT}${SDK_ROOT}${CORE_SCRIPT}
	${XILINX_ROOT}${SDK_ROOT}${ECLIPSE_ROOT} -vm ${XILINX_ROOT}${SDK_ROOT}${JRE_ROOT} -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import ${S} -data ${WORKDIR} -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole
	${XILINX_ROOT}${SDK_ROOT}${ECLIPSE_ROOT} -vm ${XILINX_ROOT}${SDK_ROOT}${JRE_ROOT} -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -T xilinx.gnu.armv7.linux.c.toolchain.linker.debug xilinx.gnu.c.link.option.ldflags="--sysroot=${TMPDIR}/sysroots/${MACHINE}/"  -build ${ECLIPSE_PROJECT}/${ECLIPSE_BUILD_CONFIG} -data ${WORKDIR} -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole
}

do_install() {
	install -d ${D}${base_bindir}
	#install the binary to /bin/mySDKapp If you want it somewhere else, change the line below
	install -m 0755 ${ECLIPSE_BUILD_CONFIG}/${ECLIPSE_BINARY} ${D}${base_bindir}
}
2 Replies
Mentor jmcclusk
Mentor
830 Views
Registered: ‎02-24-2014

Re: A HOWTO on linking your Xilinx SDK to petalinux with attached bitbake recipe.

Awesome post, Mark.   Let the kudo's rain down upon you!

Don't forget to close a thread when possible by accepting a post as a solution.
0 Kudos
Adventurer
Adventurer
828 Views
Registered: ‎09-19-2017

Re: A HOWTO on linking your Xilinx SDK to petalinux with attached bitbake recipe.

Thanks, it's taken about  week to get this to a releasable point.

0 Kudos