This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Pointer stays at hardfault handler.

Hi all

I have create a new project, the same that the provided EXTI. With its own libraries, etc. It gets compiled succesfully but when debugging the pointer stays at this function.
The project is the same that EXTI example, therefore i do not understand and it is making me nuts.

I am using discoveryF4

void HardFault_Handler(void)
{ /* Go to infinite loop when Hard Fault exception occurs */ while (1) { }
}

Thanks++Carlos

Parents
  • "but when debugging the pointer stays at this function"

    So aren't you able to get your code to do _anything_ except getting to this function?

    When debugging, it is normally possible to figure out either what source line gives this exception, or what event trigs it - like when the pin associated with your external interrupt toggles, resulting in the interrupt flag being set.

Reply
  • "but when debugging the pointer stays at this function"

    So aren't you able to get your code to do _anything_ except getting to this function?

    When debugging, it is normally possible to figure out either what source line gives this exception, or what event trigs it - like when the pin associated with your external interrupt toggles, resulting in the interrupt flag being set.

Children
  • thanks for your answers.

    The case is that i know that it should work bacause the example EXTI works perfectly. And i do not know if it is due to any project configuration/setting.

    I have read that i should see which function/instruction causes the hardfault handler. I read that looking at PSRegister i could find out the last executed instruction but i do not know how to see which instruction there is at such memory position.

    How could i know which event trigs it as you mentioned??

    Best regards and thanks in advance!

    CarloSM

  • I have checked again and actually when i start debugging, the RUN button is disabled and the pointer is here:

    ; Reset handler
    Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main

    LDR R0, =SystemInit BLX R0 => LDR R0, =__main BX R0 ENDP

    When I STOP the code execution it goes to:

    void HardFault_Handler(void)
    { /* Go to infinite loop when Hard Fault exception occurs */
    => while (1) { }
    }

    And it remains here forever!..

    I hope it helps so you can help me :D

    Thanks again

    CarloSM

  • Maybe is missing startup_stm32f4xx.s file in your program.