Reply by Steve Clevenger December 10, 20102010-12-10
The ISP bootloader validates the vector checksum from vector words 0..0x20. The checksum word itself is placed at 0x24. Your bootloader really needs its own flash sector to allow separation from your application code. A separate sector means you don't need to be concerned with saving/restoring the bootloader itself when you re-flash your application. Your bootloader can perform the same validation the ISP does (reinvoke ISP if checksum fail), or at least check for FFFF's at the target address to make certain it doesn't vector off into a blank sector.
----- Original Message -----
From: Tim Mitchell
To: l...
Sent: Friday, December 10, 2010 8:01 AM
Subject: RE: [lpc2000] Bootloader problems on LPC175x

----Original Message----
From: l...
[mailto:l...] On Behalf Of Paul Curtis
Sent: 10 December 2010 15:53 To: l...
Subject: RE: [lpc2000] Bootloader problems on LPC175x

> Hi Tim,
>
> > Umm, I still can't get it to power up without going
> > into the boot rom.
> >
> > I have changed memory_map and flash_placement.xml to
> > relocate the user code at 0x2000, but I am not sure I
> > have done it right.
>
> You do have two projects, one for the app, and one for
> the bootloader?

Errr....

No, I was trying to do it all in one project - now that you come to mention it, I can see how this would be a bad idea...

--
Tim Mitchell
t...@sabretechnology.co.uk ~ http://www.sabretechnology.co.uk
Sabre Technology (Hull) Ltd, 3a Newlands Science Park, Hull
HU6 7TQ Registered in England and Wales no.3131504
t:01482 801003 f:01482 801078

An Engineer's Guide to the LPC2100 Series

Reply by Tim Mitchell December 10, 20102010-12-10
----Original Message----
From: l...
[mailto:l...] On Behalf Of Paul Curtis
Sent: 10 December 2010 15:53 To: l...
Subject: RE: [lpc2000] Bootloader problems on LPC175x

> Hi Tim,
>
> > Umm, I still can't get it to power up without going
> > into the boot rom.
> >
> > I have changed memory_map and flash_placement.xml to
> > relocate the user code at 0x2000, but I am not sure I
> > have done it right.
>
> You do have two projects, one for the app, and one for
> the bootloader?

Errr....

No, I was trying to do it all in one project - now that you come to mention it, I can see how this would be a bad idea...
--
Tim Mitchell
t...@sabretechnology.co.uk ~ http://www.sabretechnology.co.uk
Sabre Technology (Hull) Ltd, 3a Newlands Science Park, Hull
HU6 7TQ Registered in England and Wales no.3131504
t:01482 801003 f:01482 801078
Reply by Paul Curtis December 10, 20102010-12-10
Hi Tim,

> Umm, I still can't get it to power up without going into the boot rom.
>
> I have changed memory_map and flash_placement.xml to relocate the user
> code at 0x2000, but I am not sure I have done it right.

You do have two projects, one for the app, and one for the bootloader?

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
SolderCore arriving Winter 2010! http://www.soldercore.com

Reply by Tim Mitchell December 10, 20102010-12-10
Umm, I still can't get it to power up without going into the boot rom.

I have changed memory_map and flash_placement.xml to relocate the user code at 0x2000, but I am not sure I have done it right.

memory map













If I put the boot code up at the top of the flash, everything works ok, except the flash sectors are very big up there so this is not really a solution.
--
Tim Mitchell

Reply by Paul Curtis December 10, 20102010-12-10
> > My bootloader starts at 0x0000 with application code starting at
> > 0x8000. Vector checksum needs to be at 0x0014.
> >
>
> So, how do you update the vector checksum (or the vectors) without
> affecting the bootloader?

The checksum is only over a small part of the application, so you don't need
to. The bootloader stays and replaces the application.

You can remap where vectors are located--they don't need to be at zero.
Take a look at VTOR in the SCB. Hence, the first thing your app does is
move the VTOR to the app vectors...

Place bootloader at zero, place app at 0x2000 with app's vectors at 0x2000.
On entry to app, assign VTOR to locate vector table at 0x2000 and away you
go...

All your bootloader needs to do is validate that there is an application to
jump to.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
SolderCore arriving Winter 2010! http://www.soldercore.com

Reply by Tim Mitchell December 10, 20102010-12-10
----Original Message----
From: l...
[mailto:l...] On Behalf Of Dave Such
Sent: 10 December 2010 14:45 To: l...
Subject: Re: [lpc2000] Bootloader problems on LPC175x

> My bootloader starts at 0x0000 with application code
> starting at 0x8000. Vector checksum needs to be at
> 0x0014.
>

So, how do you update the vector checksum (or the vectors) without affecting the bootloader?

--
Tim Mitchell

Reply by Herbert Demmel December 10, 20102010-12-10
Hi Tim,

I think basically it's a question of taste.
We do it in this way because we even want to be able overwrite the
bootloader by "itself" and you can't write into the flash while you are
executing out of it.
So you minimum need to put the routines responsable for writing the data
into the flash into RAM (this is what we do on the application as the
application booted by the bootloader does write into specific sectors of
the flash as well).

Hope that helps.

Best regards
Herbert

Am 10.12.2010 15:40, schrieb Tim Mitchell:
> Ah, my mistake, it doesn't power up correctly even when programmed by JTAG. I presume I have made some error in relocating the user code to 0x2000.
>
> What's the best way to do a bootloader - would I be better just copying it into RAM and executing from RAM?

--

demmel products
Radnitzkygasse 43
A-1100 Vienna / Austria / Europe
Voice: +43-1-6894700-0
Fax: +43-1-6894700-40
Email: d...@demmel.com
WWW: http://www.demmel.com
--

demmel products
Radnitzkygasse 43
A-1100 Vienna / Austria / Europe
Voice: +43-1-6894700-0
Fax: +43-1-6894700-40
Email: d...@demmel.com
WWW: http://www.demmel.com
Reply by Dave Such December 10, 20102010-12-10
My bootloader starts at 0x0000 with application code starting at
0x8000. Vector checksum needs to be at 0x0014.
On 12/10/2010 9:40 AM, Tim Mitchell wrote:
>
> Ah, my mistake, it doesn't power up correctly even when programmed by
> JTAG. I presume I have made some error in relocating the user code to
> 0x2000.
>
> What's the best way to do a bootloader - would I be better just
> copying it into RAM and executing from RAM?
>
> --
> Tim Mitchell
Reply by Tim Mitchell December 10, 20102010-12-10
Ah, my mistake, it doesn't power up correctly even when programmed by JTAG. I presume I have made some error in relocating the user code to 0x2000.

What's the best way to do a bootloader - would I be better just copying it into RAM and executing from RAM?
--
Tim Mitchell

Reply by Tim Mitchell December 10, 20102010-12-10
OK, it's executing in the boot ROM, so presumably it is something to do with the valid user code checking.

If I verify by JTAG, it verifies OK, so I have definitely programmed correctly.

Looking at the map file it appears to be putting the vector table at 0x2000, which I've defined as the start of the user code. I don't understand why this will power up correctly when programmed by JTAG but not when programmed by my bootloader code.
--
Tim Mitchell
t...@sabretechnology.co.uk ~ http://www.sabretechnology.co.uk
Sabre Technology (Hull) Ltd, 3a Newlands Science Park, Hull
HU6 7TQ Registered in England and Wales no.3131504
t:01482 801003 f:01482 801078