Keil Logo

µVISION: MULTIPLE PROGRAMS FROM 1 SOURCE FILE SET


Information in this article applies to:

  • µVision Version 3

QUESTION

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.

ANSWER

Yes, the µVision targets allow you to solve these problems. First you need to create a target as described below:

  1. Create a µVision project.
  2. 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.
  3. 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.
  4. 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:

  1. 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.
  2. 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 group.

To use conditional compiling with a target:

  1. Open the dialog Project - Options for Target.
  2. 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.
  3. In the Assembler page you may enter Set symbols that are used in $IF and $ELSEIF directives to control conditional assembly sections.
  4. 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 context menu.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, September 2, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.