STM tracing uses dictionary-based logging to send messages without redundant strings. This is based on the Zephyr logging API's dictionary feature and is particularly useful for assisted multicore logging.
Complete the following steps:
-
Make sure you have configured your application for tracing.
-
Identify the device's serial port for tracing by listing the connected devices:
nrfutil device listNote
When selecting a serial port for the trace, pick the serial port with the highest serial port number.
-
Use the
nrfutil trace stmcommand to start capturing logs from the device, specifying the database configuration for each domain ID, along with the input serial port and output type.
Use the following command pattern:nrfutil trace stm --database-config <domain_id>:build/<app_name>/zephyr/log_dictionary.json --input-serialport <serial_port> --stdout asciiIn this command, the following parameters are used:
-
<domain_id>is the decimal ID of the domain (core) that the application is running on. When using several domains, use a comma to separate each domain in the list.
Use the following prefixes to indicate the cores:Core Prefix ID Secure Domain sec0x21 Application core app0x22 Radio core rad0x23 System Controller (SysCtrl) sys0x2c Fast Lightweight Processor (FLPR) flpr0x2d Peripheral Processor (PPR) ppr0x2e -
<app_name>is the application name. <serial_port>is the serial port used for output.- The output can be either the console (
--stdout ascii) or a file (--output-ascii out.txt).
For example:
-
To capture logs from the Secure Domain and the application core, use the following command:
nrfutil trace stm --database-config 0x21:build/my_app/zephyr/log_dictionary.json,0x22:build/my_app/zephyr/log_dictionary.json --input-serialport COM10 --stdout ascii -
To capture logs from the Secure Domain, the application core, and the radio core, use the following command:
nrfutil trace stm --database-config 0x21:build/my_app/zephyr/log_dictionary.json,0x22:build/my_app/zephyr/log_dictionary.json,0x23:build/my_app/zephyr/log_dictionary.json --input-serialport COM10 --stdout ascii
nRF Util starts to capture the log data from the specified serial port and uses the provided dictionary databases to decode the logs into a human-readable format. The tool sends the decoded logs to the specified output (either the console or a file).
-
-
When done, stop tracing by pressing CTRL-C.
For more information about STM tracing with nRF54H20, see the nRF54H20 logging page in the nRF Connect SDK documentation. For more information about multidomain logging, see also Multi-domain logging using ARM Coresight STM in the Zephyr documentation.