Hi all,

Here is a test case that could be used to improve the code generation.

This code:

/************* cut here **************/

#include <io.h>
#include <signal.h>

union {unsigned long l; unsigned int i[2];}  SysTic;
unsigned int Tim1;
unsigned char Code;
interrupt (BASICTIMER_VECTOR) BasicTimerInt(void)
{
  static unsigned long Timer = 384;
  static unsigned char Counter;
  static unsigned char Codes[] = {1, 2, 9, 3, 10, 33, 4, 5, 12, 41};

  SysTic.l++;
  if (Tim1 != 0) Tim1--;

  if (Counter < sizeof(Codes)) {
    if (Timer - SysTic.l > 384) {
      if (Code == 0) {
        Timer += 384;
        Code = Codes[Counter];
        Counter++;
      }
    }
  }
}

/************* cut here **************/

When compiled with this command line:

msp430-gcc -c -mmcu=msp430x449 -I. -g -O1 -funsigned-char \
  -funsigned-bitfields -fpack-struct -fshort-enums \
  -Wall -Wstrict-prototypes -Winline \
  -fregmove -foptimize-register-move -frename-registers -fssa \
  -Wa,-adhlns=test.lst -std=gnu99 test.c -o test.o

Generates code that pushes r14 and r15, even though they are
never used.

$ msp430-gcc --version
msp430-gcc (GCC) 3.2.3
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mspgcc CVS patches as of 2/29/2004.


Thank you guys for this very useful toolchain.

--
Francisco


Reply via email to