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

Hard fault when branching to main

Hi,

I am working in a C++ project for STM3210C-Eval Board (Cortex-M3). I wrote some classes and got the project working perfectly. Then I designed other classes to increment project functionalities and the system no longer works. Debugging, I have noticed that the main function is not executed. So, I started the execution from Reset routine in startup code.

; Reset handler
Reset_Handler    PROC
                 EXPORT  Reset_Handler             [WEAK]
        IMPORT  __main
                 LDR     R0, =__main
                 BX      R0
                 ENDP

When I step into "BX R0" instruction the exception Hard Fault happens and the system hangs in an endless loop. I could see that the value loaded into R0 is 0x08000151, whereas the original value of __main is 0x08000150.

Could someone help me?