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

Debugging "__main"

Is there any way to be able to step through the code (associated C Code) that is executed when calling "__main" from the start up file?

Reset_Handler   PROC
                EXPORT  Reset_Handler             [WEAK]
                                IMPORT  HW_init
                IMPORT  __main


                LDR     R0, = HW_init ; Initialize board: FSMC, clock, etc...
                BLX     R0

                LDR     R0, =__main
                BX      R0
                ENDP

The processor that is used as the target is the STM32F103ZE (Cortex-M3) and for some reason in a new spin of a board the system keeps on crashing in the "__main" code. It does not even get to "main()" function.

When the exception occurs I can track it down to the address of the instruction that causes this

0x080034B8   1B52   SUBS  r2,r2,r5

, but I would need to analyze more assembly code to know what it is actually doing.

Is there anyway to get the "C Code" version of this code to step through?

Is there a document that explains what happens in "__main". I would imagine basic RAM memory initialization.

0