avr-libc (MyUSB) broken for at90USB647

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am sure that someone must have solved this by now and I just cant find the thread on this.

I am unable to compile either of Dean Camera's MyUSB/bootloaders using the current release of WinAvr or AvrMacPack It bombs in the link stage with an illegal elpm instruction (which makes some sense since its only a 64K chip). Looking at the code it appears that he is only using libc to get the work done.

Rebuilt the compiler chain based on current patches in FreeBSD and got same results.

Is there a workaround / patch?

/var/tmp//cchCF5EL.s: Assembler messages:
/var/tmp//cchCF5EL.s:487: Error: illegal opcode elpm for mcu at90usb647
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could you be more specific about which versions are you attempting to use? When you say "current release" of WinAVR, do you mean 20080430? If so, do you have a test case for this bug?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Eric,

I am still at the 122107 release as when I looked to upgrade (to see if this problem went away) it looked as though you had withdrawn the last one.

If there is a new current I would be more than happy to run it up there.

Yes.

The test case is to replace the processor in the makefile for either of Dean's bootloaders (MyUSB v 1.4.0 under MyUSB/MyUSB/Bootloaders/) with a at90usb64x. ( and adjust the boot starting location accordingly z.b. MCU=at90usb647, BOOT_START=0xE000)

I could have reported this as a MyUSB issue I suppose but his code just uses the avr/eeprom routines as far as I can tell.

(...excuse me while I run back to my w2k vm to test on the new WinAvr release....)

Last Edited: Sat. May 3, 2008 - 07:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Eric,

Still looks busted.

-------- begin --------
avr-gcc (WinAVR 20080430) 4.3.0
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: BootloaderDFU.c
avr-gcc -c -mmcu=at90usb647 -I. -gdwarf-2 -DF_CPU=8000000UL -DBOARD=BOARD_USBKEY -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED)" -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=0xE000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -finline-limit=20 -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=./BootloaderDFU.lst -I../../../ -std=gnu99 -Wundef -MMD -MP -MF .dep/BootloaderDFU.o.d BootloaderDFU.c -o BootloaderDFU.o
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccXCCVbN.s: Assembler messages:
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccXCCVbN.s:418: Error: illegal opcode elpm for mcu at90usb647
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccXCCVbN.s:1038: Error: illegal opcode elpm for mcu at90usb647
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp/ccXCCVbN.s:1039: Error: illegal opcode elpm for mcu at90usb647
make: *** [BootloaderDFU.o] Error 1 

Drat...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can confirm this - it's a libc/bunutils/etc. issue rather than an issue with my code. A bug report to the WinAVR project should allow EW to notify the appropriate people.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

... ok maybe I was barking up the wrong tree ...

Dean,

you are using the pgm_...._far calls if RAMPZ is defined.

#if defined(__AVR_AT90usb647__) || defined(__AVR_AT90usb646__)
#undef RAMPZ
#endif

seemed to work

Eric,
should RAMPZ be defined for a chip without the ELPM?

Don.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I see. The USB64X and the USB128X both include a common header file, which defines RAMPZ. RAMPZ should only exist on devices with over 64KB of FLASH, and so shouldn't exist for the USB64X.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for hunting this down Dean and Don.

The datasheet for these devices states:

Quote:
Note that the RAMPZ register is only implemented when the program
space is larger than 64K bytes.

I've now fixed the iousbxx6_7.h header file to conditionally define RAMPZ only if the AT90USB1286 or AT90USB1287 devices are defined. Fix is committed to avr-libc repository on HEAD and 1.6 branch.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you add the __AVR_AT90CAN64__ and __AVR_AT90CAN32__ with the same fix?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please fill out a bug report at the avr-libc project on Savannah:
http://savannah.nongnu.org/proje...