Keil Logo

Key Sequence for Tool Parameters

Use Key Sequences to pass arguments from µVision to external user programs. Key Sequences are combinations of a Key Code and a File Code. Key sequences can be used, for example, in the dialogs Tools, SVCS, Options for Target — User, or from the command line. The following rules apply:

  • Certain Key Codes have to be duplicated when used from the command line.
    To use the symbols $, #, %, @, ~, ^
    escape them with $$, ##, %%, @@, ~~, ^^.
  • Enclose Key Sequences within quotes (" ") when using folder names that might contain special characters (space, ~, or #).

Key Codes and File Codes are listed in the tables below:

Key Example Description
% PROJECT1.UVPROJX File name with extension
# C:\MYPROJECT\PROJECT1.UVPROJX Complete path and file name with extension
@ PROJECT1 File name without extension or path specification
$ C:\MYPROJECT\ Path name of a file extended with a backslash.
! .\SRC\TEST.C File name with extension and relative path specification to the current folder
~ 1 123 Line number of the current cursor position
^ 1 51 Column number of the current cursor position
File Code Description
$D Device name as selected from the Device Database.
E Editor file name currently in focus.
F Depending on the context, this File Code returns:
  • The file selected in the window Project.
  • The currently active editor file.
  • The file that is currently translated by a build process.
H Application HEX file name (PROJECT1.H86).
$J Absolute compiler system include folder. Compiler base folders are listed in the field Project — Manage — Project Items — Folder/Extensions - ARMCC Folder. The include path depends on the compiler selected in Options for Target - Code Generation - ARM Compiler.
K Absolute root folder of the development toolchain, regardless of the Key Code used.
L2 Linker output file. Typically the executable file used for debugging (PROJECT1).
$M CPU mask revision number.
P Current project file name.
$S Installation folder of the currently active device family pack. For example, "$S\xyz\test.bat" resolves to "<pack installation folder>\<pack_vendor>\<DFP_name>\<DFP_version>\xyz\test.bat".
X µVision executable program file (..\UV4\UV4.EXE). Works for Key Code %, #, and @.
$X XTAL clock frequency in MHz as specified in Options for Target — Target — XTAL.
^X XTAL clock frequency in kHz as specified in Options for Target — Target — XTAL.
Y Preprocessor symbol file co-arm_<target_name>.h for C file type defines. Works for Key Code #.
Z Preprocessor symbol file co-arm_<target_name>.hpp for C++ file type defines. Works for Key Code #.
File Codes when using an SVCS
Q 3 Name of the temporary file that contains comments (Comment).
R 3 Revision number (Revision).
C 3 Check point string (Check Point).
I 3 Project identification string (Project Ident).
U 3 User name (User Name).
V 3 Database file name string (Database).
File Codes when using a merge tool
  A merge tool gives you the opportunity to merge the application-specific configuration settings from the previous version into the current version. Specify a merge tool with Tools - Configure Merge Tool.
$current Is the file as copied from the PACK with default configuration options.
$previous Is the back-up file filename.increment number

Environment Variables

You can use environment variables for passing paths to external programs. This is described explicitly in the respective dialog documentation. Environment variables must be enclosed by curly brackets ({ }). For example, you have defined an environment variable with
SET ProgramFiles(x86)=C:\Program Files (x86).

You can use the environment variable as
{ProgramFiles(x86)} in dialog fields.


  • 1 only in combination with the File Code F.
  • 2 $L automatically prepends %L for compatibility reasons.
  • 3 only in combination with the Key Code %.
  • Examples can be found in the sections: Start External Tools and Using the SVCS Menu.
  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.