Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.
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
77 changes: 77 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,83 @@ xtensa-byt-elf-objcopy -I binary -O elf32-xtensa-le -B xtensa image.bin image.bi

xtensa-byt-elf-objdump -D image.bin.elf > image.dis.txt


sof-logger
======

sof-logger is used to print logs delivered from FW dma_trace mechanism, by searching log
entries in *.ldc file generated by rimage.

Every entry declared in FW is placed in elf output file (e.g. sof-apl) in
.static_log_entries section in a form of struct defined in sof/src/include/sof/trace.h
in sof fw repo.

*.ldc file contains snd_sof_logs_header (defined in rmbox/logger_convert.c)
following by .static_log_entries section incorporated from FW elf file (e.g. sof-apl).
snd_sof_logs_header contains basic information about .static_log_entries section
like base_address and data_length.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have a basic question, is there a default ldc_file?
I wonder if the ldc_file could be generated when we build the firmware. And if there is a default ldc file, can we save this parameter sometimes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ldc_file is generated always when we build the firmware and its name differs for particular platforms (sof-apl.ldc, sof-cnl.ldc etc.) - also *.ldc file content could be different for platforms since they can have different log_messages. For that reason, in my opinion it is hard to define deafult *.ldc file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@mengdonglin Please refer to a high level documentation of the process being delivered in thesofproject/sof-docs#51.

sof-logger works by reading entry parameters value and entries addresses from FW
dma_trace mechanism and searching suitable entry in *.ldc file by its address.

Usage sof-logger <option(s)> <file(s)>
Display mailbox contents
-h help
-l *.ldc_file Specify the *.ldc file
-i in_file Get traces from in_file, instead of the default
"/sys/kernel/debug/sof/etrace"
-o out_file Specify the output file, instead of default stdout
-t Get traces from "/sys/kernel/debug/sof/trace", instead
of the default "/sys/kernel/debug/sof/etrace"
-p Get traces from stdin, instead of the default
"/sys/kernel/debug/sof/etrace"
-c Set timestamp clock in MHz
-s Take a snapshot of state


Examples:

- Get traces from "/sys/kernel/debug/sof/etrace" file and prints logs to stdout

$ sof-logger -l ldc_file

- Get traces from "/sys/kernel/debug/sof/etrace" file and prints logs to
out_file file

$ sof-logger -l ldc_file -o out_file

- Get traces from "/sys/kernel/debug/sof/trace" file and prints logs to stdout

$ sof-logger -l ldc_file -t

- Get traces from "/sys/kernel/debug/sof/trace" file and prints logs to
out_file file

$ sof-logger -l ldc_file -t -o out_file

- Get traces from stdin and prints logs to stdout

$ sof-logger -l ldc_file -p

- Get traces from stdin and prints logs to out_file file

$ sof-logger -l ldc_file -p -o out_file

- Get traces from trace_dump file and prints logs to stdout

$ sof-logger -l ldc_file -i trace_dump

- Get traces from trace_dump file and prints logs to out_file file

$ sof-logger -l ldc_file -i trace_dump -o out_file

- c flag is intented for defining clock value (in MHz) used to format log
timestamps. By default clock value is set to 19.2 (MHz). Below example
set clock value to 19.9 (MHz).

$ sof-logger -l ldc_file -i trace_dump -o out_file -c 19.9

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can the firmware know the MHz by itself by reading some register? So the user need not specify the clock value by -c. I think the previous trace tool does not request this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mengdonglin
with @akloniex we have incorporated c flag from previous rmbox tool.
I am not sure now, but I think that there is possibility for fw to get frequency of its clock - another problem is to convey that information to logger (we can think of adding clk freq information at the begginig of *ldc file, so that logger can read that).


tests
=====

Expand Down