Hi,
I have a simple project in Keil with follow files.
startup.a51 that contains. $NOMOD51 CSEG AT 0xFC00 BootHeaderData: DB 0xA5, \ 0xFF, \ 0x01, \ 0x00 NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE ?STACK SEGMENT IDATA RSEG ?STACK DS 10 EXTRN CODE (?C_START) PUBLIC ?C_STARTUP CSEG AT 0xFC04 ?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP STARTUP1: MOV SP,#?STACK-1 ; assign stack at beginning
LJMP ?C_START ;reset location (jump to start main)
END -------------------------------------------- and I have my main.c file
void main(void) { unsigned char i =0;
i = i +1; while(1); }
What I don't understant is the hex file generated by compiler contain some additional code after the inst. LJMP ?C_START only after the execution of "some" code that compiler generate my main function is executed.
Any knows what code is generated? I don't want that the compiler generate this "additional" code, how I can do this? Thank you!
Your comment is not quite correct. startup.a51 is for you to configure to match your particular hardware; after this, the compiler does its standard start-up stuff - including setting variables defined with initialisers, etc. Only then does it actually call your main() function. C_START is the start of the compiler's runtime initialisation; it is not the start of your main() function.
http://www.keil.com/support/docs/2011.htm
Thank you very much!
It's clear for me now! The answer was in manual... I'am sorry for the basic question...
Best Regards, Nels