Problems building bootloadHID

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Problems building bootloadHID

Post by gert » Sun Oct 21, 2007 1:32 pm

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

gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Post by gert » Sun Oct 21, 2007 3:10 pm

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

gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Post by gert » Sun Oct 21, 2007 8:58 pm

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

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Tue Oct 23, 2007 1:51 pm

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...

gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Post by gert » Tue Oct 23, 2007 3:11 pm

Christian,

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

Cheers
Gert

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Tue Oct 23, 2007 3:15 pm

The new version should be online already...

gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Post by gert » Wed Oct 24, 2007 12:25 am

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

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Wed Oct 24, 2007 1:39 pm

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.

gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Post by gert » Wed Oct 24, 2007 4:21 pm

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

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Wed Oct 24, 2007 4:25 pm

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.

gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Post by gert » Wed Oct 24, 2007 8:15 pm

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

highlanderf1
Posts: 5
Joined: Fri Oct 19, 2007 11:58 am
Location: Hanoi Viet Nam
Contact:

Post by highlanderf1 » Thu Nov 01, 2007 6:47 pm

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!

gert
Rank 1
Rank 1
Posts: 27
Joined: Sat Oct 20, 2007 5:58 pm

Post by gert » Thu Nov 01, 2007 8:55 pm

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

Guest

Post by Guest » Fri Nov 02, 2007 7:55 am

Thank gert!
I found the libusb in Windriver folder of Powerswitch but it not suppose for the USB-LED-Fader!
Anyway thanks!

Daniel

drive wizard

Post by Daniel » Mon Nov 19, 2007 7:17 am

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

;)

Post Reply