Topic: all5003 - can't copy image to flash using u-boot

Hi,

I compiled a openwrt image and trying to copy it to flash. But it doesn't work:

U-Boot 1.1.3 (Dec  8 2010 - 20:18:24)   
RT5350 # loadb                   
## Ready for binary (kermit) download to 0x80100000 at 57600 bps...

RT5350 # erase linux

 Erase linux kernel block !!
From 0x50000 length 0x1FB0000
raspi_erase: offs:50000 len:1fb0000
........................................................................................................................................................................................
........................................................................................................................................................................................
...........................................................................................................................................
RT5350 # cp.linux

 Copy linux image[-1437226411 byte] to SPI Flash[0x00050000].... 
raspi_write: to:50000 len:aa55aa55 

All other attemps are also failing:

RT5350 # cp 0x80100000 0x00050000 0x540004
Usage:
cp      - memory copy

RT5350 # cp.b 0x80100000 0x00050000 0x540004
Usage:
cp      - memory copy

RT5350 # cp 80100000 00050000 540004
Usage:
cp      - memory copy

BTW: Its a small rt5350 module with 32MB flash and 32MB RAM - the startup:

U-Boot 1.1.3 (Dec  8 2010 - 20:18:24)

Board: Ralink APSoC DRAM:  32 MB
relocate_code Pointer at: 81fb4000
******************************
Software System Reset Occurred
******************************
spi_wait_nsec: 42 
spi device id: c2 20 19 c2 20 (2019c220)
find flash: MX25L25635E
raspi_read: from:30000 len:1000 
.raspi_read: from:30000 len:1000 
.============================================ 
Ralink UBoot Version: 3.5.2.0
-------------------------------------------- 
ASIC 5350_MP (Port5<->None)
DRAM_CONF_FROM: Boot-Strapping 
DRAM_TYPE: SDRAM 
DRAM_SIZE: 256 Mbits
DRAM_WIDTH: 16 bits
DRAM_TOTAL_WIDTH: 16 bits
TOTAL_MEMORY_SIZE: 32 MBytes
Flash component: SPI Flash
Date:Dec  8 2010  Time:20:18:24
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:128, ways:4, linesz:32 ,total:16384 

 ##### The CPU freq = 360 MHZ #### 
 estimate memory size =32 Mbytes

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

You choosed 4

raspi_read: from:40028 len:6 
.

4: System Enter Boot Command Line Interface.
                                                                                                                                   
U-Boot 1.1.3 (Dec  8 2010-20:18:24)
RT5350 # ?
?       - alias for 'help'
bootm   - boot application image from memory
cp      - memory copy
erase   - erase SPI FLASH memory 
go      - start application at address 'addr'   
help    - print online help
loadb   - load binary file over serial line (kermit mode)
md      - memory display
mdio   - Ralink PHY register R/W command !!
mm      - memory modify (auto-incrementing)
mw      - memory write (fill)
nm      - memory modify (constant address)
printenv- print environment variables 
reset   - Perform RESET of the CPU
rf      - read/write rf register
saveenv - save environment variables to persistent storage
setenv  - set environment variables
tftpboot- boot image via network using TFTP protocol
version - print monitor version
RT5350 # 
RT5350 # printenv
bootcmd=tftp
bootdelay=5
baudrate=57600
ethaddr="00:AA:BB:CC:DD:10"
ipaddr=10.10.10.123
serverip=10.10.10.3
ramargs=setenv bootargs root=/dev/ram rw
addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):off
addmisc=setenv bootargs $(bootargs) console=ttyS0,$(baudrate) ethaddr=$(ethaddr) panic=1
flash_self=run ramargs addip addmisc;bootm $(kernel_addr) $(ramdisk_addr)
kernel_addr=BFC40000
u-boot=u-boot.bin
load=tftp 8A100000 $(u-boot)
u_b=protect off 1:0-1;era 1:0-1;cp.b 8A100000 BC400000 $(filesize)
loadfs=tftp 8A100000 root.cramfs
u_fs=era bc540000 bc83ffff;cp.b 8A100000 BC540000 $(filesize)
test_tftp=tftp 8A100000 root.cramfs;run test_tftp
ethact=Eth0 (10/100-M)
stdin=serial
stdout=serial
stderr=serial
filesize=540004

Environment size: 781/4092 bytes

Re: all5003 - can't copy image to flash using u-boot

random hint, based on other uboot.. try the + (plus) symbol to pass lenght to cp command..

3 (edited by bertc3p0 2013-05-31 22:40:10)

Re: all5003 - can't copy image to flash using u-boot

nebbia88 wrote:

random hint, based on other uboot.. try the + (plus) symbol to pass lenght to cp command..

