Hi! Don't you get any warnings when compiling your code? I never used assembler directly, only as inline assembler through C++, but looking at your code and the mspgcc include files I have here, I wonder where U0TXBUF is defined for assembly use. The normal include files (msp430x12x2.h and all susequently loaded files) define U0TXBUF (after resolving some more macro operations) as
volatile unsigned char x asm(#U0TXBUF_) which of course makes no sense to the assembler. Or evaluates to zero (stange!). The address value itself is defined as #define U0TXBUF_ 0x0077 The macro conversions to "U0TXBUF" ensure that the C compiler will treat it as a BYTE value (which is undetermined by just the address). If you use the definitions with the appended underscore, it should work. Of course if you're using different include files than those in msp430/include, things are likely to be different. ;) JMGross ----- Ursprüngliche Nachricht ----- Von: david feldman An: [email protected] Gesendet am: 11 Aug 2009 23:58:22 Betreff: [Mspgcc-users] Unexpected output from msp430-gcc assembler (simple problem?) I'm having trouble getting the msp430-gcc assembler to emit working code in this example (target is MSP430F1232) - it appears the symbol U0TXBUF (which should point to the UART transmit data register) is getting assembled as 0, not hex 77 (I don't think this is unique to U0TXBUF or my target - I am sure this is an operator problem (me) but so far I'm stumped...) Here is the source code fragment given to msp430-gcc (with command line msp430-gcc -c f.s -o f.out): .arch msp430x1232 #include .org 0xE000 .text main: mov.b #0x42, &U0TXBUF >From this source code, I end up with this non-working binary: F2 40 42 00 00 00 The problem appears to be &U0TXBUF getting assembled as hex bytes 00 00 rather than hex bytes 77 00. However, if I try this: .arch msp430x1232 #include .org 0xE000 .text main: mov.b #0x42, &0x77 I end up with the binary I expected: F2 40 42 00 77 00 I'm very much a beginner with msp430-gcc (and gcc in general), and trying to get a working command-line development environment (no IDE) on Linux. Thanks very much, Dave _________________________________________________________________ Get your vacation photos on your phone! http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL-HM ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Mspgcc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mspgcc-users
