[U-Boot] Data abort after usb start command

Nícolas Carneiro Lebedenco nicolas.lebedenco at tasksistemas.com.br
Wed Sep 3 22:40:19 CEST 2008


Hi,

Well, here I am again with my at91rm9200dk based board. I got a segfault (data 
abort) after entering the "usb start" command with a 512mb Sandisk USB 
pendrive connected. The command succeeds if no usb drive is connected and 
obviously it reports no storage device found as expected. 

The problem seemed to be inside the usb_set_maxpacket(struct usb_device *dev) 
function (from common/usb.c). For the OHCI hub device it runs well but, oddly 
enough, for the detected usb device a fault happens anywhere we try to access 
ep->wMaxPacketSize value! Weird, han? The only way I found to fix it was 
declaring struct usb_device with __attribute__ ((packed)) inside usb.h. This 
makes me wonder if there's a hidden alignment issue around...

My fix was:

--- u-boot-1.3.4.original/include/usb.h	2008-08-12 11:08:38.000000000 -0300
+++ u-boot-1.3.4/include/usb.h	2008-09-03 17:01:03.000000000 -0300
@@ -163,7 +163,7 @@
 	int maxchild;			/* Number of ports if hub */
 	struct usb_device *parent;
 	struct usb_device *children[USB_MAXCHILDREN];
-};
+} __attribute__ ((packed));
 
 /**********************************************************************
  * this is how the lowlevel part communicate with the outer world
--

For the record, I'm using u-boot 1.3.4 stable from DENX Ftp and CodeSourcery's 
toolchain.

$ arm-none-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured 
with: /scratch/sandra/lite/src/gcc-4.2/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion=Sourcery 
G++ Lite 
2008q1-126 --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/sandra/lite/linux/install/arm-none-linux-gnueabi/libc --enable-poison-system-directories --with-build-time-tools=/scratch/sandra/lite/linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/sandra/lite/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)

Regards,

Nícolas


 


More information about the U-Boot mailing list