Quantcast

Bug in MSP430-AS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bug in MSP430-AS

Kees Schoenmakers
Hello All,

I have a project which is build with IAR in the past and contains a
couple of assembly sources.
When building it with the lastest binutils(msp430-as) I am struck with
a bug in calculation of offsets. ALL versions of msp430-as, the latest
included, generate faulty code here.

I simplified one code sample to

intern1:        mov             #1,r15
                   dec             r14
                   jz              lab1
                   nop
                   jmp             lab2

intern2:        dec             r15
                   jnz             intern2
                   ret

lab1:           mov             #2,r14
                  call    intern1
                  call    intern2
                  ret

lab2:           mov             #3,r13
                  ret
                  .end

When I assemble it with
msp430-as -c bug430as.S

the resulting code shows weird offsets for the 'jumps' (jmp, jz jnz),
even the calls...

What is happening here?  In the final linked binary with a lot of .c
and .S files the offsets are also wrong in the same way.
Another project, solely of .c files runs well....

Kees

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in MSP430-AS

Peter Bigot-4
Please clarify whether you are using msp430-as (from mspgcc) or
msp430-elf-as (from upstream binutils).  Several bugs like this were
fixed for mspgcc, but I don't believe RH picked up the fixes.  There's
discussion in the archive around February 2012 on this, and it's fully
documented on the mspgcc wiki but SourceForge isn't serving up those
pages right now.

Peter

On Mon, Mar 24, 2014 at 4:53 AM, Kees Schoenmakers <[hidden email]> wrote:

> Hello All,
>
> I have a project which is build with IAR in the past and contains a
> couple of assembly sources.
> When building it with the lastest binutils(msp430-as) I am struck with
> a bug in calculation of offsets. ALL versions of msp430-as, the latest
> included, generate faulty code here.
>
> I simplified one code sample to
>
> intern1:        mov             #1,r15
>                    dec             r14
>                    jz              lab1
>                    nop
>                    jmp             lab2
>
> intern2:        dec             r15
>                    jnz             intern2
>                    ret
>
> lab1:           mov             #2,r14
>                   call    intern1
>                   call    intern2
>                   ret
>
> lab2:           mov             #3,r13
>                   ret
>                   .end
>
> When I assemble it with
> msp430-as -c bug430as.S
>
> the resulting code shows weird offsets for the 'jumps' (jmp, jz jnz),
> even the calls...
>
> What is happening here?  In the final linked binary with a lot of .c
> and .S files the offsets are also wrong in the same way.
> Another project, solely of .c files runs well....
>
> Kees
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Mspgcc-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in MSP430-AS

Kees Schoenmakers
Hi Peter,

I believe I did in the post.

GNU assembler (GNU Binutils) 2.24.51.20140324
Copyright (C) 2014 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `msp430-elf'.


I did:    msp430-elf-as  -c  bug430as.S

and checked with msp430-elf-objdump -DS a.out

best regards

Kees

PS for what it's worth: all msp430-as versions (Underwood GNU
assembler (GNU Binutils) 2.18),  2.22 (mspgcc dev 20120911), and the
latest produce this kind of result

On 3/24/14, Peter Bigot <[hidden email]> wrote:

> Please clarify whether you are using msp430-as (from mspgcc) or
> msp430-elf-as (from upstream binutils).  Several bugs like this were
> fixed for mspgcc, but I don't believe RH picked up the fixes.  There's
> discussion in the archive around February 2012 on this, and it's fully
> documented on the mspgcc wiki but SourceForge isn't serving up those
> pages right now.
>
> Peter
>
> On Mon, Mar 24, 2014 at 4:53 AM, Kees Schoenmakers <[hidden email]>
> wrote:
>> Hello All,
>>
>> I have a project which is build with IAR in the past and contains a
>> couple of assembly sources.
>> When building it with the lastest binutils(msp430-as) I am struck with
>> a bug in calculation of offsets. ALL versions of msp430-as, the latest
>> included, generate faulty code here.
>>
>> I simplified one code sample to
>>
>> intern1:        mov             #1,r15
>>                    dec             r14
>>                    jz              lab1
>>                    nop
>>                    jmp             lab2
>>
>> intern2:        dec             r15
>>                    jnz             intern2
>>                    ret
>>
>> lab1:           mov             #2,r14
>>                   call    intern1
>>                   call    intern2
>>                   ret
>>
>> lab2:           mov             #3,r13
>>                   ret
>>                   .end
>>
>> When I assemble it with
>> msp430-as -c bug430as.S
>>
>> the resulting code shows weird offsets for the 'jumps' (jmp, jz jnz),
>> even the calls...
>>
>> What is happening here?  In the final linked binary with a lot of .c
>> and .S files the offsets are also wrong in the same way.
>> Another project, solely of .c files runs well....
>>
>> Kees
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their
>> applications. Written by three acclaimed leaders in the field,
>> this first edition is now available. Download your free book today!
>> http://p.sf.net/sfu/13534_NeoTech
>> _______________________________________________
>> Mspgcc-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>>
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Loading...