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

[microblaze-uclinux] Problems running U-Boot/Kernel from flash memory



Hello,

 

I hope someone in the community has some advice for me. I am having a problem with U-Boot and petalinux running from flash on my Spartan3E-1600 evaluation board. Basically, everything builds and downloads successfully to flash using U-Boot. However, if I let the kernel boot and then reboot the board, my U-Boot image is inaccessible to FS-BOOT until I power cycle the board, and then my U-boot bootenv is invalid until I download and write it to flash again.

 

My configuration is the following:

      petalinux-v0.20-rc3, 2.6 kernel

      ISE 9.1i

      EDK 9.1i SP2

 

I have completed the board guide for the Sparta3E-1600 development board using the hardware platform in hardware/reference-designs/Xilinx-Spartan3E1600-RevA-edk91, for which everything builds and makes without error.

 

After that, I edited the partition table using menuconfig to put a 1MB partition before the others to use for the bpi-up bitstream. I also edited the FS-BOOT to look for U-Boot at 0x21100000 instead of 0x21000000. The petalinux "make all" and the Xilinx "Build all user applications" succeeded without error. I updated the bitstream with the new FS-BOOT and downloaded it to the target. Then, I downloaded and programmed the new u-boot, bootenv, and kernel.

 

At this point I have the flash programmed and I am sitting at a U-Boot prompt. If I use the reset command or re-download the bitstream: FS-BOOT will find U-Boot, U-Boot will wait 4 seconds and then boot the kernel. However, I interrupt U-Boot before it boots the kernel by pressing a key. As long as I don't let U-boot boot the kernel, I can continue to reset the microblaze or download the bitstream and get the same results (FS-BOOT and U-Boot work correctly).

 

The next step is to let U-Boot boot the kernel. When this happens I get the boot messages I expect. The flash is detected, and the correct partitions are set from U-Boot via the command line. I end up at the login prompt.

 

Here is where it gets strange:

 

Now when I re-download the bitstream to the device, FS-BOOT fails to see U-Boot and waits for me to send it an srec (even though I have already rebooted several times from the U-Boot prompt without failure). So, instead of sending a new copy of U-Boot I cycle power on the development board and download the bitstream again. Now, FS-BOOT finds the U-Boot image and starts U-boot. However, U-Boot fails to find its bootenv and comes up to a U-Boot prompt with the default environment variables. If I download the ub.config again and run autoscr, I get my environment back and we are back to the point where I can reset the processor either via a reset command or re-downloading the bitstream until I let the kernel boot up, at which point FS-BOOT cannot find U-BOOT until I power cycle the board, and then U-Boot cannot find a valid bootenv...

 

