Content originally posted in LPCWare by MikeSimmonds on Fri Feb 15 07:55:48 MST 2013
[FONT=Tahoma][SIZE=2]OK, It seems like I am on my own on this one, but to satisfy your curiosity ...
I have a 4K boot loader which, depending on dip-switch settings 'launches' to one
of the modules (plural) loaded farther on in flash space. It can also burn flash with
my post processed elf image 'modules' (a separate switch setting).
This is entirely self contained, working, and debugged.
The 'modules' have had the elf post processed to add a custom header containing a
CRC-32 checksum, a start address 'vector' and a table of relocation/bss clear items.
They do not have the usual vector table at the base of the code image.
[As an aside, my startup code for modules as well as relocation of data and SRAM code
and clearing bss areas in on chip sram, off chip sram and off chip dynamic ram will
construct a dymanic vector table in on-chip sram (@ 10000000)]
The Boot block uses this header to validate the code module and give it control.
So I can't let the debugger load the elf's.
My debug cycle is to edit/build a module, post process, burn to flash (via the Primary
Boot Block) change the switches to 'go X' and then invoke the LPCXpresso debug.
What I wanted to happen is that the debugger resets the CPU (without loading anything)
sets a breakpoint in the module (e.g. somewhere in flash sector 12 for example) and
runs from Vector[1] in flash (@00000004). I.e the Primary Boot. This would jump to the
module start entry and hit the breakpoint from the 'Stop At' dialog.
I finally see from your previous post, that that is not how you have written the dubugger.
Although it could do this, it dosen't. This was never spelt out (at least where I could see).
So as a work round, I will put a call to my Init function to a 'pause-me' routine (if a
certain dip switch is on) which will just branch to self.
I can then break in (suspend), move the pc past the branch to self on to the function
return, manually add my desired bp, and resume.
The difference between how I thought the debugger functioned and how it actually
does was frustrating because the consequences of 'don't load' are not specified.
Still [I]now[/I] I know and can compensate.
Similarly, it seems that the 'reset' button does, in fact, [I]not[/I] do a chip reset. Interpolation
of events would imply that it sets the stack pointer from vector[0] [I]from the relocated
vector table[/I] and presumably would go on to set the PC to vector[1]. (I am getting
a hard fault due to rubbish at that location.)
I was expecting a proper reset, whereby the flash @ zero table would be re-instated
and things would proceed from there.
Again, now that I know, I can put a workround into place.
There is still an ocaisional issue with 'move to line' positioning at the following code address (i.e. +4 from where it should be). Assembler, not C so optimisation is not
to blame. (At least once this happend with a breakpoint, instead of the value of the
label, got label+4.) That one is still open for me.
Cheers, Mike
PS: One last question; if I code a bkpt instruction, will the debugger cut in and then
behave as if a breakpoint was hit?
[/SIZE][/FONT]