This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
Posted: Wed Oct 12, 2005 2:38 am
I'm making a visual debugger for the serial monitor, and I'm having a lot of trouble trying to figure out the breakpoint registers. The docs seem pretty straight-forward, but I just can't get the C32 to stop on a breakpoint.
These are the registers:
; breakpoint control registers
BKPCT0 EQU $28
BKPCT1 EQU $29
; first breakpoint registers
BKP0X EQU $2A ; PPAGE
BKP0H EQU $2B ; high byte of addr
BKP0L EQU $2C ; low byte of addr
; second breakpoint registers
BKP1X EQU $2D ; PPAGE
BKP1H EQU $2E ; high byte of addr
BKP1L EQU $2F ; low byte of addr
I know that interrupts are enabled, and I store $80 in BKCT0, and $00 in BKCT1. Then I set up the PPAGE and the address of where I want it to break (I set the same values in both sets of breakpoint registers just to be safe). And I run the program - which does nothing weird like changing the PLL, or messing with interrupts. The addr I specify is definitely an op-code address, and it is definitely being executed.
But my breakpoints are always ignored. I can't make it break. Can someone give my pointers on this?
What good is a visual debugger without breakpoints? I have to make this work!
Posted: Wed Oct 12, 2005 10:41 am
Here below, setting a breakpoint at address 0x400C. Note that we use the DBG mode, not BKP. Check also the DBG specs. I am sure you will be able to decode that following debugger debug protocol.
DBG_writebyte 0x20 0x80
DBG_writebyte 0x2a 0x0
DBG_writeword 0x2b 0x0
DBG_writebyte 0x2d 0x0
DBG_writeword 0x2e 0x0
DBG_writebyte 0x25 0x0
DBG_writeword 0x26 0x400c
DBG_writebyte 0x21 0x0
DBG_writebyte 0x29 0x0
DBG_writebyte 0x28 0x2c
DBG_writebyte 0x20 0xe0
=> DBG settings:
dbgc1: 0xe0
dbgc2: 0x2c
dbgc3: 0x0
dbgsc: 0x0
dbgcax: 0x0
dbgca: 0x0
dbgcbx: 0x0
dbgcb: 0x0
dbgccx: 0x0
dbgcc: 0x400c
Posted: Fri Oct 21, 2005 5:42 pm
>I'm making a visual debugger for the serial monitor, and I'm having a
>lot of trouble trying to figure out the breakpoint registers. The docs
>seem pretty straight-forward, but I just can't get the C32 to stop on
>a breakpoint.
>These are the registers:
>BKPCT0 EQU $28
>BKPCT1 EQU $29...
The first thing is to check your datasheet. Your register defs are correct for the DP256 etc. with the 24-bit breakpoint module, but the C32 has the new DBG. The good news is that you get THREE breakpoints instead of just two.
>I know that interrupts are enabled, and I store $80 in BKCT0, and $00
>in BKCT1. Then I set up the PPAGE and the address of where I want it
>to break (I set the same values in both sets of breakpoint registers
>just to be safe). And I run the program - which does nothing wierd
>like changing the PLL, or messing with interrupts. The addr I specify
>is definitely an op-code address, and it is definitely being executed.
Try setting the addresses FIRST, then the control bytes.
Also, you might want to use $90 instead of $80, so that the breakpoint only triggers on instruction about to be executed, and not other reads of the address (as may happen due to the pre-fetch queue)
I don't think it would affect the serial monitor version, but when using BDM writes you can't use write-word to set the word at BKP0H, since it is an odd address. OK to do word write to BKP1H since it is an even address.
Posted: Sat Oct 22, 2005 3:16 pm
> The first thing is to check your datasheet. Your register defs
> are correct for the DP256 etc. with the 24-bit breakpoint
> module, but the C32 has the new DBG. The good news is that you
> get THREE breakpoints instead of just two.
This was confusing to me for a while because it looked like contradictory information until I figured out that DBG and BKP are two different modules. I don't think I need the logging feature of DBG, but Comparator C will give me that third breakpoint.
> Try setting the addresses FIRST, then the control bytes.
> Also, you might want to use $90 instead of $80, so that the
> breakpoint only triggers on instruction about to be executed,
> and not other reads of the address (as may happen due to the
> pre-fetch queue)
> I don't think it would affect the serial monitor version, but
> when using BDM writes you can't use write-word to set the word
> at BKP0H, since it is an odd address. OK to do word write to
> BKP1H since it is an even address.
Great advice. thanks much!