[U-Boot] U-Boot Scripting suggestions to decrement counter in EEPROM. Alignment bug in itest on ARM.

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Tue Mar 3 09:33:40 CET 2009


On 17:40 Tue 03 Mar     , Tom Evans wrote:
> I'm implementing a rather complex boot that involves flags and counters 
> in EEPROM.

in which case do you need this?

update?

in u-boot you have better system that involve watchdog and bootcount

I do not known which cpu or soc you use but you can implement it simply

> BUG IN ITEST
> ------------
> itest crashes ARM chips. I can "iread.b *82000000 == 0", but
> "iread.b *82000001 == 0" throws an alignment exception that kills the 
> box. The code in itest.c is:
> 
> static long evalexp(char *s, int w)
> {
>      long l, *p;
> 
>      /* if the parameter starts with a * then assume is a
>         pointer to the value we want */
>      if (s[0] == '*') {
>          p = (long *)simple_strtoul(&s[1], NULL, 16);
>          l = *p;
here you are support to use the good accessor readb/readw/readl
b>      } else {
>          l = simple_strtoul(s, NULL, 16);
>      }
> 
>      return (l & ((1 << (w * 8)) - 1));
> }
> 
> "l = *p" works on a 486 but not on an ARM. It is a simple change - a 
> three-way case on the width reading through the "right pointer".
the arm does not allow you to do an non aligned access

Best Regards,
J.


More information about the U-Boot mailing list