This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Commit: MSP430: crt0: Remove watchdog disabling code


Hi Guys,

   I am checking in the patch below to fix a problem with the MSP430
   startup code.  There was a line in crt0.o which was supposed to
   disable the watchdog timer during the start-up sequence.  But it
   turns out the watchdog timer address is not a constant - it varies
   with the specific MCU involved.

   After discussing the problem with TI, it has been decided that the
   easiest solution is to just remove the code from crt0.o.  If a user
   discovers that the start-up sequence is taking so long that the
   watchdog timer is being tripped before main() is reached, then they
   can add this code to their application:

      #include <msp430.h>

      static void __attribute__((naked, section(".crt_0042"), used))
      disable_watchdog (void)
      {
         WDTCTL =3D WDTPW | WDTHOLD;
      }

  There is a bit of magic involved here, but basically any function in a
  section called .crt_XXXX will be included as part of the crt0 start-up
  code.  The place in the sequence of start-up instructions depends upon
  the value of XXXX.  (Incidentally this method can be used to add *any*
  start-up code, not just watchdog handlers.  For the MSP430 that is...)

Cheers
  Nick

libgloss/ChangeLog
2015-08-20  Nick Clifton  <nickc@redhat.com>

	* msp430/crt0.S: Remove watchdog disabling code.

diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S
index 375d476..5c84e7c 100644
--- a/libgloss/msp430/crt0.S
+++ b/libgloss/msp430/crt0.S
@@ -59,8 +59,6 @@ START_CRT_FUNC 0000 start
 #endif
 	mov_	#__stack, R1
 
-	;; Disable watchdog timer.
-	MOV	#0x5a80, &0x15C
 END_CRT_FUNC	start
 #endif
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]