I am using Keil uVision version 5.40. I load the application in my target board using Keil ULINK2 Debugger. I can jump to my startup code. When I get to the following instruction:
bx __main()
I cannot single step into Keil's __main(). When I try stepping into it, code starts running. When I hit stop execution, I end up in the following filename (RT_Agent.c):
void _sys_exit (int return_code) { /* Endless loop. */ while (1); }
My guess is I'm not configuring my application properly.
Please advise!
__main is *not* main.
__main is created by the compiler. It's where ram is initialized. It eventually calls main().
But... I couldn't step into either, the application just started running. It probably doesn't have debugging info, so the debugger doesn't know what to do. If you open the disassembly window and put a break point at the address of __main, it'll stop, though.
__main is created by the compiler.
Rubbish.
It's where ram is initialized.
Could certainly be phrased better.
It eventually calls main().
You're getting betterThat's more like it.
But... I couldn't step into either, the application just started running.
It is so simple to do. Select the disassembly window and single step there.
ok, now I can single step in the disassembly window. So, now I am stepping in Keil's __main() in disassembly window. I cannot reach my main(). I get stuck at while(1) mentioned earlier in this thread.
I get stuck at while(1) mentioned earlier in this thread.
So look at the instruction prior to the entry to that loop and you should easily determine the cause.
It doesn't break at the prior instruction.
Call Stack looks something like following:
_sys_exit 0x000091F4 param - int 0x00016B8C 0x00015A1E 0x00015A1E 0x00016B8C
I set breakpoints at these addresses but it doesn't break there.
Well, it didn't get there because someone waved their magic wand!
Let me rewrite stack contents.
_sys_exit 0x000091F4 param - int
0x00016B8C
0x00015A1E
Also, I make it to example application main().
It's not necessary. Just single step through the code until it jumps to the error and you have it. It'll be a lot quicker than your persistent repetition here!
My co-worker made changes to my startup code, RTX_config.c, and uVision project file.
I still can't make it to my main().
I stepped through Keil's __main(). There is following software interrupt instruction:
SWI #AB
#AB ? never saw numbers that high in software interrupts.
I think there is no handler for this software interrupt number so I consistently get stuck at while(1)