This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Software breakpoint equivalent

We were working with AD Tigersharc TS201S and we are moving to use TI's C6678.

For debug purposes, we used to add 2 lignes of code to make sure one DSP stops at that precise place in the code.
One of these 2 lines would disable interrupts and the other one was assembly code to constantly JUMP at the current address.

I've been looking at the C6678 instructions set UG but couldn't find an equivalent for the jump.

Thank you for your time,

CM

  • Clement,


    The opcode of the SW breakpoint is 0x10000000. This was for C67x CPU but I guess it is backward compatible and would work for C66x.
    From a C file you could use a line like the below one:
         asm(" .word 0x10000000");

    See as well information on the asm(); statement from the C6000 Optimizing C compiler user's guide:
    http://processors.wiki.ti.com/index.php/TI_Compiler_Information#Compiler_Manuals

    Anthony

  • Thank you Anthony for your quick answer,

    On a very simple example (a few lines a code) I added

    asm("   .word 0x10000000");

    in the middle of it to see if the program would stop at this instruction but it didn't.
    The program worked exactly the same than without the asm instruction.

    For Analog Devices Tigersharc I was using

    asm volatile (" if True, jump 0;;");

    I'd like the equivalent for C6678.

    Thanks for your help

    Clement



  • Clement,

    Are you debugging your code using Code Composer Studio via emulation, or are you trying to implement a monitor-based type of minimalist debug capability? [Please let the answer be that you are using CCS.]

    In C64x+ and later DSPs, including C674x and C66x, I use the following to insert a software breakpoint:

    asm(" SWBP 0");

    Sometimes I will put this into a Breakpoint() function so the code will call that function and I can change the behavior as needed. Another example is

    void Fail(void)
    {
     asm(" SWBP 0");
     while (1);
    }

    void Pass(void)
    {
     asm(" SWBP 0");
     while (1);
    }

    These could be changed to 'inline' with the inline keyword, but that would defeat the purpose of it being a separate function for some of my purposes.

    The advantage of using the SWBP 0 instruction is that if you are not debugging with emulation, this will be passed over as a NOP. If you are using emulation, the processor will halt when it gets to this instruction and give you control via CCS.

    If you are not using CCS and emulation, you need to. If you insist on not using CCS, you need to switch to CCS and find a powerful world of emulation tools that are awesome for multi-core products.

    But if you keep insisting that you just want to do the same thing you did on that other processor, you can use

    asm( " bnop $,5" );

    This will stop the DSP in its tracks and never let go, until you halt it in CCS using emulation.

    Regards,
    RandyP

  • Hi RandyP,

    Thank you very much for the answer.

    For now I do use CCS via emulation.

    I tried the 2 solutions you provided and they both work. (a bit differently though). I'll use the first one (SWBP) it seems more elegant/powerful and suited for my needs.
    I also found on another thread : asm(" NOP\n .work 0x1000000"); and it works too.

    You may want to correct the fact that your Fail and Pass functions are strictly the same.
    Instead of a Breakpoint() function I'll simply use a macro for now (enough for my needs).

    Thanks again,

    Regards,

    CM

  • Clement,

    Should that be .word instead of .work from the other thread you found? I am not sure there are enough 0's in the argument, but if there should be one more 0, it would match Anthony's recommendation, so I am not sure why that did not work the same for you; I do not understand why the NOP would make a difference in the case that did not work for you earlier.

    I use the two functions so I can quickly see whether my code worked or not. That is the only reason why I use the same code in both functions. Thank you for pointing that out.

    Regards,
    RandyP

  • Hello Randy,

    I work with Clement on this subject.

    Yes one must read asm(" NOP\n .word 0x10000000"); instead of what he wrote. We do not understand either why Anthony's suggestion didn't work.

    Other thing. We previously tried to do the same thing with

    asm(" .end")

    because in the documentation it says "You can use .end when you are debugging and you want to stop assembling at a specific point in your code".
    However with asm(" .end") leads to compilation errors. We are not very familiar with using asm directives.

    Additionnal question on SWBP : is it some kind of register ? Can you shed some light on it ?

    Thank you

    Nadim

  • Nadim,

    asm(" .end"); does not sound like a good way to do this since it is an assembler directive being inserted in the middle of the compiler's assembly output. I expect you are taking this out of context or trying to use it in a context outside the documentation's intent.

    SWBP is not a documented instruction, and I do not know any more than that the syntax I showed does work as I showed it.

    Sorry, but there is nothing more I can add. I use it and it works.

    Regards,
    RandyP

  • Randy,

    Thank you for your time again,

    The subject is closed, I think.

    Regards,

    CM