This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Recovering from a hard fault cortex M3

Hi,

I'm new into  mixing C and ASM on Cortex M3 using keil, here is the question,

Suppose that a function tries to access some memory that is not in the system, something like this, the system crashes with the hardfualt exception, so my question is why after executing the hardfault the program reenters the hardfault again, is there a way to simply return to the next instruction

here is my sample code

#include "LPC17xx.h"                    // Device header

int main(void)
{
    SCB->SHCSR |= 0x00007000; // enable Usage Fault, Bus Fault, and MMU Fault
    SCB->CCR |= 0x18; // enable div-by-0 and unaligned fault

    int i=0;
    static int test;



    test = (*(unsigned int *)0x678000000);
    while(1)
    {
        i++;
    
    }

}


int value;
void HardFault_Handler (void)
{
    int r1,;
    value=r1;
    
    __asm
    {

    }
}

Any ideas?

Parents Reply Children
No data