Page 1 of 1

Problems building bootloadHID

Posted: Sun Oct 21, 2007 1:32 pm
by gert
Hallo

I'm having problems building bootloadHID.2007-06-25 The avr tools are from the Ubuntu 7.10 (gutsy gibbon) repository.

Code: Select all

root@mbili:/home/uuser/avr_proj/bootload/firmware# make
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega8  -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
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
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
/usr/lib/gcc/avr/4.2.1/../../../../avr/bin/ld: address 0x2018 of main.bin section .text is not within region text
make: *** [main.bin] Error 1

root@mbili:/home/uuser/avr_proj/bootload/firmware# avr-gcc --version
avr-gcc (GCC) 4.2.1
Copyright (C) 2007 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.


My question:
- which is the recommended version of the avr tools and where can I get them?
- what else could have gone wrong, and what can I do?

Thanks for your help
Cheers
Gert

Posted: Sun Oct 21, 2007 3:10 pm
by gert
Hello again

In the meantime I read that avr-gcc 4.x.x is not recommended, and I tried to get a source for version 3.x.x.

I converted and installed the packages from here, and that's what I get when I try to build PowerSwitch (which worked fine with avr-gcc 4.2.1):

Code: Select all

make
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=at90s2313  -c usbdrv/usbdrv.c -o usbdrv/usbdrv.o
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=at90s2313  -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=at90s2313  -c usbdrv/oddebug.c -o usbdrv/oddebug.o
avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=at90s2313  -c main.c -o main.o
main.c:18:24: util/delay.h: No such file or directory
main.c: In function `main':
main.c:168: warning: implicit declaration of function `_delay_ms'
make: *** [main.o] Error 1

root@mbili:/home/uuser/avr_proj/powerswitch/firmware# avr-gcc --version
avr-gcc (GCC) 3.3-tinyos
Copyright (C) 2003 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.


Could it be that avr-libc is outdated now?

Since the use of the proper tool chain is very important for reproducing code for devices with timing/code constraints, I'd really appreciate a hint where to get it.

Cheers
Gert

Posted: Sun Oct 21, 2007 8:58 pm
by gert
I switched back to avr-gcc 4.2.1 from the ubuntu 7.10 packages and tried Thomas Fischl's avrusboot instead - no problem this time!

I tested it with Ronald Schaten's USB-LED-FADER which worked fine, too.

I'm good now, but I'd still appreciate if someone could look into the bootloadHID build problem.

/G

Posted: Tue Oct 23, 2007 1:51 pm
by christian
bootloadHID was compiled with gcc 3.3 and a more recent avr libc than you used.

I see that the most recent version is 2007-06-25. We have done some code optimizations since that version so that it fits into 2k even when compiled with gcc 4. I'll make a release soon...

Posted: Tue Oct 23, 2007 3:11 pm
by gert
Christian,

thanks a lot. I'm looking forward to the next release!

Cheers
Gert

Posted: Tue Oct 23, 2007 3:15 pm
by christian
The new version should be online already...

Posted: Wed Oct 24, 2007 12:25 am
by gert
Great, thanks!

This time "make" works, and the bootloader almost works as smoothly as one could wish: In bootloader mode the device is detected under linux (kernel 2.6.22, udev) and WinXP/SP2, both with the included and the self compiled binary.

Test under Linux:
I made a new bootloadHID binary in Linux, and when I run it as root, it works as expected:

Code: Select all

root@mbili:/home/uuser/avr_proj/usb-led-fader/firmware# ./bootloadHID main_061002.hex
Warning: could not set configuration: could not set config 1: Device or resource busy
Page size   = 64 (0x40)
Device size = 8192 (0x2000); 6144 bytes remaining
Uploading 5504 (0x1580) bytes starting at 0 (0x0)
0x01500 ... 0x01580

The warning comes from a failed access to my USB-mouse. I don't like warnings that are "normal", so maybe I'll patch bootloaderHID.

