[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux]apparent timeout problems with tftp



Hi Leonid, Larry,

Can you please try the attached patch? It actually does nothing to the ethernet/ethernetlite drivers, but rather just adds instruction and datacache support to u-boot.

I found this totally fixed the tftp issues i was seeing here. Previously there were lots of timeouts, now it's a lovely clean download, every time.

Apply it at patchlevel -p1 from the petalinux-dist/u-boot directory:

$ cd ${PETALINUX}/software/petalinux-dist/u-boot
$ patch -p1 < petalinux-u-boot-cache.patch

Rebuild u-boot, and give it a try.

Please let me know if this helps,

John

Leonid wrote:
Hi, Larry:

I have precisely same problem, in fact see my message attached here.
Your particular problem can be different though (see reference to u-boot
FAQ there). I believe, John has opened an issue regarding this matter.

This is something wrong with Ethernet Lite u-boot driver because it
doesn't show up with EMAC driver I had on my own board (you cannot use
it on your 50MHz Spartan-3E design, need 64MHz at least) nor uClinux
when finally loaded shows any network problems.

I don't know root of the problem, but I could mend its symptoms by using
different tftp server. In fact, the only server I couldn't work was
trivial Linux in.tftpd. I switched to atftpd and run it with following
parameters:

service tftp
{
        disable = no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/atftpd
        server_args             = --retry-timeout 1 --no-timeout
/tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

It's only workaround of course. I also didn't hear about such problem
from people, running tftp server on Windows.

Thanks,

Leonid.

-----Original Message-----
From: owner-microblaze-uclinux@xxxxxxxxxxxxxx
[mailto:owner-microblaze-uclinux@xxxxxxxxxxxxxx] On Behalf Of Larry
Rystrom
Sent: Thursday, March 29, 2007 1:59 PM
To: microblaze-uclinux@xxxxxxxxxxxxxx
Subject: [microblaze-uclinux]apparent timeout problems with tftp

Hi All,

I am continuing to make good basic progress on getting our c++
appplication over to uClinux but have now run into a problem with not
being able to complete the steps in the "Getting Started Tutorial for
the Spartan-3E-500 Starter Kit" (thanks John for this tutorial).

From the U-boot prompt I get the following with each 'T' evidently
representing a timeout:
U-Boot> tftp $(clobstart) u-boot-s.bin
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000
Loading: #T T T #T #T #T T T T T
Retry count exceeded; starting again

I was able to tftp into this machine from a windows machine and transfer
a file. Also the 'localhost' test seems to work correctly. I have put
the output from my three terminal windows below.

Suggestions anybody?

Larry

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"kermit" terminal window output:

PetaLinux environment set to '/home/rystrom/petalinux'
[rystrom@localhost ~]$ kermit -c
Connecting to /dev/ttyS0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------

=================================================
FS-BOOT First Stage Bootloader (c) 2006 PetaLogix
=================================================
FS-BOOT: System initialisation completed.
FS-BOOT: No existing image in FLASH.  Starting image download.
FS-BOOT: Waiting for SREC image....
FS-BOOT: Image download successful.
FS-BOOT: Warning image location differ from default boot location. Image
will not boot automatically after POR.
FS-BOOT: Press 'n' to boot old image.
FS-BOOT: Use new image.
FS-BOOT: Booting image...
SDRAM :
        U-Boot Start:0x23fc0000
        Malloc Start:0x23f60000
        Board Info Start:0x23f5ffd0
        Boot Parameters Start:0x23f4ffd0
FLASH: 16 MB
ETHERNET: MAC:00:0a:35:00:22:01

Hit any key to stop autoboot:  0
## Booting image at 210c0000 ...
Bad Magic Number
U-Boot> loadb 0x22000000
## Ready for binary (kermit) download to 0x22000000 at 115200 bps...

(Back at localhost.localdomain)
----------------------------------------------------
C-Kermit 8.0.209, 17 Mar 2003, for Red Hat Linux 8.0
 Copyright (C) 1985, 2003,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/home/rystrom/) C-Kermit>send /bin /tftpboot/ub.config.img
