avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Stack pointer loaded on main entry?


From: Harald Kipp
Subject: Re: [avr-libc-dev] Stack pointer loaded on main entry?
Date: Fri, 07 Mar 2003 12:53:21 +0100

Joerg,

Wow, you're fast. Thanks for the quick reply.

Don't use main().

[Very tiny letters] Mmmhh...grumble...but I want to[/vtl]

In the compiler source (avr.c) I found the part that's
responsible:

  if (main_p)
    {
      fprintf (file, ("\t"
                      AS2 (ldi,r28,lo8(%s - %d)) CR_TAB
                      AS2 (ldi,r29,hi8(%s - %d)) CR_TAB
                      AS2 (out,__SP_H__,r29)     CR_TAB
                      AS2 (out,__SP_L__,r28) "\n"),
               avr_init_stack, size, avr_init_stack, size);

      prologue_size += 4;
    }


You could perhaps achieve this by using something like

#define main task_main

Looks like this is the way to go. I had to redefine it for
internal RTOS use anyway, because

   start_thread(main, foo, bar);

added another problem.

Thanks again,

Harald





reply via email to

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