Hi Fintan,

Could you give us a clue what you think is wrong?

Fintan McAndrew wrote:

Hello there,

I'm having a problem with the the msp430-gcc compiler when i use the
optimisation flag -02.
The problem relates to a section of code in my serial RX ISR. I have
included the incorrect code listing below and as you can see @ f278 there is
no actual code for the "serialHdrPtr" address assignment. When i take out
the -O2 flag everything build correctly. Is this a bug with the mp430-gcc ?
as this definitly should not be happening. All ideas and help welcome as i
would like to turn on opitimisation prioir to first field code release.


/*listing for the UART0 RX ISR routine */

  if (transmitting == 0)

   f268:        c2 93 93 02     cmp.b   #0,     &0x0293     ;r3 As==00
   f26c:        10 20           jnz     $+34            ;abs 0xf28e

OK so far

        transmitting = 1;
   f26e:        d2 43 93 02     mov.b   #1,     &0x0293     ;r3 As==01

still OK

        serialBuffPtr = (unsigned char *)&serialBuff[0];
   f272:        b2 40 0a 02     mov     #522,   &0x0200     ;#0x020a
   f276:        00 02

still OK

        serialDataCnt = 0;
   f278:        c2 43 08 02     mov.b   #0,     &0x0208     ;r3 As==00

still OK

        serialHdrPtr = (unsigned char *)&serialHdrBuff[0];
        serialHdrCnt =0;
                 U0TXBUF = *serialHdrPtr++;
   f27c:        d2 42 04 02     mov.b   &0x0204,&0x0077 ;0x0204
   f280:        77 00
   f282:        b2 40 05 02     mov     #517,   &0x0202     ;#0x0205
   f286:        02 02
        serialHdrCnt++;
   f288:        d2 43 90 02     mov.b   #1,     &0x0290     ;r3 As==01
   f28c:        35 3c           jmp     $+108           ;abs 0xf2f8

Now things have got rearranged. The "=0" and "++" for serialHdrPt rhave been merged into "=1". The assignment to the port looks OK. serialHdrPtr has been assigned one beyond the start of the buffer, so the "++" has been eliminated.

  }
Am I missing something, or did you?

Regards,
Steve



Reply via email to