(/home/rystrom/) C-Kermit>connect
Connecting to /dev/ttyS0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
## Total Size      = 0x000003f4 = 1012 Bytes
## Start Addr      = 0x22000000
U-Boot> setenv ethaddr=
U-Boot> autoscr $(fileaddr)
## Executing script at 22000000
PetaLogix MicroBlaze-Auto Board Configuration
---------------------------------------------
Network Configuration:
MTD Configuration:
Clobber DRAM Configuration:
Bootloader Configuration:
Kernel Configuration:
Boot Configuration:
Saving Configurations...
Saving Environment to Flash...
Un-Protected 2 sectors
Erasing Flash...
.. done
Erased 2 sectors
Writing to Flash... done
Protected 2 sectors
Configuration Completed
U-Boot> tftp $(clobstart) u-boot-s.bin
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000
Loading: #T T T #T #T #T T T T T
Retry count exceeded; starting again
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000
Loading: ##T T #T T ##T T T T T ###T
Retry count exceeded; starting again
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000
Loading: #T T #T T T T #T T T T #
Retry count exceeded; starting again
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000
Loading: #T T #T #T T T T #T T T
Retry count exceeded; starting again
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000
Loading: ##T T T T #T T T T T T
Retry count exceeded; starting again
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000
Loading: #T T T T T T #T ##T T T #
Retry count exceeded; starting again
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'u-boot-s.bin'.
Load address: 0x22000000

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"hardware" terminal window:

PetaLinux environment set to '/home/rystrom/petalinux'
[rystrom@localhost ~]$ cd petalinux
[rystrom@localhost petalinux]$ cd hardware
[rystrom@localhost hardware]$ cd ref*
[rystrom@localhost reference-designs]$ ls
pre-built                         Xilinx-ML403-uclinux-ref-edk71
Xilinx-ML401-uclinux-ref-edk71    Xilinx-ML403-uclinux-ref-edk81
Xilinx-ML401-uclinux-ref-edk81    Xilinx-ML403-uclinux-temac-edk81
Xilinx-ML401-uclinux-ref-edk82    Xilinx-Spartan3E500-RevC-edk81
Xilinx-ML403-ppc-linux-ref-edk71  Xilinx-Spartan3E500-RevC-edk82
Xilinx-ML403-ppc-linux-ref-edk81
[rystrom@localhost reference-designs]$ cd *RevC-edk82
[rystrom@localhost Xilinx-Spartan3E500-RevC-edk82]$ make -f system.make
download
*********************************************
Downloading Bitstream onto the target board
*********************************************
impact -batch etc/download.cmd
Release 8.2.03i - iMPACT I.34
Copyright (c) 1995-2006 Xilinx, Inc.  All rights reserved.
// *** BATCH CMD : setMode -bs
// *** BATCH CMD : setCable -port auto
AutoDetecting cable. Please wait.
Reusing 78008001 key.
Reusing FC008001 key.
Connecting to cable (Parallel Port - parport0).
 WinDriver v8.02 Jungo (c) 1997 - 2006 Build Date: Jun  6 2006 X86 32bit
16:11:59.
 parport0: baseAddress=0x378, ecpAddress=0x778
 LPT base address = 0378h.
 ECP base address = 0778h.
Cable connection failed.
Reusing 79008001 key.
Reusing FD008001 key.
Connecting to cable (Parallel Port - parport1).
 WinDriver v8.02 Jungo (c) 1997 - 2006 Build Date: Jun  6 2006 X86 32bit
16:11:59.
Cable connection failed.
Reusing 7A008001 key.
Reusing FE008001 key.
Connecting to cable (Parallel Port - parport2).
 WinDriver v8.02 Jungo (c) 1997 - 2006 Build Date: Jun  6 2006 X86 32bit
16:11:59.
Cable connection failed.
Reusing 7B008001 key.
Reusing FF008001 key.
Connecting to cable (Parallel Port - parport3).
 WinDriver v8.02 Jungo (c) 1997 - 2006 Build Date: Jun  6 2006 X86 32bit
