On 17.03.2011 15:03, JMGross wrote:
> ----- Ursprüngliche Nachricht -----
> Von: Grant Edwards
> Gesendet am: 16 Mrz 2011 17:51:51
>
>>>>> It's not only that the datasheets talk about disabling the watchdog.
>>>>> Disabling an already disabled watchdog does no harm.
>>>> neither is enabling it again a problem, if you actively want to use it.
>>> But not enabling it when the docs say it is enabled
>> What docs say it's enabled when main() is entered in an app built with
>> mspgcc?
>
> The processor datasheet says that after a BOR/POR/PUC the WDT is
> enabled.
> Disabling it by inherently placed default compiler code, especially if this
> is neither well documented nor easily to prevent, is worse than bad.

__attribute__((naked, section(".init3"))) void __low_level_init()
{
}
This is "easily prevent" solution. Is it simple enough?

But I vote for not enabling WDT because it leads to different crt libs for 
different mcu families because WDT registers are located at diferent addresses.
I propose opposite solution: empty .init3 section in crt but user can add
__attribute__((naked, section(".init3"))) void __low_level_init()
{
     WDTCTL = WDTPW + WDTHOLD;
}
to his source code to disable WDT and get precisely the same code as in current 
version after linking. Moreover, user can add some peripheral init code here. 
It 
solves problem with different WDT locations, simplifying the library.

By the way you can use those two solutions with current mspgcc version too, so 
I 
think there is no need for additional gcc option such as -menable-watchdog. 
Everything what is needed is to _properly_document_ this tricks.

I think that keeping device-depended WDT disabling code in crt library "just 
because of historical reasons" _can_ lead to more problems with future MSP 
devices.

> besides being less than not obvious, it also digs the gap between mspgcc
> and the 'official' MSP compilers even deeper.
IAR has call to __low_level_init function (library version contain just single 
RET) in their cstartup code and they propose it for peripheral initialization 
_and_ disabling WDT if necessary. No gap. Same function name, same goal. 
Difference is that in gcc we don't need to CALL this function because we can 
inline it.


-- 
Regards,
   Sergey A. Borshch            mailto: sb...@sourceforge.net
     SB ELDI ltd. Riga, Latvia

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to