From 3852a56e3aa201b06113b81e91aacfa20c282873 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 4 Oct 2022 19:22:07 +0300 Subject: [PATCH 1/3] developer_guides: debugability: probes: Logging backend sof-probes update Added firmware kconfig options for enabling probes and logging backend. Also added notes about the latest updates for sof-probes demuxing tool. Signed-off-by: Jyri Sarha --- .../debugability/probes/index.rst | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/developer_guides/debugability/probes/index.rst b/developer_guides/debugability/probes/index.rst index dc019629..1984392a 100644 --- a/developer_guides/debugability/probes/index.rst +++ b/developer_guides/debugability/probes/index.rst @@ -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 ` for reference. Note that you do not need to modify the audio topology file. @@ -101,6 +123,7 @@ 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: .. code-block:: bash @@ -159,4 +182,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``. \ No newline at end of file +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 From acf7fb9b2fef5a4d100104e3fdcabf03ab5309e4 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 4 Oct 2022 19:26:53 +0300 Subject: [PATCH 2/3] developer_guides: debugability: probes: Fix misleading statement The statement about enabling a single probe point for buffer #7 was misleading. Signed-off-by: Jyri Sarha --- developer_guides/debugability/probes/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developer_guides/debugability/probes/index.rst b/developer_guides/debugability/probes/index.rst index 1984392a..880328b1 100644 --- a/developer_guides/debugability/probes/index.rst +++ b/developer_guides/debugability/probes/index.rst @@ -124,7 +124,7 @@ the last stage of extraction. - 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: .. code-block:: bash From 148391733a4009916fd13af9b3cdde3d7af3b17e Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Tue, 4 Oct 2022 19:41:23 +0300 Subject: [PATCH 3/3] developer_guides: debugability: probes: Document IPC3 and IPC4 differences Signed-off-by: Jyri Sarha --- .../debugability/probes/index.rst | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/developer_guides/debugability/probes/index.rst b/developer_guides/debugability/probes/index.rst index 880328b1..0ef12784 100644 --- a/developer_guides/debugability/probes/index.rst +++ b/developer_guides/debugability/probes/index.rst @@ -124,7 +124,7 @@ the last stage of extraction. - Add probe points via the ``debugfs`` "probe_points" entry in ``/sys/kernel/debug/sof`` - For example, to add buffer 7 with a probe point: + For example, to add buffer 7 with a probe point (IPC3): .. code-block:: bash @@ -161,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.