Page 1 of 1

Strange setting for USB_CFG_CLOCK_KHZ (solved)

Posted: Sun Aug 15, 2010 7:07 pm
by Arzhel
Hi

I am trying to compile a sample project and i have the following error while dealing with usbdrvasm.S :
../src/usbdrv/usbdrvasm.S:391:9: erreur: #error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!"

I don't use make but Eclipse with the avr-plugin.

In usbdrvasm.S, USB_CFG_CLOCK_KHZ is normally set to F_CPU/1000.
F_CPU comes from the project's settings in Eclipse (Properties/AVR/Target Hardware) where MCU Clock Frequency is set to 12000000 Hz.
What is strange is that the value affected to USB_CFG_CLOCK_KHZ seems to be different from 12000

I have tried to put global settings for the compiler via Properties/ C/C++ Build/Behavior where incremental build is set to
MMCU=${AVRTARGETMCU} F_CPU=${AVRTARGETFCPU} all
I got the same error.

Surely, i could redefine F_CPU in usbdrvasm.S, but this will be an horrible hack.

Any help would be greatly appreciated

Best regards,

Re: Strange setting for USB_CFG_CLOCK_KHZ

Posted: Mon Aug 16, 2010 6:25 pm
by frank26080115
I don't use Eclipse, but it sounds like it's a defect with the plugin
so... I'd personally suggest use something else for compiling the project
give this a shot? http://code.google.com/p/avr-project-ide/

Re: Strange setting for USB_CFG_CLOCK_KHZ

Posted: Tue Aug 17, 2010 9:02 pm
by Arzhel
Thanks for the hint.
The problem was with the Eclipse plugin.

In order to compile .S source files, i have added an extra parameter for avr-gcc:
Properties/ C/C++Build/ Settings/ Tool Settings/ AVR Assembler/ General/
where Other GCC Flags is set to -DF_CPU=${AVRTARGETFCPU}

The compile was then successful.

Others settings :
- add include path for usb.h (in my case on linux, the package libusb-dev put the file in /usr/include )
- add usbconfig.h in folder usbdrv
- add include path on usbdrv.