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; }
hi Per, thanks for reply. I have one basic question. I think when we start the processor it will jump to location 0x000000000. Can't the main function locate at that memory location without start up file.
In theory, main() could have the code placed at address zero. But that would not be enough to make the processor compatible with the C language standard. Because the processor does not know that the C standard requires all global variables to be given initial values. And the processor does not know what requirements the C language program may have for a call stack. Note that some processors - see for example Cortex-M3 ARM chips - do know how to prepare a call stack before starting the user application.