Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

TMS320F28034: The difference between running online with an emulator and running offline without an emulator

Part Number: TMS320F28034
Other Parts Discussed in Thread: C2000WARE

Recently, I discovered that executing the same code online with an emulator is different from executing it offline without an emulator. Here is my code.

  Figure 1

 Figure 2

As figure 1 shows, the function pointer is defined at the initial position of the structure. Figure 2 shows how the structure is initialized in a function where LINE_STRTUCT_DEFALUTS is the macro definition and corresponds to (void (*)(void *))LineCalc. After initializing the function pointer this way, I see that the value in the actual function pointer is still 0x00000000 rather than 0x3EA0A6. So after executing aiLine.calc(), the program jumps to an illegal ISR.

Later, the program runs normally after I modified the initialization of function pointers as shown in figure 3. So it can be said that the cause of entering an illegal interrupt at online runtime is bad initialization.

  Figure 3

Here's my puzzle! With the original function pointer initialization method, running online will enter illegal interrupt, but will run fine when running offline. Why?

  • Would there be anywhere else in the code that aiLine get written to?  When I see initialization issues sometimes they can be masked by code that writes to the variable in memory, and when there is a XRSn(reset) the value persists in memory so things work fine after that.  It would only be after power up that things no longer work well.

    Another scenario is that you have gone through the above with the emulator connected(getting the Illegal ISR) and then if you disconnect the emulator and just issue XRSn to start over, again the value is still present in memory so things work OK.

    You can also try to make sure your code works correctly standalone from a power down/up event; I would think this will likely fail.

    With that said, it also depends on what code is in your illegal ISR.  If you have the default ISR still populated(from C2000Ware), these are typically just a infinite wait loop.  With the emulator connected this will hold there, but in standalone if you have the watchdog enabled, eventually that will time out, and issue a XRSn as well.  The second time around, if the variable was eventually written to, it would work for the same reasons as above.

    Hopefully this has given you some ideas, let me know if you are still seeing some unexplained behavior and we can dive a little deeper.

    Best,

    Matthew

  • Hi Matthew!

    There is nothing else code about aiLine between initialization and excution of ailine.calc(). The defination in figure 2 is a local voriable, so it  also can not be masked by code outside.

    I try my code from a power down/up event without emulator, it works well. It only works bad when I excute my code by emulator .

    There is just a infinite wait loop in the illegal ISR and the watchdog is disable.

    Best,

    HJC

  • HJC,

    When you are connected with the emulator, set a breakpoint an instruction before the one we think is going bad, then open up a dis-assembly window(View->disassembly) and then attach a screenshot of that dis-assembly back to the E2E and I can look at it and we can debug from there. 

    Best,
    Matthew