ARM Technical Support Knowledge Articles

How can I tell whether the Cortex-M3 is in Thread or Handler mode?

Answer

Software or the debugger can inspect the Interrupt Program Status Register (IPSR).

Logic on-chip can use the ETMINTNUM[8:0] output bus to observe the corresponding value, if the ETM interface is enabled. This interface is available irrespective of whether the ETM is licensed and whether the ETM is instantiated in the configuration. The ETM interface is active when the TRCENA bit[24] of the Debug Exception and Monitor Control Register (DEMCR) is set.

At RESET, the processor adopts Privileged Thread mode. The IPSR / ETMINTNUM is zero while the processor is in Thread mode (privileged or unprivileged), and changes to the corresponding exception number (ie. the vector table index) when an exception is being processed or handled.

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential