I am using Metrowerks Code Warrior Debugger for an application based on the MC9S12DG128.
The application is controlled by two buttons:
- button 1 puts it in stand-by (execution of the instruction STOP)
- button2 wakes up the application (it sends an XIRQ to the MC9S12); when waked up, the application makes first a reset (via the watchdog) so as to initialise everything in the microcontroller.
Now I want to debug the early stages of the execution, just after the reset generated by the watchdog.
While the application is running, I set a breakpoint with the debugger in the code executed after reset. Then I press button1 (stand-by), then button2 (wake-up). The program doesn't stop at the breakpoint: it seems that it must be launched by the debugger (command Start) for the breakpoints to be active. If I stop the program (command Halt) and then re-run it (Start), breakpoints are active again,.... but the portion of program I wanted to debug has been excuted a long time ago.
I tried different things (instruction BGND in the code to debug, set the breakpoint wihile application running or in stand-by, write directly the address of the breakpoint in breakpoint registers) but nothing worked. I understand that reset clears the breakpoints, and the only way to rewrite them is to launch the application via the command Start of the debugger. Have you some idea of the way to "automatically" set a breakpoint when my program gets out of reset ?