From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 3 Mar 2009 09:33:40 +0100 Subject: [U-Boot] U-Boot Scripting suggestions to decrement counter in EEPROM. Alignment bug in itest on ARM. In-Reply-To: <49ACD0DC.10309@ceos.com.au> References: <20080827053319.18025.qmail@devel> <49ACD0DC.10309@ceos.com.au> Message-ID: <20090303083340.GA9951@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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.