Droidicus
16.11.2015, 14:21
Hallo,
da bei meinem ASURO der eine Motor schneller dreht als der andere, wollte ich die Geschwindigkeit über die Software anpassen.
Nun habe ich folgendes Problem beim Kompilieren einer c-datei für den ASURO. Es geht um den Kollisionstaster-Queltext von m.a.r.v.i.n:
/************************************************** *************************
*
* File Name: kollisiontest.c
* Project : ASURO
*
* Description: Kollisionstest mit Hilfe der Tastensensoren
*
* Ver. Date Author Comments
* ------- ---------- ----------------- ------------------------------
* 1.0 10.09.2005 m.a.r.v.i.n initial build
* 1.1 08.01.2006 m.a.r.v.i.n 2x PollSwitch + Vergleich,
* anstelle 8x PollSwitch
*
* benoetigt die modifizierte Asuro Bibliothek 'asuro.c'
* von waste, stochri und andun. Zu finden bei www.roboternetz.de
*/
/************************************************** *************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* any later version. *
************************************************** *************************/
#include "asuro.h"
#define FULL_L 300
#define FULL_R 220
/* Motor vorwärts */
void MotorFwd(void)
{
MotorDir(FWD,FWD);
MotorSpeed(FULL_L,FULL_R);
}
/* Motor rückwärts */
void MotorRwd(void)
{
MotorDir(RWD,RWD);
MotorSpeed(FULL_L,FULL_R);
}
/* Motor rückwärts Links */
void MotorRwdL(void)
{
MotorDir(RWD,RWD);
MotorSpeed(FULL_L,0);
}
/* Motor rückwärts Rechts */
void MotorRwdR(void)
{
MotorDir(RWD,RWD);
MotorSpeed(0, FULL_R);
}
/* Motor stop */
void MotorStop(void)
{
MotorSpeed(0,0);
}
int main(void)
{
unsigned char t1, t2;
Init();
while (1)
{
t1 = PollSwitch();
t2 = PollSwitch();
if (t1 == 0 && t2 == 0) /* keine Taste */
{
MotorFwd(); /* vorwärts fahren */
FrontLED(ON);
BackLED(OFF,OFF);
}
else if (t1 && t2 && t1 == t2)
{
MotorStop();
if (t1 & 0x07) /* Tasten links gedrückt? */
{
MotorRwdL(); /* Rückwärtskurve links fahren */
FrontLED(OFF);
BackLED(ON,OFF);
}
if (t1 & 0x38) /* Tasten rechts gedrückt? */
{
MotorRwdR(); /* Rückwärtskurve rechts fahren */
FrontLED(OFF);
BackLED(OFF,ON);
}
Msleep(1000); /* 1 Sekunde fahren */
}
}
return 0;
}
und dabei folgende Fehlermeldung bekommen:
> "C:\ASURO_src\FirstTry\Test-all.bat"
C:\ASURO_src\FirstTry>make all
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > asuro.d; \
[ -s asuro.d ] || rm -f asuro.d
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > test.d; \
[ -s test.d ] || rm -f test.d
-------- begin --------
avr-gcc --version
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c -o test.o
In file included from asuro.h:34,
from test.c:25:
c:/winavr-20100110/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>."
test.c: In function 'main':
test.c:94: warning: implicit declaration of function 'Msleep'
avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c -o asuro.o
In file included from asuro.h:34,
from asuro.c:29:
c:/winavr-20100110/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>."
avr-gcc -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.o test.o asuro.o --output test.elf -Wl,-Map=test.map,--cref -lm
test.o: In function `main':
C:\ASURO_src\FirstTry/test.c:94: undefined reference to `Msleep'
make: *** [test.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:06
woran liegts?:confused:
Vielen danke schon mal im vorraus :)
da bei meinem ASURO der eine Motor schneller dreht als der andere, wollte ich die Geschwindigkeit über die Software anpassen.
Nun habe ich folgendes Problem beim Kompilieren einer c-datei für den ASURO. Es geht um den Kollisionstaster-Queltext von m.a.r.v.i.n:
/************************************************** *************************
*
* File Name: kollisiontest.c
* Project : ASURO
*
* Description: Kollisionstest mit Hilfe der Tastensensoren
*
* Ver. Date Author Comments
* ------- ---------- ----------------- ------------------------------
* 1.0 10.09.2005 m.a.r.v.i.n initial build
* 1.1 08.01.2006 m.a.r.v.i.n 2x PollSwitch + Vergleich,
* anstelle 8x PollSwitch
*
* benoetigt die modifizierte Asuro Bibliothek 'asuro.c'
* von waste, stochri und andun. Zu finden bei www.roboternetz.de
*/
/************************************************** *************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* any later version. *
************************************************** *************************/
#include "asuro.h"
#define FULL_L 300
#define FULL_R 220
/* Motor vorwärts */
void MotorFwd(void)
{
MotorDir(FWD,FWD);
MotorSpeed(FULL_L,FULL_R);
}
/* Motor rückwärts */
void MotorRwd(void)
{
MotorDir(RWD,RWD);
MotorSpeed(FULL_L,FULL_R);
}
/* Motor rückwärts Links */
void MotorRwdL(void)
{
MotorDir(RWD,RWD);
MotorSpeed(FULL_L,0);
}
/* Motor rückwärts Rechts */
void MotorRwdR(void)
{
MotorDir(RWD,RWD);
MotorSpeed(0, FULL_R);
}
/* Motor stop */
void MotorStop(void)
{
MotorSpeed(0,0);
}
int main(void)
{
unsigned char t1, t2;
Init();
while (1)
{
t1 = PollSwitch();
t2 = PollSwitch();
if (t1 == 0 && t2 == 0) /* keine Taste */
{
MotorFwd(); /* vorwärts fahren */
FrontLED(ON);
BackLED(OFF,OFF);
}
else if (t1 && t2 && t1 == t2)
{
MotorStop();
if (t1 & 0x07) /* Tasten links gedrückt? */
{
MotorRwdL(); /* Rückwärtskurve links fahren */
FrontLED(OFF);
BackLED(ON,OFF);
}
if (t1 & 0x38) /* Tasten rechts gedrückt? */
{
MotorRwdR(); /* Rückwärtskurve rechts fahren */
FrontLED(OFF);
BackLED(OFF,ON);
}
Msleep(1000); /* 1 Sekunde fahren */
}
}
return 0;
}
und dabei folgende Fehlermeldung bekommen:
> "C:\ASURO_src\FirstTry\Test-all.bat"
C:\ASURO_src\FirstTry>make all
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > asuro.d; \
[ -s asuro.d ] || rm -f asuro.d
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > test.d; \
[ -s test.d ] || rm -f test.d
-------- begin --------
avr-gcc --version
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c -o test.o
In file included from asuro.h:34,
from test.c:25:
c:/winavr-20100110/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>."
test.c: In function 'main':
test.c:94: warning: implicit declaration of function 'Msleep'
avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c -o asuro.o
In file included from asuro.h:34,
from asuro.c:29:
c:/winavr-20100110/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>."
avr-gcc -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.o test.o asuro.o --output test.elf -Wl,-Map=test.map,--cref -lm
test.o: In function `main':
C:\ASURO_src\FirstTry/test.c:94: undefined reference to `Msleep'
make: *** [test.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:06
woran liegts?:confused:
Vielen danke schon mal im vorraus :)