21 lines
540 B
ArmAsm
21 lines
540 B
ArmAsm
/* Preliminary Header: Author: Mario Huettel */
|
|
|
|
.syntax unified
|
|
.cpu cortex-m4
|
|
.thumb
|
|
.type HardFault_PreHandler, %function
|
|
.global HardFault_PreHandler
|
|
.type HardFault_PreHandler, %function
|
|
HardFault_PreHandler:
|
|
TST LR, #4 // Test bit 2. If active => PSP was used, else MSP
|
|
ITE EQ
|
|
MRSEQ R0, MSP // Bit not set => MSP as argument
|
|
MRSNE R0, PSP // Bit set => PSP
|
|
LDR R1, =HardFault_Handler
|
|
BX R1
|
|
|
|
//.weak HardFault_Handler
|
|
//.thumb_set HardFault_Handler, HardFault_Handler_Default
|
|
//HardFault_Handler_Default:
|
|
//B HardFault_Handler_Default
|