MULTIPLE PROGRAMS FROM 1 SOURCE FILE SET
Applies to: uVision IDE
Information in this article applies to:
I need to create 2 programs from the same set of source files. I
know that µVision supports multiple targets, but I am not sure
if I can solve the following requirements with that?
The programs are different by just a single source file.
Is it possible to exclude source files from a target?
I am using conditional compiling. Is it possible to have
different defines that are derived by a target.
Yes, the µVision targets allow you to solve these problems.
First you need to create a target as described below:
- Create a µVision project.
Rename Target 1 (in the Project Window or by using
the dialog Project - Components, Environment and Books) to
the name of the first program you want to create.
Add all of your source files to this target. If you have a
group of files that will be excluded from the second program,
create a new group for them in the dialog Project - Components,
Environment and Books.
In the dialog Project - Components, Environment and
Books add a new target for the second program.
Now you may switch between the targets by using the selection line
in the Build toolbar.
To exclude source files from a target:
Right click on the file or group that you want to exclude from
the second program and use the Options for ... from the
context menu to open the Options - Properties dialog.
Uncheck Include in Target Build to exclude a source file
from a target. You may apply this on a single file or on a file
To use conditional compiling with a target:
Open the dialog Project - Options for
In the Compiler page you may enter pre-processor
symbols under Define. These symbols are tested
using #if, #ifdef, and #ifndef
preprocessor directives in the source files.
In the Assembler page you may enter Set
symbols that are used in $IF and $ELSEIF directives
to control conditional assembly sections.
Again, you may apply these symbol settings even on a
single file or on a file group when you right click on the file or
group that use the Options for ... dialog from the
Article last edited on: 2005-09-02 03:22:16
Rate this article
Disagree? Move your mouse over the bar and click