2007-09-06 05:04 AM
2007-08-31 08:37 AM
I'm currently working with an STR710FZ2T6 on an STR710-EVAL board. I am very new to MCU development and my background consists mostly of traditional C/C++ software development on x86 hosts.
For a few days now, I've been trying to figure out why I can't get a simple application to boot from the embedded flash (at 0x40000000) when I depress the Reset switch or reconnect power to the board. However I am able to run my app by sending a Startup/Go command to the board from the debugger. I am using the Realview Debugger software and an RVICE-ME. I realized that the declaration of my main function included arguments, and that doesn't work, but if I change it to take in no arguments, then it boots on reset or from a power cycle just fine. This won't run on reset or bootCode:
int main (int argc, char** argv)
But this worksCode:
int main (void)
So I have a few questions which I'd be happy if anyone could shed some light on. What are the differences between running a program through the debugger versus running at boot time with regards to passing arguments into the main function? Is it possible to pass in arguments to the main function, either through the debugger or at system boot? Thanks in advance.2007-08-31 08:41 PM
With IAR EWARM software, the disassembly shows no difference in generated code for main() with or without arguments. It could be different with the RealView compiler. Try examining disassembly listings for main().
Normally it is not possible to pass arguments to main() in a microcontroller-based system. You certainly could modify the pre-main() code to communicate arguments to the system via some communications link and pass them to main(), but it is not practical and no-one ever does that.2007-09-06 05:04 AM
Volius, thanks for the reply. That's what I was thinking as well; using arguments to main with a microcontroller doesn't make sense to me either.