As BillW suggests, what you're missing is the significance of "gcc doesn't support 20-bit". Using -S as I recommended would show you that gcc is adding a truncation operator around the immediate in your asm statement, because it knows no instruction accepts an immediate larger than 16 bits.
/* #APP */ ; 16 "h.c" 1 movx.a #llo(982782),&__DMA0SA ; 0 "" 2 /* #NOAPP */ Presumably, the same thing is happening in the Zolertia variant you didn't mention that you were using. Take that up with them. BillW's suggestion is unlikely to work because the assembler does not (I believe) support shift operations on operands, but give it a try. The assembler does support 20-bit immediates and appears to properly process certain extended instructions when fed in through asm statements, which was the main concern I had. I have no further suggestions on how you might convince mspgcc to produce acceptable assembler source when the immediate is not a compile-time constant that can become part of the output template in the asm statement, as with: __asm__ __volatile__ ("movx.a #0xefefe,%0":"=m" (DMA0SA)); Peter On Thu, Apr 14, 2011 at 10:50 PM, Eric Decker <cire...@gmail.com> wrote: > > > On Thu, Apr 14, 2011 at 4:21 PM, Peter Bigot <big...@acm.org> wrote: >> >> And yes, if you did it in assembler, you could use a 20-bit immediate. >> >> Peter >> >> >> Can the msp430X instruction set even access a 20 bit immediate field? > > This is kind of what I was getting at.... > > From my original post: > > >> Anyone know how to get 20 bit immediate in gcc extended asm? >> >> ie. >> >> __asm__ __volatile__ ("movx.a %1,%0":"=m" (DMA0SA):"i" (0xefefeUL)); > > Note the immediate field is 0xefefe (20 bits). > >> >> which unfortunately generates... >> >> __asm__ __volatile__ ("movx.a %1,%0":"=m" (DMA0SA):"i" (0xefefeUL)); >> 3b12: 00 18 f2 40 fe fe d2 01 movx.a #65278,&0x001d2;#0x0fefe > > looks like the immediate got tweaked from 0xefefe to 0x0fefe. > > From what I've figured out from the user's guide, I suspect that this should > havebits for the immediate. Am I missing anything? Right now it looks to > me that > generated 00 18 f2 4e fe fe d2 01. And this is a bug in the gcc asm code > in mspgcc > 3.2.3. > > Am I missing anything? > > >> Can the msp430X instruction set even access a 20 bit immediate field? >> > > > -- > Eric B. Decker > Senior (over 50 :-) Researcher > > > ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users