avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] WinAVR - gcc 3.4.6 - AVR Studio - DuoCore PC - Stackp


From: Steffen Rose
Subject: Re: [avr-gcc-list] WinAVR - gcc 3.4.6 - AVR Studio - DuoCore PC - Stackpointer problem
Date: Thu, 23 Nov 2006 10:27:03 +0100
User-agent: KMail/1.9.1

Hello,

On Wednesday 22 November 2006 00:29, Henrik Maier wrote:
> The issue may not relate to your build environment. Are you
> using external RAM with the AT90CAN128? If yes, make sure the
> SP never points to external RAM as the silicon has a bug which
> can cause corruption of the stack. Refer to datsheet Errata
> Rev C: "Miss-functioning when code stack is in XRAM"

In every case not external RAM is used. The problem is, that 
different code is generating. We didn't have any idea, why.
The Source is the same on all PCs. The AVR Studio use additional 
options to generate Makefiles and dependencies and the AVR 
Studio move the working directory in different way than the 
Makefiles working on the correct PCs.

Source code:
void FlushMbox(void)
{
BUFFER_ENTRY_PTR_T pBuffer; /* pointer */
CAN_MSG_PTR_T pCAN_Msg; /* pointer */
BUFFER_INDEX_T cnt = 10; /* unsigned char */
    ;
    if ((coLibFlags & (0xff))) {
      flagIdentification();
    }

...

Correct code:
.global FlushMbox
        .type   FlushMbox, @function
FlushMbox:
.LFB15:
.LM113:
/* prologue: frame size=0 */
        push r17
        push r28
        push r29
/* prologue end (size=3) */
.LM114:
        lds r24,coLibFlags
        tst r24
        breq .L76
.LM115:
        call flagIdentification


wrong code:
        PUSH R17
        PUSH R28
        PUSH R29
        IN R30,0x3D
        IN R31,0x3E
        SUBI R30,0x4A
        SBCI R31,0x10
        STD Z+0,R1
        LDS R24,0x500
        TST R24
        BREQ PC+0x03
        CALL 0x12A


The Subtraction 0x104A from the Stackpointer is very high.
(And outside of the stack in this case, it's now I/O area adress 
0xB0)

Ideas?

> Steffen Rose wrote:
> > our Sourcecode compiled on different PCs with WinAVR works
> > correctly. But we have one PC, where compiled the same
> > Source, the binary is corrupt. 

> > The PC is an DuoCore PC. The corrupt compilation is done
> > with the AVR Studio IDE and WinAVR with avr-gcc 3.4.6.

> > The working compilation is done on "SingleCore" PCs with
> > cygwin make (complete cygwin, not the minimal version from
> > WinAVR).

-- 
Regards
Steffen Rose





reply via email to

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