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

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

Re: [avr-gcc-list] global vars


From: Dmitry
Subject: Re: [avr-gcc-list] global vars
Date: Wed, 17 Oct 2001 13:03:59 +0400

true.

I do prefer to use types declared in inttypes.h

so in the example below one has to declare tmp as (u)int32_t or long.
in case of in it reads as

 int tmp
 
 asm volatile (
         "lds r24 tmp \n\t"
         "lds r25 (tmp)+1 \n\t"
         ...
         "sts tmp, ...
         "sts (tmp)+1, ...
 );

also, for faster math and stuff it seems to reasonable to use r24, r26, r28, 
r30 for low byte of tmp...
then tmp can be inctemented, etc. using just one line like 

lds r26, tmp
lds r27, (tmp)+1
addiw r26, 1
sts tmp, r26
sts (tmp)+1, r27




Regards,
Dmitry
 

On Wed, 17 Oct 2001 10:52:54 +0200
Christoph Plattner <address@hidden> wrote:

> Not fully correct !!!
> 
> Type "int" has only 16bits !!! NOT 32 !!!
> 
> Bye
>       Christoph P.
> 
> 
> 
> Dmitry wrote:
> > 
> > try
> > 
> > int tmp
> > 
> > asm volatile (
> >         "lds r24 tmp \n\t"
> >         "lds r25 (tmp)+1 \n\t"
> >         "lds r26 (tmp)+2 \n\t"
> >         "lds r27 (tmp)+3 \n\t"
> >         ...
> >         "sts tmp, ...
> >         "sts (tmp)+1, ...
> > );
> > 
> > at least it works in my case
> > 
> > On Mon, 15 Oct 2001 16:24:10 +0200
> > Torsten Hahn <address@hidden> wrote:
> > 
> > > Hi,
> > >
> > > if i have have defined some global vars, can i access them in an inline
> > > assembler block ? I want do something like this:
> > >
> > > int tmp;
> > >
> > > int main(void)
> > > {
> > > ....
> > > _asm_("read/write/modify tmp here");
> > > ...
> > > }
> > >
> > > CU,
> > > Torsten.
> > > --
> > > Torsten Hahn / Chemnitzer Str. 4 / 09599 Freiberg / Germany
> > > mail: address@hidden
> > > phone: (+49) 177 2181338
> > > pgp key avaiable at: http://math-www.uni-paderborn.de/pgpnet/wwwkeys.html
> > >
> > > _______________________________________________
> > > avr-gcc-list mailing list
> > > address@hidden
> > > http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
> > >
> > 
> > *********************************************************************
> >    ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
> >     `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys
> >     (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
> >   _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
> >  (il),-''  (li),'  ((!.-'                 +7 (812) 314-8860, 5585314
> > *********************************************************************
> > 
> > _______________________________________________
> > avr-gcc-list mailing list
> > address@hidden
> > http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
> 
> -- 
>   +--------V--------+ address@hidden
>   |  A L C A T E L  | -----------------------------
>   +-----------------+ Phone: +43 1 27722 3706 
>          T A S                Fax:   +43 1 27722 3955
> 


*********************************************************************
   ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys 
    (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
  _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
 (il),-''  (li),'  ((!.-'                 +7 (812) 314-8860, 5585314
*********************************************************************



reply via email to

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