Fehler beim Compilieren (ATMega168)

Gast #4290397
Lesenswert?

Hallo,

ich möchte im AVR-Studio4 folgendes PWM-Programm "build"en. Dabei 
erhalte ich folgende Fehlermeldung:

c:/program files (x86)/atmel/avr tools/avr 
toolchain/bin/../lib/gcc/avr/4.5.1/../../../../avr/bin/ld.exe: 
_motor2.map: No such file: No such file or Directory

woran liegt das?

•
1
#include<avr/io.h>
2
#define F_CPU 20000000UL       //Taktfrequenz 20MHz
3
#include<util/delay.h>        // Verzögerung
4

5
int main(void)
6
{
7
DDRB |= (1<<PB0); //initialisieren Output 14 [Motor rechtslauf]
8
DDRD |= (1<<PD5); //initialisieren Output 11 [LED]
9
TCCR2B = (1<<CS21)|(1<<CS20);    //Clock select       
10
TCCR2A = (1<<COM2A1) | (1<<WGM21) | (1<<WGM20);  //Waveform generation mode
11
OCR2A = 127; //50% cycle
12
uint8_t speed; //unsigned int Variabelle speed
13
PORTD |= (1<<PD5); //LED einschalten
14
  while(1)
15
    {
16
        // increasing speed
17
        for (speed = 0; speed < 255; ++speed)
18
        {
19
            // set the speed as duty cycle
20
            OCR2A = speed;
21
 //Verzögerung um Änderung zu erkennen
22
            _delay_ms(10);
23
        }
24
        // decreasing speed
25
        for (speed = 255; speed > 0; --speed)
26
        {
27
            // set the speed as duty cycle
28
            OCR2A = speed;
29
  //Verzögerung, um Änderung zu erkennen
30
            _delay_ms(10);
31
        }
32
    }
33
  return 0;
34
}

genau so bei dem Programm:
•
1
#include<avr/io.h>
2
#define F_CPU 20000000UL       //Taktfrequenz 20MHz
3
#include<util/delay.h>        // Verzögerung
4

5
int main(void)
6
{
7
  unsigned char duty_cyc_a,duty_cyc_b;
8
  DDRB |= (1 << PB0); //initialisieren Output 14 [4A]
9
  DDRD |= (1 << PD5); //initialisieren Output 11 [LED]
10

11
  PORTD |= (1<<PD5); //LED einschalten
12
  // Initial TIMER0 Fast PWM
13
  // Fast PWM Frequency = fclk / (N * 256), Where N is the Prescaler
14
  // f_PWM = 11059200 / (64 * 256) = 675 Hz
15
  TCCR0A = 0b10100011; // Fast PWM 8 Bit, Clear OCA0/OCB0 on Compare Match, Set on TOP
16
  TCCR0B = 0b00000011; // Used 64 Prescaler
17
  TCNT0 = 0;           // Reset TCNT0
18
  OCR0A = 0;           // Initial the Output Compare register A & B
19
  OCR0B = 0;
20
  duty_cyc_a=0;  // Initial Duty Cycle for Channel A
21
  duty_cyc_b=255;  // Initial Duty Cycle for Channel B
22

23
  for(;;) // Loop Forever
24
  {            
25
    while(duty_cyc_a < 255) {
26
      OCR0A=duty_cyc_a++;
27
      OCR0B=duty_cyc_b--;
28
       _delay_ms(10);
29
    }
30

31
    while(duty_cyc_b < 255) {
32
      OCR0A=duty_cyc_a--;
33
      OCR0B=duty_cyc_b++;
34
      _delay_ms(10);
35
    }
36
  }
37
  return 0;    
38
}
#4290517
Lesenswert?

hast du ein neues Projekt eröffnet?
F_CPU und MCU gesetzt?

klappt doch, mit File 1

Build started 28.9.2015 at 22:59:12
avr-gcc  -mmcu=atmega644p -Wall -gdwarf-2 -std=gnu99 -DF_CPU=20000000UL 
-Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD 
-MP -MT motor2.o -MF dep/motor2.o.d  -c  ../motor2.c
avr-gcc -mmcu=atmega644p -Wl,-Map=motor2.map motor2.o     -o motor2.elf
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature 
motor2.elf motor2.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" 
--change-section-lma .eeprom=0 --no-change-warnings -O ihex motor2.elf 
motor2.eep || exit 0
avr-objdump -h -S motor2.elf > motor2.lss
AVR Memory Usage
Device: atmega644p
Program:     216 bytes (0.3% Full)
(.text + .data + .bootloader)
Data:          0 bytes (0.0% Full)
(.data + .bss + .noinit)
Build succeeded with 0 Warnings...

klappt auch mit 168
Device: atmega168
Program:     196 bytes (1.2% Full)
(.text + .data + .bootloader)
Data:          0 bytes (0.0% Full)
(.data + .bss + .noinit)
Build succeeded with 0 Warnings...
Gast #4290851
Lesenswert?

Hallo,

ja, der erste C-Code läuft tatsächlich.
mein Fehler lag wohl in der Verwendung von zwei Code-Dateien in einem 
Projet, wobei der zweite Code fehlerhaft "gebuided" wird.
Danke.

PS.: wo stelle ich den den MCU ein? F-FPU habe ich schon eingestellt 
gehabt (in GERNERAL?)

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren