Forums

LPC2214 - IAP - Executable Image

Started by Guy van den Berg November 7, 2006
Hi,

I am looking for a little clarity on how to create an executable image for
In-Application-Programming.

I am using IAR 4.0 toolchain. Compiling code for the LPC2214. The interupt
vector table is not remapped. If I compile my code and download it to the
LPC2214 internal flash via JTag all runs fine.

On the target I create a hex representation of the first 10K worth of the
executable starting at address 0x00000000 to compare to later.
(JTAG_IMAGE.hex)

I use IAR to create an Intel Hex format executable image. I place the LPC
into ISP mode and send it the hex file. All runs fine.

On the target I create another hex representation of the first 10K worth of
the executable stating at address 0x00000000 to compare to late.
(ISP_IMAGE.hex)

Finally, I create a simple-code executable image from IAR from which I am
going to ASCII encode, transmit over the air and then program via IAP.
(SIM_IMAGE)

First thing I notice is that the JTAG_IMAGE.hex & ISP_IMAGE.hex, which are
both identical, start at the 27th byte of the SIM_IMAGE. So this is where I
start to make my over the air image from.

Second thing I notice is that 4 bytes starting at 0x14 are different. I read
that this is a "un-used vector". I also read that the vector table 0x00 to
0x1F needs to have a 0 check sum. Are the 4 bytes from 0x14 used to create
this? and how is the checksum calculated?

Thirdly, if i create a hex representation of my SIM_IMAGE starting at the
27th byte of the SIM_IMAGE and flash this onto the targets internal flash,
my application begins to boot and then very quickly resets it's self. I
beleive that there must be an error in my vectored interupt table, but don't
know where to start...

Any insight into the executable image or how to get an image that I can
write via IAP onto the target will be most helpful.

Thanks

Guy

--
Sincerely

Guy van den Berg
v...@gmail.com

An Engineer's Guide to the LPC2100 Series

Hi,

Maybe I was a little unclear in my posting below. My main problem,
what I am trying to establish is how to create the executable image on
the host that will be pushed to the target.

What format of output should the linker use? How is the checksum on
the vector interupt table generated and is the image programmed to
address 0x0 on the targets flash.

Thanks

Guy

--- In l..., "Guy van den Berg"
wrote:
>
> Hi,
>
> I am looking for a little clarity on how to create an executable
image for
> In-Application-Programming.
>
> I am using IAR 4.0 toolchain. Compiling code for the LPC2214. The
interupt
> vector table is not remapped. If I compile my code and download it
to the
> LPC2214 internal flash via JTag all runs fine.
>
> On the target I create a hex representation of the first 10K worth
of the
> executable starting at address 0x00000000 to compare to later.
> (JTAG_IMAGE.hex)
>
> I use IAR to create an Intel Hex format executable image. I place
the LPC
> into ISP mode and send it the hex file. All runs fine.
>
> On the target I create another hex representation of the first 10K
worth of
> the executable stating at address 0x00000000 to compare to late.
> (ISP_IMAGE.hex)
>
> Finally, I create a simple-code executable image from IAR from which
I am
> going to ASCII encode, transmit over the air and then program via IAP.
> (SIM_IMAGE)
>
> First thing I notice is that the JTAG_IMAGE.hex & ISP_IMAGE.hex,
which are
> both identical, start at the 27th byte of the SIM_IMAGE. So this is
where I
> start to make my over the air image from.
>
> Second thing I notice is that 4 bytes starting at 0x14 are
different. I read
> that this is a "un-used vector". I also read that the vector table
0x00 to
> 0x1F needs to have a 0 check sum. Are the 4 bytes from 0x14 used to
create
> this? and how is the checksum calculated?
>
> Thirdly, if i create a hex representation of my SIM_IMAGE starting
at the
> 27th byte of the SIM_IMAGE and flash this onto the targets internal
flash,
> my application begins to boot and then very quickly resets it's self. I
> beleive that there must be an error in my vectored interupt table,
but don't
> know where to start...
>
> Any insight into the executable image or how to get an image that I can
> write via IAP onto the target will be most helpful.
>
> Thanks
>
> Guy
> --
> Sincerely
>
> Guy van den Berg
> vandenberg.guy@...
>
>
guyvdb21 wrote:
>
> Hi,
>
> Maybe I was a little unclear in my posting below. My main problem,
> what I am trying to establish is how to create the executable image on
> the host that will be pushed to the target.
>
> What format of output should the linker use? How is the checksum on
> the vector interupt table generated and is the image programmed to
> address 0x0 on the targets flash.
>
> Thanks
>
> Guy
>
> --- In lpc2000@yahoogroups .com ,
> "Guy van den Berg"
> wrote:
> >
> > Hi,
> >
> > I am looking for a little clarity on how to create an executable
> image for
> > In-Application- Programming.
> >
> > I am using IAR 4.0 toolchain. Compiling code for the LPC2214. The
> interupt
> > vector table is not remapped. If I compile my code and download it
> to the
> > LPC2214 internal flash via JTag all runs fine.
> >
> > On the target I create a hex representation of the first 10K worth
> of the
> > executable starting at address 0x00000000 to compare to later.
> > (JTAG_IMAGE. hex)
> >
> > I use IAR to create an Intel Hex format executable image. I place
> the LPC
> > into ISP mode and send it the hex file. All runs fine.
> >
> > On the target I create another hex representation of the first 10K
> worth of
> > the executable stating at address 0x00000000 to compare to late.
> > (ISP_IMAGE.hex)
> >
> > Finally, I create a simple-code executable image from IAR from which
> I am
> > going to ASCII encode, transmit over the air and then program via IAP.
> > (SIM_IMAGE)
> >
> > First thing I notice is that the JTAG_IMAGE.hex & ISP_IMAGE.hex,
> which are
> > both identical, start at the 27th byte of the SIM_IMAGE. So this is
> where I
> > start to make my over the air image from.
> >
> > Second thing I notice is that 4 bytes starting at 0x14 are
> different. I read
> > that this is a "un-used vector". I also read that the vector table
> 0x00 to
> > 0x1F needs to have a 0 check sum. Are the 4 bytes from 0x14 used to
> create
> > this? and how is the checksum calculated?
>

It is a simple 32bit addsum, add up all the entries of the vector table
and you get that.
// attempt to open binary image.
if ((binary = fopen (argv[1], "rb")) == NULL) {
printf ("Failed to open %s\n", argv[1]);
exit (-2);
}
fread (vectors, sizeof(unsigned int), 8, binary);
// calculate CRC value.
vectors [5] = 0;
for (i = 0, CRC = 0; i<8; i++) {
CRC += vectors [i];
}
CRC = 0 - CRC;
vectors[5] = CRC;
fseek (binary, 0, SEEK_SET);
fwrite (&vectors, sizeof(int), 8, binary);
fclose (binary);

--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------