resolved - Compiling Usbasp '__attribute__((progmem))'

Post Reply
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

resolved - Compiling Usbasp '__attribute__((progmem))'

Post by rperkins »

This issue is resolved I just wanted to document it here.

Usbasp uses V-usb for usb communications. Usbasp includes V-usb in it's source code. The version of V-usb included in Usbasp is not the latest and would not compile with a recent avr-gcc. This issue affected er9x over a year ago.

When trying to compile the 2009 or 2011 versions of Usbasp from http://www.fischl.de/usbasp/ I got about a dozen of these errors.

Code: Select all

usbdrv/usbdrv.h:451:6: error: variable ‘usbDescriptorDevice’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
The solution was to remove the ./firmware/usbdrv directory from the Usbasp source and replace it with the source from http://www.obdev.at/downloads/vusb/vusb-20121206.tar.gz . Then I was able to compile Usbasp. I tested both the 2009 and 2011 versions on a programmer and was able to program a MCU.

Not sure when avr-gcc became picky about this issue or if that is even the issue. Nor do I know why my Ubuntuish 'Linux Mint 14 Nadia' calls the package gcc-avr. Anyway this is what versions of the relevant ( I think) packages I have installed.

ii avr-libc 1:1.8.0-2 all Standard C library for Atmel AVR developm
ii binutils-avr 2.20.1-3 amd64 Binary utilities supporting Atmel's AVR t
ii gcc-avr 1:4.7.0-2 amd64 The GNU C compiler (cross compiler for av
Last edited by rperkins on Tue Feb 05, 2013 11:05 pm, edited 1 time in total.

Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by Romolo »

Just add a const before the definition of usbDescriptorDevice at line 451
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by rperkins »

Thanks for the reply. There were a dozen lines that would have needed to be edited. Since I wasnt sure exactly the change to make, I just updated v-usb . I'm confident your method would work also.

Do you think there would be a problem updating the library as i did ? It compiled fine and worked in my tests.
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by Romolo »

I don't think so... probably it works without any problem
anyway here is my complete patch against 2009 version.

it resolves sck and 2560 page issues
Attachments
patch.zip
(3.43 KiB) Downloaded 580 times
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by rperkins »

Thanks.
I see this patch is much more in depth than the one you provided in this thread
viewtopic.php?f=10&t=1363#p19315

What is the goal of each patch ??

I'm trying to find the best usbasp firmware for the 9x. I'm pretty sure you left the cap on your reset line. On both my 9x's they came with a 47uf cap on the reset line. Without removing that cap I had to unplug and replug my usbasp from the computer after every interaction between the 9x and the usbasp.

I put the reset cap back on and tried the smaller patch in the thread I linked to above. Didnt work unless I removed the cap. Tonight maybe I'll try this patch.

Currently I am using the vanilla 2011 usbasp firmware, cap removed from reset, with a usbasp that has 100 ohm current limiting resistors on the programming lines.

Thanks for you help

Thanks

Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by Romolo »

I use usbasp for 3 radios: M128, GRUVIN board, 9X
Without the original patch there were possible issues with ATMEGA 2560.
The original patch anyway was done when I had a old GCC and usbasp was compiling...
This one take also care of my newer gcc 4.7.2
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by rperkins »

Just looking at this again I see now that your latest patch solves my original issue of this post.
So if f you use this patch on 2009 version of usbasp there is no need to update the V-usb as I had mentioned in the first post in this thread. Thanks
JustinTime
Posts: 140
Joined: Tue Jan 29, 2013 4:12 am
Country: -
Location: SoCal

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by JustinTime »

rperkins, mind telling the technically challenged where to put the patch file? I downloaded the usbasp.2009-02-28. Where in that directory do I put it?
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: resolved - Compiling Usbasp '__attribute__((progmem))'

Post by rperkins »

Hi
It goes in the firmware directory

Thanks for bringing it to my attention. I updated this thread which trys to cover compiling a patched version of usbasp.

viewtopic.php?f=10&t=2571&p=38887#p38887

Post Reply

Return to “PROGRAMMERS”