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

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




--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@a...> 
wrote:
> At 06:30 PM 11/18/04 +0000, you wrote:
> >Did you ever solve the vector table checksum problem?  Like you, 
I've
> >tried the algorithm described in the manual (the one you typed 
below)
> >and the boot code won't start when the file is loaded with IAP.  
From
> >the description, the checksum covers the first 8 words.
> >
> >My application uses IAP for firmware updates, so long-term 
dependency
> >on the Philips downloader is not an option.
> 
> Take a look at the source for Martin's LPC21ISP.  It does the 
calculation 
> and it should be simple to adapt.
> 
> Robert
> 
> " 'Freedom' has no meaning of itself.  There are always 
restrictions,
> be they legal, genetic, or physical.  If you don't believe me, try 
to
> chew a radio signal. "
> 
>                          Kelvin Throop, III

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.