Debugging on a Linux target

To debug an application on a target running Linux, you need an evaluation board with the target set up properly. Find the details in the documentation for the respective development package that you have installed on S32 Design Studio in order to support the target.
Note: The user documentation is available in the help system of S32 Design Studio . The PDF versions of the guides are located in folder <S32DS_install_path>/S32DS/help/pdf.

To debug an application on a target running Linux:

  1. Connect the board to a USB port of your computer. Power up the board.
  2. Build the application project.
  3. Open the Debug Configurations dialog and go to the C/C++ Remote Application group of configurations. Click the launch configuration generated for your Linux application project.
  4. On the Main tab, expand the Connection menu and select the connection to the Linux target. If you have not created this connection before, do it as follows:
    1. With the Linux running on the board, start a terminal program (for example, PuTTY) on your PC computer:


      putty

      Set the connection type to “Serial”. Set the speed to “115200”, data bits to “8”, stop bits to “1”, and parity to “None”.

      Then specify the destination you want the terminal to connect to, for instance, the USB port on your computer to which the board is connected.

    2. Start the terminal session and log into Linux (for example, use the “root” login name).
    3. To get the IP address of the Linux target, enter the following command:
      ifconfig
      The output includes the section for Ethernet link. For example, this section can look as follows:
      root@s32v234evb:~# ifconfig
      eth0      Link encap:Ethernet  HWaddr 00:1b:c3:12:34:22
                inet addr:10.222.24.206  Bcast:10.222.24.255  Mask:255.255.255.0
                inet6 addr: fe80::21b:c3ff:fe12:3422/64 Scope:Link
                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                RX packets:709 errors:0 dropped:1 overruns:0 frame:0
                TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:91479 (89.3 KiB)  TX bytes:1512 (1.4 KiB)
      
      The inet addr parameter in this section is the IP address of the target.
    4. On the Main tab of the Debug Configurations dialog, click the New button next to the Connection field.
    5. In the Create a new connection dialog box, select SSH and click OK.


      SSH

    6. In the New connection dialog box, specify the following settings:


      Connection options

      • Connection name: Specify the preferred connection name.
      • Host: Enter the IP address of the target that you have obtained in the Linux terminal.
      • User: Enter the Linux user name (“root”).
      • Password based authentication: If required, enable authentication and enter the Linux user password.
    7. Click Finish.
  5. On the Debugger tab, specify the following settings for GDB remote debugging:


    S32 Debug configuration

    Table 1. Debugger tab: Settings for remote debugging
    Setting Description
    Stop on startup at Specify the location in code where the debugger will place the first breakpoint and stop. Default: main.
    Debugger Options: Main tab Specify the GDB debugger settings.
    • GDB debugger: Specify the path of the GDB executable.
    • GDB command file: Specify the path of the GDBINIT file with the GDB commands to be executed at startup.
    • Non-stop mode: Select this option to enable non-stop debugging of multi-threaded programs. This mode enables the user to examine stopped program threads in the debugger while other threads continue to execute freely.
    • Enable Reverse Debugging at startup using: Select this option to start a debug session in the reverse debugging mode. Expand the menu and select hardware or software reverse debugging.
    • Force thread list update on suspend: Select this option for the thread list to be updated forcedly if the debug session is suspended.
    • Automatically debug forked processes: Select this option for the debugger to automatically debug child processes created with the fork function.
    • Tracepoint mode: Select the tracepoint mode. Options: Normal, Fast, Automatic.
    Debugger Options: Shared Libraries tab Specify the paths on the target host where the GDB debugger will search for shared libraries with symbols. To adjust the priority of a search path, use the Up and Down buttons.

    Load shared library symbols automatically: Select this option to enable the GDB debugger to automatically find the local copy of the library and load its symbols unless the remote path of the respective library is specified in the list.

    Debugger Options: Gdbserver settings tab Specify the settings of the gdbserver program running on the target host.
    • Gdbserver path: The gdbserver path on the target host.
    • Port number: The port for listening commands from the GDB host.
    • Gdbserver options: The command line options with which gdbserver is started.

  6. Click Apply, then click Debug. The debug session is started and stopped at the first breakpoint.
  7. Click Resume and debug the application.