|ARM Technical Support Knowledge Articles|
Applies to: ARM Developer Suite (ADS)
When you build a project written in C or C++ and load the generated image in the debugger, the core's program counter initially points to __main. This function performs the scatter-loading and the C library initialization, and finally branches to main().
In some cases the program crashes or exits before reaching main(). These are the most common reasons why this can happen:
The image hasn't been loaded correctly in memory. For example, this can happen if there is no memory or read-only memory at the address where the image is loaded. It can also happen if the MMU/MPU hasn't been programmed correctly.
Before loading the image you should ensure that there is RAM at the target address by opening a memory window and writing to it.
Once the image is loaded you can ensure that it is loaded correctly by checking the contents of memory in the disassembly window.
There is an exception (e.g. an interrupt or a memory abort) before reaching main(). Exceptions can be detecting by enabling vector catch in the debugger.
The stack is placed at an address where there is no RAM. This can happen, for instance, if the debugger variable $top_of_memory is not set up correctly.
The endianness of the image doesn't match the endianness of the target or the debugger.
Semihosting is disabled or the debugger / JTAG emulator doesn't support it.
For more information about $top_of_memory, __main and the C library initialization, please see Application Note 107: Embedded Software Development with ADS v1.2.
Article last edited on: 2008-09-09 15:47:41
Did you find this article helpful? Yes No
How can we improve this article?