I am facing an issue with initialization. I created a project with uVision3. I modified standard start up file STARTUP.A51 for my application as below:
?C_C51STARTUP SEGMENT CODE ?STACK SEGMENT IDATA RSEG ?STACK DS 1 EXTRN CODE (my_main) ;EXTRN CODE (?C_START) ;--- commented ?C_START ;.........Standard Code....... IF PBPSTACK <> 0 EXTRN DATA (?C_PBP) MOV ?C_PBP,#LOW PBPSTACKTOP ENDIF MOV SP,#?STACK-1 ;LJMP ?C_START ;--- commented jump to ?C_START LJMP my_main
NOTE: my_main is a starting function defined in my project.
I am including this modified file in my project. Also i am not including INIT.A51. With this i am facing an issue in my code. Whenever i initialized global data, program wont take it. For example, if i initialized below global variable:
unsigned char counter = 5;
When in code i checked counter value, it is always 0x00. I think this is problem with not calling ?C_START which is defined in INIT.A51. Due to this, all global initialisation is not happening.
Is this correct ? Is there any way to avoid this issue (apart from including INIT.A51)? Can anyone tell me which part of the INIT.A51 file i can copy to STARTUP.A51 before below code
;LJMP ?C_START ;--- commented jump to ?C_START LJMP my_main
so that i cant have this issue ?
Thanks in advance !!
I am facing an issue with initialization.
No, you're not. You're not facing an issue, you've just created one.
You foolishly decided to pick an utterly pointless fight with the tools --- and you lost. Yes, that hurts. So here's your lesson to take home for today: don't do that.