diff options
author | 2018-08-21 12:16:52 -0700 | |
---|---|---|
committer | 2019-03-12 12:27:57 -0700 | |
commit | 4fe3f1178cd5e3fa340ce548448d8afd0d475696 (patch) | |
tree | cb22f6e050b859aed9c69c15e77648e9d1c150de /src/peripheral/dcb.rs | |
parent | d562f762f5d5ef231c4423e47198b527d14a7529 (diff) | |
download | cortex-m-4fe3f1178cd5e3fa340ce548448d8afd0d475696.tar.gz cortex-m-4fe3f1178cd5e3fa340ce548448d8afd0d475696.tar.zst cortex-m-4fe3f1178cd5e3fa340ce548448d8afd0d475696.zip |
Add explanatory note about C_DEBUGEN
Diffstat (limited to 'src/peripheral/dcb.rs')
-rw-r--r-- | src/peripheral/dcb.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/peripheral/dcb.rs b/src/peripheral/dcb.rs index ac84eef..6189317 100644 --- a/src/peripheral/dcb.rs +++ b/src/peripheral/dcb.rs @@ -34,8 +34,14 @@ impl DCB { // unset bit 24 / TRCENA unsafe { self.demcr.modify(|w| w & !DCB_DEMCR_TRCENA); } - /// Is there a debugger attached? - pub fn is_debugger_attached(&self) -> bool { - self.dhcsr.read() & 0x1 == 1 + /// Is there a debugger attached? (see note) + /// + /// N.B. This function is [reported not to + /// work](http://web.archive.org/web/20180821191012/https://community.nxp.com/thread/424925#comment-782843) + /// on Cortex-M0 devices. Per the ARM v6-M Architecture Reference Manual, "Access to the DHCSR + /// from software running on the processor is IMPLEMENTATION DEFINED". Indeed, from the + /// [Cortex-M0+ r0p1 Technical Reference Manual](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0484c/BABJHEIG.html), "Note Software cannot access the debug registers." + pub fn is_debugger_attached() -> bool { + unsafe { (*Self::ptr()).dhcsr.read() & 0x1 == 1 } } } |