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
Posts: 1
Joined: Thu Oct 04, 2007 3:58 pm

Error during compilation

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


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:

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?


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