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: 
Highlighted
Contributor
Contributor
264 Views
Registered: ‎10-28-2018

Created petalinux application fail to run, trying to set system root also failed.

Hi,

I'm trying to create a linux application for the petalinux project that is already built and booted from SD card in zynq board zcu102,

I followed the official video How to Create Linux Applications using Xilinx SDK which introduced create and debug of the petalinux on zynq device .

In the video the toolchain and linux system root was not set, I read somewhere that the paths are set by default if not set.

in the video:

linux_toolchain.JPG

 

 

 

 

 

 

But when I followed the video and created a hello world( on windows machine as the video ,and also didnot set  toolchain and linux system root), and copied the compiled elf executable to the linux environment,

It cannot run and reports a weird message stating that itself does not exist (the name of the executable is "hello_world2.elf" ):

root@xilinx-zcu102-2017_3:/run/media/mmcblk0p1# ./hello_world2.elf 
-sh: ./hello_world2.elf: No such file or directory

I figured that may be it's the system root and toolchain problem, so I moved to linux machine, started the xsdk and tried to find the system root and toolchain for the petalinux project that booted on the zcu102.

The toolchain was easily found under the recommended directory "$PETALINUX/tools/linux-i386/gcc-arm-linux-gnueabi", but the system root dir sdk suggested from "<petalinux project dir>/build/linux/rootfs/stage" is not so easy to find, as I searched under the project dir, there is no such directory.

So is this recommended directory obsolete or the video is not applicable now ? I'm using a 2017.3 version while the UI in the video seems not so recent.

I also followed the video to the remote debug part, the envrironment is also different for me, there is a "Remote ARM Linux Application" tab in the run configuration, which is missing for me:

debug_config.JPG               and              debug_config_me.JPG

I also checked the "Linux TCF Agent", and the "test connection" succeeds.

I'm certainly missing something, but how do I do it right?

There is also a chapter " Creating and Adding Custom Applications" in ug1144 which setup a application project by commands and makefile

petalinux-create -t apps --template c++ --name myapp --enable

and

$ petalinux-build -x do_populate_sysroot
$ petalinux-build -c rootfs
$ petalinux-build -x package

$ petalinux-build -c helloworld

which seems an approach that integrates application to linux, which seems not so convenient for debug compared to xsdk's eclipse approach.

I also followed the steps in the ug1144 to install the built helloworld:

To install the selected user application:
$ petalinux-build -c helloworld -x do_install 
This will install the application into the target rootfs host copy:
<TMPDIR>/work/plnx_aarch64-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/ 

and after doing so, there is also no such folder "rootfs" in the position:

<TMPDIR>/work/plnx_aarch64-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/

Simply run

$ petalinux-build

works fine and the "helloworld" is put into the /usr/bin/ folder of the petalinux system.

I'm still looking for how to do this within/outside the xsdk and can debug the linux application using the xsdk from remote board.

Any suggestions?

 

 

Regards,
Kang
Learn how to create Linux Applications using Xilinx SDK. We'll also highlight and demonstrate SDK features supporting different aspects of Linux application development and debug. The overall process is quick and simple. For More Zynq Tutorials please visit: http://www.xilinx.com/training/zynq
0 Kudos
1 Reply
Adventurer
Adventurer
165 Views
Registered: ‎01-24-2018

Re: Created petalinux application fail to run, trying to set system root also failed.

So after you ave completed petalinux-build you should have a sysroot to point to in the SDK.

When I build 2017.3 petalinux, My sysroot directory is created in

<petalinux-project-dir>/build/tmp/sysroots/plnx_aarch64

 

When I use the SDK to create a Linux app for the A53, I check the "Linux System Root"

checkbox and put the above directory entry into the text field.

The other place I set this at is in the

project/properties/C/C++ build/settings/ARM v8 Linux gcc Linker/Miscellaneous

Linker Flags field.

Here it looks like this

"--sysroot=<petalinux-project-dir>/build/tmp/sysroots/plnx_aarch64"

Hope this helps.

 

 

 

0 Kudos