[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] PC (ProgrammCounter) problems
From: |
Larry Barello |
Subject: |
Re: [avr-gcc-list] PC (ProgrammCounter) problems |
Date: |
Mon, 28 Jul 2003 17:05:38 -0700 |
Besides the obvious:
lo8()
hi8()
which are the first and second byte of a "short" or "long"
There are the Program Memory equivalents:
pm_lo8()
pm_hi8()
which do the divide by 2. There is also
hlo8() Third byte of long
hhi8() fourth byte of long
There is also the hh8() and pm_hh8() which I have no clue what they do.
Probably the
third byte for future addressing in future avr's...
This isn't documented anywhere.
Cheers!
----- Original Message -----
From: "Andreas Buhr" <address@hidden>
To: <address@hidden>
Sent: Monday, July 28, 2003 6:42 PM
Subject: [avr-gcc-list] PC (ProgrammCounter) problems
> Hello all!
>
> Could you please help me?
>
> I write assembler-apps and want to compile them with avr-as/avr-ld.
> I often use lapels as arguments.
> For example I wan to push the address of a function on the stack:
>
> In AVRStudio this works:
>
> myfunction:
> nop
> nop
> ldi r16, low(myfunction)
> push r16
> ldi r16, high(myfunction)
> push r16
> ret
>
> (it is a loop)
>
> How to do this with avr-as? In avr-as 'myfunction' is exactly twice what
> it should be. So this is working code for avr-as:
>
> myfunction:
> nop
> nop
>
> ldi r16, lo8(myfunction)
> ldi r17, hi8(myfunction)
> lsr r17
> ror r16
> push r17
> push r16
> ret
>
> But I don't want to have the lsr and ror. There are two instructions
> wasted. I am searching for something like:
> ldi r16, lo8(myfunction>>1)
> or
> ldi r16, lo8(myfunction/2)
>
> These two instructions give errors:
> Error: invalid sections for operation on `myfunction' and `L0'
>
> any help?
>
> thanks in advance
>
> Andreas Buhr
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
>