Looks like changes in gcc 4.7 result in that declaration being added as a
common block declaration in the assembly, and it's not syntactically valid
since the asm statement substitutes the address whereever the name would
normally be given.  Making the declaration static inhibits this invalid
declaration:

static volatile unsigned int flag __asm__("0x2300");

Peter

On Tue, Feb 5, 2013 at 3:33 PM, Jose Luis Honorato L. <
joseluishonor...@gmail.com> wrote:

> I just installed the latest mspgcc version (4.7 20120911) and I'm having
> trouble placing variables in specific memory locations with the __asm__
> attribute.
>
> I've written a simple test program:
>
> #include <msp430.h>
> volatile unsigned int flag __asm__("0x2300");
> int main(void) {
>     WDTCTL = WDTPW + WDTHOLD;
>     if(flag) {
>     P1SEL &= ~BIT0;
>     P1DIR |= BIT0;
>     P1OUT |= BIT0;
>     }
>     LPM3;
>     return 0;
> }
>
> Compiled it with:
>
> msp430-gcc -mmcu=msp430f5529 -save-temps -mmemory-model=small src/main.c
>
> The error message I get is:
>
> main.s: Assembler messages:
> main.s:7: Error: expected symbol name
>
> And the generated assembler looks like this:
> .file "main.c"
>  .arch msp430f5529
> .cpu 430xv2
> .mpy 32dw
>  .cpux_target sr20
>
> .comm 0x2300,2,2
>  .section .init9,"ax",@progbits
> .p2align 1,0
>  .global main
> .type main, @function
> /***********************
>  * Function `main'
>  ***********************/
> main:
> mov r1, r4
>  add #4, r4
> mov #23168, &__WDTCTL
>  mov &0x2300, r15
> cmp #0, r15
>  jeq .L2
> mov.b &__PASEL_L, r15
>  and.b #-2, r15
> mov.b r15, &__PASEL_L
>  mov.b &__PADIR_L, r15
> bis.b #1, r15
>  mov.b r15, &__PADIR_L
> mov.b &__PAOUT_L, r15
>  bis.b #1, r15
> mov.b r15, &__PAOUT_L
> .L2:
> bis #208, r2
> mov #0, r15
> .LIRD0:
> .size main, .-main
> .ident "GCC: (GNU) 4.7.0 20120322 (mspgcc dev 20120911)"
>
> The versions of the tools I'm using:
> msp430-gcc (GCC) 4.7.0 20120322 (mspgcc dev 20120911)
> GNU assembler (GNU Binutils) 2.22 (mspgcc dev 20120911)
>
> I'm not familiar at all with the 20-bit series, but I'd like to know if I'm
> missing a command line option or something else.
>
> Kind regards,
> Jose
>
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
>
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to