Thanks westfw, using ISR_NAKED fixed my resetting problem with the #included file in the ISR. Presumably because I did my own reti the stack crashed after a while because the postamble never got executed.
Now how do I get the IDE to link in the .S file? The only thing I can see is Sketch>Add file which appears to do nothing.
EDIT: This works
#include "atmon_isr.s"
ISR (WDT_vect, ISR_NAKED)
{
asm("jmp WDT_vect\n");
}
but is no different to
ISR (WDT_vect, ISR_NAKED)
{
#include "atmon_isr.s"
}
And still needs a .S with all the asm("") stuff.
Rob