assembly instruction for breakpointing during stack overflow

Hi

I need to implement a stack overflow handler which will disable all interrupts and then execute some instruction such as bkpt  #0 in case of ARM Cortex and then enter infinite loop 

void StackOverflow( ) {

// disable all interrupts
//todo: Indicate Overflow by write to GPIO port or an LED

__asm volatile("bkpt #0"); // breakpoint here

for(;;) { }

}

Is there similar instruction in RH850 to do this similar to bkpt #0 in case of ARM Cortex?

Thanks,

Parents
  • Hello pras,

    JimB is right regarding generation of breakpoints using the "dbtrap" instruction. However, it does only forces the CPU to enter the debug mode ("breakpoint"), where an external Debugger may communicated with the debug system via the debug interface. This is most probably not what you intend.

    Most RH850 (like RH850/F1K) offer a Memory-Protection-Function (MPU), which is intended to force an exception in case of memory protection violations. This is the most common way to handle stack overflows. The MPU is described in the manuals mentioned by Fragero.

    The debug system itself also offer to set breakpoints on memory access (/violations). However, in most RH850 (like F1K), the debug system is not accessible by the CPU core. Only an external Debugger connected via LPD-1/LPD-4/Nexus is able to access the debug system for such purposes.

    Best regards

Reply
  • Hello pras,

    JimB is right regarding generation of breakpoints using the "dbtrap" instruction. However, it does only forces the CPU to enter the debug mode ("breakpoint"), where an external Debugger may communicated with the debug system via the debug interface. This is most probably not what you intend.

    Most RH850 (like RH850/F1K) offer a Memory-Protection-Function (MPU), which is intended to force an exception in case of memory protection violations. This is the most common way to handle stack overflows. The MPU is described in the manuals mentioned by Fragero.

    The debug system itself also offer to set breakpoints on memory access (/violations). However, in most RH850 (like F1K), the debug system is not accessible by the CPU core. Only an external Debugger connected via LPD-1/LPD-4/Nexus is able to access the debug system for such purposes.

    Best regards

Children