srecord CRC16

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I just found Peter Miller's srecord installed probably during
WinAVR installation.

I'm planning to add CRC to program memory (flash).
For one Mega8 intel hex-file I tested this:
   srec_cat test.hex -intel -Big_Endian_CRC16 0x1FFA -o test2.hex -intel
and it seems to provide reasonable output file.
I guess it is OK to use some fixed address like here (MAX-6)...
Better solutions (automated, when amount of flash changes) are welcome.

srecord doc says that CRC is "industry standard"
Is it compatible with
found from WinAVR package.
/* Copyright (c) 2002, Marek Michalkiewicz
   All rights reserved.
/* $Id: crc16.h,v 1.2 2002/12/12 11:41:01 joerg_wunsch Exp $ */
   avr/crc16.h - optimized CRC-16
   Polynomial: x^16 + x^15 + x^2 + 1 (0xa001)
   Initial value: 0xffff

Another question:
What about the blank adresses in hex. Should they be filled?
srecord manual says "Holes in the input data are ignored."

Yes, I know it shouldn't take too much time to figur out
these by myself...but I'm feeling a bit lazy at the moment.


Re: srecord CRC16
On Thu, 30 Dec 2004 15:12:24 +0200, "Pygmi"

Quoted text here. Click to load it
Quoted text here. Click to load it

Google for "A Painless Guide to CRC Error Detection Algorithms"
by Ross Williams. They're not that hard to write.

Rich Webb   Norfolk, VA

Re: srecord CRC16
Quoted text here. Click to load it

The CRC Pitstop at has plenty of useful info!


Re: srecord CRC16
Quoted text here. Click to load it

How are you going to use the CRC?  I am writing a utility to insert a
CRC in a program image.  It will read the object file (s19), then
compute and store the CRC.  This requires that the application store a
pointer at a fixed address in low memory to a structure which contains
various data (name and version) and a place for the CRC.  The program
computes the CRC of the code image and places it into the table.  It
then computes and stores a separate CRC of the table itself for use by a
boot loader.  The table can be located either within or outside the code
area, but if in the code area, it is skipped for the CRC computation.
When it is finished, it writes out the new image.

The application will place the table pointer at a fixed address using a
linker command to locate a specific segment.

Quoted text here. Click to load it

If you are going to use the CRC to verify the code from the program, it
isn't feasible to ignore the holes.  I recommend setting them to 0xff,
then making a new program image with all the holes filled.  My utility
will preset the memory to 0xff, load the image, insert the CRC, then
dump from address 0 to the highest used address.


Re: srecord CRC16
Quoted text here. Click to load it

Why are you writing a new utility for that?  Peter Miller's srecord package
already can do that, and much more.

Re: srecord CRC16
Quoted text here. Click to load it

I already had some code for reading s19 records.  There is a
requirement for new code for some of the utility requirements.  It is
sometimes easier to write a little bit of new code, rather than wade
through a large package to discover all the items needed to use it
properly and to possibly adapt.

I am using the documentation, though, as an excellent source for hex
record formats.  ;-)


Site Timeline