16:11:59.
Cable connection failed.
Reusing A0008001 key.
Reusing 24008001 key.
Connecting to cable (Usb Port - USB21).
Checking cable driver.
File version of /opt/pkg/xilinx/ise8.2/bin/lin/xusbdfwu.hex = 1021(dec),
03FD.
File version of /etc/hotplug/usb/xusbdfwu.fw/xusbdfwu.hex = 1025(dec),
0401.
Calling setinterface num=0, alternate=0.
DeviceAttach: received and accepted attach for:
  vendor id 0x3fd, product id 0x8, device handle 0x8fba4e8
 Cable PID = 0008.
 Max current requested during enumeration is 280 mA.
 Cable Type = 3, Revision = 0.
 Setting cable speed to 6 MHz.
Cable connection established.
Firmware version = 1025.
CPLD file version = 0012h.
CPLD version = 0012h.
// *** BATCH CMD : identify
Identifying chain contents ....Version is 0000
'1': : Manufacturer's ID =Xilinx xc2c64a, Version : 0
PMSPEC -- Overriding Xilinx file
</opt/pkg/xilinx/ise8.2/xbr/data/xbr.acd> with
local file </opt/pkg/xilinx/ise8.2/xbr/data/xbr.acd>
INFO:iMPACT:1777 -
   Reading /opt/pkg/xilinx/ise8.2/xbr/data/xc2c64a.bsd...
INFO:iMPACT:501 - '1': Added Device xc2c64a successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
Version is 1111
'2': : Manufacturer's ID =Xilinx xcf04s, Version : 15
INFO:iMPACT:1777 -
   Reading /opt/pkg/xilinx/ise8.2/xcf/data/xcf04s.bsd...
INFO:iMPACT:501 - '1': Added Device xcf04s successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
Version is 0000
'3': : Manufacturer's ID =Xilinx xc3s500e, Version : 0
INFO:iMPACT:1777 -
   Reading /opt/pkg/xilinx/ise8.2/spartan3e/data/xc3s500e.bsd...
INFO:iMPACT:501 - '1': Added Device xc3s500e successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
done.
Chain TCK freq = 10000000.
Chain TCK freq = 10000000.
Validating chain...
Boundary-scan chain validated successfully.
Elapsed time =      0 sec.
// *** BATCH CMD : identifyMPM
Elapsed time =      0 sec.
// *** BATCH CMD : assignFile -p 1 -file "implementation/download.bit"
'1': Loading file 'implementation/download.bit' ...
done.
INFO:iMPACT:501 - '1': Added Device xc3s500e successfully.
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
// *** BATCH CMD : program -p 1
Chain TCK freq = 10000000.
Chain TCK freq = 10000000.
Validating chain...
Boundary-scan chain validated successfully.
'1':Programming  device...
done.
'1': Reading status register contents...
CRC error                                         :         0
Decryptor security set                            :         0
DCM locked                                        :         1
DCI matched                                       :         1
legacy input error                                :         0
status of GTS_CFG_B                               :         1
status of GWE                                     :         1
status of GHIGH                                   :         1
value of MODE pin M0                              :         1
value of MODE pin M1                              :         0
value of MODE pin M2                              :         1
value of CFG_RDY (INIT_B)                         :         1
DONEIN input from DONE pin                        :         1
IDCODE not validated while trying to write FDRI   :         0
write FDRI issued before or after decrypt operation:         0
Decryptor keys not used in proper sequence        :         0
INFO:iMPACT:2219 - Status register values:
INFO:iMPACT - 0011 0111 1011 1000 0000 0000 0000 0000
INFO:iMPACT:579 - '1': Completed downloading bit file to device.
INFO:iMPACT:580 - '1':Checking done pin ....done.
'1': Programmed successfully.
Elapsed time =      1 sec.
// *** BATCH CMD : quit
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
[rystrom@localhost Xilinx-Spartan3E500-RevC-edk82]$ cat
/tftpboot/u-boot.srec > /dev/ttyS0
[rystrom@localhost Xilinx-Spartan3E500-RevC-edk82]$

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"tftp" terminal window:

