[En-Nut-Discussion] NutThreadSwitch and debug build

Harald Kipp harald.kipp at egnite.de
Thu Feb 10 09:14:19 CET 2005


Pete,

At 17:41 09.02.2005 +0000, you wrote:

>I fixed the problem by adding "__attribute__ ((naked)" to the declaration 
>for NutThreadSwitch thus:
>
>void NutThreadSwitch(void) __attribute__ ((noinline)) __attribute__ ((naked));

Really a bad bug.


>BTW.  I notice that some code, eg NutInit(), writes to 0x005D to set the 
>ATmega128 stack pointer, whereas other code, eg NutThreadSwitch(), writes 
>to 0x003D to do this.
>Is this anything to do with the different instruction used in each case - 
>out .v. sts ?

Yes, the AVR architecture uses memory area 0x20-0x5F for direct
port access at 0x00-0x3F. This saves 2 address bits in the
RISC code.

Harald




More information about the En-Nut-Discussion mailing list