Cortex M4 Fault Handler

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cortex M4 Fault Handler

2,530 Views
mr_s
Contributor I

I have a build system that makes use of LPCScrypt on a linux machine.  Everything works really well, except that without the ability to set breakpoints (no debugger nor IDE), I'm unable to debug as effectively as I'm used to.

cr_startup_lpc43xx.c describes a lot of great fault handlers I can implement, namely, HardFault_Handler.  But I don't have a good way to print out the call stack/all the function calls that led me to this terrible, terrible point.

Is there a template I can use to paste into one of these fault handlers to be able to printf() some basic state of the world before just dying silently?

Thank you,

//*****************************************************************************

// Default exception handlers. Override the ones here by defining your own

// handler routines in your application code.

//*****************************************************************************

__attribute__ ((section(".after_vectors")))

void NMI_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void HardFault_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void MemManage_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void BusFault_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void UsageFault_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void SVC_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void DebugMon_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void PendSV_Handler(void) {

    while (1) {

    }

}

__attribute__ ((section(".after_vectors")))

void SysTick_Handler(void) {

    while (1) {

    }

}

Labels (1)
0 Kudos
Reply
2 Replies

1,592 Views
massimomanca
Contributor III
0 Kudos
Reply

1,592 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The free version of the LPCXpresso.IDE is available for download here:

LPCXpresso IDE v8.2.0 NXP

Here's a FAQ for debugging a hard fault:

Debugging a Hard Fault

Thanks and regards,

LPCXpresso Support

0 Kudos
Reply