Keil Logo

User

The dialog Options for Target - User allows you to specify programs that are executed during the build process. Programs can be run before compiling, before building, and after building the application.

The section Before Compile C/C++ File specifies programs that run before compiling any C/C++ source file (typically used for extensive syntax checkers, such as MISRA tools).

The section Before Build/Rebuild specifies programs that run before building or rebuilding an application.

The section After Build/Rebuild specifies programs that run after a successful build or rebuild (typically, file converters or debuggers). Refer to the checkbox Run 'After-Build' Conditionally described below for details.

Section Items

Each section has the following items:

Run #
Enable the checkbox to activate execution.
User Command
Specify the command. Enclose the string in double quotes when the path contains blanks. For example: "C:\Program Files (x86)\emulator\emulator.exe". You can use the "Open folder" icon to navigate to the executable. Relative paths can be entered with respect to the project folder. Arguments can be passed to an external program using Key Sequences and environment variables.
...

Opens a standard dialog to navigate to the executable needed in the field User Command.

Stop on Exit Code
Specifies an exit condition when compilation errors occur. Not Specified is the default setting. In this case, all files are compiled; all errors are captured and displayed. To halt execution upon a certain number of errors, select a condition from the drop-down list. For example, to exit upon the 5th error, select the entry >=5.
Spawn
Is a legacy option available only for Window 32-bit operating systems. Enable this checkbox for external programs that must run in a 16-bit DOS environment.

Control Checkboxes

Run 'After-Build' Conditionally
By default, the user commands entered and enabled in the section After Build/Rebuild are always executed. This is also true when the target is up to date and the build command exited without building a new object file. Enable this check-box to optimize the execution of After Build/Rebuild commands. The commands get executed if the build was executed or one or both user commands or settings have been changed.
Beep When Complete
Gives an acoustic signal after the build process completed.
Start Debugging
Starts the Debugger after the application was built successfully.

Examples:

  • Run #1: C:\Utilities\Programmer.exe -d271001 #H
    Runs the external program Programmer.exe with a program-specific parameter, -d271001. The key sequence, #H, identifies the HEX Output file (H) with the full path specification (#). For example, #H could be C:\MyProject\Project1.HEX.
  • Run #2: C:\Utilities\Emulator.exe "%L" -p"$P"
    Runs the external program Emulator.exe using key sequences for passing arguments. "%L" for using the linker output file without a path specification. "$P" for passing the project path. -p is the argument identifier of the external program. For example, the command could generate the following output:
    C:\Utilities\Emulator.exe "Project1.lnk" -p"C:\My Project\"

Clickable output

The standard output from the User Commands gets redirected to the Build Output window.

To directly navigate to a certain file location, you can create clickable User Command output. Format the output as follows when referring to a code location:

filepathname(linenumber): message

Where, filepathname specifies either an absolute file path or a file path relative to the current project folder (where the .uvprojx file is located) and linenumber specifies the line number in this file. An output message text may follow after the filepathname(line_number):.

For example, executing a batch file (here: test_message.bat) with the following content:

@ECHO OFF
ECHO main.c(8): test: jump to main.c, line 8

This will provide an output line highlighted below:

Double-clicking it, the main.c file opens with the cursor put on line 8.

Note the preceding line that indicates execution of the pre-built User Command.


Examples:

C:\Temp1\V6Sample\Src\file1.cpp(75)  // note: a trailing space after ')'
Statemachine.cpp(27): location := Statemachine.cpp(27)
./SubDir/Statemachine.h(11): message text
C:\Temp1\V6Sample\Src_Files\templates.cpp(15): xxxx
C:\temp\data\TestMod.c(5): error C141 : syntax error near 'x', expected ';'
  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.