----- Original Message ----- 
From: "Björn Haase" <[EMAIL PROTECTED]>
To: <[email protected]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; 
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
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. 




_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to