I have enough code space to hold 2 versions of code. I plan to have a
boot block that can be changed to execute out of block 1 or block 2
and provide the mechanism for remote upload.
I haven't decided yet, but block 1 may be a factory fallback block and
block 2 might be my new code uploaded remotely. I might even
overwrite block 1 with block 2 when I decide the new code has been
working correctly for some time and then reuse block 2 for new
updates. However, if there is a crash during the overwrite, then you
are up the creek, so I haven't decided on that yet.
Anybody see any other holes I should be aware of? How have others
accomplished this? Also, is there 'C' code to start executing out of
a particular place in flash? Or is this done by assembly language?
Thanks.
Sutton
------------------------------------

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )
Hi Sutton,
I partition the flash to 4 parts:
1. boot-app
2. main-app
3. space for main-app upgrade
4. registry
The boot-app can't be changed. It is very short application which does only one thing: it
looks into registry whether there is a 'request' to copy the new version of the main-app
from the part 3 into part 2. If so, it does the upgrade and reset the 'request' in the
registry. Then it jumps to the main-app.
The main-app is 'somehow' able to get new version of itself (from UART or USB or SD card)
and copy it to part 3. Then it sets the request in the registry (part 4) and resets the
processor, so that the boot-app can finish the upgrade.
I can't change the boot-app, because if I'd try, there would be a moment where the 1st
flash sector - the address where the processor jumps to when powered on (or the address
from which it reads the addres to jump to) - would be invalid. So I keep it very simple (<
2kB).
The potential problem is when I upgrade to a buggy new version of the main-app, which is
not able to initiate the upgrade of itself, to copy new version of itself to part 3 and
set the request in part 4. So I have to test properly before I release.
Also, because the boot-app can't be changed there is a 'problem' with the vector table.
It is processor specific. On STM32F101 I can set the address of the vector table. On
LPC2888 it is not possible, but I can keep the address of 2nd level IRQ handler table in
INT_VECTOR0 register (and I had to slightly change the assembly code of the 1st level IRQ
handler (linked into boot-app) to jump to correct IRQ handler from table pointed by
INT_VECTOR0).
With regards,
Jan
----- Original Message -----
From: Sutton Mehaffey
To: l...@yahoogroups.com
Sent: Wednesday, October 08, 2008 5:34 PM
Subject: [lpc2000] remote programming for LPC2148
I have enough code space to hold 2 versions of code. I plan to have a
boot block that can be changed to execute out of block 1 or block 2
and provide the mechanism for remote upload.
I haven't decided yet, but block 1 may be a factory fallback block and
block 2 might be my new code uploaded remotely. I might even
overwrite block 1 with block 2 when I decide the new code has been
working correctly for some time and then reuse block 2 for new
updates. However, if there is a crash during the overwrite, then you
are up the creek, so I haven't decided on that yet.
Anybody see any other holes I should be aware of? How have others
accomplished this? Also, is there 'C' code to start executing out of
a particular place in flash? Or is this done by assembly language?
Thanks.
Sutton
#ygrp-mkp { BORDER-RIGHT: #d8d8d8 1px solid; PADDING-RIGHT: 14px; BORDER-TOP: #d8d8d8
1px solid; PADDING-LEFT: 14px; PADDING-BOTTOM: 0px; MARGIN: 14px 0px; BORDER-LEFT: #d8d8d8
1px solid; PADDING-TOP: 0px; BORDER-BOTTOM: #d8d8d8 1px solid; FONT-FAMILY:
Arial}#ygrp-mkp HR { BORDER-RIGHT: #d8d8d8 1px solid; BORDER-TOP: #d8d8d8 1px solid;
BORDER-LEFT: #d8d8d8 1px solid; BORDER-BOTTOM: #d8d8d8 1px solid}#ygrp-mkp #hd
{ FONT-WEIGHT: bold; FONT-SIZE: 85%; MARGIN: 10px 0px; COLOR: #628c2a; LINE-HEIGHT:
122%}#ygrp-mkp #ads { MARGIN-BOTTOM: 10px}#ygrp-mkp .ad { PADDING-RIGHT: 0px;
PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px}#ygrp-mkp .ad A { COLOR: #0000ff;
TEXT-DECORATION: none}
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )