Keil Logo

µVISION: Set Unique Preprocessor Symbols by Project Target


Information in this article applies to

  • MDK V4 and V5 - All versions

Question

I have different targets that require different initialization schemes. I currently use #defines and #ifdef/#ifndef to change this, but have to manually change this every time I switch targets. Is there an easier way to change #defines than manually in the file?

Answer

Yes. You can do this by creating separate Project Targets and assigning them unique Preprocessor Symbols (#defines).

To do this:

  1. Create a new Project Target by opening Manage Project Items. A dialog will open. 
  2. Under Project Targets, click New. 
  3. Give the new target a name, click OK. 
  4. Using the drop-down, select the Target that you wish to edit the Preprocessor Symbols (#defines) for.
  5. Click Options for Target. A dialog will open. 
  6. Click the C/C++ tab. 
  7. In the "Define:" textbox, type the comma separated list of define symbols you wish to add. Click OK. 

Repeat this process for any other unique Preprocessor Symbols configurations needed.

Once finished, you can now switch between targets (and their Preprocessor Symbols) using the dropdown.

More Information

Last Reviewed: Wednesday, January 9, 2019


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.