Thx for your reply nebbia88 - doesn't fix the problem. I just applied a network port and made an update thru tftpboot. Flashing with cp.linux worked fine - strange.

Nevertheless I'm facing a new problem:

[   33.040000] ------------[ cut here ]------------
[   33.040000] WARNING: at net/sched/sch_generic.c:254 dev_watchdog+0x180/0x288()
[   33.060000] NETDEV WATCHDOG: eth0 (): transmit queue 0 timed out
[   33.070000] Modules linked in: i2c_algo_bit gpio_pcf857x i2c_dev i2c_core ohci_hcd ledtrig_usbdev ip6t_REJECT ip6t_rt ip6t_hbh ip6t_mh ip6t_ipv6header ip6t_frag 
ip6t_eui64 ip6t_ah ip6table_raw ip6table_mangle ip6table_filter ip6_tables nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_irc nf_nat_ftp nf_conntrack_irc nf_conntrack_ftp 
xt_REDIRECT ipt_MASQUERADE iptable_nat xt_nat nf_nat_ipv4 nf_nat pppoe xt_conntrack xt_CT iptable_raw xt_state nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack ehci_pl
atform ehci_hcd pppox xt_mark xt_time ipt_REJECT xt_TCPMSS xt_LOG xt_comment xt_multiport xt_mac xt_limit iptable_mangle iptable_filter ip_tables xt_tcpudp x_tables
 ppp_async ppp_generic slhc rt2800pci(O) rt2800lib(O) rt2x00soc(O) rt2x00pci(O) rt2x00mmio(O) rt2x00lib(O) mac80211(O) usbcore usb_common nls_base crc_itu_t crc_cci
tt ipv6 eeprom_93cx6 cfg80211(O) compat(O) arc4 crypto_blkcipher aead leds_gpio button_hotplug(O) gpio_keys_polled input_polldev input_core
[   33.240000] Call Trace:
[   33.240000] [<80010474>] dump_stack+0x8/0x34
[   33.250000] [<800193bc>] warn_slowpath_common+0x78/0xa4
[   33.260000] [<80019470>] warn_slowpath_fmt+0x2c/0x38
[   33.270000] [<8019c030>] dev_watchdog+0x180/0x288
[   33.280000] [<800249f0>] call_timer_fn.isra.37+0x24/0x84
[   33.290000] [<80024bc0>] run_timer_softirq+0x170/0x1cc
[   33.300000] [<8001ff7c>] __do_softirq+0xb0/0x184
[   33.310000] [<80020100>] do_softirq+0x48/0x68
[   33.320000] [<8002031c>] irq_exit+0x4c/0x84
[   33.330000] [<8000482c>] ret_from_irq+0x0/0x4
[   33.340000] [<80004a60>] r4k_wait+0x20/0x40
[   33.350000] [<8000dad0>] cpu_idle+0x30/0x60
[   33.350000] [<802898ec>] start_kernel+0x364/0x384
[   33.360000] 
[   33.370000] ---[ end trace 409fe188e1879dba ]---

The code base is a fresh trunk (Bleeding Edge, r36813). Not sure, but maybe the switch config could be the problem:

oot@OpenWrt:/# cat /etc/config/network 

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd53:e8e:2bcd::/48'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '0'

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

4 (edited by Vonger 2013-11-26 17:41:34)

Re: all5003 - can't copy image to flash using u-boot

Hi, bertc3p0
  I get same problem as yours when I was trying to upload firmware by serial today. 
  That is ralink uboot bug, I make a quick dirty fix by add two line in uboot/drivers/spi_flash.c, in do_mem_cp function

    addr = CFG_LOAD_ADDR;
    count = (unsigned int)NetBootFileXferSize;
    if(count <= 0)
        count = simple_strtoul(argv[1], NULL, 16);

  The problem is if you do not upload your firmware from net, NetBootFileXferSize will be zero or some random value.
  Add that two line code, upload bootloader.Now we can call loadb to load bin to 0x80100000 first, then call erase linux, third call tftpboot but use Ctrl-C to stop that(now NetBootFileXferSize = 0), final cp.linux [your bin size], and it will work.

Re: all5003 - can't copy image to flash using u-boot

Hi,

I have recently bought the ALL5003EVAL and there is neither user manual nor schematic that comes with it.

Have gone to the ALLNET website and could not find the user manual and the schematic either.

Have couple of questions and appreciate the forum help. Thanks !

Q1. May I know where could I get the User Manual and the Schematic? Without the User Manual is quite difficult to start and use the board.

Q2. What is the default console setting? The RJ45-Serial Adapter Cable that comes with the board is having three serial connectors at one end, labelled "1", "2" and "3" which one should I use?

Thanks & regards,
Kim