Skip to main content
TEE logs aren’t enabled in the current release.
Debug provides a set of common logging and debugging techniques to troubleshoot issues in Qualcomm TEE, trusted and client applications, and secure devices. Important Run all the SSH commands in the SELinux Permissive mode. The Enforcing mode will be supported in the future. For instructions on how to connect to the device, see Qualcomm Linux Build Guide.

Debug Qualcomm TEE

Qualcomm TEE kernel logs, also known as the TrustZone diag log, can be used to debug errors that occur in Qualcomm TEE. The TrustZone diag log is available in the Linux kernel driver, which redirects the logs.
  1. Connect to the device as the root using SSH.
  2. Capture the TrustZone logs using the following command:
The error codes in tzbsp_log.txt are encoded in hexadecimal. You can run the following tool to decode tzbsp_log.txt from hexadecimal to string.
  1. Go to <TZ.XF.X.X path>/trustzone_images/ssg/bsp/tz/build/tz/A53_64/<BuildFlavor>
  2. Run the following commands using python 3.
    For example:
For device log collection, the TrustZone diag log buffer is part of the RAM dump, which can be parsed using qsee.elf from TZ.XF software in the crash dump parser tool. For offline or off-device log collection, the TrustZone diag log buffer is part of the RAM dump, which can be parsed using qsee.elf (trustzone\_images/ssg/bsp/qsee/build/\${tz\_bid:EACAANAA}) from the TZ.XF software in the crash dump parser tool.

Debug using secure crash dump

You can debug Qualcomm TEE using the RAM dump. The execution region dump of Qualcomm TEE is collected using secure crash dumps. Devices that trigger the fuse with stage 2 sec.elf are known as secure boot-enabled devices. To debug on these devices, see SecTools v2: Secure Debug User Guide. Note The SecTools guides are available to licensed developers with authorized access.

Debug trusted and client applications

The trusted application logs, also known as Qualcomm TEE logs, are used to debug the errors in trusted applications. To debug errors in the client application, the kernel and journalctl logs are used. For online or on-device log collection, Linux collects the Qualcomm TEE/kernel logs at runtime. You can connect to the device using SSH and use the following commands:
  • To collect the Qualcomm TEE logs from Linux:
  • For client applications, to collect the kernel and logcat logs:
  • For offline or off-device log collection, the Qualcomm TEE log is available in RAM dumps along with the kernel and journalctl logs.

Debug on secure devices

As part of the secure boot procedure, blowing debug disable fuses disable debugging capabilities on the devices. This includes RAM dumps, INV, and NINV debug on the subsystems. The debug policy feature allows control over the debug capability for a device enabled with secure boot. The debug policy image allows debug capabilities such as JTAG re-enable (INV debug), RAM dump, and TrustZone logging (NINV debug) on commercial secure devices. For security reasons, the serial number of the device controls the debug policy for secure RAM dumps, Qualcomm TEE logs, and JTAG. Enabling JTAG on the Qualcomm TEE subsystem disables the device security with respect to hardware key generation. As a result, existing secure storage like user data, SFS, and RPMB becomes inaccessible. Sometimes, the device may prompt for a factory data reset. Use the following command to debug on secure devices:
Ensure that you configure the OEM_ID, PRODUCT_ID, serial number and keys, and certification paths appropriately. For more information, see SecTools v2: Secure Debug User Guide. Note The SecTools guides are available to licensed developers with authorized access.

Flash APDP on device

To flash APDP on the device, run the following command:
Table : Debug policy flags for dump collection
/trustzone_images/ssg/securemsm/trustzone /qsee/mink/oem/config<chipset>/oem_config.xml
See KBA-191202045020-1 (ZIP). For more information, see MiniDump Software User Guide. Note The SecTools and MiniDump guides are available to licensed user with authorized access.

Qualcomm TEE/TrustZone diag log collection on secure device

On the secure device, the Qualcomm TEE/TrustZone log that’s collected from Linux is disabled by default. Qualcomm provides an encrypted log feature for logging. Follow these steps for enabling this feature:
  1. Generate an RSA key for encryption using:
  2. Show RSA key information and modulus using:
    Note The modulus is used in the pub_mod in oem_config.xml file. The pub_exp exponent is usually 65537. 0x10001 is known as the publicExponent.
  3. Set the RSA public key (exponent and modulus) in the trustzone_images/ssg/securemsm/trustzone/qsee/mink/oem/config/<chipset>/ oem_config.xml file. Enable this feature by adding the following lines to the oem_config.xml file using:
    Note When the public key in the oem_config.xml file is updated, ensure that there are no new line characters, tabs, or spaces inserted between due to the Notepad or Wordpad editors.
  4. Enable the encryption feature configuration flag from the trustzone_images/ssg/securemsm/trustzone/qsee/mink/oem/config/<chipset>/oem_config.xml file, using:
  5. To build the TrustZone devcfg image, enter the OEM_ID field value and sign the devcfg.mbn image.
  6. Flash the signed devcfg.mbn image using:
Note Use devcfg.mbn for QCS6490 and devcfg_iot.mbn for QCS9100.
  1. Collect the Qualcomm TEE/TrustZone log using:

Qualcomm TEE/TrustZone diag log decryption steps

  1. Download the Python decryption tool decrypt_tzdiag_qsee_log_tools.py from KBA-200917004544-1 (ZIP).
  2. To install, run the following commands:
  3. To decrypt, run the following command:
  4. After successful decryption:
    1. Navigate the plain text of the Qualcomm TEE log to a readable string format.
    2. Convert the hexadecimal encoded error codes to string, using:

Next steps