cancel
Showing results for 
Search instead for 
Did you mean: 

Read Secure World Registers with GDB

RustyCohle
Associate

Hello everyone,

I am currently debugging a Cortex-M33 MCU with TrustZone-M. During my debugging session, I have observed some unexpected behavior when reading the VTOR (Vector Table Offset Register) in both secure and non-secure states using GDB.

Background

The core is executing in the secure state.
I have accessed the VTOR (0x0E00_0ED08) and its non-secure alias (0x0E002_ED08) registers through GDB.

Initial Values

The VTOR_S (secure state) register initially held the value 0x0C00_0000.
The VTOR_NS (non-secure state) register initially held the value 0x0800_0000.

Expected Outcome

The value read from the VTOR register (0x0E00_0ED08) should be 0x0C00_0000.
The value read from the VTOR non-secure alias (0x0E002_ED08) should be 0x0800_0000.

Observed Results

The value read from 0x0E00_0ED08 was 0x0800_0000.
The value read from 0x0E002_ED08 was 0x0.

Issue
It appears that GDB is operating in the non-secure state, as the values read do not match the expected secure state values. This discrepancy has led me to question whether GDB can be configured to operate in the secure state.

Question
Is there a method to configure GDB to work in the secure state of the Cortex-M33 MCU? If so, could you please provide guidance on how to achieve this?

I appreciate any assistance you can offer in resolving this issue.

1 REPLY 1
Jocelyn RICARD
ST Employee

Hello @RustyCohle ,

the value read in 0x0E002_ will always be 0. I think this is a documentation mistake.

Value in 0x0E000_ depends on core context (secure or non secure)

GDB works fine with secure/non secure contexts. You can experiment it using STM32CubeIDE.

Best regards

Jocelyn