----- Ursprüngliche Nachricht -----
Von: Przemek Klosowski
Gesendet am: 03 Apr 2009 16:19:26

>> I know that initializing the variable fields at startup can take longer than 
>> the WDT interval on processors with more RAM, but it would be way more 
>> compatible to use a slower startup code that triggeres WDT

> Absolutely right, and I think the correct way would be to turn off WDT
> specifically for the initialization and then turn it on again. It
> would make for clearer code, too: WDT manipulation would happen right
> next to the code that requires it.

I you require a WDT for environment stability (and not just to circumvent code 
deadlocks due to poorly written code) then the WDT may not be disabled EVER. It 
is on at startup and it has to stay on. period.
If you don't need it, well, maybe a faster startup that disables WDT is nice. 
And if you KNOW that htis happens wihtout digging into linker listings or 
library source code, it is even nicer. But in case you NEED the 
WDT to ensure device crash recovery, there must be a way to never disable it at 
all.

----- Ursprüngliche Nachricht -----
Von: N. Coesel
Gesendet am: 03 Apr 2009 18:01:26

>Still, this shouldn't be hidden in the C library. Most other
>microcontroller platforms have a startup.S which is simply compiled
>together with the rest of the project. Startup.S takes care of any hardware
>dependant initialisation and jumps to main. For a developer it is very
>clear what the code does and there is no magic happening at hard to find
>places.

At least it would be easier to detect. But requiring to include an '.s'-File 
into your project is an uncommon approach for play 'C' programmers. Usually, 
you just write your code and put it into the makefile. The rest is up 
to the linker.
But I see it is difficult to find a solution that meets all requirements/wishes.

After figuring out what's going on, it wasn't too difficult to write my own 
startup code and assign it to the reset vector. The main problem isn't the 
startup code itself, but the (currently) poor decomentation of it inner 
workings.
As a normal programmer you don't expect that you have to mess with the C 
startup code. (okay, I must admit, a normal C programmer wouldn't care for the 
WDT at all and and disabled WDT saves him a lot of 
wondering about reboots) :)


----- Ursprüngliche Nachricht -----
Von: Peter Jansen
Gesendet am: 05 Apr 2009 04:28:44

>The watchdog is enabled by PUC to timeout in SMCLK/32768, so could interrupt 
>the BSS clear or DATA section copy, this should be made clear by the doco. 
>Where in the current code is the WDT disabled?

Right before the data section copy. On a standard C project, this is the very 
first instruction executed at the reset vector.


JMGross


Reply via email to