SystemView is a real-time recording and visualization tool for embedded systems that reveals the true runtime behavior of an application, going far deeper than the system insights provided by debuggers. This is particularly effective when developing and working with complex embedded systems comprising multiple threads and interrupts. SystemView can ensure a system performs as designed, can track down inefficiencies, and find unintended interactions and resource conflicts.
On the target system, SystemView records events that happen during runtime. This can be interrupts, timers, task switches and scheduling with an RTOS, API function calls and returns, or user events and messages. The events are retrieved from the target, analyzed and visualized in the SystemView Application, while the target keeps running. The Events Window in SystemView displays the recorded events along with more information.
To keep the communication overhead on the target system low, it only needs to record basic information, such as "API function with Id x has been called with parameter values y and z and n ticks after the last event".
SystemView analyzes all information from the events and shows:
- The API function name and its parameters and values
- The recording time or system time when the call happened
- The task in which the call happened
- The duration of the API call
A regular event is 4 to 8 bytes long and takes about 1 us to be recorded at 200 MHz. With 10,000 events per second the overhead added by SystemView is less than 1% of the CPU time and the amount of data is easily within the bandwidth limits of the recorder.
The timestamps for events can be as accurate as 1 CPU cycle, which equates to 5 ns on a 200 MHz CPU.
Most embedded systems do not have linear code execution. They implement interrupts for timers and use of peripherals, or might use an RTOS with multiple tasks. SystemView records the runtime behavior of such a system.
The target generates events on enter and leave of interrupts, when tasks become ready for execution, and when a task starts or stops execution. The SystemView Application visualizes these events plotted over the system time in the Timeline Window and shows all other events in the context in which they happen.
This enables easy analysis of when, how long, and why tasks run or what happens on an interrupt.
Issues and inefficiencies in the system can be identified that way:
- Incorrect task priorities or priority inversion leading to starvation
- Incorrect inter-task communication
- Inefficient delays and timeouts
- Spurious or unnecessary interrupts
CPU cycles are limited on embedded systems. Therefore it can be important to optimize the performance of tasks as well as getting the order of execution and the time distribution right.
With the CPU Load Window, SystemView helps analysis of where CPU load is high. With SystemView's information of what happens at or before high-load times, the system can be tuned to avoid such bottlenecks which may lead to delayed execution of important tasks.
The Runtime Window provides additional information about the runtime distribution of contexts. It can be used to verify that each context runs within its timing limits or to find cases where a context unexpectedly runs too long.
SystemView provides events especially suited to mark certain points in a target system. To easily measure the duration from point A to point B, or from point A through point B to point C, marker start, mark, and marker stop events can be generated. The SystemView Application automatically links corresponding markers and adds more information, such as run time and run count of the measurement.
SystemView also includes logging of messages with a recording. Simple strings can be recorded as log, warning, or error message. The logging functions support formatting of strings, similar to printf(). Since formatting strings can be time-consuming and requires additional memory, this can be deferred to the SystemView Application. The target system simply records the format string and the parameters in an event, and the SystemView Application takes care of formatting the string and prints it in the Terminal Window.
SEGGER SystemView (3:38)
A: Yes. SystemView can run in parallel to a debugger and do continuous recording. To make sure that data can be read fast enough, configure the debugger connection to a high interface speed (>= 4 MHz). Parallel connections to a target are currently only supported on Windows and Linux.
A: Yes. SystemView can in general be used with any J-Link. J-Link LITE and J-Link OB are limited in the debug interface speed, which can lead to overflow events when the RTT buffer cannot be read fast enough and the system creates too many events. To get a full-featured J-Link, have a look at the purchase options.
A: Yes. SystemView can in general be used with any J-Link if the J-Link supports the target core. Older J-Links (V8 and older) might have limited RTT capability, which can lead to overflow events when the RTT buffer cannot be read fast enough and the system creates too many events. To trade-in or upgrade your J-Link, have a look at our purchase options.
A: This is target device-dependent. RTT requires memory access on the target while the target is running. On Cortex-A and Cortex-R this is done via the AHB-AP. If your target device has an AHB-AP you can continuously record with SystemView.
A: No. RTT requires memory access on the target while the target is running. If you have one of these devices, only single-shot and post-mortem modes are supported.
A: Yes. SystemView can be used with any (RT)OS. For Task and OS execution recording your OS might have options to hook up trace/profiling instrumentation modules where you can add SystemView, otherwise the OS has to be instrumented to be able to do so.When in doubt, get in contact with your OS vendor. If instrumenting the OS isn't possible you can still use SystemView to record interrupt activity and user events.
A: Yes. Even without any OS, SystemView can be used to record interrupt activity, to verify that interrupts occur as expected, and to record user events which can be used to measure module execution times.
A: Overflow events occur when the SystemView RTT buffer is full. This can happen for following reasons:
- J-Link is kept busy by a debugger and cannot read the data fast enough.
- The target interface speed is too low to read the data fast enough.
- The application generates too many events to fit into the buffer. To prevent this:
- Minimize the interactions of the debugger with J-Link while the target is running. (i.e. disable live watches)
- Select a higher interface speed in all instances connected to J-Link. (i.e. The debugger and SystemView)
- Choose a larger buffer for SystemView. (1 - 4 kByte)
- Run SystemViewer stand-alone without a debugger.
A: Make sure ~200 Bytes of stack are available for SystemView in every context (Task, Interrupt, Scheduler) which can create SystemView events.
A: Possible reasons are:
- J-Link or target is not connected: Make sure all connections are okay.
- The target is not running: Make sure the target is running, otherwise connection might fail or the RTT Control Block can not be found.
- The SystemView module is not configured: Make sure the SystemView module is included in your application and SEGGER_SYSVIEW_Conf() is called at the start of the application.
- The J-Link Software is out-of-date: Make sure you have the latest J-Link Software and Documentation Package installed.
A: Auto-detection of the RTT Control Block can only be done in a known RAM address range after it is initialized. Make sure the application startup has ran when starting to record. If the RTT Control Block is outside the known range for the selected device, either select 'Address' and enter the exact address of the RTT Control Block or select 'Address Range' and enter an address range in which the RTT Control Block will be.
A: Invalid packets are mostly generated by the target system due to either one of two reasons: 1. SystemView does not correctly lock when recording an event and is interrupted by another event. In this case make sure SEGGER_SYSVIEW_LOCK() and SEGGER_RTT_LOCK() are configured correctly for your device. 2. The system goes into sleep or low-power mode and the J-Link cannot correctly access the RAM to read the SystemView buffer. It is recommended to not use WFI or any low-power mode while a debug probe is connected to the system.
A: Yes. J-Link needs to know which target device is connected. The drop-down lists the most recently used devices. To select another device simply enter its name. A list of supported devices can be found here.