Skip to content

Conversation

@jsarha
Copy link
Contributor

@jsarha jsarha commented Nov 26, 2025

Add simple text message sending functionality to debug stream. This can be useful sometimes in debugging when other methods fail. The last messages should be visible in the debug window even after the crash.

Copilot AI review requested due to automatic review settings November 26, 2025 17:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds text message sending functionality to the debug stream system, allowing developers to send debug messages that persist in the debug window even after a crash. This supplements existing debug stream capabilities with a simple text-based messaging interface.

Key Changes:

  • Added new ds_msg() function for sending formatted text messages through the debug stream
  • Implemented Python parser support for the new text message record type
  • Added configuration option CONFIG_SOF_DEBUG_STREAM_TEXT_MSG to enable the feature

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/debug_stream/debug_stream.py Added TextMsg structure and parsing logic for text message records
src/include/user/debug_stream_text_msg.h Defined header file with text message structure and ds_msg() function declaration
src/include/user/debug_stream.h Added DEBUG_STREAM_RECORD_ID_TEXT_MSG constant for the new record type
src/debug/debug_stream/debug_stream_text_msg.c Implemented ds_msg() function with formatted message support
src/debug/debug_stream/Kconfig Added configuration option for enabling text message functionality
src/debug/debug_stream/CMakeLists.txt Added conditional compilation for text message source file
app/debug_stream_overlay.conf Enabled text message feature in debug stream configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jsarha jsarha force-pushed the debug_stream_text_msg branch from e06bd61 to 8a88f29 Compare November 27, 2025 14:12
Add new record type for simple text messages to the debug stream
protocol and a function for sending the messages. This functionality
is for debugging purposes when for some reason or another the usual
methods do not work. ds_msg() can be used like printf and the printed
messages can be displayed on host side with debug_stream.py.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the debug_stream_text_msg branch from 8a88f29 to cc1a054 Compare November 27, 2025 14:45
Jyri Sarha added 3 commits November 27, 2025 16:45
Add support for showing DEBUG_STREAM_RECORD_ID_TEXT_MSG messages that
can be sent from firmware code with sd_msg() command.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Enable debug messages in debug_stream_overlay.conf

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add reference to tools/debug_stream/debug_stream.py in the Kconfig
help message.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha
Copy link
Contributor Author

jsarha commented Nov 27, 2025

Copilot pointed copy-paste errors fixed.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one open.

struct {
struct debug_stream_text_msg msg;
char text[128];
} __packed buf = { 0 };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, how does Python parse C structures - it probably assumes "normal" (default) packing, i.e. as if no __packed attribute was specified. Can you tell Python that the structure is packed?

Copy link
Contributor Author

@jsarha jsarha Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, "_pack_ = 1" in Class(ctypes.Structure) does it. But in this context it does not really matter as the "struct debug_stream_text_msg" size is 32-bit aligned and what remains after that is all cosidered utf-8 encoded string.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to go.

_fields_ = [
("id", ctypes.c_uint),
("seqno", ctypes.c_uint),
("size_words", ctypes.c_uint),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in commit: sd_msg->ds_msg

@lgirdwood lgirdwood merged commit 045475f into thesofproject:main Dec 1, 2025
34 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants