summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2012-08-05 22:26:09 +0800
committerGerrit <chrome-bot@google.com>2012-08-08 11:39:48 -0700
commita7d7297577d5450610ddc1a76544fe3300873042 (patch)
treeb49d4b5150dcb543ddc3955a15354c31c9753070 /core
parent99a770b14cfd4f1e713623088e0311fc95c2927f (diff)
downloadchrome-ec-a7d7297577d5450610ddc1a76544fe3300873042.tar.gz
stm32f: Use FLASH_KEYR to lock entire flash
Writing wrong key to FLASH_KEYR locks entire flash and effectively performs RW_NOW. Therefore we can use this and remove RW_AT_BOOT to prevent having to reboot for RW to be protected. BUG=chrome-os-partner:12043 TEST=1. fakewp 1 -> wp_gpio_asserted 2. flashwp now -> nothing happens 2. flashwp enable -> wp_gpio_asserted ro_at_boot 3. reboot -> wp_gpio_asserted ro_at_boot ro_now 4. flasherase 0x10000 0x1000 -> success 5. flashwp now -> wp_gpio_asserted ro_at_boot ro_now rw_now 6. flasherase 0x10000 0x1000 -> error 7. reboot -> wp_gpio_asserted ro_at_boot ro_now 8. flasherase 0x10000 0x1000 -> success Change-Id: I22df188e31404c190c5830c6d94c9646224eb9ab Reviewed-on: https://gerrit.chromium.org/gerrit/29255 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Ready: Vic Yang <victoryang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/panic.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/cortex-m/panic.c b/core/cortex-m/panic.c
index 1663d8fd93..26d537ce85 100644
--- a/core/cortex-m/panic.c
+++ b/core/cortex-m/panic.c
@@ -19,6 +19,9 @@
/* This is the size of our private panic stack, if we have one */
#define STACK_SIZE_WORDS 64
+/* Whether bus fault is ignored */
+static int bus_fault_ignored;
+
/* We save registers here for display by report_panic() */
static struct save_area
{
@@ -361,6 +364,20 @@ void exception_panic(void)
}
+void bus_fault_handler(void) __attribute__((naked));
+void bus_fault_handler(void)
+{
+ if (!bus_fault_ignored)
+ exception_panic();
+}
+
+
+void ignore_bus_fault(int ignored)
+{
+ bus_fault_ignored = ignored;
+}
+
+
#ifdef CONFIG_ASSERT_HELP
void panic_assert_fail(const char *msg, const char *func, const char *fname,
int linenum)