Public bug reported:

A "C" source of a Lowpass DSP filter function hangs on CC1 for avr-gcc
4.8x and above but is OK with avr-gcc 4.7x

This code compiled OK with avr-gcc 4.7x on Kubuntu 13.10 but hangs at
CC1 with near 100% CPU usage for any later version of avr-gcc and
Kubuntu. The compilation does complete after a long pause. The code
below demonstrates this problem when compiled to assembler with "avr-gcc
-Wall -S filter.c". The later versions of gcc will compile this code
using "gcc -Wall -S filter.c" without this problem. Kubuntu 14.10, GCC
version 4.9.1 (Ubuntu 4.9.1-16ubuntu6) is OK but the corresponding
version of GCC-AVR for Kubuntu 14.10, gcc-avr 4.8.1+Atmel3.4.4-2 will
hang with near 100% CPU usage, but does eventually complete.

The code below has been part of a commercial production product's
firmware for a number of years and were compiled with gcc-avr on earlier
versions of Kubuntu 13.10.

long Lowpass(long ADC_In)
{
    static long long xv[4] = {0,0,0,0};
    static long long yv[4] = {0,0,0,0};

    // "Mkfilter" Low Pass Filter for the ADC value
    // 3rd order IIR Butterworth 0.2Hz corner frequency
    // Sample Rate 50Hz
    xv[0] = xv[1];
    xv[1] = xv[2];
    xv[2] = xv[3];
    xv[3] = (long long)ADC_In;
    yv[0] = yv[1];
    yv[1] = yv[2];
    yv[2] = yv[3];
    yv[3] =  (xv[0] + xv[3]) + 3 * (xv[1] + xv[2]);
    yv[3] += ((  950976L * yv[0] ) + ( -2900727L * yv[1] )) / 1000000L;
    yv[3] +=  ( 2949736L * yv[2] ) / 1000000L;

    // Scale for filter GAIN and resolution of 10bit ADC
    ADC_In = (long)(yv[3] >> 18);

    return (ADC_In);
}

** Affects: gcc-avr (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1446462

Title:
  CC1 hangs on DSP filter function

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-avr/+bug/1446462/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to