What are the restrictions when debugging TriCore PCP code ?

These are ..

  • Full context
    Otherwise the unsaved registers cannot be restored after a channel break (breakpoint or step), the unsaved registers will have an undefined contents the debugger is not prepared for other than full context
  • PCP_CS.RCP must be 0 (channel start from context)
    Otherwise the channel starts from the channel entry point (0xF002000 + 4 * priority) rather than from the location where the program was broken (stepping would not be possible). The register R7 must be set correctly in the PRAM in the user program example (Tasking):
  .sdecl "pcp.context", DATA
  .sect "pcp.context"
  .space 32
  Ch1: .word 0x00020040 ;R7 begin address 0x2, channel enabled
  .word 0x0 ;R6
  .word 0x0 ;R5
  .word 0x0 ;R4
  .word 0x0 ;R3
  .word 0x0 ;R2
  .word 0x0 ;R1
  .word 0x0 ;R0
  • Channel must be enabled
    Disabling the channel is an indicator that a debug instruction was executed. Together with PCP_ES the idle state of the channel is interpreted as running or halted.
  • Shared code is not debugable
    Otherwise the debugger gets confused, (UDE® is not a multi thread debugger yet)
  • Only one channel may be debugged at a time
    If one channel is broken and a second channel is invoked and the second channel runs also into a break, then the debugger gets confused
  • Error handler for pcp errors must exist in the TriCore program (only for TC1.2 Derivates TC1775)

Only necessary if the channel that is being debugged can be invoked while the program is at an breakpoint. (i.e. a timer invokes the channel while the user steps thru the channel code) the TriCore must run to handle the error interrupts coming from the PCP.

Example for an error handler (Tasking):

  #define PCPERRSR 3
  void _interrupt(PCPERRSR) PcpErrSr (void)
  {
  }
  void main ()
  {
    PCPCS = 0x00000021 | PCPERRSR << 24;
  }