[En-Nut-Discussion] Watchdog Debugging

Harald Kipp harald.kipp at egnite.de
Wed Sep 24 20:03:11 CEST 2008


Timothy M. De Baillie wrote:

> One idea that crossed my mind would be very simple to implement across 
> the OS and user code.  If you could assign a specific piece of memory 
> (say 4 bytes of high heap memory) to keep thread flags, upon reboot, 
> your program could detect a watchdog reboot and then report the 4 bytes 
> back to the user.

If you search in the Configurator for NUTMEM_RESERVED, you'll find a 
default of 64, which creates an array in arch/avr/os/nutinit.c:
uint8_t nutmem_onchip[NUTMEM_RESERVED];

If I remember correctly, this had been used to reserve some memory in 
internal AVR RAM, which can be used while manipulating the address 
lines. One application is to access the hidden external RAM, that 
overlaps the internal addresses. The implementation is so awful, that I 
would like to delete it immediately.

However, the right way may be to put nutmem_onchip in a different 
segment. I remember, that avr-libc offers an uninitialized data segment, 
which won't be touched by the runtime initialization. If we manage to 
force it into internal RAM, this array could provide both features.

In any case I agree, that your suggestions would be most helpful for 
debugging.

Harald





More information about the En-Nut-Discussion mailing list