Can't disable watcdog in main()

I have posted all my code [here

When I use Jim Lynch’s script.ocd to load the binary, everything is fine - the application (binary count from 0000 to 1111) runs forever. But when I reset the power it runs from 0000 to 0100 then resets.

The difference is that the watchdog status register does not show that I have disabled it. It shows the default value.

From OCD, if I reset and write to the watchdog mode register (write once mind you), and resume the application from 0x0, I do not get a reset.

If I pet the watchdog, the application runs fine.

Processor: AT91SAM7X256

Board: Olimex SAM7-EX256

Debugger: Olimex USB OCD Tiny

Toolchain: YAGARTO

Any ideas what is the right way to write to the watchdog mode register?

Thanks!!

Autif](http://tekxtc.googlepages.com/arm)