I found two things that are not good:
First is a major problem that I'm not sure how it got this far.
It looks like, when you use Timer_A CCR0 IRQ there is a missing iret
instruction. Here is a snapshot of what I have:
00001a8a <TimerACC0IRQ>:
/***********************************************************************
*******
Timer_A Capture Compare Interrupt Service Routine (CCIFG0):
************************************************************************
******/
interrupt (TIMERA0_VECTOR) TimerACC0IRQ( void )
{
// Clear TAR, this is not 100% accurate, because of IRQ latency.
// But will do for a test
TACTL |= TACLR; // Clear the TAR register.
1a8a: a2 d2 60 01 bis #4, &0x0160 ;r2 As==10
count8m = TACCR0; // Get current value of CCR0
1a8e: 92 42 72 01 mov &0x0172,&0x0200 ;0x0172
1a92: 00 02
1a94: 82 43 02 02 mov #0, &0x0202 ;r3 As==00
__asm__( "reti" );
1a98: 00 13 reti
00001a9a <BasicTimerIRQ>:
}
As you can see, the reti is only there because I specifically added the
__asm__ instruction. Since this is an interrupt, shouldn't the reti be
there automatically?
Second thing I found is an optimizing issue. The very handy
"port4.out.pin7" method of accessing the ports has a slight side effect.
When using it to manually set a pin high, or low, etc. it works great
and is very small code. However, in this example, it is amazing what is
generated. The net effect I want here it to "toggle" the output pin:
port4.out.pin7 = ~port4.out.pin7;
1a52: fb b0 80 00 bit.b #128, 0(r11) ;#0x0080
1a56: 00 00
1a58: 4e 43 clr.b r14 ;
1a5a: 4e 63 adc.b r14 ;
1a5c: 7e e3 xor.b #-1, r14 ;r3 As==11
1a5e: 4e 11 rra.b r14 ;
1a60: 4e 43 clr.b r14 ;
1a62: 4e 10 rrc.b r14 ;
1a64: 6f 4b mov.b @r11, r15 ;
1a66: 7f f0 7f 00 and.b #127, r15 ;#0x007f
1a6a: 4f de bis.b r14, r15 ;
1a6c: cb 4f 00 00 mov.b r15, 0(r11);
I can't even tell what this is doing. This is quite a bit of code for a
simple toggle. A more efficient way would be:
__asm__( " xor.b #0x0080, &0x001d ;\n" );
Both examples were compiled w/ 20030506 version of Win32 release. I
used the following command line:
msp430-gcc -lm -mmcu=msp430x449 -W -Wall -g %2 -o %1.elf %1.c
(%1 is filename and %2 is "-O2")
Any thoughts?
-Mark