Under ubuntu > 7.xx, with the following udev rules all USB devices with the"public" AVRUSB idVendor:idProduct pairs can be used with ordinary user rights:

Code: Select all

uuser@mbili:~/avr_proj/usbasp/firmware$ cat /etc/udev/rules.d/45-avrusb.rules 
#custom (libusb)
SYSFS{idVendor}=="16c0", SYSFS{idProduct}=="05dc", MODE="0660", GROUP="plugdev"
#HID
SYSFS{idVendor}=="16c0", SYSFS{idProduct}=="05df", MODE="0660", GROUP="plugdev"
#CDC
SYSFS{idVendor}=="16c0", SYSFS{idProduct}=="05e1", MODE="0660", GROUP="plugdev"

Note that I only verified "custom" and "HID". Reloading the udev rules is necessary (e.g. reboot).

Test under Windows:
I currently have no working Win32 compiler setup, so I tried the binary "bootloadHID.exe" from the recent zip file. I got the following error message:

Code: Select all

E:\>bootloadHID.exe main_061002.hex
Error opening HIDBoot device: The specified device was not found

Maybe I did something wrong, and someone else should try this.

Best
Gert

Posted: Wed Oct 24, 2007 1:39 pm
by christian
It's hard to analyze the Windows problem with only this message. Is the device recognized as HID at all? You should see some kind of bubble info when you connect it.

Posted: Wed Oct 24, 2007 4:21 pm
by gert
Christian

As I wrote above the device is being detected under WinXP. It shows up in the hardware settings as "HIDBoot", and I have no reason to think that there is anything wrong with it. It's just the bootloaderHID.exe that casts the error message above, and doesn't do anything useful,

If I got it right, the use of the HID class should make extra drivers unnecessary. So I can't see what mistake I could have made with the installation. A brief test with the bootloaderHID.exe binary from the first release shows the same error message.

I'm sorry that I can't be more specific, but unless I get a working MinGW installation. Someone else with WinXP and the MinGW toolchain should give it a try. Blame it on a broken WinXP installation if it works for them.

Cheers
Gert

Posted: Wed Oct 24, 2007 4:25 pm
by christian
Sorry, I overlooked that Windows recognizes the device.

If you have configured libusb-win32 to attach to the HID device, then bootloadHID will probably not be able to connect to it. Maybe the result of a previous experiment?

The first thing bootloadHID does is to enumerate the devices, ask them for their IDs and names and compare these to the expected values. If the device is not found, this enumeration step fails. I don't think that any HID specific commands are used for that.

Posted: Wed Oct 24, 2007 8:15 pm
by gert
I tested HIDBoot with a different WinXP installation, and this time it worked. A closer examination of the first PC showed a badly broken USB enumeration (even attaching a USB 1.1 hub requires a manual driver installation).

Sorry for having bothered you for nothing!
/G

Posted: Thu Nov 01, 2007 6:47 pm
by highlanderf1
to gert: do you get the driver for the USB-LED-Fader that control by WinXP?
Ive built it but i used Winxp not Linux so that i cant control the Leds via USB!
Thank in advance!

Posted: Thu Nov 01, 2007 8:55 pm
by gert
highlanderf1

Sorry, but I didn't try USB-LED-Fader under WinXP, and currently I don't even have a WinXP installation for testing,

If you're looking for libusb, it's included in the powerSwitch archive.

Cheers
gert

Posted: Fri Nov 02, 2007 7:55 am
by Guest
Thank gert!
I found the libusb in Windriver folder of Powerswitch but it not suppose for the USB-LED-Fader!
Anyway thanks!

drive wizard

Posted: Mon Nov 19, 2007 7:17 am
by Daniel
Go to http://sourceforge.net/project/showfile ... p_id=78138 and download libusb-win32-device-bin-0.1.12.1.tar.gz uncompress it and go to bin folder, run inf-wizard.exe and u will can to make the driver for whatever device you want.

Daniel Barragan
Argus Smart / Parquesoft
Colombia - South America

danielbcr.blogspot.com

;)