Overview
In this topic:
•Symmetric multiprocessing (SMP)
•Asymmetric multiprocessing (AMP)
•Multi-Core Trace and Profiling
This topic explains the background of handling multi-core debugging in winIDEA IDE and winIDEA SDK, multiprocessing modes, and other specifics.
As explained in Multi-Memory Space Session Overview, in the winIDEA, you can configure each Application separately, and then switch Process debugging contexts on the fly.
An Application running in its own Memory Space is called a Process, which gets assigned its distinctive process ID.
A Memory Space can be a single core, multiple cores, or an MMU-controlled virtual memory on one or more cores.
winIDEA provides support for debugging multi-core systems, allowing you to debug either
•single application running on multiple cores (SMP) or
•multiple applications running on separate cores (AMP).
By default, all the cores are automatically observed via Session Explorer.
In Symmetric multiprocessing (SMP), all cores are identical and have equal access to the system's resources (memory, Ethernet, HDMI). The Operating System (OS) views these cores as a single processing unit, and the same instance of an application or operating system can run on any/all core(s). Any core can execute any task, controlled via OS. SMP is typically used for tasks that can be parallelized easily, and it aims to distribute the workload evenly across all available cores.
With an SMP binding in winIDEA, you debug one Application on multiple (identical) cores in one winIDEA instance. All the cores are executing the same Application (optional Operating System - OS) from the same Memory Space.
An SMP binding allows access to the Process debug context of all cores from a single winIDEA instance (and workspace).
You can conveniently switch between cores:
•Automatically - If a breakpoint is hit by any of the SMP cores, winIDEA will automatically focus on that specific core.
•Manually - If you need to see what some other SMP core is doing at that time, change the focus via Debug | SMP | <core>.
When you switch between cores, it synchronizes the Core Registers and accordingly refreshes:
•Editor,
•Disassembly,
•Locals,
•Callstack,
•etc.
In the bottom right corner, winIDEA Debug status will show depending on a selected core [CPU1] STOP .
If the first core (CPU0) is included in an SMP group, then the Debug | SMP menu is already available. |
Once you set a breakpoint somewhere in your code, the breakpoint will be configured for all the cores that are observed within the SMP. This ensures that any core executing the code at the breakpoint will trigger the stop.
Once the breakpoint is reached, the Process debug context will focus the core that hit the breakpoint.
In asymmetric multiprocessing (AMP) you debug multiple applications on separate cores which can use different architectures. It is a system where not all CPUs are treated equally, and each core typically runs a different Application.
When a SoC features two or more cores from different architectures, each core is debugged in an individual winIDEA instance. The Application code for all cores is loaded by the primary winIDEA instance, which downloads the application code in the SoC internal program flash.
AMP - Two separated Applications are executing on separate cores.
You can conveniently switch between cores (winIDEA instances) and view them side-by-side via Debug | Core | <core>.
Breakpoints are managed separately for each AMP. Setting a breakpoint in one AMP doesn't affect breakpoints in other AMPs.
Multi-Core Synchronization allows you to run and stop multiple cores simultaneously among other customization options. It depends on the architecture you are using.
Depending on your system debug requirements, you might want to have multiple cores synchronized so that in case one core stops on a breakpoint, other cores stop as well. For SMP to operate properly - cores in an SMP must always be synchronized.
Core Synchronization can be achieved automatically or manually. Refer to Multi-Core and Multi-SoC Synchronization for more information.
If you are using Automatic Analyzer Configuration, winIDEA will automatically trace all the cores of the configured process - see analyzer configuration dialog.
For more information, refer to the Knowledge Base category Multi-Core Debugging.
Refer to SMP/AMP Tutorials for the basic configuration steps.
winIDEA includes a collection of Example Workspaces that cover a range of supported CPU architectures and hardware combinations, together with predefined AMP and SMP configurations. These Examples are perfect for simulation, and evaluation, and as references for your own configurations.
Follow Start with Example Workspaces Tutorial and filter, e.g., SMP.
The isystem.connect API is mostly the same whether you use Python, C++, C#, or Java. For some Python specifics, please check out Python specifics in winIDEA SDK User’s Guide).
•For each instance of winIDEA, you want to control, you have to instantiate isys::ConnectionMgr:
oSMP - use one ConnectionMgr;
oAMP - use one instance of ConnectionMgr for each AMP.
•For debug session control use isys::CSessionCtrl and use the provided methods to start a debug session in a suitable way (e.g., call CSessionCtrl::begin_program() to start a debug session by downloading the configured binaries to the target);
oSMP - use isys::CSoCCtrl methods to get or set focused core in winIDEA.
•For debug operations control (run, stop, step, set BPs) use isys::CDebugFacade. This is a wrapper class for the most used functionalities of different controllers. If the functionality is not covered by the methods of CDebugFacade, you can use the methods to return any of the underlying controllers and use their methods instead.
An instance of CDebugFacade is coupled with an instance of the ConnectionMgr, therefore in:
oAMP - use two CDebugFacade instances one for each AMP.
oSMP - use one instance of CDebugFacade, and then use the CSoCCtrl to switch the context (focus) to the desired core, to which the methods of the CDebugFacade will be applied.
i.Breakpoints will be applied to all the cores within an SMP binding, not only the core that is focused.
•For closing winIDEA, you can use the disconnect_close() method of the isys::ConnectionMgr controller.
Refer to the Knowledge Base category Multi-Core Debugging.
•Timing Analysis Across Two ECUs - Webinar
•Pure SMP system - Video Tutorial
•Hybrid AMP/SMP system - Video Tutorial