[ECOS] 32 bit flash checksums
Gary Thomas
gary@mlbassoc.com
Tue Jan 10 13:25:00 GMT 2006
On Mon, 2006-01-09 at 17:10 -0800, Adam Yergovich wrote:
> Hello all,
>
> After a few problems with my client throwing in html code in the email,
> i've got some additional questions and clarification of the problem.
>
> I'll preface this by saying i have a port of Redboot for the Cirrus
> Logic EP93XX family of chips. While many things are different, with
> regards to checksumming and the areas of memory i'm looking at there
> shouldn't be much different.
>
> I think the place to start with is to explain what i am seeing. Most of
> the "Magic numbers" are stored in the FIS Directory partition. This is
> not the case though for the Redboot Config partition. Through some
> experimentation i've noted that it appears to store the checksum for
> this partition in the last 4 bytes of the partition, preceded by what
> looks like an identifier of 0xADDEADED . (So the final 8 bytes are
> 0xADDEADEDZZZZZZZZ where ZZZZZZZZ coresponds to the magic number).
>
> The question is how to deal with this checksum in particular. Is it the
> same algorithm, and if so, what does it use as its length? Does it
> reduce the 0x1000 partition to cut off the last 4 bytes? Treat them as
> 0's, 1's?
Have you read the source? The answers are all there :-)
The fconfig data is represented by a structure:
struct _config {
unsigned long len;
unsigned long key1;
unsigned char config_data[MAX_CONFIG_DATA-(4*4)];
unsigned long key2;
unsigned long cksum;
};
The checksum is simply the crc32 sum over everything except the checksum
itself:
crc = cyg_crc32((unsigned char *)conf, sizeof(*conf)-sizeof(conf->cksum));
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list