Page 1 of 1

IAR AVR build error with new usbdrv lib 2007-12-01

Posted: Mon Dec 24, 2007 12:59 pm
by icefire
I try to build ppm RC to usb interface with the new released usbdrv 2007-12-01 and get following errors:

Building configuration: rcu - Release
Updating build tree...

36 file(s) deleted.
Updating build tree...
in_adc.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
out_joystick.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
usbdrv.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
Warning[Pe177]: variable "recipient" was declared but never referenced E:\mcu projects\test\source\usbdrv\usbdrv.c 342
in_ppm.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
in_ppm_adv.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
main.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
out_joystick_btn.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
out_reflex.c
Warning[Pe047]: incompatible redefinition of macro "usbDeviceConnect" (declared at line 79 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 274
Warning[Pe047]: incompatible redefinition of macro "usbDeviceDisconnect" (declared at line 80 of "E:\mcu projects\test\source\options.h") E:\mcu projects\test\source\usbdrv\usbdrv.h 276
usbdrvasm.asm
Error[18]: No such pre-processor command: 'warning' E:\mcu projects\test\source\usbdrv\usbdrv.h 471
Warning[16]: Suspicious sfr expression E:\mcu projects\test\source\usbdrv\usbdrvasm.S 87
Error[41]: Bad label E:\mcu projects\test\source\usbdrv\usbdrvasm12.S 246
Error[14]: Missing #endif E:\mcu projects\test\source\usbdrv\usbdrvasm.asm 21

Total number of errors: 3
Total number of warnings: 18

Posted: Mon Dec 24, 2007 1:06 pm
by icefire
after removed the redefine macro usbDeviceConnect and usbDeviceDisconnect in options.h , removed the #warning... in usbdrv.h,
changed .macro to macro .endm to endm and then...
only one error last:

Building configuration: rcu - Release
Updating build tree...

33 file(s) deleted.
Updating build tree...
in_adc.c
usbdrv.c
Warning[Pe177]: variable "recipient" was declared but never referenced E:\mcu projects\test\source\usbdrv\usbdrv.c 342
in_ppm_adv.c
out_joystick.c
out_joystick_btn.c
in_ppm.c
main.c
out_reflex.c
usbdrvasm.asm
Warning[16]: Suspicious sfr expression E:\mcu projects\test\source\usbdrv\usbdrvasm.S 87
Error[14]: Missing #endif E:\mcu projects\test\source\usbdrv\usbdrvasm.asm 21

Total number of errors: 1
Total number of warnings: 2

Posted: Wed Dec 26, 2007 9:01 pm
by christian
Thanks for your feedback about the current status of IAR compatibility!

I have added your .macro and .endm fix for the next release.

Please define USB_INTR_PENDING to the appropriate register or memory address in usbconfig.h. The default is EIFR or GIFR in usbdrv.h, but these constants may not be defined at the time we check for them, or they may be defined in an unexpected way (not as numeric constant). With this fix, you should get rid of the warning in line 87 of usbdrvasm.S.

But I can't see where an #endif could be missing. Maybe this is a consequence of the line 87 warning. Or it's the #error preprocessor command at the end of usbdrvasm.S. Did you remove it? And did you make sure that you have not changed the #if/#endif structure where you removed #warning or #error commands?

Posted: Thu Dec 27, 2007 5:28 am
by icefire
Thank you christian.


I am sure i have never change any #if/#endif structure, my change is so simple:
// #warning "You should define USB_CFG_VENDOR_ID and USB_CFG_DEVICE_ID in usbconfig.h"

Posted: Thu Dec 27, 2007 6:21 am
by icefire
It is no use , even if i define the USB_INTR_PENDING, the warning also exist.

I use the lazy way to solve this:

// #if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */
# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING
# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg
// #else /* It's a memory address, use lds and sts */
// # define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING
// # define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg
// #endif :oops:

Posted: Thu Dec 27, 2007 8:18 pm
by christian
At least you have a solution. If somebody suggests a way how the #if can be made compatible with both, GCC/avr-libc and IAR-CC, I'd be happy to add it.