Hi,
I try to call hard fault handler from the handler created by STM32CubeMX like this
/** * @brief This function handles Hard fault interrupt. */void HardFault_Handler(void){ /* USER CODE BEGIN HardFault_IRQn 0 */ __asm volatile( "tst lr, #0x4 \n" "ite eq \n" "mrseq r0, msp \n" "mrsne r0, psp \n" "b hardFaultHandlerU \n" );
NVIC_SystemReset(); /* USER CODE END HardFault_IRQn 0 */ while (1) { /* USER CODE BEGIN W1_HardFault_IRQn 0 */ /* USER CODE END W1_HardFault_IRQn 0 */ }}
However Compiling ends to error
../Core/Src/stm32l4xx_it.c(96): error: #20: identifier "lr" is undefined "tst lr, #0x4 \n"
Without the line 'tst lr,#0x04 'compiling is succesful, but of course it is not working properly
I have used same code earlier in assembler to call C -function.
And based googling the code above should work. Any idea, what I'm missing?
BR,
Hande
Thanks,
Problem solved