Error during compilation

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
langsweirdt
Posts: 1
Joined: Thu Oct 04, 2007 3:58 pm

Error during compilation

Post by langsweirdt » Thu Oct 04, 2007 4:05 pm

Hi,

When I'm compiling (with gcc 4.1.2) the firmware of the PowerSwitch project, I got this error:

usbdrv/usbdrv.c: In function `usbInit':
usbdrv/usbdrv.c:538: invalid lvalue in assignment
usbdrv/usbdrv.c:543: invalid lvalue in assignment

The compiler is referring to the lines in usbdrv.c:
USB_INTR_CFG |= USB_INTR_CFG_SET;
and
USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT);

I've noticed that this is an error that can occur by upgrading form gcc 3 to gcc 4. But I don't know how I have to change these lines to correct it.
Can anyone help me with this one?

Greets,
Dré.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Sun Oct 07, 2007 9:24 pm

The error messages says that the macros USB_INTR_CFG and USB_INTR_ENABLE expand to invalid left-hand values for an assignment.

These macros are defined in usbdrv.h to MCUCR and GIMSK (or similar registers). You may override these values in usbconfig.h, though.

Please run your code through the preprocessor only (gcc option '-E') to see the expansion of the macros. Maybe your avr-libc is not installed correctly and the register macros don't work as they should.

Post Reply