how to compile AVRUSBBoot

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

can anyone please help me with compiling AVRUSBBoot, a bootloader developed by Thomas Fischl. i am unable to compile it properly. i guess some alterations have to made in the arguments, or somewhere in the source code, or a few things have to be specified before compiling the source code. please have a look at this:

http://www.fischl.de/contact.html

the steps for compiling are mentioned on the webpage, but since i am a newbie, i don't understand most of it.

can anyone please provide me with something like a step-by-step description, that is easy to understand.

i tried to contact the person who wrote this bootloader and who is the maintainer of this website, but got no reply from him.

please help me regarding this bootloader.

thank you.

Long live my MASTER.

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

That looks like the wrong URL - it just gives Thomas Fischl's contact details?!? I assume you meant this:

http://www.fischl.de/avrusbboot/

I just un-tar'd the files, switched to the firmware directory and typed "make". It said:

E:\avrusbboot.2006-06-25\firmware>make
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8  -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
usbdrv/usbdrv.c: In function 'usbInit':
usbdrv/usbdrv.c:503: warning: cast from pointer to integer of different size
usbdrv/usbdrv.c:504: warning: cast from pointer to integer of different size
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8  -x assembler-with-cpp -c usbdrv/usbdrvasm.s -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8  -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8  -c main.c -o main.o
In file included from main.c:25:
e:/winavr-20100110/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete.  Use ."
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8  -o main.bin usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o -Wl
,--section-start=.text=1800
rm -f main.hex main.eep.hex
avr-objcopy -j .text -j .data -O ihex main.bin main.hex
./checksize main.bin
E:\avrusbboot.2006-06-25\firmware\checksize: awk: command not found
E:\avrusbboot.2006-06-25\firmware\checksize: [: -gt: unary operator expected
ROM:  bytes (data=)
E:\avrusbboot.2006-06-25\firmware\checksize: [: -gt: unary operator expected
RAM:  bytes

As far as I can see that built the code just fine - how does your attempt differ?

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

yes, thats what i meant. sorry for the wrong url.

here is what i get when i do 'make':

Quote:

avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
usbdrv/usbdrv.c:77:21: error: variable ‘usbDescrDevice’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
usbdrv/usbdrv.c:106:21: error: variable ‘usbDescrConfig’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
usbdrv/usbdrv.c:152:21: error: variable ‘usbDescrString0’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
usbdrv/usbdrv.c:159:21: error: variable ‘usbDescrString1’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
usbdrv/usbdrv.c:165:21: error: variable ‘usbDescrString2’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
usbdrv/usbdrv.c: In function ‘usbInit’:
usbdrv/usbdrv.c:503:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
usbdrv/usbdrv.c:504:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
make: *** [usbdrv/usbdrv.o] Error 1

Long live my MASTER.

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

Open usbdrv/usbdrv.c and add the word const first on every line with the word PROGMEM in it.

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

The reason I didn't see this is because the compiler I invoked at the command line is actually the old, out of date one from WinAVR (4.3.3). Since about version 4.6 (or was it even 4.5) the compiler has insisted that everything destined to locate into flash must be "const". I'm guessing you have a 4.7 or even a 4.8.

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

snigelen wrote:
Open usbdrv/usbdrv.c and add the word const first on every line with the word PROGMEM in it.

ok! i did that. now some new errors are being displayed:

Quote:

avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8 -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
usbdrv/usbdrv.c: In function ‘usbInit’:
usbdrv/usbdrv.c:503:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
usbdrv/usbdrv.c:504:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8 -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
usbdrv/usbdrvasm.S:72:13: error: attempt to use poisoned "SIG_INTERRUPT0"
usbdrv/usbdrvasm.S:73:13: error: attempt to use poisoned "SIG_INTERRUPT0"
usbdrv/usbdrvasm.S:80:1: error: attempt to use poisoned "SIG_INTERRUPT0"
make: *** [usbdrv/usbdrvasm.o] Error 1

Long live my MASTER.

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

SIG_INTERRUPT0 existed about 8+ years ago. It was deprecated. The modern equivalent for vector names end with the word "_vect". In this particular case I imagine you want to change "SIG_INTERRUPT0" to be "INT0_vect". Also if the file has:

#include 

remove it and make sure (if it's not already there) that:

#include 

is used. Also if it uses:

SIGNAL(SIG_something) {
...

then apart from changing the SIG_something to equivalent_vect also change SIGNAL() to ISR().

This is the drawback of using very old, out of date, unmaintained code.

Perhaps if you bring it up to date you could return an update to the author (if he'll respond!).

BTW wouldn't all this be simpler if you just picked an AVR-USB chip and put a LUFA bootloader into it??

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

yes, that would be a lot more easier. but unfortunately, AVR-USB chips are not available at my location.

Long live my MASTER.

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

Quote:

AVR-USB chips are not available at my location.

As a moderator I can tell your location (from your IP address). Surely you can get at least one of the models of AVR-USB in that location?

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

ok! i know a little bit of embedded-c, and so i tried to edit the source, but it seems too much complcated to me. i am not able to understand even a single thing.

can anyone please go through the code and please make the necessary updations??

thank you.

Long live my MASTER.

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

this also seems to be more difficult to me because the changes are to be made in *.S file. and i don't even know what this extension '.S' means......

Long live my MASTER.

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

I have tried. As far as I can see the errors you have noted are the ONLY things that need to be changed so I edited usbdrv.c to add const to the PROGMEMs and I edited usbdrvasm.S to change the poisoned SIG_INTERRUPT0 to INT0_vect and then the code appears to build OK. (I still get the error about missing "awk" for the check size at the end but that doesn't matter). The one thing I can't/won't do is test this in hardware - that's your job.

Attachment(s): 

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

ok sir, that compiled perfectly, except this:

Quote:

make: execvp: ./checksize: Permission denied
make: *** [main.hex] Error 127

can you explain what this means?

also, can you please explain to me what does the extension '.S' mean?

Long live my MASTER.

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

Quote:

can you explain what this means?


Nope but I know that something called "checksize" is nothing important.

The key thing is that the code ends before the end of the mega8 it is built for. It is based at 0x1800 which is the 6K point so it needs to be under 2K to fit. If I check with:

E:\avrusbboot.2006-06-25\firmware>avr-size main.hex
   text    data     bss     dec     hex filename
      0    1934       0    1934     78e main.hex

1,934 is less than 2048 so it fits into the space available.

I guess the next question is: after you have used ISP to load it into your mega8 does it actually work?

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

no, it isn't working.
i burnt that main.hex into atmega8, and then connected it to a computer via a usb (as per the schematic).
but it says: "the usb device is not recognised".

any other suggestions??

oh! i forgot to mention.... thank you sir for the help.

Long live my MASTER.

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

Quote:

any other suggestions??

Time to put on your debugging hat ;-)

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

ok! i tried as much as i could. but it didn't worked.
fortunately, i found another bootloader. this one works fine.
http://www.obdev.at/products/vusb/bootloadhid.html

thank you everyone for your help.

Long live my MASTER.