[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] GDB5.3 and ret instruction

From: Marek Michalkiewicz
Subject: Re: [avr-gcc-list] GDB5.3 and ret instruction
Date: Mon, 5 May 2003 22:25:54 +0200
User-agent: Mutt/1.4i

On Mon, May 05, 2003 at 08:32:44PM +0200, Marko Panger wrote:
> My memoty looks like:
> $402 : 0x85
> $403 : 0x01
> Before "ret / reti" instruction is executed my stack pointer points to 0x400 
> and since this instruction uses a pre-increment scheme the return address 
> should be feched from 0x402, but only 0x85 is fetched and the PC jumps to 
> 0x10A instead of 0x30A.

Return addresses are stored on stack in big endian byte order (no
idea why, since AVR is otherwise little endian - ask Atmel :), and
pre-increment is by one byte.  So, if SP is 0x400, the high byte
will be fetched from address 0x401 and low byte from 0x402.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]