PetaLinux environment set to '/home/rystrom/petalinux'
[rystrom@localhost ~]$ ls -l /tftpboot
total 32672
-rw-r--r--  1 rystrom users       13 Mar 28 13:36 foo.txt
-rwxrwxrwx  1 nobody  users  3141675 Mar 28 12:07 image.bin
-rwxrwxrwx  1 nobody  users 13652504 Mar 28 12:07 image.elf
-rwxrwxrwx  1 nobody  users  9412828 Mar 28 12:07 image.srec
-rwxrwxrwx  1 nobody  users  3141696 Mar 28 12:07 image.ub
-rwxrwxrwx  1 nobody  users  1257472 Mar 28 12:07 linux.bin
-rwxrwxrwx  1 nobody  users  1884160 Mar 28 12:07 romfs.img
-rwxrwxrwx  1 nobody  users     1012 Mar 28 12:07 ub.config.img
-rwxrwxrwx  1 nobody  users   102232 Mar 28 12:07 u-boot-s.bin
-rwxrwxrwx  1 nobody  users   102972 Mar 28 12:07 u-boot-s.elf
-rwxrwxrwx  1 nobody  users   306466 Mar 28 12:07 u-boot.srec
-rwxrwxrwx  1 nobody  users   306812 Mar 28 12:07 u-boot-s.srec
[rystrom@localhost ~]$ ls
add_ibuf.txt  edk_user_repository  Lab2             pcores
Desktop       foo.txt              microblaze-auto  petalinux
Desktop1      Lab1                 old.kermrc~      test
[rystrom@localhost ~]$ rm foo.txt
[rystrom@localhost ~]$ tftp localhost
tftp> get foo.txt
tftp> quit
[rystrom@localhost ~]$ ls
add_ibuf.txt  edk_user_repository  Lab2             pcores
Desktop       foo.txt              microblaze-auto  petalinux
Desktop1      Lab1                 old.kermrc~      test
[rystrom@localhost ~]$ cat foo.txt
testing this
[rystrom@localhost ~]$ netstat -l -u | grep tftp
udp 0 0 *:tftp *:* [rystrom@localhost ~]$



___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive :
http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/



------------------------------------------------------------------------

Subject:
[microblaze-uclinux] Bad u-boot ETHERLITE driver performance.
From:
"Leonid" <Leonid@xxxxxxxxx>
Date:
Thu, 22 Feb 2007 12:35:23 -0700
To:
<microblaze-uclinux@xxxxxxxxxxxxxx>

To:
<microblaze-uclinux@xxxxxxxxxxxxxx>


Hi:

On Xilinx Spartan-3e Starter Kit during uClinux image downloading from
u-boot via TFTP some packets get lost slower down downloading process.

This is typical downloading snapshot:

U-Boot> tftp 23000000 lm125/rel/1.0.0/image.ub
TFTP from server 192.168.0.141; our IP address is 192.168.0.206
Filename 'lm125/rel/1.0.0/image.ub'.
Load address: 0x23000000
Loading:
#################################################################
         #######################################T
##########################
################################################################# #################################################################
         ##########################T ##############################T
#########
         ############################################T
###################T ###############################################################
done
Bytes transferred = 3313728 (329040 hex)
U-Boot>

