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 Reply Children
  • Hello pras,

    if any exception is called, the CPU enter the exception mode and no other (maskable) interrupt can be called. Depending on the exception level also other exceptions might be prevented, before the exception returns to normal operation mode. Leaving the exception can only be done by a EIRET/FERET instruction, which places the Compiler at the end of an exception routine. This just explain the CPU modes, which you should take in mind when trying to execude code from the exception routine. Some software drivers might needed interrupt processing in the background and may not work as expected.

    The flash handling (regardless of code/data flash) is handled by an internal Flash Access Controller Interface (FACI), which do not care for the CPU mode. You could control the flash as usual. Please take in mind that you may have currently a data flash operation. So, it depends on the current status, which kind of access is possible.

    Attention: If you have a stack overflow, you have to think about the consequences. Calling data flash libraries could work , but without having a valid stack, this should be handled with care (e.g. restoring stack to valid area).

    The flash librarues are usual not designed for re-entrance!

    Best regards