psthomas psthomas

Strange issue with register display in debugger

Discussion created by psthomas psthomas on Aug 12, 2010
Latest reply on Aug 19, 2010 by Patrick Thomas

Hey all... not sure if this is a problem with the BDM or with the debugger (or with me!) so I'll post at both sites. :smileyhappy:

I have a very simple app that is supposed to read data from one serial port at one speed, and send it out via the other at a different speed.  At this point it is all polling-based because I'm trying to test one character at a time.  The problem is that upon (or during) entry to the receive routine, the uC seems to simply hang.  I've seen similar "weird behavior" from time to time via the serial bootloader, but have not seen any since I moved to the BDM.

Target is a MC9S12DP256B, I'm using the "small" memory map (the program is probably a few hundred bytes, not counting any freescale template overhead), and in fact have been prototyping the design with an old Dragon12 board, which I've known to work on other projects.  I'm using CodeWarrior IDE 5.9.0, and debugger 6.1, with a PE Micro USB Multilink (USB-ML-12E) that has the latest firmware (5.81).

I do use the PLL as a clock due to serial speed, but the serial handling routines (except for the one it's hanging on) have all been used successfully in the past, and indeed I even used a test function on those that just outputs sequential serial data, and it did work for that.

Even though I turned interrupts off in the code, and the I flag corroborated this, I also set "ISRDISABLEDSTEP" just in case.

The disassembly in the debug window is as follows:
C127  JSR   0xC051
C12A  LEAX  2,SP
C12D  LEAX  3,SP
C130  LEAX  4,SP
C132  TFR   X,D
C134  JSR   0xC06C
C06C  PSHD   <---- hangs here

Clicking "assembly step" at C12A results in no apparent change, although clicking again results in it going to C12C, so presumably it's executing the instruction, but for whatever reason is not highlighted.

At C12D, a similar behavior, where it is never highlighted... however I noticed the PC is actually set to C12E, which shows no code!  Then C12F is never highlighted, but C130 and onward seems to work okay, until finally the branch is taken, where it jumps to C06C and hangs at the PSHD, no matter how many times I continue to press "step", etc.

I tried removing this from a function and putting it directly into the main code, and now it actually hangs somewhere back in my serial setup routine, which does nothing except set 3 SCI registers, with the same symptom: assembly steps do not "align" with actual code, ex: for setting SCI1BDL=26, C061 is LDAB #26, C063 is STAB 0xD1, but PC=C062 (!?!?).

I have done clean rebuilds to confirm the object code matches source, restarted the compiler & debugger to see if it was a resource issue... no dice.

Any help GREATLY appreciated!!