This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Removing INIT.A51 file

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 !!

Parents
  • Removing INIT.A51 file
    by sheer accident I found out that if you have no initialized variables you will not have the init file. Of course, the startup is still there (as should be).

    thus

    char blah = 0;
    will give an init file

    char blah
    main
    { blah = 0;
    will not

    Erik

Reply
  • Removing INIT.A51 file
    by sheer accident I found out that if you have no initialized variables you will not have the init file. Of course, the startup is still there (as should be).

    thus

    char blah = 0;
    will give an init file

    char blah
    main
    { blah = 0;
    will not

    Erik

Children