Bug 2626

Summary: Problems with LPM on attiny26
Product: binutils Reporter: Hakan Ardo <hakan>
Component: gasAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: bug-binutils, eric.weddington, joachim.falk
Priority: P2    
Version: 2.16   
Target Milestone: ---   
Host: i486-linux-gnu Target: avr
Build: i486-linux-gnu Last reconfirmed:
Attachments: The FIX. Patch is against GNU assembler 2.17.50 20060817 Debian GNU/Linux + coff-avr-patch (20050630)

Description Hakan Ardo 2006-05-01 09:07:00 UTC
Forwarding debian bug #362270 from Terran Melconian <terran@consistent.org>:

The attiny26 supports some forms of the LPM (load program memory)
instruction, but under certain circumstances GAS produces an incorrect
error claiming that it does not.

There are three forms of the LPM instruction.  They are:

    i.	    LPM			(r0 is implied destination)
    ii.	    LPM destreg, Z
    iii.    LPM	destreg, Z+

(reference: Atmel AVR instruction set reference, revision 06/99, page
79)

Of these, the attiny26 supports forms i and ii but not iii.
(reference:  Atmel attiny26 datasheet, revision 1477G 03/05, page 170)

avr-as will assemble form i, but refuses to assemble forms ii or iii.
Since the datasheet states that form ii *is* supported on this part, I
believe this to be a bug.

Of course it is possible that it is an error in the manufacturer's
datasheet, and that as' behavior is in fact correct, but barring
explicit information to the contrary I must assume that the
manufacturer's datasheet is authoritative.
Comment 1 Joachim Falk 2008-02-06 20:42:58 UTC
Created attachment 2236 [details]
The FIX. Patch is against GNU assembler 2.17.50 20060817 Debian GNU/Linux + coff-avr-patch (20050630)

The bugfix has been tested with attiny26 and attiny2313.
Where gas now allows lpm r,z for attiny26 but generates
"xxx.S:Nr: Error: postincrement not supported" errors
for lpm r,z+. As before attiny2313 allow both forms of
the lpm instruction.

Cheers,
Joachim Falk
Comment 2 Nick Clifton 2008-02-14 13:04:50 UTC
Hi Hakan,

  Thanks for submitting this fix.  I have applied it along with these changelog
entries.

Cheers
  Nick

include/opcode/ChangeLog
2008-02-14  Hakan Ardo  <hakan@debian.org>

	PR gas/2626
	* avr.h (AVR_ISA_2xxe): Define.

gas/ChangeLog
2008-02-14  Hakan Ardo  <hakan@debian.org>

	PR gas/2626
	* config/tc-avr.c (mcu_types): Change the ISA tyoe of the attiny26
	to AVR_ISA_2xxe.
	(avr_operand): Disallow post-increment addressing in the lpm
	instruction for the attiny26.
Comment 3 Hakan Ardo 2008-02-14 15:10:40 UTC
Subject: Re:  Problems with LPM on attiny26

Hi,
I only forwarded this bugrepport from the debian bts, the fix was done
(as far as I can tell) by joachim dot falk at gmx dot de, and you
should probably contribute it to him and not to me.

On 14 Feb 2008 13:04:51 -0000, nickc at redhat dot com
<sourceware-bugzilla@sourceware.org> wrote:
>
>  ------- Additional Comments From nickc at redhat dot com  2008-02-14 13:04 -------
>  Hi Hakan,
>
>   Thanks for submitting this fix.  I have applied it along with these changelog
>  entries.
>
>  Cheers
>   Nick
>
>  include/opcode/ChangeLog
>  2008-02-14  Hakan Ardo  <hakan@debian.org>
>
>         PR gas/2626
>         * avr.h (AVR_ISA_2xxe): Define.
>
>  gas/ChangeLog
>  2008-02-14  Hakan Ardo  <hakan@debian.org>
>
>         PR gas/2626
>         * config/tc-avr.c (mcu_types): Change the ISA tyoe of the attiny26
>         to AVR_ISA_2xxe.
>         (avr_operand): Disallow post-increment addressing in the lpm
>         instruction for the attiny26.
>
>
>  --
>            What    |Removed                     |Added
>  ----------------------------------------------------------------------------
>              Status|WAITING                     |RESOLVED
>          Resolution|                            |FIXED
>
>
>
>
>  http://sourceware.org/bugzilla/show_bug.cgi?id=2626
>
>  ------- You are receiving this mail because: -------
>  You reported the bug, or are watching the reporter.
>