Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 81 additions & 2 deletions developer_guides/debugability/probes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ Firmware side

make menuconfig

The following options available

Required for audio probes:

.. code-block:: bash

CONFIG_PROBE=y # enable probes
CONFIG_PROBE_POINTS_MAX=16 # max probepoints

Required for logging through probes interface:

.. code-block:: bash

CONFIG_LOG_BACKEND_SOF_PROBE=y
CONFIG_ZEPHYR_LOG=y

This option enables the probes logging automatically when probes extraction DMA is started:

.. code-block:: bash

CONFIG_LOG_BACKEND_SOF_PROBE_OUTPUT_AUTO_ENABLE=y

- Refer to **Step 3 Build firmware binaries** in :ref:`Build SOF from Scratch <build-from-scratch>` for reference.

Note that you do not need to modify the audio topology file.
Expand Down Expand Up @@ -101,7 +123,8 @@ the last stage of extraction.
- Pause the playback stream. (optional)
- Add probe points via the ``debugfs`` "probe_points" entry in ``/sys/kernel/debug/sof``

For example, to add a buffer with 7 probe points:

For example, to add buffer 7 with a probe point (IPC3):

.. code-block:: bash

Expand Down Expand Up @@ -138,6 +161,52 @@ the last stage of extraction.
strnlen(tw->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) > 0
? tw->sname : "none");

For IPC4 system, the above example looks like this:

.. code-block:: bash

echo 2,0,0 > probe_points

The semantics of the buffer_id are quite different on IPC4 system:

.. code-block:: c

typedef union probe_point_id {
uint32_t full_id;
struct {
uint32_t module_id : 16; /**< Target module ID */
uint32_t instance_id : 8; /**< Target module instance ID */
uint32_t type : 2; /**< Probe point type as specified by ProbeType enumeration */
uint32_t index : 6; /**< Queue index inside target module */
} fields;
} __attribute__((packed, aligned(4))) probe_point_id_t;

.. code-block:: c

/**
* Description of probe point
*/
struct probe_point {
probe_point_id_t buffer_id; /**< ID of buffer to which probe is attached */
uint32_t purpose; /**< PROBE_PURPOSE_xxx */
uint32_t stream_tag; /**< Stream tag of DMA via which data will be provided for injection.
* For extraction purposes, stream tag is ignored when received,
* but returned actual extraction stream tag via INFO function.
*/
} __attribute__((packed, aligned(4)));

Enabling the log in IPC3 system (in case auto enable is not on):

.. code-block:: bash

echo 0,1,0 > probe_points

And on IPC4 system:

.. code-block:: bash

echo 0,0,0 > probe_points

2. Unpause the playback stream. (optional)
#. Close the playback stream when done.
#. Close the crecord tool.
Expand All @@ -159,4 +228,14 @@ Usage and ouput:
sof-probes: done

As a result, ``buffer_7.wav`` is generated in the *tools/build_tools/probes* folder. The wave file can then be examined with your tool of choice
such as ``Audacity``.
such as ``Audacity``.


Simple logging case
*******************

With the crecord and sof-probes in path, probes logging backend with auto enable option it is possible to get the firmware logs to stdout with this command combination:

.. code-block:: bash

crecord -c3 -d0 -b8192 -f4 -FS32_LE -R48000 -C4 | sof-probes -l