I'm using an LPC2138/2148 with Rowley CrossWorks and GCC 4.1.1
Essentially, I have a boot monitor in the first two sectors of flash
that checks the primary application image against another
application image, and if required copies the upgrade over the
primary application.
Addr: 0x0000 0000 - 0x0000 1FFF (sect: 0 - 1) - Custom boot monitor
Addr: 0x0000 4000 - 0x0001 FFFF (sect: 4 - 10) - Primary Application
Addr: 0x0002 0000 - 0x0003 FFFF (sect: 11 - 14) - Upgrade Image
The boot monitor then performs a jump to the primary application,
using the method:
typedef void (*func_ptr)(void);
func_ptr func = (void*)0x4000;
func();
The primary application then reconfigures the device, trashing all
the memory used by the boot monitor - reconfiguring stack sizes and
all that jazz. After jumping to the application, interrupts no
longer function. I had a suspicion this would be the case before
starting on this, but wasn't totally sure of that until I got this
far.
I think my solutions are along the lines of...
a) Have the primary application place it's interrupt vectors in RAM
and configure MEMMAP to RAM mode.
b) Configure the boot monitor interrupt vectors to jump ahead into
the vectors of the application (i'm unsure about how suitable this
is). Interrupts are NOT used by the boot monitor.
There are bound to be other people that have implemented similar
solutions, are there any pros/cons to each method?
Is this a reasonable method in which to implement a boot monitor
(not to be confused with the boot loader of course)?
Is there a better way to jump to the main application?
Thanks very much
Cheers
Darcy