I am writing an interrupt-driven app for the ez430-F2012T target
board, and using three switch/case statement inside two interrupt
handlers.
I'm using the TI-supplied IAR Embedded Workbench compiler,
specifically:
IAR C/C++ Compiler for MSP430 V4.10E/W32 [Kickstart] (4.10.5.3).
In one case, the IAR compiler generates a very nice jump table.
In a second, it rejects this statement:
switch (__even_in_range(TAIV,10))
generating the following error:
Error[Ta021]: This intrinsic can only be used as argument
to a switch statement
but accepts this:
switch (TAIV) {
(On an earlier incarnation of this same code, the IAR compiler might
-- or might not -- generate error TA021 depending on the C
statements in one of the 'case' sections.)
In a third case, a swtch() inside the TAIV switch(), the IAR
compiler generates a series of SUB.B/JEQ instructions.
Here's a sample of an error-generating switch() statement:
#include "msp430x20x2.h"
int main( void )
{
switch (__even_in_range(TAIV,10)) {
case 0:
break;
case 2:
TACCR1 = 0;
break;
case 4:
case 6:
case 8:
break;
case 10:
break;
}
return 0;
}
When I attempt to compile this on my system, it generates an
Error Ta021. If I comment out the TACCR1 line, it compiles
successfully.
I've read the EW430_CompilerReference.pdf manual, but other than
the (seemingly random) __even_in_range() intrinsic, it doesn't
say much about controlling the code generated from switch/case
statements.
Can anyone shed some light on this? As a fallback, I could create
a whole mess of functions and create a table of function pointers,
but that adds the call/ret overhead and more stuff on the stack.
Thanks for any suggestions...
Frank McKenney
--
(A)bort, (R)etry, (G)o fishing?
--