Debugging on multiple cores

This topic describes concurrent debugging of multiple applications running on different cores of the target and interacting with each other.

Designing embedded software for a multi-core target includes several steps as follows:
  • Step 1: Create an application project for a multi-core target in S32 Design Studio. The project creation wizard generates several application projects, one per core.
  • Step 2: Add custom code and compile each application project into an executable (ELF file). The executables are indexed for use on a particular core of the target. One of the executables (indexed “0”, or “0_0”, or “boot”) is intended for the boot core.
  • Step 3: Debug the executables on the target. You can debug each executable as a standalone application, or you can load all executables to the intended cores and debug them in parallel.
Note: Debugging on multiple cores in the simulation mode is not supported. Though you can run multiple debug sessions concurrently and switch between them, the simulator executes each application as a standalone process.

Loading executables for debugging on the target can be done manually or using a launch group. To load the code manually, run the first debug session for the boot core. If successful, add debug sessions for the remaining cores. Find the details in Debugging on a bare-metal target.

When using a launch group, just run it. The settings inside the launch group specify the order of launching for the debug sessions and the time intervals between the launches. For details, refer to Using launch groups.

To start debugging on multiple cores using a launch group:

  1. Click the (Debug As) button on the toolbar, then click Debug Configurations from the drop-down menu.
  2. In the Debug Configurations dialog box, expand Launch Group in the left pane and find the launch groups named as your project. Click the launch group created for debugging from FLASH or from RAM.
    The right pane displays the included debug configurations in the order of launching. The top configuration will initialize the boot core and run the debug session for it.
  3. In the left pane, expand the debugging interface (S32 Debugger or other) used by the board. Find inside the debug configuration intended for the boot core, and click it.


    Viewing configurations in the launch group

    On the Debugger tab of the debug configuration, specify the board connection settings and make sure that the Initial core option is flagged. Click Apply.
  4. Open the launch group again and click Debug. Wait for the debug sessions to be started. If prompted, confirm switching to the Debug perspective.
  5. When all debug sessions are started, they appear in the Debug view. If you did not modify the breakpoints in the debug configurations, all debug sessions are started and stopped at the first breakpoint (main).


    All debug sessions are started

    To start debugging on the boot core, select the respective thread in the Debug view and click the (Resume) button on the toolbar, or press F8.

    You can use debugging techniques such as stepping, breakpoints, stops, resumes, monitoring registers and memory, and other. To learn more, refer to Using the debugger and Debugging on a bare-metal target.

  6. To continue debugging on a different core, switch to the respective thread in the Debug view. Click the (Resume) button or press F8.


    Switching to a different debug session

    The other cores are up and running, executing their code and interacting with each other.

  7. When debugging is done, terminate the debug sessions. To terminate a debug session, select the respective thread in the Debug view, then click (Terminate).

    Termination of any debug session (primary or secondary) does not terminate the remaining debug sessions in a group. To terminate all debug sessions in a group at once, click the launch group, then click (Terminate).

Running a launch group may sometimes end with unexpected termination of the secondary debug sessions. This may be caused by an attempt to launch the secondary debug sessions too early, when the boot core initialization is still on and the secondary cores are not up and ready yet. To solve this problem, open the launch group and click Edit for the first configuration.


Adjusting the post-launch delay before the next debug session starts

In the Edit Launch Configuration dialog box and increase the delay. Alternatively, set the breakpoint right after the initialization section and select the Wait for stop on breakpoint post launch action. Click OK and Apply. Then try to run the launch group again.