[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] PC (ProgrammCounter) problems
From: |
Andreas Buhr |
Subject: |
[avr-gcc-list] PC (ProgrammCounter) problems |
Date: |
Tue, 29 Jul 2003 01:42:34 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030622 |
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] PC (ProgrammCounter) problems,
Andreas Buhr <=