I have placed all my boot output below. I hope someone has some advice for me. It seems as though booting the kernel is leaving the flash in a bad state (I don't know if that is U-Boot's or the kernel's fault). However, I don't know of anything during the kernel's boot process that would be writing to flash.

 

Thanks for your help,

Doug

 

Here is the actual output:

 

1. U-Boot and its environment have been written to flash and I re-download the bitstream (or type U-Boot>reset). I have stopped U-Boot from booting the kernel by pressing a key (I can do this all day long with no problems).

 

<output>

 

=================================================

FS-BOOT First Stage Bootloader (c) 2006 PetaLogix

=================================================

FS-BOOT: System initialisation completed.

FS-BOOT: Searching for U-Boot at address: 0x21100000

FS-BOOT: Booting from FLASH. Press 's' for image download.

FS-BOOT: Booting image...

SDRAM :

Enabling caches...Icache:OK...Dcache:OK

        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

U-Boot>

 

</output>

 

2. I allow U-Boot to boot the kernel

 

<output>

 

=================================================

FS-BOOT First Stage Bootloader (c) 2006 PetaLogix

=================================================

FS-BOOT: System initialisation completed.

FS-BOOT: Searching for U-Boot at address: 0x21100000

FS-BOOT: Booting from FLASH. Press 's' for image download.

FS-BOOT: Booting image...

SDRAM :

Enabling caches...Icache:OK...Dcache:OK

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

   Image Name:   PetaLinux Kernel 2.6

   Image Type:   Microblaze Linux Kernel Image (uncompressed)

   Data Size:    2863280 Bytes =  2.7 MB

   Load Address: 22000000

   Entry Point:  22000000

   Verifying Checksum ... OK

OK

Found romfs @ 0x221b808c (0x00103000)

#### klimit 221d0000 ####

Moving 0x00103000 bytes from 0x221b808c to 0x221cf980

New klimit: 0x222d3000

Linux version 2.6.20-uc0 (dougb@dougb-linux) (gcc version 3.4.1 ( PetaLinux 0.20

 Build -rc1 050607 )) #8 Fri Sep 14 23:16:01 PDT 2007

setup_cpuinfo: initialising

setup_cpuinfo: Using full CPU PVR support

setup_memory: max_mapnr: 0x23fff

setup_memory: min_low_pfn: 0x22000

setup_memory: max_low_pfn: 0x2000

On node 0 totalpages: 8192

  DMA zone: 64 pages used for memmap

  DMA zone: 0 pages reserved

  DMA zone: 8128 pages, LIFO batch:0

  Normal zone: 0 pages used for memmap

Built 1 zonelists.  Total pages: 8128

Kernel command line: mtdparts=physmap-flash.0:1M(bitstream),256K(boot),256K(boot

env),256K(config),5M(image),9M(spare) macaddr=00:0a:35:00:22:01

OPB INTC #0 at 0x41200000

PID hash table entries: 128 (order: 7, 512 bytes)

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory: 29588k/32768k available

Calibrating delay loop... 33.07 BogoMIPS (lpj=165376)

Mount-cache hash table entries: 512

NET: Registered protocol family 16

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 1024 (order: 0, 4096 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP reno registered

io scheduler noop registered

io scheduler anticipatory registered

io scheduler deadline registered

io scheduler cfq registered (default)

xgpio0 #0 at 0x40040000 mapped to 0x40040000 device: 10,185 not using IRQ

xgpio1 #1 at 0x40060000 mapped to 0x40060000 device: 10,186 not using IRQ

uartlite.0: ttyS0 at MMIO 0x40600000 (irq = 2) is a uartlite

RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize

eth0: using sgDMA mode.

eth0: PHY Address:31

eth0: Xilinx EMAC #0 at 0x40C00000 mapped to 0x40C00000, irq=1

eth0: id 2.0l; block id 11, type 1

physmap platform flash device: 01000000 at 21000000

physmap-flash.0: Found 1 x16 devices at 0x0 in 8-bit bank

 Intel/Sharp Extended Query Table at 0x0031

Using buffer write method

cfi_cmdset_0001: Erase suspend on write enabled

erase region 0: offset=0x0,size=0x20000,blocks=128

6 cmdlinepart partitions found on MTD device physmap-flash.0

Creating 6 MTD partitions on "physmap-flash.0":

0x00000000-0x00100000 : "bitstream"

0x00100000-0x00140000 : "boot"

0x00140000-0x00180000 : "bootenv"

0x00180000-0x001c0000 : "config"

0x001c0000-0x006c0000 : "image"

0x006c0000-0x00fc0000 : "spare"

uclinux[mtd]: RAM probe address=0x221cf980 size=0x103000

Creating 1 MTD partitions on "RAM":

0x00000000-0x00103000 : "ROMfs"

uclinux[mtd]: set ROMfs to be root filesystem index=6

input: Button Keypad as /class/input/input0

Directional Button & Rotary Encoder Driver

(c) 2007 PetaLogix

TCP cubic registered

NET: Registered protocol family 1

VFS: Mounted root (cramfs filesystem) readonly.

Freeing unused kernel memory: 80k freed

Mounting proc:

Mounting var:

Populating /var:

Running local start scripts.

Mounting /etc/config:

Populating /etc/config:

flatfsd: invalid header magic

flatfsd: Nonexistent or bad flatfs (-183), creating new one...

flatfsd: Wrote 344 bytes to flash in 1 seconds

flatfsd: Created 6 configuration files (192 bytes)

Mounting sysfs:

Setting hostname:

Setting up interface lo:

Setting up interface eth0:

Starting portmap:

Starting thttpd:

 

uclinux login:

 

</output>

 

3. I re-download the bitstream to the board, and suddenly FS-BOOT cannot find U-Boot.

 

<output>

 

=================================================

FS-BOOT First Stage Bootloader (c) 2006 PetaLogix

=================================================

FS-BOOT: System initialisation completed.

FS-BOOT: Searching for U-Boot at address: 0x21100000

FS-BOOT: No existing image in FLASH.  Starting image download.

FS-BOOT: Waiting for SREC image....

 

</output>

 

4. Instead of downloading an SREC, I power cycle the board and re-download the bitstream, and suddenly FS-BOOT can find U-Boot again. However, U-Boot has not found its boot environment.

 

<output>

 

=================================================

FS-BOOT First Stage Bootloader (c) 2006 PetaLogix

=================================================

FS-BOOT: System initialisation completed.

FS-BOOT: Searching for U-Boot at address: 0x21100000

FS-BOOT: Booting from FLASH. Press 's' for image download.

FS-BOOT: Booting image...

SDRAM :

Enabling caches...Icache:OK...Dcache:OK

        U-Boot Start:0x23fc0000

        Malloc Start:0x23f60000

        Board Info Start:0x23f5ffd0

        Boot Parameters Start:0x23f4ffd0

FLASH: 16 MB

ETHERNET: MAC:<NULL>

 

*** Warning - bad CRC, using default environment

 

U-Boot>

 

</output>

 

5. U-Boot has not found its bootenv, so I download a new one and run autoscr. I have been converting the ub.config.img to ub.config.srec for download because I am using TeraTerm running on a Windows machine as my terminal emulator and its Kermit transfer does not seem to be compatible with U-Boot (hence the "loads" command).

 

<output>

 

U-Boot> loads 0x22000000

## Ready for S-Record download ...

 

## First Load Addr = 0x22000000

## Last  Load Addr = 0x220005CF

## Total Size      = 0x000005D0 = 1488 Bytes

## Start Addr      = 0x00000000

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>

 

</output>

 

6. Here is a dump of the environment I just downloaded, in case it helps.

 

<output>

 

U-Boot> printenv

baudrate=115200

filesize=5D0

autoload=no

ethaddr=00:0a:35:00:22:01

ipaddr=192.168.0.10

serverip=192.168.0.1

netkargs=macaddr=00:0a:35:00:22:01

mtdparts=physmap-flash.0:1M(bitstream),256K(boot),256K(bootenv),256K(config),5M(

image),9M(spare)

mtdkargs=mtdparts=physmap-flash.0:1M(bitstream),256K(boot),256K(bootenv),256K(co

nfig),5M(image),9M(spare)

clobstart=0x22000000

bootsize=0x40000

bootstart=0x21100000

bootenvsize=0x40000

bootenvstart=0x21140000

eraseenv=protect off $(bootenvstart) +$(bootenvsize); erase $(bootenvstart) +$(b

ootenvsize)

kernsize=0x500000

kernstart=0x211c0000

bootargs=mtdparts=physmap-flash.0:1M(bitstream),256K(boot),256K(bootenv),256K(co

nfig),5M(image),9M(spare) macaddr=00:0a:35:00:22:01

bootcmd=bootm 0x211c0000

bootdelay=4

load_kernel=tftp $(clobstart) image.ub

install_kernel=protect off $(kernstart) +$(kernsize);erase $(kernstart) +$(kerns

ize); cp.b $(fileaddr) $(kernstart) $(filesize)

update_kernel=run load_kernel install_kernel

load_uboot=tftp $(clobstart) u-boot-s.bin

install_uboot=protect off $(bootstart) +$(bootsize);erase $(bootstart) +$(bootsi

ze);cp.b $(clobstart) $(bootstart) $(filesize)

update_uboot=run load_uboot install_uboot

 

Environment size: 1172/262140 bytes

U-Boot>

 

</output>

 

7. Now I re-download the bitstream (or type reset) and FS-BOOT can find U-boot and U-Boot can find its environment, but I can't let it boot the kernel or my problems start over again. Essentially I am back to step 1.

 

<output>

 

=================================================

FS-BOOT First Stage Bootloader (c) 2006 PetaLogix

=================================================

FS-BOOT: System initialisation completed.

FS-BOOT: Searching for U-Boot at address: 0x21100000

FS-BOOT: Booting from FLASH. Press 's' for image download.

FS-BOOT: Booting image...

SDRAM :

Enabling caches...Icache:OK...Dcache:OK

        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

U-Boot>

 

</output>