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

Where is __main?

We use Keil tools to generate C++ embedded application that run in our embedded controller.

My initialization code jumps to __main as follows:

IMPORT __main LDR R0, =__main BX R0

Wher is "__main" ?

I searched C:\Keil but could not find definition of __main.

This is what my map file says about __main

__main 0x00008308 ARM Code 8 __main.o(!!!main)

My application starts at 0x8000. __main is at 0x00008308. Where is __main.o ?

Parents
  • Thank you! Your response is helpful but I cannot get to my main() function. I get stuck
    in forever loop between __main() and my main(). I can't debug the code because it's Keil
    code. How do I resolve this problem? What do I need to do to get Keil to jump to my
    main(). I'm not using any printf() statements.

Reply
  • Thank you! Your response is helpful but I cannot get to my main() function. I get stuck
    in forever loop between __main() and my main(). I can't debug the code because it's Keil
    code. How do I resolve this problem? What do I need to do to get Keil to jump to my
    main(). I'm not using any printf() statements.

Children
  • in forever loop between __main() and my main().
    I se two possibilities
    a) active watchdog
    b) no infinite loop in main

    I can't debug the code because it's Keil
    HUH? I know of no means of loading an ARM processor that can not be used for debugging
    code.

    How do I resolve this problem? What do I need to do to get Keil to jump to my
    main().

    you state above "loop between __main() and my main()" so it must "jump to my
    main()" That you need to clarify.

    Erik

  • Well you should probably review your startup.s file, and your target memory settings. Check also if you need to configure registers within your chip, or initialize external RAM, before C can start.

    You'll likely have to uncheck "Run to main()" in order to debug the situation.