Regarding startup file

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;
}

Parents
  • Here is a little known secret.

    Some processors (like 8051 and ARM chips) don't contain any logic to locate any main() function on startup. So the compiler manufacturer or the developer have to add a bit of work-around code to handle this processor limitation.

    The workaround code takes a bit of time and code space, but you really need it. In theory, a compiler vendor could create a C compiler that creates work-around code directly when it compiles the program, but that is seldom done. The reason is that different processors have requires different types of workarounds to manage to reach main(), so it's better to have the workarounds outside the compiler.

Reply
  • Here is a little known secret.

    Some processors (like 8051 and ARM chips) don't contain any logic to locate any main() function on startup. So the compiler manufacturer or the developer have to add a bit of work-around code to handle this processor limitation.

    The workaround code takes a bit of time and code space, but you really need it. In theory, a compiler vendor could create a C compiler that creates work-around code directly when it compiles the program, but that is seldom done. The reason is that different processors have requires different types of workarounds to manage to reach main(), so it's better to have the workarounds outside the compiler.

Children
More questions in this forum