This is happening only with ETHERNETLITE core and never with EMAC core
(network setup is precisely the same). Also as soon as uClinux is
loaded, network applications (including NFS and TFTP) are working
smoothly meaning that problem is in u-boot emaculite drivers themselves
(I'm using u-boot 1.1.4 snapshot from Petalinux distro).
Wolfgang Denk suggested here
http://www.denx.de/wiki/view/DULG/TFTPTimeout that it can be problem
with full/half duplex configuration, but I couldn't find how to
configure such mode is configured for emaculite driver.

Please advise,

Leonid.

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/


===================================================================
--- u-boot/lib_microblaze/cache.c	(revision 2350)
+++ u-boot/lib_microblaze/cache.c	(working copy)
@@ -1,7 +1,9 @@
 /*
  * (C) Copyright 2004 Atmark Techno, Inc.
+ * (C) Copyright 2007 PetaLogix
  *
  * Yasushi SHOJI <yashi@xxxxxxxxxxxxxxxxx>
+ * John williams <john.williams@xxxxxxxxxxxxx>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -24,8 +26,87 @@
 
 #include <common.h>
 
+/* Relevant bits in MSR */
+#define MSR_ICE 0x20
+#define MSR_DCE 0x80
+
 void flush_cache (ulong addr, ulong size)
 {
-	/* MicroBlaze have write thruough cache. nothing to do. */
+	int i;
+	for(i=0;i<size;i+=4)
+		asm volatile (	
+#if CONFIG_XILINX_MICROBLAZE0_USE_ICACHE
+				"wic	%0, r0"
+#endif
+#if CONFIG_XILINX_MICROBLAZE0_USE_DCACHE
+				"wdc	%0, r0"
+#endif
+				:
+				: "r" (addr+i)
+				: "memory");
 	return;
 }
+
+void icache_enable(void)
+{
+	asm volatile (	"mfs r3, rmsr;"
+			"ori r3, r3, %0;"
+			"mts rmsr, r3;"
+			:
+			: "i" (MSR_ICE)
+			: "r3");
+
+}
+
+void icache_disable(void)
+{
+	asm volatile (	"mfs r3, rmsr;"
+			"andi r3, r3, %0;"
+			"mts rmsr, r3;"
+			:
+			: "i" (~MSR_ICE)
+			: "r3");
+}
+
+int icache_status(void)
+{
+	int flags;
+	asm volatile (	"mfs %0, rmsr;"
+			: "=r" (flags)
+			:
+			: "memory");
+	return (flags & MSR_ICE)!=0;
+}
+
+void dcache_enable(void)
+{
+	asm volatile (	"mfs r3, rmsr;"
+			"ori r3, r3, %0;"
+			"mts rmsr, r3;"
+			:
+			: "i" (MSR_DCE)
+			: "r3");
+}
+
+void dcache_disable(void)
+{
+	asm volatile (	"mfs r3, rmsr;"
+			"andi r3, r3, %0;"
+			"mts rmsr, r3;"
+			:
+			: "i" (~MSR_DCE)
+			: "r3");
+
+
+}
+
+int dcache_status(void)
+{
+	int flags;
+	asm volatile (	"mfs %0, rmsr;"
+			: "=r" (flags)
+			:
+			: "memory");
+	return (flags & MSR_DCE)!=0;
+}
+
Index: u-boot/lib_microblaze/board.c
===================================================================
--- u-boot/lib_microblaze/board.c	(revision 2350)
+++ u-boot/lib_microblaze/board.c	(working copy)
@@ -140,6 +140,13 @@
 	/* Setup SDRAM memory partition pointers */
 	addr = (CFG_SDRAM_BASE + CFG_SDRAM_SIZE);
 
+	puts ("Enabling caches...");
+	icache_enable();
+	dcache_enable();
+	printf("Icache:%s...",icache_status()?"OK":"FAIL");
+	printf("Dcache:%s\n",dcache_status()?"OK":"FAIL");
+	
+
 	/* 
 	 * Reserve memory for U-BOOT code.
 	 * u-boot code resides on top of SDRAM 
Index: u-boot/include/configs/petalogix-microblaze-auto.h
===================================================================
--- u-boot/include/configs/petalogix-microblaze-auto.h	(revision 2350)
+++ u-boot/include/configs/petalogix-microblaze-auto.h	(working copy)
@@ -104,10 +104,10 @@
 
 #if defined(CONFIG_XILINX_ETHERNET_0_INSTANCE) || defined(CONFIG_XILINX_ETHERNETLITE_0_INSTANCE)
 #define REMOVE_COMMANDS		(CFG_CMD_MMC | CFG_CMD_IMLS) 
-#define CONFIG_COMMANDS		((CONFIG_CMD_DFL | CFG_CMD_PING) & ~REMOVE_COMMANDS)
+#define CONFIG_COMMANDS		((CONFIG_CMD_DFL | CFG_CMD_CACHE | CFG_CMD_PING) & ~REMOVE_COMMANDS)
 #else 
 #define REMOVE_COMMANDS		(CFG_CMD_MMC | CFG_CMD_IMLS | CFG_CMD_NET) 
-#define CONFIG_COMMANDS		(CONFIG_CMD_DFL & ~REMOVE_COMMANDS)
+#define CONFIG_COMMANDS		(CONFIG_CMD_DFL | CFG_CMD_CACHE & ~REMOVE_COMMANDS)
 #endif
 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
 #include <cmd_confdefs.h>