Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Interrupt Handling (Vector checksum)

2004-11-18 by tom_laffey

Martin,

2's complement can be generated a few ways; I chose the 
textbook "flip the bits and add 1".  Subtracting from 0 as you have 
done produces the same value.

I'm generating the checksum on a PC (little endian) and the LPC is 
little endian, so no trouble found there.  

I'm thinking that the checksum is a red herring, so I'm looking at my 
IAP flash write function to see where there could be a problem.  If I 
find something, I'll post here.

Thanks,

Tom



--- In lpc2000@yahoogroups.com, capiman@t... wrote:
> Endian-Problem ?
> 
> ----- Original Message ----- 
> From: <capiman@t...>
> To: <lpc2000@yahoogroups.com>
> Sent: Thursday, November 18, 2004 9:42 PM
> Subject: Re: [lpc2000] Re: Interrupt Handling (Vector checksum)
> 
> 
> >
> > Have you compared what value you get with your routine and 
perhaps load 
> > the
> > same with my routine ?
> > Is it really the same ? I see you are doing a +1 at the end ?
> >
> > Regards,
> >
> >        Martin
> >
> > ----- Original Message ----- 
> > From: "tom_laffey" <tom_laffey@y...>
> > To: <lpc2000@yahoogroups.com>
> > Sent: Thursday, November 18, 2004 8:40 PM
> > Subject: [lpc2000] Re: Interrupt Handling (Vector checksum)
> >
> >
> >>
> >>
> >> Hi Robert,
> >>
> >> Thanks for your reply.  I found Martin's checksum code, which is
> >>
> >>        ivt_CRC = 0;
> >>        for(i = 0;i < 8; i++)
> >>        {
> >>            if(i == 5) continue;            // Jump over address 
0x14
> >>            ivt_CRC += BinaryContent_as_unsigned_long[i];
> >>        }
> >>
> >>        ivt_CRC = 0 - ivt_CRC;              // Negate result
> >>        BinaryContent_as_unsigned_long[5] = ivt_CRC;
> >>
> >> The code I am using is in a program to add this checksum to a
> >> binary program file before downloading:
> >>
> >> // pBuf is char *, aligned 4
> >> unsigned long * pVectors = (unsigned long *) pBuf;
> >>
> >>        pVectors[5] = 0;
> >>        for( checksum = index = 0; index < 8; index++)
> >>        {
> >>            checksum += pVectors[index];
> >>        }
> >>        pVectors[5] = ~checksum + 1;
> >>
> >> which looks like it does the same thing as Martin's.
> >>
> >> This has me wondering what I am missing.  When I modify the 
binary
> >> image and load it with my ISP program, it is not recognized by 
the
> >> Philips boot loader.  I can tell by stopping the CPU and looking 
at
> >> the PC: pc=0x7fffef32.  Downloading the same image using the 
Philips
> >> downloader (and a hex version of the executable), the program 
boots.
> >>
> >> Thanks,
> >>
> >>
> >> Tom
> >>
> >>
> >>
> >>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.