[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] gnu-as: Error: invalid sections for operation on `ConfigD
From: |
Erik Christiansen |
Subject: |
Re: [avr-chat] gnu-as: Error: invalid sections for operation on `ConfigDescriptor' and `L0' |
Date: |
Thu, 26 May 2005 12:30:51 +1000 |
User-agent: |
Mutt/1.5.6+20040722i |
On Wed, May 25, 2005 at 12:44:16PM +0200, Jörgen Birkler wrote:
> Command line:
> avr-gcc -c -mmcu=atmega8 -I. -x assembler-with-cpp -save-temps
> -Wa,-ahlms=USB2RS232.lst, -gstabs USB2RS232.s -o
>
> Errors:
> USB2RS232.s:1676: Error: invalid sections for operation on `StatusAnswer'
> and `L0'
> USB2RS232.s:1677: Error: invalid sections for operation on `StatusAnswer'
> and `L0'
>
>
> Offending line example:
> -----
> ComposeGET_STATUS2:
> ldi ZH, high_rom(StatusAnswer<<1) ;ROMpointer to answer
> ldi ZL, low(StatusAnswer<<1)
> rjmp ComposeEndXXXDescriptor ;and complete
>
> -----
> Defines:
> #define high_rom(x) ((x)>>8)
> #define low(x) ((x) & 0xFF)
>
Jörgen,
The situation is much much simpler than it appears. :-)
Please replace
ldi ZH, high_rom(StatusAnswer<<1)
with
ldi ZH, hi8(StatusAnswer)
Then the error should vanish. Your two problems are summarised in a
note I wrote to myself:
Debug: "Error: invalid sections for operation on `L0' and `some_progmem_label'"
Cause: ldi ZH,hi8(some_progmem_label<<1) OR
ldi ZL,pm_lo8(2*some_progmem_label)
Diagn: IAR has only high/low modifiers, and needs the manual <<1 hack.
Fix: GCC has two modifier pairs, used as follows:
hi8/lo8 treat the data or progmem label as a byte address, e.g. for use
with lpm. (So manual doubling, as in Atmel examples, is harmful.)
pm_hi8/pm_lo8 treat the progmem label as byte_address/2, e.g. for use
with icall.
Given that, I doubt you'll have much doubt about when to use which,
seeing you've gone as far as providing operators of your own, but a
quick look at the resulting list file quickly sorts that out.
hth,
Erik