Home Forum Developers General discussions Updating U-Boot

JRPassphrase Registration Control

In order to register on this site, you must first submit the passphrase below.

TODO list for each hardware target can be found as sticky topic in the corresponding forum


Chewi
useravatar
User Info

Updating U-Boot

I have two IP02 boxes and I noticed that one takes a lot longer to boot than the other, which I thought was strange because they were ordered together. After attaching the JTAG, I realised that U-Boot was causing the delay. I also discovered that the faster one has U-Boot 2010.06 while the slower one has U-Boot 1.1.5, the same version that is distributed with Switchfin.

On the same day, I managed to break both boxes by flashing a dud firmware image. Not quite sure how that happened. I was able to restore the faster box easily enough via U-Boot but the slower box would simply hang while displaying "Starting Kernel at = 223df4".

I figured this would be a good time to try a newer version of U-Boot so I grabbed 2011.06 and fixed up our scripts. Just about all of the old patches have now been applied upstream. The only one that seems to be missing is for memtoenv/envtomem, whatever that is. Does anyone need it?

What is also missing upstream is support for the BR4 and PR1. I haven't tried since I don't have this hardware but I strongly suspect the old files won't work any more. Is someone willing to do the work for this? Supporting both versions isn't impossible but it would be nice to drop the old cruft.

I did have to create one new patch to add support for the Winbond SPI that my boxes appear to have. Strange that the old version didn't seem to care about this. I'll send the patch upstream soon.

So the new version is working fine, even on the slower box that previously wouldn't boot, but I haven't yet written it to the EEPROM. I'm a little worried that the binary is too large. This wiki page talks about trying to squeeze it into 128KB. My binary is 165KB. The old one is only 105KB. I don't think the binary size is what it's referring to though. It says to check u-boot.map but I couldn't find what you're supposed to look for. There are no entries in the System.map file in the 0x04000000 range though so maybe it's okay. After all, it seems to run okay. But I want to be sure after someone posted just the other day that you cannot repair U-Boot on an IP02 at all, even with an ICEbear.



Edited By:  Chewi
Jul-06-11 16:31:36

Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

Another interesting thing I noticed is that the older U-Boot can't cope with data being pasted into the terminal whereas the newer versions can.


Administrator has disabled public posting
Andy
useravatar
User Info

Re: Updating U-Boot

I'm curious how did you manage to get ICEbear working with the IP02.

I was told by Atcom that the IP04 and IP08 have two JTAG connectors, JTAG1 for the Blackfin and JTAG2 for the Xilinx CPLD. The IP02 only has a single JTAG connector, JTAG2 which is for the Xilinx CPLD. According to Atcom it is not possible to use ICEbear for the Blackfin on the IP02. This makes no sense to me but that is what I was told by Atcom.

Andy


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

I don't have an ICEbear. It was your post I was referring to at the end of my first post. I have only tried this newer U-Boot temporarily with...

tftp 0x1000000 u-boot.bin
go 0x1000000

This page tells me that I can write it permamently to the EEPROM like this...

tftp 0x1000000 u-boot.ldr
eeprom write 0x1000000 0x0 $(filesize)

I don't think this requires an ICEbear, right? I am very new to this but my understanding was that serenissimo couldn't use this method because he set bootdelay to 0.


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

I've realised why the older U-Boot wouldn't actually boot. When I reflashed the kernel, I must have accidentally mistyped the bootargs value because it was console=ttyB0 rather than console=ttyBF0! I had to retype this when I first tried the newer U-Boot because it wasn't able to read from the SPI until I created that patch. After applying the patch, the newer U-Boot also stopped booting because it was reading the bad value. I got there in the end. smile Very confusing! Nevertheless, the older U-Boot is still quite slow so the update would be worthwhile. Please let me know if you think it is safe.


Administrator has disabled public posting
Andy
useravatar
User Info

Re: Updating U-Boot

I think that perhaps you are confusing the serial console with the JTAG. The Blackfin JTAG is a debugging interface that can also be used to load the u-boot. Once the u-boot has been loaded you can then use the serial console to load the software image via tftp.

Given that the IP02 does not have a JTAG interface if something goes wrong with the u-boot upgrade you will have totally bricked your IP02. As I understand it the only way to recover from this would be to unsolder the SPI flash chip, reprogram it using a programmer and then resolder it. Personally I question the logic of omitting the JTAG connector.

So before you attempt to upgrade the u-boot I'd wait for one of the gurus to provide you with the definitive step by step upgrade instructions as you'll only get one chance to get this right..

Andy


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

You're right and sorry for the confusion. I simply thought that the JTAG was what you attached the serial cable to. In retrospect, I'm not sure where I got that idea from.


Administrator has disabled public posting
admin
useravatar
User Info

Re: Updating U-Boot

Hi Guys,

Yes Atcom did very good job updating the uboot.

In Switchfin we are using U-Boot 1.1.5 sources. At the time we have started BF1 project (few years ago) u-boot had no dm9000 support. Ivan Danov colleague of mine has integrated the dm9000 driver in u-boot 1.1.5. Since then we are using this version unchanged.
From what I see now the recent u-boot has dm9000 support and we can easily  migrate to it as Atcom has done.

The new u-boot has lot of good things and indeed is quicker.
For those with an old u-boot we recommend for now to tftp/eeprom the uboot image (from Atcom web site) as it was mentioned before in this thread

Best regards
Dimitar


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

I didn't want to commit the changes as they probably don't work for the BR4 or PR1. Here is the result of my work. Do you think you could take it from here?

http://www.aura-online.co.uk/~chewi/switchfin/uBoot.mk
http://www.aura-online.co.uk/~chewi/swi … -spi.patch

