Keil Logo

Command Line

µVision can be invoked from a command line to build a project, start the debugger, or download a program to Flash. The command applies to project and multiple-project files:

UV4 〚command〛 〚projectfile〛 〚options

Where

command is one of the commands listed below. If no command is specified, µVision opens the project file in interactive Build Mode.
projectfile is the name of a project file. µVision project files have the extension .uvproj, multiple-project files the extension .uvmpw. If no project file is specified, µVision opens the project file used last.
options are additional parameters that specify the project target name or output file.

The following commands are available:

Command Description
-b Builds the last current target of a project and exits after the build process finished. Refer to option -t to change the target. For multi-projects, the command builds the targets as defined in the dialog Project - Batch Build.

Examples:
UV4 -b PROJECT1.uvprojx
-c Clean all project targets of a project. For a multi-project, the command cleans all targets that have been selected in the dialog Project - Batch Build. Refer to the note on Project Menu and Commands for details about the cleaning process.

Examples:
UV4 -c PROJECT1.uvprojx
-cr Clean all project targets and re-translate the last current target of a project. Refer to option -t to change the target. For multi-projects, the command cleans all targets and re-translates the targets as selected in the dialog Project - Batch Build. Refer to the note on Project Menu and Commands for details about the cleaning process.

Examples:
UV4 -cr PROJECT1.uvprojx
-d Starts µVision in Debugging Mode. Use this command together with a debug initialization file to execute automated test procedures. Exit the debugging session with the EXIT command.

Examples:
UV4 -d PROJECT1.uvprojx
-f Downloads the program to Flash and exits after the download process finished.

Examples:
UV4 -f PROJECT1.uvprojx -t"MCB2100 Board"
-r Re-translates the last current project target and exits after the build process finished. Refer to option -t to change the target. For multi-projects, the command re-translates the targets as defined in the dialog Project - Batch Build.

Examples:
UV4 -r PROJECT1.uvprojx -t"Simulator"
-5 Converts a µVision 4 uvproj file into a µVision 5 uvprojx file. The only valid option with this command is -l for writing a log file.

Examples:
UV4 -5 myoldproject.uvproj -l log.txt
If the conversion fails, error code 20 will be returned.
-et Exports a project target to <projectName>.<targetName>.cprj file. Use the option -t targetname to specify the target to be exported, otherwise the current target is used. Note that -et command with option -t, does not change the current target configuration in the project. No other options are supported with this command.

Examples:
UV4 -et myProject.uvprojx
Export current target in myProject.uvprojx to myProject.<targetName>.cprj file.
0
UV4 -et myProject.uvprojx -t "my-target"
Export target "my-target" in myProject.uvprojx to myProject.my-target.cprj file.
-ep Exports all project targets to respective <projectName>.<targetName>.cprj files.

Examples:
UV4 -ep myProject.uvprojx
-X Generates preprocessor symbol file co-arm_<target_name>.h/hpp in the current target's output folder.

Examples:
UV4 -X myProject.uvprojx
UV4 -X myProject.uvprojx -T "Target 1"

Note that the generation process can take a while. If you want to see the progress, use uvision.com instead of uv4.exe.
-X1 Generates preprocessor symbol files co-arm_<target_name>.h/hpp for all targets in their respective output folder.

Examples:
UV4 -X1 myProject.uvprojx

Note that the generation process can take a while. If you want to see the progress, use uvision.com instead of uv4.exe.

The following options can be used:

Option Description
-j0 Hides the µVision GUI. Messages are suppressed. Use this option for batch testing.
-i import_file.xml Creates a new project or updates an existing project using the data provided by an XML file, which has to be compliant to the schema project_import.xsd available in the directory ..\UV4. The target name may be specified with the option -t. If a project is created from the command line without -t, the device name is used as the name of the target. The GUI is suppressed automatically when using this option.

Examples:
UV4 MyProject.uvprojx –i MyImport.xml
-l logfile Saves the output of the command in the specified logfile.

Examples:
UV4 -5 myoldproject.uvproj -l log.txt
If the conversion fails, error code 20 will be returned.
-n device_name Creates a new project with the specified device_name. The target name can be specified with the option -t. By default, the target name is set to the device name. The GUI is suppressed automatically when using this option.

Examples:
UV4 MyProject.uvprojx –n Device1234
UV4 MyProject.uvprojx –i MyImport.xml –n Device5678 -t FlashDebug
-np device_name Creates a new project with the specified device_name if the project does not exist. If the project already exists, the device selection gets updated to the specified device_name in all targets of the project. The GUI is suppressed automatically when using this option.

Example:
UV4 MyProject.uvprojx –np Device1234
-o outputfile Specifies the output log file.

Examples:
UV4 -r PROJECT1.uvprojx -o"listmake.prn"
UV4 -r "C:\MyProjects\ARM\Example-mpw.uvmpw" -o "c:\temp\log.txt"
-q Re-builds the selected targets of a multiple-project. Ensure that each target has another object output folder. Use the menu Projects - Options for Target - Output - Select Folder for Objects.

Examples:
UV4 -r "C:\MyProjects\ARM\Example-mpw.uvmpwx" -q -o "c:\temp\log.txt"
-s port Enables UV Socket port and assigns the value of port to it. See section UVSOCK (TCP/IP) Settings in the description of the Other dialog

Examples:
UV4 MyProject.uvprojx -s 4328
-t targetname Sets targetname as the current target. If not specified, then the last known target is used.

Examples:
UV4 -r PROJECT1.uvprojx -t"MCB2100 Board"
-x Enables DDE mode and returns complete command output. This option can be used only with the command -d.
-y Enables DDE mode and returns only command confirmations. This option can be used only with the command -d.
-z Re-builds all targets of a project or multiple-project. Ensure that each target has another object output folder. Use the menu Projects - Options for Target - Output - Select Folder for Objects.

Examples:
UV4 -b PROJECT1.uvproj -z -o "c:\temp\log.txt"
UV4 -b "C:\MyProjects\ARM\Example-mpw.uvmpwx" -q -z -o "c:\temp\log.txt"
-sg Disables use of the user GUI layout from uvguix files.
Default window layout for edit and debug mode is used during the complete session and layout modifications are note stored in a uvguix.<user> when closing a project.
Useful when running µVision in batch mode to avoid undesired modification of the uvguix file.

Examples:
UV4 -sg myProject.uvproj

µVision sets the ERRORLEVEL after each build process to indicate the status. Refer to the Windows-help for information about ERRORLEVEL. The values are listed below:

ERRORLEVEL Description
0 No Errors or Warnings
1 Warnings Only
2 Errors
3 Fatal Errors
11 Cannot open project file for writing
12 Device with given name in not found in database
13 Error writing project file
15 Error reading import XML file
20 Error converting project

Examples:

  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.