Skip to content
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

doc: Updated 54H logging documentation #17331

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

FrancescoSer
Copy link
Contributor

Updated 54h logging documentation.
Added small fix to 54h custom pcb documentation.

@github-actions github-actions bot added doc-required PR must not be merged without tech writer approval. changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. labels Sep 16, 2024
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Sep 16, 2024

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 7

Inputs:

Sources:

sdk-nrf: PR head: d0cf7150d107c4401f693287070a29951a9b17a4

more details

sdk-nrf:

PR head: d0cf7150d107c4401f693287070a29951a9b17a4
merge base: cf2cc23fc692f3ec613eb717e0e53dd76346c05a
target head (main): ad488ad9ee3f156e8103af2a679302da401ee31a
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (3)
doc
│  ├── nrf
│  │  ├── app_dev
│  │  │  ├── device_guides
│  │  │  │  ├── nrf54h.rst
│  │  │  │  ├── working_with_nrf
│  │  │  │  │  ├── nrf54h
│  │  │  │  │  │  │ ug_nrf54h20_logging.rst
│  │  │ links.txt

Outputs:

Toolchain

Version:
Build docker image:

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain
  • ◻️ Build twister
  • ◻️ Integration tests
Disabled integration tests
    • desktop52_verification
    • doc-internal
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-boot
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_cloud
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_mosh
    • test-fw-nrfconnect-nrf-iot_nrf_provisioning
    • test-fw-nrfconnect-nrf-iot_positioning
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • test-fw-nrfconnect-nrf-iot_thingy91
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-proprietary_esb
    • test-fw-nrfconnect-ps
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread
    • test-fw-nrfconnect-zigbee
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-mcuboot
    • test-sdk-pmic-samples
    • test-sdk-sidewalk
    • test-sdk-wifi

Note: This message is automatically posted and updated by the CI

Copy link
Contributor

@nordic-krch nordic-krch left a comment

Choose a reason for hiding this comment

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

I cannot leave comments inline because those lines are not changed but following things changed:

  • proxy core is changed. ETR is handled by cpuapp (it used to be SDFW). SDFW knows if STM shall be enabled based on UICR entry
  • enabling logging is done using a snippet nordic-log-stm or nordic-log-stm-dict. That is because not only Kconfig is needed but also devicetree entry (to get info to UICR).
  • There is an upstream documenation which might be referenced here: https://docs.zephyrproject.org/latest/services/logging/cs_stm.html

@NordicBuilder
Copy link
Contributor

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.

Copy link
Contributor

@PavelVPV PavelVPV left a comment

Choose a reason for hiding this comment

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

