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

How to control external tools with #define directive?

Hi community,

on 'Options for Target' -> Tab 'Output' -> Groupbox 'After Make' -> 'Run User Program #1' and 'Run User Program #2' i can specify to run external tools after compiling and linking. Normally i start a *.BAT commandline batch file.
I am using C51 with µVision 3.

Now, i want to control this mechanism depending on a #define directive in a source code, e.g.:

#define HARDWARE_CONFIG 1


If HARDWARE_CONFIG is defined with value '1', then run batch file 'hw_rev_1.bat', otherwise run 'hw_rev_0.bat'.

Alternatively, is it possible to pass a numeric argument (here the value of HARDWARE_CONFIG) to the batch file?

Has s.o. any suggestions to solve my problem? Thanks in advance,

Martin

Parents
  • Yes, key sequences may well be useful.

    For each target, your 'Run User Program' command line would have to contain the appropriate parameter(s); eg

    In Target 1: Run User Program= my_script.bat option_1

    In Target 2: Run User Program= my_script.bat option_2a option_2b

    In Target 3: Run User Program= my_script.bat option_3

    etc...

    You can't use #define - that's a compiler directive.

Reply
  • Yes, key sequences may well be useful.

    For each target, your 'Run User Program' command line would have to contain the appropriate parameter(s); eg

    In Target 1: Run User Program= my_script.bat option_1

    In Target 2: Run User Program= my_script.bat option_2a option_2b

    In Target 3: Run User Program= my_script.bat option_3

    etc...

    You can't use #define - that's a compiler directive.

Children