Linux application debug with Layerscape SDK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linux application debug with Layerscape SDK

Jump to solution
1,317 Views
miloserdin
Contributor I

Hi!

I'm working with LS1021A-TWR board. I installed Layerscape SDK 19.03 and booted the board from SD card using LSDK.

Please tell me how to debug Linux applications from CodeWarrior? I don't see AppTRK inside Linux root filesystem and also anywhere in Layerscape SDK.

Labels (1)
0 Kudos
Reply
1 Solution
1,165 Views
Pavel
NXP Employee
NXP Employee

You are right.

There is not other way to add AppTRK to root filesystem built by Layerscape SDK 19.03.


Have a great day,
Pavel Chubakov

-------------------------------------------------------------------------------
Note:

This thread is continued as a private discussion with the submitter,
NXP support is not following the thread anymore.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
6 Replies
1,166 Views
Pavel
NXP Employee
NXP Employee

You are right.

There is not other way to add AppTRK to root filesystem built by Layerscape SDK 19.03.


Have a great day,
Pavel Chubakov

-------------------------------------------------------------------------------
Note:

This thread is continued as a private discussion with the submitter,
NXP support is not following the thread anymore.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,165 Views
miloserdin
Contributor I

Pavel, thanks for your help!

0 Kudos
Reply
1,165 Views
Pavel
NXP Employee
NXP Employee

See below a detailed procedure for a standalone build of apptrk.

The following prerequisites are needed prior to build (and also on the target rootfs):
-libelf
-libuitl
-libthread_db

We proceed further with the build process as follows:

1) Download the arm tool-chain from:
https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/

export ARCH=arm
export CROSS=arm-linux-gnueabihf-
export CC=arm-linux-gnueabihf-gcc
 export PATH=$PATH:<path_to_the_toolchain>

2) Compiling libelf:
git clone  
https://github.com/WolfgangSt/libelf.git

cd libelf

edit config.h and set:

#define HAVE_MMAP 0

edit Makefile and set 
CC=CC = arm-linux-gnueabihf-gcc

edit lib/Makefile and set
CC = arm-linux-gnueabihf-gcc
LD = arm-linux-gnueabihf-ld
RANLIB = arm-linux-gnueabihf-ranlib

make

3) Install the libutil and thread_db armhf packages:

sudo apt-get install  libc6-armhf-cross

After installation, libraries will be found here:
 /usr/lib/arm-linux-gnueabihf/

|||. unpack apptrk.zip and change to the apptrk  folder and execute:

make clean
make C_INCLUDE_PATH=/<path_to_libelf>/lib/  LDFLAGS="-L/<path_to_libelf>/lib -L/usr/arm-linux-gnueabihf/lib/"  all

4) Check what are the dependencies of the elf:
In the apptrk folder where the elf file is generated, execute:

arm-linux-gnueabihf-readelf -d AppTRK_debug.elf

Output:
Dynamic section at offset 0x1cf00 contains 27 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libelf.so.0]
 0x00000001 (NEEDED)                     Shared library: [libutil.so.1]
 0x00000001 (NEEDED)                     Shared library: [libthread_db.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
[...]

These files should be deployed on the root file system (if they are already there, the deployment should be skipped)

5)
Deploy also the apptrk.elf file and launch it as per your need.


Have a great day,
Pavel Chubakov

-------------------------------------------------------------------------------
Note:

This thread is continued as a private discussion with the submitter,
NXP support is not following the thread anymore.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,165 Views
miloserdin
Contributor I

Thanks, Pavel for your answer!

As far as I understand, there isn't other way to add AppTRK to root filesystem built by Layerscape SDK 19.03, is it?

Best regards,

Miloserdin Oleg

0 Kudos
Reply
1,165 Views
Pavel
NXP Employee
NXP Employee

See the Section 2.3.3 of the CW_ARMv7_Targeting_Manual.pdf file. This file is available in CodeWarrior folder:

C:\Freescale\CW_ARMv7_v2019.01\CW_ARMv7\ARMv7\Help\PDF

 

This Section contains information about creation CodeWarrior Linux Application project.

See also the Chapter 7 in this file.


Have a great day,
Pavel Chubakov

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,165 Views
miloserdin
Contributor I

Hi, Pavel!

Thanks for your reply!

I've already read this manual and tried all the things.

Since I didn't found apptrk application in target root filesystem, I tried to download AppTRK.elf file (located in CW_ARMv7\ARMv7\ARM_Linux\AppDebug\AppTRK) via TFTP to target system. But it failed to start due to missing libraries at target system. I don't have these libraries at my host PC and I don't know where to get them.

My question is how to add apptrk application to root filesystem at build time using Layerscape SDK (I'm using Ubuntu-based userland)? Do you really try to debug Linux application using Layerscape SDK 19.03 built as described in section 4.1.4 of the Layerscape SDK User Guide Rev.19.03?

Best regards,

Miloserdin Oleg

0 Kudos
Reply