Hi,
i tried to compile a simple program that i found at this link: http://codeandlife.com/2012/01/29/avr-a ... al-part-3/ using the v-usb library
This is the code:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include "usbdrv.h"
#include <util/delay.h>
USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) {
return 0; // do nothing for now
}
int main() {
uchar i;
wdt_enable(WDTO_1S); // enable 1s watchdog timer
usbInit();
usbDeviceDisconnect(); // enforce re-enumeration
for(i = 0; i<250; i++) { // wait 500 ms
wdt_reset(); // keep the watchdog happy
_delay_ms(2);
}
usbDeviceConnect();
sei(); // Enable interrupts after re-enumeration
while(1) {
wdt_reset(); // keep the watchdog happy
usbPoll();
}
return 0;
}
I use Arduino and i red here http://balau82.wordpress.com/2011/03/29 ... in-pure-c/ how program my Arduino board with avr-gcc.
So i wrote in my terminal:
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o prova.o prova.c
and it's work, but when i wrote
avr-gcc -mmcu=atmega328p prova.o -o prova
i receive this error messages:
prova.o: In function `main':
prova.c:(.text+0x1a): undefined reference to `usbInit'
prova.c:(.text+0x3a): undefined reference to `usbPoll'
i think this could be a linker problem.
Can someone help me please?
Thank you and i apologize for my bad English.
i tried to compile a simple program that i found at this link: http://codeandlife.com/2012/01/29/avr-a ... al-part-3/ using the v-usb library
This is the code:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include "usbdrv.h"
#include <util/delay.h>
USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) {
return 0; // do nothing for now
}
int main() {
uchar i;
wdt_enable(WDTO_1S); // enable 1s watchdog timer
usbInit();
usbDeviceDisconnect(); // enforce re-enumeration
for(i = 0; i<250; i++) { // wait 500 ms
wdt_reset(); // keep the watchdog happy
_delay_ms(2);
}
usbDeviceConnect();
sei(); // Enable interrupts after re-enumeration
while(1) {
wdt_reset(); // keep the watchdog happy
usbPoll();
}
return 0;
}
I use Arduino and i red here http://balau82.wordpress.com/2011/03/29 ... in-pure-c/ how program my Arduino board with avr-gcc.
So i wrote in my terminal:
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o prova.o prova.c
and it's work, but when i wrote
avr-gcc -mmcu=atmega328p prova.o -o prova
i receive this error messages:
prova.o: In function `main':
prova.c:(.text+0x1a): undefined reference to `usbInit'
prova.c:(.text+0x3a): undefined reference to `usbPoll'
i think this could be a linker problem.
Can someone help me please?
Thank you and i apologize for my bad English.