Shop OBEX P1 Docs P2 Docs Learn Events
Debug Break Help — Parallax Forums

Debug Break Help

pjvpjv Posts: 1,903
edited 2009-03-28 03:22 in General Discussion
Hi All;

I'm doing a project that needs to consume very little battery power. To facilitate that, I have my SX 48 mostly asleep. Now, to debug my program, I need to set break points in my code as per normal, but I find that as the wake-up event - a bit stream into an RB pin- occurs, the processor wakes up alright, and, as expected, ·heads straight for the Initialization code, but then halts and breaks into the SX IDE monitor and waits for human intervention. I am required to press "RUN" to get it to continue, and of course by this time my bit stream is long gone.

Is there a way that this "break into monitor" can be turned off and on wake-up·instead start executing code at the RESET code point, but not break into the IDE until an actual set·"break" is encountered.

I can understand that frequently, in fact probably most often, one might want to break on encountering the RESET code, but not always, as in the case I have before me.

One can somewhat get around it by using "POLL", but again, not without delay, and in my case this just won't work.

Any ideas???

Cheers,

Peter (pjv)
·

Comments

  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2009-03-28 01:51
    Peter,

    ·· I am not sure if you are trying to debug timing or logic.· This might mess with the timing a little but but should be useful for verifying code logic.

    ·· I have never actually tried this but I wonder if it might be possible to...
    1. Create a subroutine that checks an initialization flag.·· If the flag is not set, set it and jump to the debugger code.·· (Set it to jump to an easy to find address if you do not know the address of the debugger.)· However, if the flag is already set, jump to your interrupt routine instead.
    2. Load your program with the debugger as usual.
    3. Read the program back out with the debugger and save it as a hex file.
    4. Edit the hex file and replace the jump address going to the debugger with the jump address of your initialization check routine.
    5. Replace the memorable jump address of your initialization code if you used one with the now known address of the debugger code.
    6. Load the modified hex file back into the chip.
    7. See if it runs!

    ·· You may have to keep the chip awake, though.· If it sleeps and drops the pin states the SX-Key may find it confusing.

    ·· I hope this helps.· Let us know how it goes.

    ·- Sparks-R-Fun!
  • pjvpjv Posts: 1,903
    edited 2009-03-28 03:22
    Hello Sparks;

    Thanks for your interest and your idea. I think you may have something there.... I'll try that tomorrow.

    Cheers,

    Peter, (pjv)
Sign In or Register to comment.