summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChromeOS Developer <dparker@chromium.org>2014-03-24 19:54:05 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-26 05:33:35 +0000
commit7895c278033acbb0f55020e5ac54fa8e6e669f14 (patch)
tree71365d782e21c3d079520dfc3c8a3020ac59503a
parentd430602af8db20b8c8f173178ed0068f06a93926 (diff)
downloadchrome-ec-7895c278033acbb0f55020e5ac54fa8e6e669f14.tar.gz
cortex-m: Add debug config option for disabling buffered writes
This can be helpful when debugging "Imprecise" data bus errors. BUG=None BRANCH=None TEST=Write to a memory-mapped register such as LM4_ADC_ADCISC for a hardware block that is powered down. Check the exception trace for a "Precise" error. Change-Id: Ia246c3661b482e212bb0ce37b9c2d383021de639 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191392 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--core/cortex-m/init.S10
-rw-r--r--include/config.h9
2 files changed, 19 insertions, 0 deletions
diff --git a/core/cortex-m/init.S b/core/cortex-m/init.S
index 00072c7f0f..0f5a3e2310 100644
--- a/core/cortex-m/init.S
+++ b/core/cortex-m/init.S
@@ -364,6 +364,16 @@ data_loop:
isb
#endif /* CONFIG_FPU */
+#ifdef CONFIG_DEBUG_DISABLE_WRITE_BUFFER
+ /* Disable write buffer used for default memory map accesses */
+ ldr r0, =0xE000E008 /* Load address of ACTLR */
+ ldr r1, [r0] /* Read ACTLR */
+ orr r1, r1, #2 /* Set DISDEFWBUF bit */
+ str r1, [r0] /* Write back ACTLR */
+ dsb /* Wait for store to complete */
+ isb /* Reset pipeline */
+#endif /* CONFIG_DEBUG_DISABLE_WRITE_BUFFER */
+
/* Jump to C code */
bl main
diff --git a/include/config.h b/include/config.h
index 8cfbb38a80..5982a38fdc 100644
--- a/include/config.h
+++ b/include/config.h
@@ -344,6 +344,15 @@
#define CONFIG_DEBUG_ASSERT_REBOOTS
/*
+ * Disable the write buffer used for default memory map accesses.
+ * This turns "Imprecise data bus errors" into "Precise" errors
+ * in exception traces at the cost of some performance.
+ * This may help identify the offending instruction causing an
+ * exception. Supported on cortex-m.
+ */
+#undef CONFIG_DEBUG_DISABLE_WRITE_BUFFER
+
+/*
* Print additional information when exceptions are triggered, such as the
* fault address, here shown as bfar. This shows the reason for the fault
* and may help to determine the cause.