New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
samples: nrf9160: Add modem traces to flash sample #9364
samples: nrf9160: Add modem traces to flash sample #9364
Conversation
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publishing GitHub Action. |
67320da
to
58c7553
Compare
Test specificationCI/Jenkins/NRF
CI/Jenkins/integration
All integration tests: null Detailed information of selected test modules Note: This message is automatically posted and updated by the CI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it this is intended to be used by customers, the trace backed should be put in nrf_modem_lib/trace_backends
instead of the sample's folder.
58c7553
to
a86591c
Compare
@lemrey I agree that would make sense, but I think it needs further refining before it can be a generic backend in |
a86591c
to
67827fe
Compare
samples/nrf9160/modem_trace_flash/boards/nrf9160dk_nrf9160_ns.conf
Outdated
Show resolved
Hide resolved
samples/nrf9160/modem_trace_flash/boards/nrf9160dk_nrf9160_ns.conf
Outdated
Show resolved
Hide resolved
samples/nrf9160/modem_trace_flash/boards/nrf9160dk_nrf9160_ns.conf
Outdated
Show resolved
Hide resolved
|
||
static void print_traces(void) | ||
{ | ||
uint8_t buf[1024]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint8_t buf[1024]; | |
uint8_t buf[READ_BUF_SIZE]; |
And define READ_BUF_SIZE to 1024 at the top of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use a const
inside the function? It's only needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to clearly explain why a magic number was chosen. A macro in place of a magic number becomes a self-explanatory way of doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree to avoid the magic number, but I don't see the reason to use a define that would be file global instead of a const that would only be visible inside the function scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah! sorry I misunderstood. A const works too! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some cleanup remains. See comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partition manager changes looks OK
samples/nrf9160/modem_trace_flash/boards/nrf9160dk_nrf9160_ns.conf
Outdated
Show resolved
Hide resolved
return (int)len; | ||
} | ||
|
||
int trace_flash_flush(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not part of the trace_backend.h
interface, it's a bit confusing that it is here, but exported by trace_flash.h
. Same for trace_read.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest moving it to a separate C file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved the flash handling logic to trace_storage.h
and trace_storage.c
, and the trace backend logic to trace_flash_backend.c
(which calls trace_storage_write to write trace data to flash).
LOG_DBG("Written %d bytes in %lld ms", traces_size, tot_write_time); | ||
LOG_DBG("Throughput = %lld kb/s ", (traces_size * 8 / tot_write_time)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some built-in facility for this now (in nrf_modem_lib_trace.c
), both for trace backend throughput and trace throughput from modem. You could see if that works for you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I wasn't aware of that. Tried it now, but I prefer the average speed for all trace writes instead of printing periodically. Perhaps possible to configure, but have to look into that later.
You need to add a entry in https://github.com/nrfconnect/sdk-nrf/blob/main/doc/nrf/releases/release-notes-changelog.rst |
|
||
static void print_traces(void) | ||
{ | ||
uint8_t buf[1024]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to clearly explain why a magic number was chosen. A macro in place of a magic number becomes a self-explanatory way of doing that.
04b4419
to
4dd3082
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
7871f65
to
52007cb
Compare
Sample that demonstrates how to create a modem trace backend that writes the modem traces to the external flash on the nRF9160 DK, and how to read it out again. Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no> Co-Authored-By: Balaji Srinivasan <balaji.srinivasan@nordicsemi.no> Co-Authored-By: divya pillai <divya.pillai@nordicsemi.no>
52007cb
to
76ff415
Compare
Sample that demonstrates how to create a modem trace backend that writes the modem traces to the external flash on the nRF9160 DK, and how to read it out again.
Signed-off-by: Gregers Gram Rygg gregers.gram.rygg@nordicsemi.no