Page 1 of 1

Error during compilation

Posted: Thu Oct 04, 2007 4:05 pm
by langsweirdt
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é.

Posted: Sun Oct 07, 2007 9:24 pm
by christian
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.