I got the bundle that supports STM over UART and was able to run it and went through this page. Here are my comments.

  1. I can't comment on technical details as I don't know how this is actually implemented, so I trust what is written here. But I find the figure (https://docs.zephyrproject.org/latest/services/logging/cs_stm.html#logging-using-stm) from zephyr doc very useful. It helped me wade through a bunch of acronyms. Duplicating it is probably not a good idea, but a link to that page or even figure could be very useful.

  2. Regarding both configuration sections, they work with 2 snippets: nordic-log-stm (for standalone logging) and nordic-log-stm-dict (dictionary logging/assisted multicore logging) as @nordic-krch said. The Kconfig option in the Standalone logging section can be replaced with -S nordic-log-stm addition to west build command and in the assisted multicore logging sections with -S nordic-log-stm-dict.

  3. This is a nit-picking comment but referring a user to a devicetree doc here

    .. note::
    To use UART in your application, the UART's node must be described in devicetree.
    For more details, see :ref:`zephyr:devicetree-intro`.
    for just enabling UART is way to confusing... Aren't there any samples that explain this already in a less intimidating manner?

  4. This (":file:build/zephyr") is not fully correct:

    After building your application, a dictionary database file named :file:`log_database.json` will be generated in the :file:`build/zephyr` directory.
    This file is crucial for decoding the logs and is updated with every build.

    It will be under build/<app_name>/zephyr/ folder where <app_name> is the name of the application built for a specific core. And there will be as many <app_name> folders as apps built for each core. So for example, in my case when I built samples/bluetooth/peripheral_uart sample, I got 2 files: build/peripheral_uart/zephyr/log_dictionary.json and build/ipc_radio/zephyr/log_dictionary.json because it built 2 images: peripheral_uart for the application core and ipc_radio for the radio core.

  5. This line has few issues:

    nrfutil trace stm --database-config 33:build/secdom/src/secdombuild/zephyr/log_dictionary.json,34:build/zephyr/log_dictionary.json --input-serialport /dev/ttyACM1 --baudrate 115200 --output-ascii out.txt

    1. It can't be copy-pasted it assumes that secdom fw is also built which is not the case when building samples. Usually it is application core and radio core that are built more often.
    2. It uses decimals as domain IDs, but in the table below (nRF54H20 log prefixes) they are provided in heximals. Passing heximals to a terminal will most likely won't work (can't say for all terminals though, but for bash it won't work). So these IDs should be in decimals for a user to easily copying them.
    3. Might be more convenient to use --stdout ascii instead of --output-ascii out.txt option just to see the output in a real-time (like a user would see if used serial terminal with standalone logging or normal logging over UART).
    4. nRF54H20 has 2 UARTs, but only one will print logs. It would be good to explain how to find which serial ports exposed by the DK (as far as I know nrfutil device list prints ports).

    In my opinion it could be better to convert this command to a generic one, for example:

nrfutil trace stm --database-config <domain_id>:build/<app_name>/zephyr/log_dictionary.json --input-serialport <port> --baudrate 115200 --stdout ascii

where:
- <domain_id> is an ID of the domain which the application is running on (for several domains use `,` comma to separate each domain),
- <app_name> is the application name,
- <port> is the serial port used for output.

It is up to you if you fixes all my comments or some of them as well as if you fix them now or later. IMHO I'd suggest to fix 5, 4 and 2 comments now as they are most confusing now and comments 2 and 3 at some point later.

@FrancescoSer
Copy link
Contributor Author

@PavelVPV @nordic-krch Please rereview. I realized the upstream doc was heavily based on the original orphaned page here, and it currently looks partly outdated. Best solution here would be to ensure that this document here is currently correct and updated for CS2, and then resolve the duplication of content upstream before 2.8.

@nordic-krch
Copy link
Contributor

Might be more convenient to use --stdout ascii instead of --output-ascii out.txt option just to see the output in a real-time

--stdout ascii was not working correctly in previous nrfutil trace version but now it works ok, so definitely it's a better option.


This command contains the following parameters:

* ``<domain_id>`` is the ID of the domain which the application is running on.
Copy link
Contributor

Choose a reason for hiding this comment

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

As domain_id should be in decimals, then to be consistent, at csv-table:: nRF54H20 log prefixes there should be also decimals - currently there are hexadecimals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@PavelVPV Could you check this?

Copy link
Contributor

Choose a reason for hiding this comment

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

That was point 5.2 from my comment: #17331 (review). It would be more friendlier if the table had ids in decimals, though I'm fine with how it is right now. Maybe there are other places where heximals are used. Up to you if you want to fix it or not.

* It reduces the amount of data that needs to be sent to and processed by the application core, as the string formatting is offloaded to the host side.
To show the logs for a given domain in the UART output, you must enable the STM for both the application core (as the ETR buffer processing proxy) and that domain's CPU.
To do so, use the :ref:`zephyr:nordic-log-stm-dict` snippet when building the application for the related cores.
For example, the following command uses the snippet when building for the application core::
Copy link
Contributor

Choose a reason for hiding this comment

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

There is sample for STM at https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/boards/nordic/coresight_stm
maybe it can be linked here?
Maybe this sample require some doc/readme too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Moreover, this doc provides some example stm output but not stating from which application/code. How user can achieve such logs.
Thus would be great it IMHO better to show logs from sample.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is sample for STM at https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/boards/nordic/coresight_stm maybe it can be linked here? Maybe this sample require some doc/readme too?

That's merged in Zephyr. Linking could be done here if considered relevant by @nordic-krch, however, documentation cannot be done upstream before CS2. This would be a task for a future release, if we actually support that sample. @nordic-krch Any input here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moreover, this doc provides some example stm output but not stating from which application/code. How user can achieve such logs. Thus would be great it IMHO better to show logs from sample.

@nordic-krch Any input here?

To read the dictionary-based STM log output, do the following:

1. Set up the log capture.

Use the ``nrfutil trace stm`` command to start capturing logs from the device, specifying the database configuration for each domain ID, as well as the serial port, the baud rate, and the output file name::

nrfutil trace stm --database-config 33:build/secdom/src/secdombuild/zephyr/log_dictionary.json,34:build/zephyr/log_dictionary.json --input-serialport /dev/ttyACM1 --baudrate 115200 --output-ascii out.txt
nrfutil trace stm --database-config <domain_id>:build/<app_name>/zephyr/log_dictionary.json --input-serialport <port> --baudrate 115200 --stdout ascii
Copy link
Contributor

@nordic-piks nordic-piks Sep 25, 2024

Choose a reason for hiding this comment

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

If example command is now --stdout ascii then sections regarding file with output content are obsolete - Open the output file to review the decoded log messages., Capture and decode the logs.
With --stdout ascii results will be shown at console.
with --output-ascii out.txt will be save into file.

@nordic-piks
Copy link
Contributor

Why there is reference to logging from System Controller (SysCtrl) and Secure Domain as no such thing will be available in the system?
@hubertmis Can you confirm that those domains will never show logs from user perspective?

@nordic-piks
Copy link
Contributor

Regarding Each log line contains a domain-related or core-related, what is the difference between core and domain?
Doc seems to use those name as synonyms but at some point states that those are different elements i.e. produce different prefix.

@@ -193,11 +184,11 @@ The following are the prefixes used to indicate the cores:
Peripheral Processor (PPR), ``ppr``, 0x2e
, ``mod``, 0x24
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no core name for mod - cell in a table is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Internal docs did not define this. @hubertmis Should we remove that line? @nordic-krch What exactly is "mod" in the logs?

@nordic-piks
Copy link
Contributor

If the log capture fails to find a sync, rerun the capture process.
This is very general statement. What does it mean (how it looks at console?) to fail to find a sync?
If application is constantly logging, then sync should be immediate.
If application is currently not logging at all (it ended or there is a "pause") there will not be logs, even if user will restart nrfutil trace command (DK reset is needed in such case)

@FrancescoSer
Copy link
Contributor Author

Regarding Each log line contains a domain-related or core-related, what is the difference between core and domain? Doc seems to use those name as synonyms but at some point states that those are different elements i.e. produce different prefix.

It was never technically clarified if these names can be synonims or not. From the doc point of view, when we have product names like Application Core and Secure Domain, saying just Domain might confuse the reader, I'll try to clarify that sentence.

@FrancescoSer
Copy link
Contributor Author

logging, then sync should be immediate.
If application is currently not logging at all (it ended or there is a "pause") there will not be logs, even if user will restart nrfutil trace command (DK reset is needed in such case)

@nordic-krch Could you provide an answer here?

Updated 54h logging documentation.
Added small fix to 54h custom pcb documentation.

Signed-off-by: Francesco Domenico Servidio <francesco.servidio@nordicsemi.no>
@FrancescoSer
Copy link
Contributor Author

FrancescoSer commented Sep 25, 2024

@nordic-piks As the PR is part of the CS2 milestone and received approvals already, I'll ask for merge. I'll also open a separate PR to continue the discussion on your feedback.

@rlubos rlubos merged commit 29c9b1c into nrfconnect:main Sep 25, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants