Hello, I written simple c program mention below by selecting the lpc2148 chip but not include its startup file in the project. when i run it will go in infinite loop. I also put the break point but i think its not coming to that execution line. Is it necessary to include startup file? void main() { int a=2,b=3,c; c= a+b; }
but not include its startup file in the project.
That makes less of a difference than you think. The linker will insist on having some startup file. If you refuse to put one in the project, it'll still pick one from the library. Go figure.
so how do you stop it gettnig the library?
Why the great debate to a simple problem? Just add the startup file to your project and compile it and, guess what? your code will startup. Why are you trying so hard to avoid using the startup file. It is required to setup vectors, stack, heap, and initialise data etc. In theory you could locate your main() at the processor's start address but then you would still end up having to do what the startup files does at the beginning of your main() function.
Just use the startup file and stop wasting your time trying to avoid it!
can i write my own start up codes and librarys?
Yes. But why would you?
View all questions in Keil forum