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
Martin, This may be cumbersome, but you can create a build target per revision (by Components, Environment and books -> Project targets). Each target/hardware revision can then run its own script.
Or supply the appropriate parameter(s) to a common script
Hi Michael and Andy,
thank you for your help. I rearranged my Project with multiple targets for each hardware revision. This works fine, wow 8-)
@Andy: How can I supply the appropriate parameter(s) to a common script? I found a hint on http://www.keil.com/support/man/docs/uv3/uv3_ut_keysequence.htm. So I'm able to put some filenames as a parameter to a common script. But I don't know how to passing a value of a #define xxx directive as a parameter to a common script? Can that be done at all?
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.
Thank you! have a nice day :-)