Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] saving and restoring context [RSS Feed]

#1 Nov. 19, 2005 16:50:40

juan a.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] saving and restoring context


Hi, Im writing a couple of functions in assembler for the ATMEGA8, and Istore the value of the registers that Im using in the stack, but when I getin to the assembler output generated by winavr, apears at the begining ofthe fuction another context saving of extra registers, is there a way toskip this and do it by my self??!!!how can I skip this lines¡¡¡¡

unsigned char serial_in(){
5c: cf 93 push r28
5e: df 93 push r29
60: cd b7 in r28, 0x3d ; 61
62: de b7 in r29, 0x3e ; 62
64: 21 97 sbiw r28, 0x01 ; 1
66: 0f b6 in r0, 0x3f ; 63
68: f8 94 cli
6a: de bf out 0x3e, r29 ; 62
6c: 0f be out 0x3f, r0 ; 63
6e: cd bf out 0x3d, r28 ; 61

unsigned char Rxbyte;

!!! Is there any way that my fuction starts from here ¡¡¡

asm volatile(
70: 1f 93 push r17
72: 2f 93 push r18
74: 1f b7 in r17, 0x3f ; 63
76: 29 e0 ldi r18, 0x09 ; 9

....

thanks

JAJM




_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#2 Nov. 19, 2005 20:21:02

Joerg W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] saving and restoring context


"juan antonio jimenez martinez" <> wrote:

> Hi, Im writing a couple of functions in assembler for the ATMEGA8,
> and I store the value of the registers that Im using in the stack,
> but when I get in to the assembler output generated by winavr,
> apears at the begining of the fuction another context saving of
> extra registers, is there a way to skip this and do it by my self??

If you want to write entire functions in assembly, better use a
separate assembly source file for them rather than hacking up inline
asm stuff. The inline asm will eventually look rather scary, and as
you can see, you have to play by the rules of the compiler (as it's
the compiler that controls variable allocation etc. still), lest
you'll run into trouble.

--
cheers, J"org .-.-. --... ...-- -.. . DL8DTLhttp://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] saving and restoring context [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support