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.

TMS320F2808: TRAP Instruction while entering a function

Part Number: TMS320F2808
Other Parts Discussed in Thread: C2000WARE

We Have two partitions for two applications running in the TMS320F2808 controller.

1.One application is running in Sectors A and B.

2.Second application is running is Sectors C and D.

After power on controller enters into the first application then immediately checks for common flag b/w application one and two.And jumps to second application and the normal initialisation steps happens for the second application.

In the second application when we enter any function we are getting TRAP instruction with PC address pointing to 0x66.

Below is the instruction for jump from application one to two.

void main (void)
{
      Uint32 lastFgCounter = 0;

     //here is the code which check for common flag b/w applications


     asm(" LB 0x3EC000");//Jump instruction to the next application
      // Initialize System Control: PLL, WatchDog, Peripheral Modules' Clocks
     InitSysCtrl();

   // Initialize GPIO
    InitGPIO();

   // Initialize the PIE control registers
    InitPieCtrl();

  • Sirnivas,

    Is there are particular reason you are using a hardcoded ASM LongBranch to 2nd application?  If you've forced that address in the .cmd file to always hold the main() of that function, I suppose this will be static; but you should just be able to call the function, or if you wanted to use asm, you could LB to _symbol  vs the immediate.

    At any rate, illegal instruction(typically caused by executing 0x0000 or 0xFFFF) will force an immediate call to the ILLEGAL ISR, which if you haven't yet initialized the PIE will be mapped to the M0 space.

    I'd recommend creating the Illegal ISR(we provide this in our defaultISR.c file in C2000Ware).  Once you are in the ISR, you can look on the stack for the return address which will be +1 from the instruction that caused the illegal.

    In CCS: View->Registers then expand the core registers and find the SP(stack pointer).  Whatever value is in the SP, open a memory browser to that location.  Assuming the SP is evan address, the return address I mentioned above will be at SP -2 with LSB at -2 and MSB at -1.  You can look at this address in the memory window and if there is code there the window will show the symbols and you can debug from there.

    Best,

    Matthew

  • Hi MatthewPate,

     Thank you for the support,this issue is solved as  codestartbranch.asm file was excluded from the build in the second application,after including the this file and made minor changes to linker command file.Now the jump from first application to second application is working fine without any issues.

    Thanks,

    Srinivas