You copied the Doc URL to your clipboard.

How do I use a debugger tool to access Non-secure registers in Secure state?

Information in this article applies to:

  • ARMv8-M

Problem/Question

How do I use a debugger tool to access Non-secure registers in Secure state?

Scenario

N/A

Answer

In Secure state, there are two views of the System Control Space (SCS).

  • 0xE000E000-0xE000F000 is the address range for Secure registers.

  • 0xE002E000-0xE002F000 is the address range for the Secure alias for Non-secure registers.

The Secure software can access the Non-secure registers directly through the address 0xE002E000-0xE002F000. Unlike the Secure software, the debugger always accesses banked SCS registers in the address range 0xE000E000-0xE000F000.

According to the Armv8-M architecture, permitted Debug Access Port (DAP) accesses to the region 0xE002E000-0xE002EFFF are RAZ/WI if the access is privileged and return an error if the access is unprivileged.

Consider the NVIC_ISER0 register as an example. In Secure state, the Secure register is at 0xE000E100, and has a Secure alias for the Non-secure register at 0xE002E100. However, the Secure software can access 0xE002E100 to get the Non-secure register value. When the debugger accesses the address 0xE002E100, it returns 0. Therefore, for debuggers such as DS-5 and Keil, the value of the address 0xE002E100 is 0 in the memory window.

Which banked registers can be accessed by the debugger are determined by the following settings:

  • The value of DHCSR.S_SDE.

  • The value of DSCSR.SBRSEL.

  • The value of DSCSR.SBRSELEN.

  • The current security state of the PE.

DHCSR.S_SDE defines whether Secure invasive debug is allowed. When this bit is set to 1, Secure invasive debug is allowed.

DSCSR.SBRSELEN defines whether the access result is decided by the current security state or by DSCSR.SBRSEL.

When the DHCSR.S_HDE bit is set to 1, how the debugger accesses memory banked registers is determined as follows:

  • If DSCSR.SBRSELEN is set to 0, the current security state determines which memory banked registers are accessed by the debugger. For example, the debugger accesses the secure registers in Secure state; the debugger accesses non-Secure registers in Non-secure state.

  • If DSCSR.SBRSELEN is set to 1, DSCSR.SBRSEL determines which memory bank registers are accessed by the debugger:

    • If DSCSR.SBRSEL is set to 0, the debugger accesses the Secure alias for the Non-secure registers.

    • If DSCSR.SBRSEL is set to 1, the debugger accesses the Secure registers.

To access the Non-secure registers in Secure state, you can set register bits as follows:

  • DHCSR.S_HDE=1.

  • DSCSR.SBRSELEN =1.

  • DSCSR.SBRSEL=0.

Workaround

N/A

Example

N/A

Related Information

For details about DAP access permissions, see the Armv8-M Architecture Reference Manual.

Was this page helpful? Yes No