Skip to main content
Visitor II
August 18, 2021
Solved

Trace disabled on STM32MP157A-DK1?

  • August 18, 2021
  • 2 replies
  • 1266 views

I am trying to record instruction traces on-chip via ETF on a stm32mp157a-dk1 board, but the data read from FIFO through RRD is always 0. During the debugging process, I found the value of ETM_AUTHSTAT is 0x08, which means non-secure non-invasive debug disabled.

...
 uint32_t ret;
 void __iomem *vaddr = ioremap(ETM_AUTHSTAT, 4);
 ret = __raw_readl(vaddr);
 iounmap(vaddr);
 ...

0693W00000Dpe2VQAR.jpgAfter that, I tried to read DBG_AUTHSTAT and BSEC_DENABLE respectively:

[10725.551984] Check some registers......
[10725.555600] BSEC_DENABLE:047F
[10725.565686] DBG_AUTHSTAT:00FF

It seems all debug signals are 1.

So what I want to confirm is whether the trace function is disabled on my board? Is it because stm32mp1 supports the Security Extensions?

    This topic has been closed for replies.
    Best answer by Yujia.L

    Thanks for your reply OlivierK, I've already solved this problem :)

    From the results of various attempts, I made 2 mistakes before:

    1. The trace clock was not enabled, that's why I cannot get any data from ETF. Then I added these codes and it worked!

    write_reg(0x5000080C, 0x0301);
    reg = read_reg(0x5000080C);
    pr_info("RCC_DBGCFGR: %04X\n", reg);

    2. It seems the ETM_AUTHSTAT can be enabled by ETMPDN, not permanently disabled. It’s just the name made me believe it’s OTP related

    2 replies

    Technical Moderator
    September 7, 2021

    Hi Yujia.L (Community Member)

    Did you manage to progress on the issue? I don't have the DK1 board at hand but the DK2 board have the same settings regarding BSEC_DENABLE after linux boot. The NSNI and NSI are by default set to 1. Which mode register did you select for the ETF?

    Yujia.LAuthorAnswer
    Visitor II
    September 8, 2021

    Thanks for your reply OlivierK, I've already solved this problem :)

    From the results of various attempts, I made 2 mistakes before:

    1. The trace clock was not enabled, that's why I cannot get any data from ETF. Then I added these codes and it worked!

    write_reg(0x5000080C, 0x0301);
    reg = read_reg(0x5000080C);
    pr_info("RCC_DBGCFGR: %04X\n", reg);

    2. It seems the ETM_AUTHSTAT can be enabled by ETMPDN, not permanently disabled. It’s just the name made me believe it’s OTP related

    Technical Moderator
    September 14, 2021

    Hi Yujia.L (Community Member)

    Thank you for your inputs. For sure it will help others on this topic.

    Regards,

    Olivier