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 ?
return 0 should never execute. We should never get to return 0 statement.
did you set a breakpoint and verify that "return 0 should never execute"
return 0 should never execute. We should never get to return 0 statement. I assume you want to say that the code should never exit main(). True. But when using RTOS, main() is terminated. And, "return" in main() is not good for embedded designs.
Coming back to the topic what is your startup code? possibly post your code. And use Tips for Posting Messages
But when using RTOS, main() is terminated.
Really?
Correct me if i am wrong
The os_sys_init(MasterTask) is called before termination. Hence it is valid if the while(1) statement is not written at the end of main(), because the controller executes "os_idle_demon()" even if there are no other tasks. And other tasks, if present, also have code written in infinite loop. Hence the controller will always have atleast one infinite loop.
int main(void) { . . . os_sys_init(MasterTask); //while(1); // }
Currently, I'm not working on this project. If I resume this project, I'll continue the thread.
Thank you so much for valuable feedback.
We downgraded to Keil uVision4 version 4.54 and I'm still unable to hit my main().
I am stuck in Keil's code as follows:
Filename RT_Agent.c
void _sys_exit (int return_code) { /* Endless loop. */ while (1); }
And idea why I'm stuck in this while(1).