How to debug Linux Application in SDK 2019.1


How to debug Linux Application in SDK 2019,1

In this brief tutorial we shall discuss how to debug a Linux application running on Zynq Ultrascale



Building the Linux Images:

The steps to build the project here are explained in the wiki page here.
User can create the sysroots. However, for this app it is not needed.
  • petalinux-build --sdk
  • petainux-package --sysroot

    Setting up the LAN:

    To debug an linux application running on the kernel, then the local machine needs to be connected to the board in a Local Area Network (LAN).
    Below are my HOST settings:


    Then boot your kernel, and setup the board IP address:

    Make sure you can ping the host before continuing

    Create the SDK Linux Application Project:


    Launch SDK on the same machine as the HOST settings are set up on.
    Then File -> New -> Application Project:

    For the Linux System Root, browse to the plnx_aarch64 copied over in previous step.

    Select Next, and choose the Linux Empty Application template and select finish.

    Note: you may see an error on the console. To address this, right click on the gpio_linux application in the Project Explorer in SDK,
    and select C/C++ Build Settings:

    Right click on the gpio_linux/src folder in the Project Explorer and select New -> Source File. Give this a name, and then copy the contents below into this newly created one.




    Next, we need to setup the Target connection. In the Target connection, drop down the Linux Agent, and select Add new target connection:


    To Debug, Right click on the GPIO_LINUX application in the Project Explorer, and select Debug -> Debug As.
    Double click on the Xilinx C/C++ application (System Debugger) to create a new debug configuration:

    Make sure that the Application is setup correctly:

    Upon pressing Debug, the user will be asked if they would like to enter the debug perspective. Select Yes.
    In the Debug Perspective will have all the debug option available to debug your application:

    Users can step over to step through the code line by line. Users can also step into if the user would like to step into a function. Or, you can just resume .
    Resume will execute until it hits a breakpoint (at exit in this case). If you monitor the LED on the board, you should see the LEDs toggling continuosly.

  • Executing manually without connecting to board:

  • Users can also execute the Executable created in SDK manually, by placing this on the SD card manually and executing from there.

  • mount /dev/mmcblkp1 /mnt
  • /mnt/gpio_linux.elf

Related Links