Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Problem with watchdog

2005-12-07 by Ake Hedman, eurosource

Tom Walsh wrote:

> Ake Hedman, eurosource wrote:
>
> >I have found part of this problem. The GNU compiler translates
> >
> >WDFEED = 0xAA; WDFEED = 0x55;
> >
> >to
> >
> >710 04c4 8E22A0E3         mov    r2, #-536870904
> >711 04c8 5530E0E3         mvn    r3, #85
> >712 04cc 0030C2E5         strb    r3, [r2, #0]
> >713 04d0 8E22A0E3         mov    r2, #-536870904
> >714 04d4 5530A0E3         mov    r3, #85
> >715 04d8 0030C2E5         strb    r3, [r2, #0]
> >
> >
> >i.e. just writing 0x55.    This is done even if compiled with
> >optimization of.
> >
> >Anyone know how to work around this?
> >
> > 
> >
> do you have WDFEED declared as "volatile"?  This tells gcc not to
> optimize out accesses to that memory, that the memory location may
> change between readings (as in the case of an interrupt writing to that
> location).
>
> example:
>
> volatile char * WDFEED;
>
Thanks Tom,

Yes its defined as

#define WDFEED         (*((volatile unsigned char *) 0xE0000008))

forgetting volatile have bite me so many times during the years. 

/Ake


-- 
 ---
Ake Hedman (YAP - Yet Another Programmer)
eurosource, Brattbergavägen 17, 820 50 LOS, Sweden
Phone: (46) 657 413430 Cellular: (46) 73 84 84 102
Company home: http://www.eurosource.se      
Kryddor/Te/Kaffe: http://www.brattberg.com
Personal homepage: http://www.eurosource.se/akhe
Automated home: http://www.vscp.org

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.