How to use the XSCOPE continuous event type

  • version

    1.0.0

  • scope

    Example.

    This code is provided as example code for a user to base their code on.

  • description

    How to use the XSCOPE continuous event type

  • boards

    Unless otherwise specified, this example runs on the SliceKIT Core Board, but can easily be run on any XMOS device by using a different XN file.

XSCOPE is fully supported on hardware platforms which provide an XMOS link between the target device and the XSYS development connector.

View the document (XSCOPE overview) for further information on tracing data from XMOS applications.

This example provides a simple demonstration of using the XSCOPE continuous event type for data logging from within an XMOS application. The continuous event type can be used to capture and log the value of specific variables within an application to allow debugging.

This example assumes you are familiar with creating a run configuration and enabling the associated XSCOPE options in that run configuration in xTIMEcomposer Studio or using the command line tools.

In order to used XSCOPE the correct header file must be included in the application

#include <xscope.h>

The xscope_probe_data() function is used to send the contents of user variable data_value_1 to XSCOPE probe id 0 for logging

void output_data_1(unsigned int data_value_1) {
  xscope_probe_data(0, data_value_1);
}

The xscope_probe_data() function is used to send the contents of user variable data_value_2 to xscope probe id 1 for logging

void output_data_2(unsigned int data_value_2) {
  xscope_probe_data(1, data_value_2);
}

Using the XSCOPE constructor which gets called automatically by the XSCOPE system register 2 probes using event type XSCOPE_CONTINUOUS which will collect data of type XSCOPE_UINT

void xscope_user_init(void) {
      xscope_register(2,
                      XSCOPE_CONTINUOUS, "Continuous Value 1",
                      XSCOPE_UINT, "Value",
                      XSCOPE_CONTINUOUS, "Continuous Value 2",
                      XSCOPE_UINT, "Value");
}