And do you know anything about this 128KB limit?


Administrator has disabled public posting
admin
useravatar
User Info

Re: Updating U-Boot

Hi James,

Thanks for the uboot patch.
Yes I'll fix it for the other targets.

In some of the new nand flash chips they have expanded the Out Of Band (OOB) area to 128 bits. Not sure you are talking about this?

Best Regards
Dimitar


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

Well I'm not sure what I'm talking about, that's the problem! lol I'm only going by what's written on that wiki. It was David Rowe who wrote that stuff so I've sent him a mail.


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

No reply yet from David Rowe. I have made an interesting discovery though.

First I noticed that the mtd1 "boot loader(spi)" partition in /proc/mtd is actually 128KB. That got me thinking that maybe the binary does need to be smaller.

But then I copied /dev/mtd1 and /dev/mtd2 from the box with the newer U-Boot and found that this U-Boot binary actually straddles the partition boundary. It was easy to see because this part of the binary holds the string messages and one of the messages was cut in half by the boundary. Maybe the binary doesn't need to be less than 128KB after all.

I'm not sure what the mtd2 "linux kernel(spi)" partition is supposed to be for. I guess some space is needed to hold the U-Boot environment variables but 384KB seems a bit much. I know that this partition table isn't actually read from the SPI but is hardcoded in package/uClinux-dist/vendors/Rowetel/IP04/pre_config/ip04.c, which explains why it doesn't match what I'm finding on this box. I think the table is only used by the flashupdate script to update U-Boot. I doubt it would allow you to write a file larger than 128KB but if it did, it would probably get truncated and then you'd be in real trouble. It would probably be safer to simply present the SPI as one 512KB partition rather than make assumptions about the size of U-Boot.

I also noticed that this hardcoded partition table depends on CONFIG_MTD_M25P80, which is enabled for the IP04. My IP02s actually don't have this SPI. They have the Winbond W25X40 as I mentioned above. I don't think this is specific to the IP02. Maybe ATCOM simply started using a different SPI. Evidently it is still able to read the data anyway so maybe this isn't really an issue.


Administrator has disabled public posting
Andy
useravatar
User Info

Re: Updating U-Boot

I just checked and both my IP02 and IP08 systems have a W25X40 which is a 4Mbit (512 KByte) serial flash. The M25P80 is a 8Mbit (1 MByte) device. Shouldn't the source code reflect the device that appears to be used in the current production units?


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

If there was a size difference then I think autodetection would be important. I see that you're right about the M25P80 being 8Mbit/1Mbyte but the hardcoded partition table only covers 512KB. Maybe only half of it was used? That would explain why they switched to a different one.


Administrator has disabled public posting
admin
useravatar
User Info

Re: Updating U-Boot

Hi Guys,

All IP04 type hardware goes with 512KB spi flash and the partitions
[code]
dev:    size   erasesize  name
mtd1: 00020000 00001000 "boot loader(spi)"
mtd2: 00060000 00001000 "linux kernel(spi)"
[code/]
is hard codded in ip04.c indeed.

Currently in Switchfin we don't mount those partitions for something useful.

Well we read the uboot environment from Linux during the firmware upgread
but this is kind of a hack.

Best Regards
Dimitar


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

admin wrote:

Currently in Switchfin we don't mount those partitions for something useful.
You don't mount them but /dev/mtd1 is used by the flashupdate script when updating U-Boot. As I mentioned above, this could be dangerous if it actually tries to write a file larger than 128KB. It could get truncated and that would brick an IP02.

I was wondering about how U-Boot knows where in the SPI to store the environment. I just found these two variables in include/configs/ip04.h.

Code:

#define CONFIG_ENV_OFFSET       0x30000

#define CONFIG_ENV_SIZE         0x10000

I think this means it will store an environment of size 64KB at offset 192KB. Presumably this means that the U-Boot binary can be up to 192KB. But I still don't want to test that theory in a hurry! Still no word from David. Does he usually reply to such e-mails?


Administrator has disabled public posting
admin
useravatar
User Info

Re: Updating U-Boot

Hi James,

Currently we don't have the uboot update working from linux.
Something to be fixed smile
What we use the flashupdate is for linux updates.

Yup those are the variables for the environment.
At the moment the uboot environment is in the second spi partition at offset 0x10000. It is good if we put at the end of the first partition. 

Best Regards
Dimitar


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

admin wrote:

At the moment the uboot environment is in the second spi partition at offset 0x10000.
You mean in the version of U-Boot that's built by Switchfin at the moment? Are you sure because that's only 65KB? Your U-Boot binary is surely bigger than that? In any case, the boxes I must use 0x30000 because the newer binary that ATCOM provided is at least 128KB and my own binary was able to read the existing environment.


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

Good news. I finally went for it on the older box........ IT WORKED! big_smile You can now access my changes in my github branch.

https://github.com/HaydenTech/switchfin/tree/new-u-boot


Administrator has disabled public posting
admin
useravatar
User Info

Re: Updating U-Boot

Hi James,

Very good news!
Currently I am kind of a busy with other things but I will try to put your changes in Switchfin and will test with other targets as soon as possible.

Cheers
Dimitar


Administrator has disabled public posting
Chewi
useravatar
User Info

Re: Updating U-Boot

My SPI patch has been accepted by one of the U-Boot developers, although it hasn't hit the main repository yet. Hopefully it'll make the next release or the one after that.


Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 2587  Total Topics: 299  Total Polls: 1  Total Posts: 1727  Dormant
User Info:   Newest User :  user2553   Members Online: 0   Guests Online: 236
Online  There are no members online
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked