mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2026-04-21 06:14:05 +00:00
add hard_fault handler
This commit is contained in:
parent
373e56f006
commit
79d1060a46
2 changed files with 21 additions and 0 deletions
2
.gdbinit
Normal file
2
.gdbinit
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
target extended-remote :4242
|
||||
b hard_fault_handler_c
|
||||
19
main.c
19
main.c
|
|
@ -1485,3 +1485,22 @@ int main(void)
|
|||
chThdSleepMilliseconds(1000);
|
||||
}
|
||||
}
|
||||
|
||||
/* The prototype shows it is a naked function - in effect this is just an
|
||||
assembly function. */
|
||||
void HardFault_Handler( void );
|
||||
|
||||
void hard_fault_handler_c(uint32_t *sp) __attribute__( ( naked ) );;
|
||||
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
uint32_t* sp;
|
||||
//__asm volatile ("mrs %0, msp \n\t": "=r" (sp) );
|
||||
__asm volatile ("mrs %0, psp \n\t": "=r" (sp) );
|
||||
hard_fault_handler_c(sp);
|
||||
}
|
||||
|
||||
void hard_fault_handler_c(uint32_t* sp)
|
||||
{
|
||||
while (true) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue