Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: exit from debug state in THUMB mode

2006-01-23 by robostanley

First I want to say what I great groups this is.  I have been 
learning a lot from reading current posts and posts in the archive.

I was searching for an answer to a problem that I am currently 
encountering and I found this thread from last year.  I have been 
working on my own debugger and got most of the core functionality to 
work when the debug state has been entered in ARM mode.  When I enter 
the debug state from THUMB mode, I can switch back into ARM mode, 
read/write registers and read/write memory.  However, I can't exit 
the debug state in THUMB mode.

I use a BX R0 instruction to reenter THUMB mode and then use a "B 
sigened_11bit_immediate_offset" THUMB instruction (bit 33 of the 
previous NOP instruction is set to indicate that the system should re-
enter full-speed mode).  If I then enter the RESTART JTAG command and 
enter the run/idle state of JTAG, the DSR will show that the core is 
in Thumb mode but it ends up back in the debug state.  

Re-entering ARM mode and dumping the registers at this point results 
in garbage.  Many of the registers come back as 0 (including R15) but 
some do have other non-zero values.  Even the CPSR is garbage (the 
mode bits are not valid.)

To make sure that I don't have some invalid THUMB instructions in my 
command sequence, I clear bit 33 of the penultimate NOP and don't 
bother to enter the RESTART JTAG command.  If I then re-enter ARM 
mode here and dump the registers, they all look correct.  Even r15 
has the expected value.  This makes it appear to me that the 
instructions are restoring the context correct and performing the 
right branch but the core doesn't seem to like the THUMB Branch 
instruction being used to get it to re-enter full-speed mode.  A 
similar sequence is working for me in ARM mode (but I don't need to 
perform the BX instruction and I use a ARM variant of the Branch 
instruction instead).  Should I be using a different THUMB 
instruction as the last instruction before sending the RESTART 
command?

Thanks!
--- In lpc2000@yahoogroups.com, Radoslaw Mitura 
<radoslaw_mitura@y...> wrote:
> > >     Does anyone know the proper way of exit from
> > debug state to the thumb
> > >  running state? This is not described in any
> > available arm documents.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.