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

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

[avr-libc-dev] make main a normal function


From: Anatoly Sokolov
Subject: [avr-libc-dev] make main a normal function
Date: Sat, 3 Jun 2006 20:28:57 +0400

----- Original Message ----- 
From: "Björn Haase" <address@hidden>
To: <address@hidden>
Cc: <address@hidden>; <address@hidden>; <address@hidden>; 
<address@hidden>; <address@hidden>
Sent: Friday, May 12, 2006 3:44 PM
Subject: [avr-libc-dev] [PATCH series] AVR: add support for new 
controllerfamily to binutils, gcc and avr-libc

Hello.

> 2.) make main a normal function
>
> As discussed on the avr-libc-dev list, it is desirable that main() is just
> an ordinary function like any other. The stack pointer initialization is
> now only located in the gcrt1.S file of the avr-libc.
>

Well, 'main' function is now called using the 'CALL' instruction instead 
'JMP'. But on devices which  have hardware stack we permanently lose 1 stack 
level from 3, that can lead error in projects for 'avr1' devices. I suggest 
to use for 'avr1' devices JMP instruction for calling 'main' function.

Index: avr-libc/crt1/gcrt1.S
===================================================================
RCS file: /sources/avr-libc/avr-libc/crt1/gcrt1.S,v
retrieving revision 1.8
diff -u -r1.8 gcrt1.S
--- avr-libc/crt1/gcrt1.S       10 Nov 2005 21:12:09 -0000      1.8
+++ avr-libc/crt1/gcrt1.S       3 Jun 2006 15:41:37 -0000
@@ -196,6 +196,11 @@
 #endif /* !__AVR_ASM_ONLY__ */

        .section .init9,"ax",@progbits
+#ifdef __AVR_ASM_ONLY__
        XJMP    main
+#else
+       XCALL   main
+       XJMP    exit
+#endif /* __AVR_ASM_ONLY__ */
 ;      .endfunc


PS: Björn, please, create one patch for one change.  It will be easy to 
understand and testing.

Anatoly. 






reply via email to

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