The manual offers a solution for early watchdog disabling in .init3.
However, the code uses a global variable to store the current value of
MCUSR. Isn't this variable cleared again in .init4? Did I miss something?
Anyway, it should be noted, that using .init3 may not work under certain
Answering my own questions:
No idea what __init() is intended to do, but it won't help: No
initialized stack pointer, no return.
Using any earlier section than .init3 provides another problem: No
initialized __zero_reg__, no MCUSR or watchdog clear.
To avoid overriding the mirror variable,
As Harald Kipp wrote:
No idea what __init() is intended to do, but it won't help: No
initialized stack pointer, no return.
__init() is the name of the routine jumped to from the reset vector.
crtXXX.o provides a default implementation which is marked weak, so
you could overlay it by your own.