On Tue, Aug 7, 2012 at 12:27 AM, James Brown <james.br...@alcolizer.com> wrote:
> Hi Everyone,
>
> I'm using an msp430f235 which has a 16x16 hardware multiplier but the
> msp430-gcc does not produce code to utilise the hardware multiplier,
> instead it generates a software multiply function.
>
> My final linker command looks like the following:
> /usr/bin/msp430-gcc -mmcu=msp430f235 -mmpy=16 -O2
> -Wa,-adhlns=output/S5S.elf  -o output/S5S.elf output/.obj/Main.o
> output/.obj/SysConf.o output/.obj/System.o output/.obj/Version.o
> output/.obj/hw_io.o output/.obj/FCell.o
>
> I'm using the following gcc version from the arch linux distro
> msp430-gcc (mspgcc_20120406) 4.6.3 20120301 (mspgcc LTS 20120406 unpatched)
>
> What am I doing wrong?  How do I get gcc to utilise the HW multiplier
> correctly (with interrupt disabling)?

You need to provide -mmcu=msp430f235 option both when compiling and linking.

You do not need to provide the -mmpy=16 option: any multiplier
available on an MCU is automatically defaulted to enabled when -mmcu
option is provided.

You do not need to specify any particular level of optimization.

mspgcc automatically disables interrupts around all multiplier
accesses, unless you provide the -mnoint-hwmul option in which case no
multiplier accesses are protected.

llc[27]$ cat /tmp/f.c
int domult (int a, int b) { return a * b; }
llc[28]$ msp430-gcc -S -Os -mmcu=msp430f235 /tmp/f.c
llc[29]$ cat f.s
        .file   "f.c"
        .arch msp430f235
        .cpu 430
        .mpy 16se

        .text
        .p2align 1,0
        .global domult
        .type   domult, @function
/***********************
 * Function `domult'
 ***********************/
domult:
        push    r2
        dint
        nop
        mov     r15, &__MPYS
        mov     r14, &__OP2
        mov     &__RESLO, r15
        pop     r2
        ret
        .size   domult, .-domult
        .ident  "GCC: (GNU) 4.7.0 20120322 (mspgcc dev 20120716)"



>
> Thanks,
> James
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to