0

I am trying to compile my code but keep getting this error:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp: In function 'main':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: r28 cannot be used in asm here

 }

 ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: r29 cannot be used in asm here

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: r28 cannot be used in asm here

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: r29 cannot be used in asm here

lto-wrapper: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Code:

#define LOG_OUT 0        
#define LIN_OUT 1
#define FFT_N 256    

#include <FFT.h>        
#include <FastLED.h>  
#include <math.h>  
#define DATA_PIN 3 
#define NUM_LEDS 10
CRGB leds[NUM_LEDS];
float faktoren[10] = {1, 1.1, 1.15, 1.25, 1.45, 1.55, 1.75, 1.8, 2, 3};       //factors to increase the height of each column
unsigned char hs[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};                        //height of each column
float hue = 0; 

unsigned char grenzen[11] = {0,3,5,7,9,11,13,16,24,32,69};          //borders of the frequency areas


void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, GRB> (leds, NUM_LEDS);
  Serial.begin(115200);                                             //use the serial port
  TIMSK0 = 0;                                                       //turn off timer0 for lower jitter
  ADCSRA = 0xe5;                                                    //set the adc to free running mode
  ADMUX = 0b01000111;                                               //use pin A7
  DIDR0 = 0x01;                                                     //turn off the digital input for 
  analogReference(EXTERNAL);                                        //set aref to external

}

void loop() {
  while(1) {                                                        //reduces jitter
    cli();                                                          //UDRE interrupt slows this way down on arduino1.0
    for (int i = 0 ; i < 512 ; i += 2) {                            //save 256 samples
      while(!(ADCSRA & 0x10));                                      //wait for adc to be ready
      ADCSRA = 0xf5;                                                //restart adc
      byte m = ADCL;                                                //fetch adc data
      byte j = ADCH;
      int k = (j << 8) | m;                                         //form into an int
      k -= 0x0200;                                                  //form into a signed int
      k <<= 6;                                                      //form into a 16b signed int
      fft_input[i] = k;                                             //put real data into even bins
    }

    fft_window();                                                   // window the data for better frequency response
    fft_reorder();                                                  // reorder the data before doing the fft
    fft_run();                                                      // process the data in the fft
    fft_mag_lin();                                                  // take the output of the fft
    sei();

    fft_lin_out[0] = 0;
    fft_lin_out[1] = 0;

    for(unsigned char i = 0; i < 11; i++){
      unsigned char maxW = 0;
        for(unsigned char x = grenzen[i]; x < grenzen[i+1];x++){

           if((unsigned char)fft_lin_out[x] > maxW){
            maxW = (unsigned char)fft_lin_out[x];
           }
        }

      //setBalken(i, maxW);
      Serial.print(maxW);
      Serial.print(" ");
    }
    Serial.println("");
    TIMSK0 = 1;
    FastLED.show();
    TIMSK0 = 0;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.