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

Can I use #ifdef in STARTUP.A51

My current project has 2 targets, For 1 the code starts at 0x0000 and for the other the code starts at 0x8000. I therefore modified STARTUP.A51 to give:

                PUBLIC  ?C_STARTUP
#ifdef TOP
                CSEG    AT      0x8000
#else
                CSEG    AT      0x0000
#endif

?C_STARTUP:     LJMP    STARTUP1

I have set the preprocessor define symbol to TOP under Options for Target/C51 for the target I want to start at 0x8000. When I look at the m51 file the LJMP to the STARTUP Code is always put at 0x0000.

However if i change STARTUP.A51 to give:
                PUBLIC  ?C_STARTUP

                CSEG    AT      0x8000

?C_STARTUP:     LJMP    STARTUP1

The LJMP to the STARTUP Code is now situated at 0x8000.

I therefore assume that the preprocessor directive #ifdef is being ignored.

Can anyone explain this?

Parents
  • Note that you put that definition for TOP in the C51 pane of the options dialog, while the source code in question is not C, but assembler. The assembler has its own options pane --- you'll have to add the definition there.

    Depending on the version of C51/A51 you have, it may not be possible to pass #define type macros on the command line. Use Ax51 style $if()'s then.

Reply
  • Note that you put that definition for TOP in the C51 pane of the options dialog, while the source code in question is not C, but assembler. The assembler has its own options pane --- you'll have to add the definition there.

    Depending on the version of C51/A51 you have, it may not be possible to pass #define type macros on the command line. Use Ax51 style $if()'s then.

Children