在非特权执行时是否可以读取循环计数寄存器(DWT_CYCCNT)?

Is it possible to read the Cycle Count Register (DWT_CYCCNT) when executing at unprivileged?

在非特权模式下执行时是否可以读取循环计数寄存器 (DWT_CYCCNT)?

#define DWT_CYCCNT  (*(volatile uint32_t*)(0xE0001004)) /**<  Cycle Count Register */
CycleCount = DWT_CYCCNT; /* Unprivileged read of the Cycle Count Register causes a Bus Fault. */

相关:

简答:没有。

调试寄存器位于特殊保留地址space

The architecture reserves address space 0xE0000000 to 0xFFFFFFFF for system-level use. ARM reserves the first 1MB of this system address space, 0xE0000000 to 0xE00FFFFF, as the Private Peripheral Bus (PPB)

具体注册有问题

Data Watchpoint and Trace (DWT) block 0xE0001000-0xE0001FFF

C1.2.1 适用于调试寄存器访问的一般规则”部分明确指出,根据经验,DWT 内存仅特权访问:

The Private Peripheral Bus (PPB), address range 0xE0000000 to 0xE0100000, supports the following general rules:

  • The region is defined as Strongly-ordered memory
  • Registers are always accessed little-endian
  • Debug registers can only be accessed as a word access
  • A reserved register or bit field has the value UNK/SBZP

Unprivileged access to the PPB causes BusFault errors unless otherwise stated.


检索自 "ARMv7-M Architecture Reference Manual" (ARM DDI 0403D)