Fix MSR register for boards with DFU
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 5 Oct 2011 05:05:06 +0000 (14:05 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 5 Oct 2011 05:05:06 +0000 (14:05 +0900)
ChangeLog
boards/common/board-common.c

index 73dd149..51ba714 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-05  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * boards/common/board-common.c (__early_init): Set MSP register
+       in case of DFU.
+
 2011-10-04  NIIBE Yutaka  <gniibe@fsij.org>
 
        * src/chconf.h (THREAD_CONTEXT_SWITCH_HOOK): New.
index bdd8b36..35c2178 100644 (file)
@@ -57,6 +57,10 @@ void
 __early_init(void)
 {
 #ifdef DFU_SUPPORT
+  extern void __main_stack_end__(void);
+  uint32_t msp = (uint32_t)__main_stack_end__;
+
+  asm volatile ("msr     MSP, %0" : : "r" (msp));
   SCB->VTOR = 0x08003000;
 #endif