When the application starts the code contained in Startup.S begins to execute. It initializes stack and C-environment (previously initialized variables) and annuls uninitiated variables in the stack area, and calls global C objects constructors. After that it hands over control to the application on C. This file is generated automatically from the universal make-file. 

By default the point of entry into C application on GCC has a standard name main. The prototype, however, is of course different from the standard ANSI C and looks as follows:

int main( 
DWORD dwInDataLng, DWORD dwOutDataLng, DWORD dwP1);

dwInDataLng – length of data received from PC,

dwOutDataLng – length of data requested back by PC,

dwP1 – parameter given to GrdCodeRun() function.

 

If you need to change the point of entry address, you need to correct the following lines in Startup.S file:

.global main 
... 
LDR R4, =main
  • No labels