2008-09-23 14:27:14 fw_setenv on CM-BF537?
Ben Burleson (UNITED STATES)
Message: 62576
Has anyone had success using fw_setenv on the Bluetechnix CM-BF537E?
I seem to have things configured at least half-correct becuase fw_printenv works fine:
root:/> fw_printenv
bootdelay=2
baudrate=115200
loads_echo=1
autoload=no
rootpath=/romfs
hostname=lcobfin
loadaddr=0x1000000
ubootfile=u-boot.bin
update=tftp $(loadaddr) $(ubootfile);protect off 0x20000000 0x2003FFFF;erase 0x20000000 0x2003FFFF;cp.b $(loadaddr) 0x20000000 $(filesize)
addip=set bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):eth0:off
ramargs=set bootargs root=/dev/mtdblock0 rw earlyprintk=serial,uart0,115200 console=ttyBF0,115200 lpj=2093056
imagename=uImage-fw75a-02
ramboot=tftp $(loadaddr) $(imagename);run ramargs;run addip;bootm
nfsargs=set bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath),tcp,nfsvers=3
nfsboot=tftp $(loadaddr) vmImage;run nfsargs;run addip;bootm
tftpupdate=tftp $(loadaddr) $(imagename);protect off 0x20040000 0x203FFFFF;erase 0x20040000 0x203FFFFF;cp.b $(loadaddr) 0x20040000 3BFFFF;protect on all;setenv bootcmd run localboot;saveenv;reset
localboot=cp.b 0x20040000 0x1000000 1c0000;pf4 clear;cp.b 0x20000000 0x11c0000 1fffff;bootm
flashboot=bootm 0x20100000
ethaddr=DA:FD:D8:98:F9:E1
ethact=Blackfin EMAC
bootcmd=run localboot
stdin=serial
stdout=serial
stderr=serial
filesize=289d91
fileaddr=1000000
gatewayip=172.16.4.254
netmask=255.255.255.0
ipaddr=172.16.4.232
serverip=172.16.4.206
bootargs=root=/dev/mtdblock2 rw earlyprintk=serial,uart0,115200 console=ttyBF0,115200 lpj=2093056
root:/> fw_printenv bootdelay
bootdelay=2
root:/> fw_setenv bootdelay 5
Unlocking flash...
Done
Erasing old environment...
MTD erase error on /dev/mtd0: Invalid argument
Error: can't write fw_env to flash
root:/> fw_printenv bootdelay
bootdelay=2
root:/>
I'm also posting this under the Bluetechnix forum (where this probably should exist), but I see no evidence of traffic there, so I posted here as well.
Thanks,
Ben
QuoteReplyEditDelete
2008-09-23 14:37:12 Re: fw_setenv on CM-BF537?
Mike Frysinger (UNITED STATES)
Message: 62577
please describe your setup. what u-boot/kernel/toolchain version ? what are you using for the fw_setenv config file ?
QuoteReplyEditDelete
2008-09-23 14:59:00 Re: fw_setenv on CM-BF537?
Ben Burleson (UNITED STATES)
Message: 62578
I'm attaching the entire boot output.
At the end is the contents of /proc/mtd and /etc/fw_env.config
Is there a different config for fw_setenv?
fw_env-configs.txt
QuoteReplyEditDelete
2008-09-23 15:15:07 Re: fw_setenv on CM-BF537?
Ben Burleson (UNITED STATES)
Message: 62579
Looks like I need to tweak my fw_env configs...
I think the flash sector size should be 0x20000.
I don't really know what device offset means, but u-boot starts at 0 in flash.
Also not sure what Env. size means....the size of the environment variable section within u-boot?
I'll look into the configs....
QuoteReplyEditDelete
2008-09-23 15:15:18 Re: fw_setenv on CM-BF537?
Mike Frysinger (UNITED STATES)
Message: 62580
what flash mapping driver are you using ? i dont think you're using the right one
your config file is also wrong ... where did you get it ? the config file must be written specifically for the flash part you are using
QuoteReplyEditDelete
2008-09-23 15:42:27 Re: fw_setenv on CM-BF537?
Mike Frysinger (UNITED STATES)
Message: 62582
these are u-boot tools from the u-boot source tree. that means they have the same exact meaning as u-boot.
http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:parallel-flash
QuoteReplyEditDelete
2008-09-23 17:25:20 Re: fw_setenv on CM-BF537?
Ben Burleson (UNITED STATES)
Message: 62585
From u-boot-1.1.6/include/configs/cm-bf537e.h:
#define CFG_ENV_OFFSET 0x4000
#define CFG_ENV_SIZE 0x2000
#define CFG_ENV_SECT_SIZE 0x20000 /* Total Size of Environment Sector */
But using Device offset=0x4000 does not work for erasing and writing, it erases and writes with Device offset=0.
However, if I write anything, it destroys the previous environment variables and reverts to some default environment + whatever parameter I added to the fw_setenv command.
I would expect the tool to read the existing environment out, add or change variables as needed (depending on your parameters given to fw_setenv), and write the new environment in. Am I
I'm using the physmap mapping driver. How do I know if that's right or wrong? I read the flash on CM-BF537 is CFI-compliant.
Thanks,
Ben
QuoteReplyEditDelete
2008-09-23 19:13:13 Re: fw_setenv on CM-BF537?
Mike Frysinger (UNITED STATES)
Message: 62586
look at the flash sector layout ... you cant erase partial sectors
the manual explains that the flash uses gpios to do part of the addressing ... you cant access the whole flash directly without gpio toggling. there's a gpio mapping driver in trunk already for this.
QuoteReplyEditDelete
2008-09-24 17:30:57 Re: fw_setenv on CM-BF537?
Mark T (UNITED STATES)
Message: 62657
look at the flash sector layout ... you cant erase partial sectors
the manual explains that the flash uses gpios to do part of the addressing ... you cant access the whole flash directly without gpio toggling. there's a gpio mapping driver in trunk already for this.
---
Mike,
I actually have similar problem on our br-4 and pr-1 boards.
I can read no problem but get similar error while writing back to the SPI flash.
Can you please point me to the right document/driver? Sorry, but I am confused...
Thanks,
mark
QuoteReplyEditDelete
2008-09-24 19:20:48 Re: fw_setenv on CM-BF537?
Mike Frysinger (UNITED STATES)
Message: 62661
i just upgrade the tools in uclinux-dist svn trunk ... you might want to try it out as well
QuoteReplyEditDelete
2008-09-24 19:21:52 Re: fw_setenv on CM-BF537?
Mike Frysinger (UNITED STATES)
Message: 62662
userspace doesnt care about the driver. the mtd layer hides all of that.
the u-boot env tools are documented in our wiki and you can look in the u-boot source tree for more documentation:
http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:env
QuoteReplyEditDelete
2008-09-26 23:44:14 Re: fw_setenv on CM-BF537?
Mark T (UNITED STATES)
Message: 62824
i just upgrade the tools in uclinux-dist svn trunk ... you might want to try it out as well
---
Thanks Mike but no luck, same problem. I am going to look deeper into that.
Can anyone actually confirm proper functionality of fw_setenv working with SPI flash?
Thanks,
Mark
QuoteReplyEditDelete
2008-09-27 00:20:52 Re: fw_setenv on CM-BF537?
Mike Frysinger (UNITED STATES)
Message: 62828
the env tools merely go through the MTD layer. they dont care about the underlying technology, only the sector sizes.