Keil Logo

GENERAL: Using Targets Effectively

Information in this article applies to

  • µVision v2 and later

Introduction

In µVision, use targets to create individualized build and debug configurations such as which files to include, optimization settings, and more. Simply switch between these configurations by selecting a target from a drop down menu.

  • Each target saves the settings found in:
    • Options for Target
    • Options for Group
    • Options for File
    • Options for Component Class (Pack contents)

This article shows how to use Project Targets and File Groups effectively.

Creating a New Target

  1. Open Manage Project Items - a dialog opens.
  2. Under Project Targets, click New.
  3. Give the new target a name.
  4. (Optional) click on Set as Current Target to switch to this target after closing this dialog. See Project Items for more details.
  5. Click OK - the dialog closes.
  6. To use this target, on the build toolbar click the drop-down and select a Target to use and edit it.
  7. Click Options for Target - the Options for Target dialog opens. See the Options section of the User Guide for more details of each tab.

Option for Target maintains the settings including:

  • Device
  • Memory mapping and linking
  • Flash downloading
  • Debug/debugger configuration and initialization
  • Preprocessor symbols
  • Output
  • Include paths

Note: A newly created Target will inherit the settings of the currently selected Target.

Tips for the Options for Target Dialog

  • Add Preprocessor Symbols on the MDK-ARM C/C++ Compiler tab. In the Define: textbox type the comma separated list of symbols. This is useful for things like #Define for controlling code inclusion or values.
  • Set a specific target to use off-chip memory.
    1. On the MDK-ARM Linker tab, uncheck the Use Memory Layout From Target Dialog - the scatterfile field ungrays out.
    2. Open and then edit the scatter file. Note - the Keil tools will no longer auto-generate a scatterfile.
    3. On the Debug tab, to add a flash algorithm for the memory, click Settings.
    4. Click the Flash Download tab, then click Add. Select an algorithm and click OK.
    5. Click OK to close the dialog.
  • Build all targets at once using the Batch Build button on the build toolbar. This defaults to all targets, for details on customizing what is built see Batch Setup for Single and Multi-Projects.
  • µVision: MULTIPLE PROGRAMS FROM 1 SOURCE FILE SET
  • µVision: CREATE LIBRARY AND APPLICATION IN ONE PROJECT
  • If you would like to be able to compare the executable you can set a unique name for each target's executable in the Output tab. This can also be done for the listing files and object files of the different targets by setting a unique folder in the Output and Listing tabs, respectively. See Redirect Output for Object and Listing Files.

Options for a File

By default, a file uses the Tool Options settings in the Target dialog. The µVision IDE allows setting other options for files. See File and Group Specific Options for details. In the Project Window, right-click on a file, and select Options for File …, - the Options dialog opens.

Use the Properties tab to Change:

On the next tab, use the C/C++ tab to:

  • Set optimization - to simplify debugging, compile a single source file at the lowest optimization. Or compile one file for speed, and the rest of the project for size.
  • Add preprocessor symbols - Undefine symbols for a file.
  • Disable warnings - for a particular file.
  • Change compiler settings for a particular file.

Create a Group

  • Click Manage Project Items. A dialog will open, under Groups, click New, and give the new group a name. See Create File Groups for more details.
  • To add files to this new group, highlight the group.
  • In the Files column, click Add Files....
  • Remove files by highlighting a file and clicking the red 'X' (delete) button.

Options for a File/Group

Options for a Component

  • Even though some files are include via the Manage RTE window, the µVision IDE allows changing component options. See Options for Component for Details.
  • One useful option is change the Pack variant. For example, you make a debug target that includes the source or debug variant, and a release target that includes the library or release variant.

Tips for the Options for Groups and Files

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.