Hi, I think it is something very obvious but I can't get it to work...
Trying to compile HID_mouse example with AVRSTUDIO.
Did copy all the USBDRVto the project directory, changed usbconfig-protoype.h to usbconfig.h, did make some adjustments for the correct port and CPU speed.
Added to the project the source files: main.c, oddebug.c, usbdrv.c and usbdrvasm.S
When I build all: I get -only- the warning:
../main.c:155: warning: implicit declaration of function 'usbInterruptIsReady'
../main.c:159: warning: implicit declaration of function 'usbSetInterrupt'
and later -only- on the error:
D:\sw_atmel\attiny44\default/../main.c:155: undefined reference to `usbInterruptIsReady'
D:\sw_atmel\attiny44\default/../main.c:159: undefined reference to `usbSetInterrupt'
Seems I am missing some link ?
Any hints ?
Thanks,
Boris
-resolved- Compiling with AVRStudio
-
- Posts: 4
- Joined: Mon May 24, 2010 11:16 pm
-resolved- Compiling with AVRStudio
Last edited by borisdekat on Thu Jun 10, 2010 5:47 pm, edited 1 time in total.
Re: Compiling with AVRStudio
Actually, at first i also got stuck when trying it with AVRStudio...
But, after seeking up some reference i got the sample which is using avr studio for IDE.
You can look avr-cdc example for Your reference.. I got my project compile with it makefile..
Here i try to post my working makefile...
I can attach the working mouse example projects here if you want, but i didnt know how to attach file in this forum..
If it is allowed, i'll upload the file to shared file hosting and post the link directly here...
But, after seeking up some reference i got the sample which is using avr studio for IDE.
You can look avr-cdc example for Your reference.. I got my project compile with it makefile..
Here i try to post my working makefile...
Code: Select all
###############################################################################
# Makefile for the AVRStudio Project.
###############################################################################
## General Flags ---> Change this project name refers to your projects name
PROJECT = RX
#MCU = atmega8
#MCU = atmega16
#MCU = atmega48
#MCU = atmega88
#MCU = atmega168
MCU = atmega32
#MCU = atmega328p
CLK = 12000000UL
#CLK = 15000000UL
#CLK = 16000000UL
#CLK = 18000000UL
#CLK = 20000000UL
TARGET = RX.elf
CC = avr-gcc
## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU) -DF_CPU=$(CLK)
## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -Os -fsigned-char
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS +=
## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature
HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
## Include Directories
INCLUDES = -I".." -I"../../usbdrv"
## Objects that must be built in order to link
OBJECTS = usbdrv.o usbdrvasm.o oddebug.o main.o
## Objects explicitly added by the user
LINKONLYOBJECTS =
## Build
all: $(TARGET) RX.hex RX.eep RX.lss size
## Compile
usbdrvasm.o: ../../usbdrv/usbdrvasm.S
$(CC) $(INCLUDES) $(ASMFLAGS) -c $<
usbdrv.o: ../../usbdrv/usbdrv.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
oddebug.o: ../../usbdrv/oddebug.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
main.o: ../main.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
##Link
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
%.hex: $(TARGET)
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@
%.eep: $(TARGET)
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0
%.lss: $(TARGET)
avr-objdump -h -S $< > $@
size: ${TARGET}
@echo
@avr-size -C --mcu=${MCU} ${TARGET}
## Clean target
.PHONY: clean
clean:
-rm -rf $(OBJECTS) RX.elf dep/* RX.hex RX.eep RX.lss
## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
I can attach the working mouse example projects here if you want, but i didnt know how to attach file in this forum..
If it is allowed, i'll upload the file to shared file hosting and post the link directly here...
-
- Posts: 4
- Joined: Mon May 24, 2010 11:16 pm
Re: Compiling with AVRStudio
I found my Error !. Nothing to do with AVRstudio and/or linking stuff.
I used for the hid-mouse example not the included usbconfig.h but started of with usbconfig-prototype and made the (I thought...) needed changes. Apparantly I missed one very important one:
#define USB_CFG_HAVE_INTRIN_ENDPOINT 0
/* Define this to 1 if you want to compile a version with two endpoints: The
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
* number).
*/
It should be "1" to enable the interrupt routines in main.c to function correct (even compile correct)....
So a real newbee error
Thanks for the reply , gl
Boris.
I used for the hid-mouse example not the included usbconfig.h but started of with usbconfig-prototype and made the (I thought...) needed changes. Apparantly I missed one very important one:
#define USB_CFG_HAVE_INTRIN_ENDPOINT 0
/* Define this to 1 if you want to compile a version with two endpoints: The
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
* number).
*/
It should be "1" to enable the interrupt routines in main.c to function correct (even compile correct)....
So a real newbee error
Thanks for the reply , gl
Boris.