Home >> Information >> Comparison of C Compilers for the AVR

Comparison of C Compilers for the AVR

Analyse the efficiency and speed of the code Generated by IAR, CodeVisionAVR, ICCAVR and AtmanAvr.

Comparison of the code efficiency through a test program:

void Delay(void)
{
    unsigned char a, b;
    for (a =1;a;a++)
        for (b =1;b;b++)
            ;
}

void LED_On(int i)
{
PORTB=~(1<<i);
Delay(); } void main(void) { int i; MCUCR=0x00; DDRB =0xFF; PORTB =0xFF; while (1) { for (i =0;i <8;i++) LED_On(i); for (i =8;i >0;i--) LED_On(i); for (i =0;i <8;i +=2) LED_On(i); for (i =7;i >0;i -=2) LED_On(i); } }
Generated code size:
Compiler Code Size(byte)
IAR 413
ICCAVR 311
CodeVisionAVR 327
AtmanAvr(GCC) 211
KEIL51 136
Note: For KEIL51 Change 'PORTB' for 'P1'. For AtmanAvr Change 'void main' for 'int main'.

Comparison of the code running time through a floating-point program:

void main(void)
{
    float x,y,z;
    x = 1.0;
    y = 2.0;
    z = sin(x+y);
}
Running time with 8MHz
Compiler Code Size(byte)
Running Time
Efficiency
IAR 1237 747.5us
7.09
ICCAVR 1991 950.75us
5.58
CodeVisionAVR 1267 521us
10.17
AtmanAvr(GCC) 1292 728.25us
7.28
KEIL51 1403 5.301ms
1
Note: For AtmanAvr Change 'void main' for 'int main'.