Cortex M4 Fault Handler

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Cortex M4 Fault Handler

2,531 次查看
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) {

    }

}

标签 (1)
0 项奖励
回复
2 回复数

1,593 次查看
massimomanca
Contributor III
0 项奖励
回复

1,593 次查看
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 项奖励
回复