Hi Dmitry,

I think this problem is for you.......

I have a delay loop for a slow LCD interface. This includes the following routine:

static __inline__ void delay_b(void)
{
        int i;

        for (i = 90;  i > 0;  i--)
                __asm__ __volatile__("; loop");
}


Compiled with the current mspgcc, this is optimsed to nothing. I reported this problem before. It seemed to be fixed a week or two ago, but is now back. A slightly modified routine:

static __inline__ void delay_b(void)
{
        int i;

        for (i = 90;  i > 0;  i--)
                _NOP();
}

produces a single NOP instruction, and there is no reason why it should not. However, if you take away the __inline__ you get something unexpected. You get 30 nop instructions, with a loop around them to repeat them 3 times. This is correct, but not very efficient :-)

The above effects are with -O2 optimisation.

Regards,
Steve



Reply via email to