This is the mail archive of the
mailing list for the newlib project.
Commit: MSP430: crt0: Remove watchdog disabling code
- From: Nick Clifton <nickc at redhat dot com>
- To: newlib at sourceware dot org
- Date: Thu, 20 Aug 2015 17:18:25 +0100
- Subject: Commit: MSP430: crt0: Remove watchdog disabling code
- Authentication-results: sourceware.org; auth=none
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:
static void __attribute__((naked, section(".crt_0042"), used))
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...)
2015-08-20 Nick Clifton <firstname.lastname@example.org>
* msp430/crt0.S: Remove watchdog disabling code.
diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S
index 375d476..5c84e7c 100644
@@ -59,8 +59,6 @@ START_CRT_FUNC 0000 start
mov_ #__stack, R1
- ;; Disable watchdog timer.
- MOV #0x5a80, &0x15C