Skip to content

Conversation

@Kaben123
Copy link

@Kaben123 Kaben123 commented Jan 21, 2026

This patch adds support for dumping binary contents from noteram via the
trace dump -b <file> command. Changes include:

  • Add a binary parameter to trace_dump() and the public header
    system/trace/trace.h to indicate binary output mode.
  • Update trace_dump() to set the noteram read mode to binary using
    NOTERAM_SETREADMODE when requested.
  • Update trace dump CLI parsing in system/trace/trace.c to accept
    the -b flag and pass it through to trace_dump().
  • Update usage/help text to include the new -b option.

Note: Please adhere to Contributing Guidelines.

Summary

This PR adds support for dumping binary noteram contents from the trace
utility. A new -b option is provided to trace dump to emit the raw
binary data instead of the human-readable text format.

What I changed

  • system/trace/trace.h: updated prototype int trace_dump(FILE *out, bool binary);
  • system/trace/trace.c: parse -b option for trace dump and pass the
    flag to trace_dump(); update usage text.
  • system/trace/trace_dump.c: when binary mode is requested, set the
    noteram read mode to NOTERAM_MODE_READ_BINARY via ioctl NOTERAM_SETREADMODE.

Files modified

  • system/trace/trace.h
  • system/trace/trace.c
  • system/trace/trace_dump.c

Impact

  • Adds new capability to export raw noteram binary data.
  • Backwards compatible: text dump behavior remains unchanged when -b
    is not specified.
  • Low risk; only affects the trace utility and noteram read mode usage.

Testing

  • Run nsh> trace dump -b /tmp/trace.bin and verify the produced file
    contains binary data as expected.
  • Run nsh> trace dump /tmp/trace.txt to verify the original text output.
  • Build and run the trace utility on a target with noteram support.

This patch adds support for dumping binary contents from noteram via the
`trace dump -b <file>` command. Changes include:

- Add a `binary` parameter to `trace_dump()` and the public header
  `system/trace/trace.h` to indicate binary output mode.
- Update `trace_dump()` to set the noteram read mode to binary using
  `NOTERAM_SETREADMODE` when requested.
- Update `trace dump` CLI parsing in `system/trace/trace.c` to accept
  the `-b` flag and pass it through to `trace_dump()`.
- Update usage/help text to include the new `-b` option.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
@Kaben123 Kaben123 changed the title trace_dump: Support dump binary noteram. apps/system/trace: support binary dump of noteram Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants