Arm Keil Studio Visual Studio Code Extensions User Guide 108029 0000 02 en
Arm Keil Studio Visual Studio Code Extensions User Guide 108029 0000 02 en
User Guide
Non-Confidential Issue 02
Copyright © 2023 Arm Limited (or its affiliates). 108029_0000_02_en
All rights reserved.
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Release information
Document history
Proprietary Notice
This document is protected by copyright and other related rights and the practice or
implementation of the information contained in this document may be protected by one or more
patents or pending patent applications. No part of this document may be reproduced in any form
by any means without the express prior written permission of Arm. No license, express or implied,
by estoppel or otherwise to any intellectual property rights is granted by this document unless
specifically stated.
Your access to the information in this document is conditional upon your acceptance that you
will not use or permit others to use the information for the purposes of determining whether
implementations infringe any third party patents.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR
ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL,
INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND
REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS
DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 2 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
This document consists solely of commercial items. You shall be responsible for ensuring that
any use, duplication or disclosure of this document complies fully with any relevant export laws
and regulations to assure that this document or any portion thereof is not exported, directly
or indirectly, in violation of such export laws. Use of the word “partner” in reference to Arm’s
customers is not intended to create or refer to any partnership relationship with any other
company. Arm may make changes to this document at any time and without notice.
This document may be translated into other languages for convenience, and you agree that if there
is any conflict between the English version of this document and any translation, the terms of the
English version of the Agreement shall prevail.
The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks
of Arm Limited (or its affiliates) in the US and/or elsewhere. All rights reserved. Other brands and
names mentioned in this document may be the trademarks of their respective owners. Please
follow Arm’s trademark usage guidelines at https://www.arm.com/company/policies/trademarks.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
(LES-PRE-20349|version 21.0)
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be
subject to license restrictions in accordance with the terms of the agreement entered into by Arm
and the party that Arm delivered this document to.
Product Status
Feedback
Arm welcomes feedback on this product and its documentation. To provide feedback on the
product, create a ticket on https://support.developer.arm.com
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 3 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
We believe that this document contains no offensive language. To report offensive language in this
document, email [email protected].
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 4 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Contents
Contents
1. Introduction...................................................................................................................................................... 7
1.1 Conventions......................................................................................................................................................7
1.2 Other information........................................................................................................................................... 8
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 5 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Contents
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 6 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Introduction
1. Introduction
1.1 Conventions
The following subsections describe conventions used in Arm documents.
Glossary
The Arm Glossary is a list of terms used in Arm documentation, together with definitions for
those terms. The Arm Glossary does not contain terms that are industry standard unless the Arm
meaning differs from the generally accepted meaning.
Typographic conventions
Arm documentation uses typographical conventions to convey specific meaning.
Convention Use
italic Citations.
bold Interface elements, such as menu names.
For example:
SMALL CAPITALS Terms that have specific technical meanings as defined in the Arm® Glossary. For example,
IMPLEMENTATION DEFINED, IMPLEMENTATION SPECIFIC, UNKNOWN, and UNPREDICTABLE.
Recommendations. Not following these recommendations might lead to system failure or damage.
Requirements for the system. Not following these requirements might result in system failure or damage.
Requirements for the system. Not following these requirements will result in system failure or damage.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 7 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Introduction
Convention Use
A useful tip that might make it easier, better or faster to perform a task.
A reminder of something important that relates to the information you are reading.
• Arm® Developer.
• Arm® Documentation.
• Technical Support.
• Arm® Glossary.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 8 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
The extension packs are installed and used with Visual Studio Code or Visual Studio Code for the
Web. An extension pack is a set of related extensions that are installed together.
There is one extension pack for Visual Studio Code desktop (Keil Studio Pack), and one extension
pack for Visual Studio Code for the Web (Keil Studio Pack For Web).
The Arm CMSIS csolution and Arm Environment Manager extensions are only
available with Visual Studio Code desktop.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 9 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
• Arm Virtual Hardware (Identifier: arm.virtual-hardware): This extension allows you to manage
Arm Virtual Hardware and run embedded applications on them. An authentication token is
required to access the service.
The Arm Remote Build and Arm Virtual Hardware extensions are experimental, and
are not described in this guide.
The extensions contained in the packs can be also installed and used individually. We however
recommend installing the Keil Studio Pack in Visual Studio Code desktop to quickly set up your
environment and start working with an example. See the desktop pack Readme for more details.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 10 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
• Embedded and IoT software development using CMSIS-Packs and csolution projects: The
“Common Microcontroller Software Interface Standard” (CMSIS) provides driver, peripheral
and middleware support for thousands of MCUs and hundreds of development boards. Using
the csolution project format, you can incorporate any CMSIS-Pack based device, board, and
software component into your application. For more information about supported hardware for
CMSIS projects, go to the Boards and Devices pages on keil.arm.com. For information about
CMSIS-Packs, go to open-cmsis-pack.org.
• Enhancement of a pre-existing Visual Studio Code embedded software development
workflow: USB device management and embedded debug can be adapted to other project
formats (for example CMake) and toolchains without additional overhead. This use case
requires familiarity with Visual Studio Code to configure tasks. See the individual extensions for
more details.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 11 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
We recommend installing the Keil Studio Pack in Visual Studio Code desktop as explained in the
Readme. The pack installs all the Keil Studio extensions, including the Arm Environment Manager,
as well as the Red Hat YAML, Microsoft C/C++, and Microsoft C/C++ Themes extensions.
Then:
• Do the setup using the Blinky_FRDM-K32L3A6 csolution project available from keil.arm.com
(recommended).
• Download a Keil μVision *.uvprojx project from the website and convert it to a csolution
(alternative).
The examples available on keil.arm.com are shipped with a Microsoft vcpkg manifest file (vcpkg-
configuration.json). The Arm Environment Manager extension uses the manifest file to acquire
and activate the tools you need to work with csolution projects.
Each example also comes with a tasks.json and launch.json to build, run, and debug the project.
Finalize the set up of your development environment. If you do not want to use Microsoft C/C++
and Microsoft C/C++ Themes, you can install and set up the clangd extension instead to add smart
features to your editor.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 12 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1. Go to keil.arm.com.
2. Click the Hardware menu and select Boards.
3. Search for the FRDM-K32L3A6 board and click the Results box.
4. Find the Blinky project that is available in the Projects tab.
The Keil Studio compatibility label indicates that the example is compatible with Keil Studio
Cloud and the Keil Studio Visual Studio Code extensions.
5. Hover over the Get Project button, then click Open in Keil Studio for VS Code to import the
csolution example.
6. Click the Open Visual Studio Code button in the “Open Visual Studio Code?” pop-up that
opens at the top of your browser window.
7. Click the Open button in the “Allow an extension to open this URI” pop-up that opens in Visual
Studio Code.
8. Choose a folder to import the project and click the Select as Unzip Destination button.
9. Click the Open button in the “Would you like to open the unzipped folder?” pop-up.
If there are missing CMSIS-Packs, a pop-up displays in the bottom right-hand corner with the
following message “Solution Blinky requires some packs that are not installed”.
10. Click Install.
You must activate a license to be able to use tools such as Arm Compiler, Arm Debugger, or
Fixed Virtual Platforms in your toolchain. If you have not activated your license after installing
the desktop pack, a pop-up displays in the bottom right-hand corner with the message
“Activate license for Arm tools?”. See Activate your license to use Arm tools for more details on
licensing.
11.
Click the Explorer icon .
A vcpkg-configuration.json is available. You do not need to do anything to install the tools.
Microsoft vcpkg and the Arm Environment Manager extension take care of the setup. See
Tools installation with Microsoft vcpkg.
A tasks.json and launch.json files are also available in the .vscode folder. Visual Studio Code
uses the tasks.json file to build and run the project, and the launch.json for debug.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 13 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1. Go to keil.arm.com.
2. Connect your board over USB and click Detect hardware using WebUSB in the bottom right-
hand corner.
3. Select the device firmware for your board in the dialog box that displays at the top of the
window, then click Connect.
4. Click the Board link in the pop-up that displays in the bottom right-hand corner.
This takes you to the page for the board. Example projects are available in the Projects tab.
5. Look for an example with a μVision compatibility label.
6. Hover over the Get Project button for the project you want to use and click Download zip to
download the Keil μVision *.uvprojx example.
7. Unzip the example and open the folder in Visual Studio Code.
8. A pop-up displays in the bottom right-hand corner with the following message “Convert
μVision project [project-name].uvprojx to csolution?”.
9. Click Convert.
The conversion starts immediately.
Alternatively, you can right-click the *.uvprojx and select Convert μVision project to csolution
from the Explorer.
You can also run the CMSIS: Convert μVision project to csolution command from the
Command Palette. In that case, select the *.uvprojx that you want to convert on your machine
and click Select.
10. Check the OUTPUT tab (View > Output). Conversion messages are logged under the μVision
to Csolution Conversion category.
If there are missing CMSIS-Packs, a pop-up displays in the bottom right-hand corner with the
following message “Solution [solution-name] requires some packs that are not installed”.
11. Click Install.
You must activate a license to be able to use tools such as Arm Compiler, Arm Debugger, or
Fixed Virtual Platforms in your toolchain. If you have not activated your license after installing
the desktop pack, a pop-up displays in the bottom right-hand corner with the message
“Activate license for Arm tools?”. See Activate your license to use Arm tools for more details on
licensing.
12.
Click the Explorer icon .
The *.cproject.yml and *.csolution.yml files are available next to the *.uvprojx.
A vcpkg-configuration.json is available.
A tasks.json and launch.json files are also available in the .vscode folder. Visual Studio Code
uses the tasks.json file to build and run the project, and the launch.json for debug.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 14 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Each official Arm example project is shipped with a manifest file (vcpkg-configuration.json). The
manifest file records the vcpkg artifacts that you need to work with your projects. An artifact is a
set of packages required for a working development environment. Examples of relevant packages
include compilers, linkers, debuggers, build systems, and platform SDKs.
For more information on vcpkg, see the official Microsoft vcpkg documentation. See also the
Microsoft vcpkg-tool repository for more details on artifacts.
"requires": {
"arm:tools/open-cmsis-pack/cmsis-toolbox": "2.0.0-0",
"arm:compilers/arm/armclang": "^6.20.0",
"microsoft:tools/kitware/cmake": "^3.25.2",
"microsoft:tools/ninja-build/ninja": "^1.10.2"
}
The artifacts installed with this example manifest file are cmsis-toolbox, armclang (Arm Compiler for
Embedded), cmake and ninja.
Go to the OUTPUT tab (View > Output) and select the vcpkg category in the drop-down list to
see what has been installed. By default, Microsoft vcpkg installs the tools in the Visual Studio Code
application directory.
After Microsoft vcpkg has been activated for a project, any terminal that you open in Visual Studio
Code has all the tools added to the path by default (Arm Compiler for Embedded, CMSIS-Toolbox,
CMake and Ninja). This allows you to run the different CMSIS-Toolbox tools such as: cpackget,
cbuildgen, cbuild, or csolution.
• Configure an HTTP proxy. This step is only required if you are working behind an HTTP proxy.
• The desktop pack installs all the Keil Studio extensions as well as the Arm Environment
Manager, Red Hat YAML, Microsoft C/C++ and Microsoft C/C++ Themes extensions. If you
do not want to use the Microsoft C/C++ and Themes extensions, you can disable them in
Visual Studio Code and install and set up the clangd extension as an alternative.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 15 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
The clangd extension requires the clangd language server. If the server is not found
on your path, add it with the clangd: Download language server command from the
Command Palette. Read the clangd extension Readme for more information.
There is no extra setup needed once clangd has been installed. The Arm CMSIS csolution
extension generates a compile_commands.json file for each project in a solution whenever a
csolution file changes or when you change the context of a solution (Target and Build types). A
.clangd file is kept up to date for each project in the solution. The .clangd file is used by the
clangd extension to locate the compile_commands.json files and enable IntelliSense. See the clangd
documentation for more details.
You can turn off the automatic generation of the .clangd file and compile_commands.json file.
1. Open the settings:
• On Windows or Linux, go to: File > Preferences > Settings.
• On macOS, go to: Code > Settings > Settings.
2. Find the Cmsis-csolution: Auto Generate Clangd File and Cmsis-csolution: Auto Generate
Compile Commands settings and clear their checkboxes.
Procedure
1. Build the project:
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 16 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
A Rebuild option is also available in the right-click menu. This option cleans output
directories before building the project.
• Using the Build button:
a.
Click the CMSIS icon in the Activity Bar.
b.
Click the Build button in the ACTIONS panel.
A Clean Build option is also available when you click the arrow next to Build. Clean
Build is the same as Rebuild in the right-click menu.
As a tasks.json is provided for all the examples available on keil.arm.com. You do not
need to configure a build task for these examples. This is only required if you are using
your own project. See Configure a build task for more details.
• From the Command Palette: Build and Rebuild can also be triggered from the Command
Palette with the CMSIS: Build and CMSIS: Rebuild commands.
2. Check the TERMINAL tab to find where the elf file (.axf) was generated.
The Blinky_FRDM-K32L3A6 example has just one project and one target type FRDM-K32L3A6. You
can choose between Debug or Release for the build type.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 17 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1.
Click the Device Manager icon in the Activity Bar to open the Arm Device Manager
extension.
2. Connect your board to your computer over USB. In our example we use the FRDM-K32L3A6
board from NXP.
Procedure
1.
Click the CMSIS icon in the Activity Bar.
2.
Click the Run button in the ACTIONS panel.
As a tasks.json is provided for all the examples available on keil.arm.com. You do not need to
configure a task for these examples. This is only required if you are using your own project. See
Run your project on your hardware for more details.
3. As we are using a FRDM-K32L3A6 board, a device with multiple cores, you must select the
appropriate processor for your project in the Select a processor drop-down list that displays at
the top of the window. Select cm4.
The project is run on the board.
4. Check the TERMINAL tab.
Procedure
1.
Click the CMSIS icon in the Activity Bar.
2.
Click the Debug button in the ACTIONS panel.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 18 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
As a launch.json is provided for all the examples available on keil.arm.com. You do not need to
configure a task for these examples. This is only required if you are using your own project. See
Debug your project for more details.
3. Select the appropriate processor for your project in the Select a processor drop-down list that
displays at the top of the window. Select cm4.
The RUN AND DEBUG view displays and the debug session starts. The debugger stops at the
function “main” of your project.
4. Check the DEBUG CONSOLE tab to see the debugging output.
Next steps
Look at the Visual Studio Code documentation to learn more about the debugging features
available in Visual Studio Code.
Procedure
1.
Click the CMSIS icon in the Activity Bar.
2.
Click the Open Serial button in the ACTIONS panel.
3. Select a baud rate of 115200 for your FRDM-K32L3A6 board in the drop-down list that opens
at the top of the window. The baud rate you select must be the same as the baud rate of the
project.
The serial output displays in the TERMINAL tab.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 19 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1.
Click the CMSIS icon in the Activity Bar to open the CMSIS view.
2. Look at the available contexts for the csolution in the CONTEXT panel. You can change the
target type (build target) and build configuration.
• Active Solution: The name of the active csolution, Blinky (Blinky.csolution.yml).
• Target Type: The build target FRDM-K32L3A6. Note that for this example you can only select
FRDM-K32L3A6. Some examples are compatible with Arm Virtual Hardware (AVH) targets as
well, so you can have more options in the drop-down list in that case. For more details on
AVH, read the product overview.
• Build Type: The build configuration Debug or Release. A build configuration adds the
flexibility to configure each target type towards a specific testing. Use Debug for a full debug
build of the software for interactive debug, or Release for the final code deployment to the
systems. Note that you can create your own build types as required by your application.
• Project: The name of the cproject, FRDM-K32L3A6 (FRDM-K32L3A6.cproject.yml). If you have
multiple projects in your solution, you can select the active one here.
3.
Click the Explorer icon and open the Blinky.csolution.yml and FRDM-
K32L3A6.cproject.yml files. YAML syntax support helps you with editing.
4. Go the PROBLEMS tab and check for errors.
5. Open the main.c file and check the IntelliSense features available. Read the Visual Studio Code
documentation on IntelliSense to find out about the different features.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 20 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Next steps
A *.cprj file is generated automatically for the context selected in the CONTEXT panel each time
you update the *.csolution.yml file.
You can turn off the automatic generation of cprj files. Note that this step is optional.
1. Open the settings:
• On Windows or Linux, go to: File > Preferences > Settings.
• On macOS, go to: Code > Settings > Settings.
2. Find the Cmsis-csolution: Auto Generate Cprj setting and clear its checkbox.
Click the CMSIS icon in the Activity Bar to open the CMSIS view. The SOLUTION outline
displays under the CONTEXT panel.
◦ Optimize: Generic optimize levels for code generation. The values are size, speed,
balanced, none.
• Packs: Packs included in the solution sorted by vendors and pack names.
• Projects: cprojects included in the solution. Details that can be included for a given cproject
are:
◦ Groups: Groups are a way to structure code files into logical blocks.
◦ Components:
All the software components selected for the cproject. Components are sorted
by component class (Cclass).
◦ Layers: The software layers defined for the cproject. A layer is a set of source files and pre-
configured software components that can be shared across multiple projects. Layers are
defined in *.clayer.yml files. The software components used by each layer in the cproject
appear in the tree view.
When you hover over the SOLUTION label, you can choose the following actions:
•
Collapse All: Click the Collapse All icon to close all the entries in the outline.
•
Open csolution file: Click the Open csolution file icon to open the corresponding
csolution.yml file.
When you hover over a project under the Projects entry, you can click the Open file icon to open
the corresponding cproject.yml file.
The *.csolution.yml, *.cproject.yml, and *.clayer.yml file formats are described in the Open-
CMSIS-Pack documentation.
From this view you can see all the component details called attributes in the Open-CMSIS-Pack
documentation.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 22 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1.
Click the CMSIS icon in the Activity Bar to open the Arm CMSIS csolution extension.
2.
Hover over the CONTEXT label and click the Manage software components icon .
Results
The Software Components view opens.
The default view displays the components included in the active project only (Selected toggle
button). If you click the All toggle button, all the components available for use display.
You can use the Search field to search the list of components.
With the Target drop-down list, you can select components for the different target types you have
in your solution or for all the target types at once.
Figure 5-1: The ‘Software Components’ view showing all the components that are available for
use
The CMSIS-Pack specification states that each software component should have the following
attributes:
• Component class (Cclass): A top-level component name. For example: CMSIS.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 23 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
• Component group (Cgroup): A component group name. For example: CORE for the CMSIS
component class.
• Component version (Cversion): The version number of the software component.
Layer icons indicate which components are used in layers. In the current version, layers are
read-only so you cannot select or clear them from the Software Components view. Click the layer
icon of a component to open the *.clayer.yml file or files associated.
Documentation links are available for some components at the class, group, or sub-group level.
Click the book icon of a component to open the related documentation.
Procedure
1. Click the All toggle button to display all the components available.
2. Select a specific target type in the Target drop-down list or, if you want to modify all the target
types at once, select All Targets. For the Blinky_FRDM-K32L3A6 example, there is just one
target.
3. Use the checkboxes to select or clear components as required. For some components, you can
also select a vendor, variant, or version.
The cproject.yml file is automatically updated.
4. Manage the dependencies between components and solve validation issues from the
Validation panel.
Issues are highlighted in red and have an exclamation mark icon next to them. You can
remove conflicting components from your selection or add missing component dependencies
from a suggested list.
5. If there are validation issues, hover over the issues in the Validation panel to get more details.
You can click the proposed fixes to find the components in the list. In some cases, you may
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 24 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
have to choose between different fix sets. Select a fix set in the drop-down list, make the
required component choices, and then click Apply.
If a pack is missing in the solution, a message “Component’s pack is not included in your
solution” displays in the Validation panel. An error also displays in the PROBLEMS view. See
Install missing CMSIS-Packs to know how to install CMSIS-Packs.
5.4 CMSIS-Packs
CMSIS-Packs offer you a quick and easy way to create, build and debug embedded software
applications for Cortex-M devices.
CMSIS-Packs are a delivery mechanism for software components, device parameters, and board
support. A CMSIS-Pack is a file collection that might include:
• Source code, header files, software libraries - for example RTOS, DSP and generic middleware.
• Device parameters, such as the memory layout or debug settings, along with startup code and
Flash programming algorithms.
• Board support, such as drivers, board parameters, and descriptions for debug connections.
• Documentation and source code templates.
• Example projects that show you how to assemble components into complete working systems.
CMSIS-Packs are developed by various silicon and software vendors, covering thousands of
different boards and devices. You can also use them to enable life-cycle management of in-house
software components.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 25 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1.
Open the *.csolution.yml file for your csolution project from the Explorer view .
The required packs are listed under the packs key of the csolution.yml file. If one or several
CMSIS-Packs are missing, errors display in the PROBLEMS view and a pop-up displays in the
bottom right-hand corner with the following message “Solution [solution-name] requires some
packs that are not installed”.
2. Click Install.
Alternatively, right-click the error in the PROBLEMS view and select the Install missing pack
option. If there are several packs missing, use Install all missing packs.
You can also install missing packs with the CMSIS: Install required packs for active solution
command from the Command Palette.
With the Arm CMSIS csolution extension, you can configure a build task using the tasks.json
file to build your projects. When you run the build task, the extension executes cbuild with the
options you defined.
If you are working with an example for which no build task has been configured yet, follow the
steps below:
1. Go to Terminal > Configure Tasks….
2. In the drop-down list that opens at the top of the window, select the CMSIS Build task.
{
"tasks": [
{
"label": "CMSIS Build",
"type": "cmsis-csolution.build",
"solution": "${command:cmsis-csolution.getSolutionPath}",
"project": "${command:cmsis-csolution.getProjectPath}",
"buildType": "${command:cmsis-csolution.getBuildType}",
"targetType": "${command:cmsis-csolution.getTargetType}",
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 26 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
With IntelliSense, you can see the full set of task properties and values available in the
tasks.json file. You can bring up suggestions using Trigger Suggest from the Command
Palette. You can also display the task properties specific to cbuild by typing cbuild --help in
the terminal.
4. Save the tasks.json file.
Alternatively, you can define a default build task using Terminal > Configure Default Build Task….
The Terminal > Run Build Task… option triggers the execution of default build tasks.
Procedure
1. Open the project that contains the *.uvprojx you want to convert in Visual Studio Code.
2. A pop-up displays in the bottom right-hand corner with the following message “Convert
μVision project [project-name].uvprojx to csolution?”.
3. Click Convert.
The conversion starts immediately.
Alternatively, you can right-click the *.uvprojx and select Convert μVision project to csolution
from the Explorer.
You can also run the CMSIS: Convert μVision project to csolution command from the
Command Palette. In that case, select the *.uvprojx that you want to convert on your machine
and click Select.
4. Check the OUTPUT tab (View > Output). Conversion messages are logged under the μVision
to Csolution Conversion category.
The *.cproject.yml and *.csolution.yml files are available in the folder where the *.uvprojx
is stored.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 27 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 28 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
See “Firmware naming rules” in Overview of ST-LINK derivatives for more details on naming
conventions.
Procedure
1.
Click the Device Manager icon in the Activity Bar to open the extension.
2. Connect your hardware to your computer over USB.
The hardware is detected and a pop-up displays in the bottom right-hand corner.
3. Click OK to use the hardware.
Alternatively, you can click the Add Device button and select
your hardware in the drop-down list that displays at the top of the window.
Next steps
If you need to add more hardware, click the Add Device icon in the top right-hand corner.
Procedure
1.
Hover over the hardware you want to edit and click the Edit Device icon .
2. Edit the hardware name in the field that displays at the top of the window if needed and press
Enter. This is the name that displays in the Device Manager.
3. Select a Device Family Pack (DFP) CMSIS-Pack for your hardware in the drop-down list.
4. Select a device name to use from the CMSIS-Pack in the field and press Enter.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 29 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1. Hover over the hardware for which you want to open a serial monitor and click the Open Serial
icon .
A drop-down list displays at the top of the window where you can select a baud rate (the data
rate in bits per second between your computer and your hardware). To view the output of your
hardware correctly, you must select an appropriate baud rate. The baud rate you select must be
the same as the baud rate of your active project.
2. Select a baud rate.
A Terminal tab opens with the baud rate selected.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 30 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Procedure
1. In Visual Studio Code, go to Terminal > Configure Tasks….
2. In the drop-down list that opens at the top of the window, select embedded-debug.flash:Flash
Device or embedded-debug.daplink-flash:Flash Device (DAPLink).
{
"label": "Flash Device",
"type": "embedded-debug.flash",
"program": "${command:embedded-debug.getApplicationFile}",
"serialNumber": "${command:device-manager.getSerialNumber}",
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 31 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
"cmsisPack": "${command:device-manager.getDevicePack}",
"problemMatcher": [],
"dependsOn": "CMSIS Build"
}
{
"type": "embedded-debug.daplink-flash",
"serialNumber": "${command:device-manager.getSerialNumber}",
"program": "${command:embedded-debug.getBinaryFile}",
"problemMatcher": [],
"label": "embedded-debug.daplink-flash: Flash Device (DAPLink)"
}
If you are using a Flash Device task, then in order to flash a hardware, the task configuration must
know which CMSIS-Pack to read information from and the device name in the CMSIS-Pack to use.
These are named as cmsisPack and deviceName and you can specify them in multiple ways.
If your target hardware is automatically detected, or if the pack and device name have been set for
it, the task configuration can automatically pick this up by using:
{
[...]
"serialNumber": "${command:device-manager.getSerialNumber}",
"cmsisPack": "${command:device-manager.getDevicePack}",
"deviceName": "${command:device-manager.getDeviceName}",
[...]
}
Alternatively, these can be specified directly as a full path to the CMSIS-Pack file or a folder on
your machine:
{
[...]
"serialNumber": "${command:device-manager.getSerialNumber}",
"cmsisPack": "/Users/me/mypack.pack",
"deviceName": "STM32H745XIHx",
[...]
}
You can also use the short code for the CMSIS-Pack in the form <vendor>::<pack>@<version>.
Note that this triggers an automatic download of the CMSIS-Pack:
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 32 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
[...]
"serialNumber": "${command:device-manager.getSerialNumber}",
"cmsisPack": "Keil::[email protected]",
"deviceName": "STM32H745XIHx",
[...]
}
7.1.2.1 Flash configuration options for CMSIS-DAP and ST-Link hardware (Flash
Device)
The extension provides the task options below. Other Visual Studio Code options are also available.
Use the Trigger Suggestions command (Ctrl+Space) to see what is available and read the Visual
Studio Code documentation on tasks, as well as the Schema for tasks.json page.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 33 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
7.1.2.2 Flash configuration options for DAPLink hardware (Flash Device DAPLink)
The extension provides the task options below. Other Visual Studio Code options are also available.
Use the Trigger Suggestions command (Ctrl+Space) to see what is available and read the Visual
Studio Code documentation on tasks, as well as the Schema for tasks.json page.
Configuration Description
option
"program" Path(s) (file or url) to the project(s) to use. Command available: embedded-debug.getBinaryFile - Returns a Bin or Hex
file.
"serialNumber" Serial number of the connected USB hardware to use. Command available: device-manager.getSerialNumber - Gets
the serial number of the selected device.
Procedure
1. Check that your hardware is connected to your computer.
2. Select Terminal > Run Task… to run the project on your hardware.
3. In the drop-down list that opens at the top of the window, select the embedded-
debug.flash:Flash Device task or the embedded-debug.daplink-flash:Flash Device (DAPLink)
task.
If you have installed the desktop pack, you can alternatively go to the CMSIS view and click the
Run button in the ACTIONS panel.
4. If you are using a device with multiple cores, you must select the appropriate processor for your
project in the Select a processor drop-down list that displays at the top of the window.
5. Check the Terminal tab to verify that the project has run correctly.
Procedure
1. In Visual Studio Code, go to Run > Add Configuration….
A launch.json file opens.
2. Select Arm: Embedded Debug in the IntelliSense suggestions widget that opens.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 34 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
{
"configurations": [
{
"name": "Embedded Debug",
"type": "embedded-debug",
"request": "launch",
"serialNumber": "${command:device-manager.getSerialNumber}",
"program": "${command:embedded-debug.getApplicationFile}",
"cmsisPack": "${command:device-manager.getDevicePack}",
"debugFrom": "main"
}
]
}
See also the details provided for the tasks.json file for cmsisPack and deviceName. In order to debug
a hardware, the launch configuration must know which CMSIS-Pack to read information from and
the device name in the CMSIS-Pack to use.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 35 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
7.2.3 Debug
Start a debug session.
Procedure
1. Check that your device is connected to your computer.
2. Select Run > Start Debugging.
If you have installed the desktop pack, you can alternatively go to the CMSIS view and click the
Debug button in the ACTIONS panel.
A Run & Debug option is also available when you click the arrow next to Debug. This allows
you to do both actions consecutively.
3. If you are using a device with multiple cores, you must select the appropriate processor for your
project in the Select a processor drop-down list that displays at the top of the window.
The Run and Debug view displays and the debug session starts. The debugger stops at the
function “main” of your project.
4. Check the Debug Console tab to see the debugging output.
Next steps
Look at the Visual Studio Code documentation to learn more about the debugging features
available in Visual Studio Code.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 36 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
After you have installed the pack available for Visual Studio Code Desktop, Keil Studio Pack, a pop-
up displays in the bottom right-hand corner.
Click Activate.
By default, this activates the Keil MDK Community Edition license. After activation, the Community
license takes precedence over any existing licenses, including MDK and Flex licenses.
If you already have a commercial license, click Do not ask again in the pop-up to ignore the Keil
MDK Community Edition license activation.
The settings related to licensing are available under the Keil Studio Pack category:
• Mdk License Product Code: By default, the Keil MDK Community Edition license product code
displays. You can replace it by the Keil MDK professional product code for example.
• Mdk License Server Url: The default is https://mdk-preview.keil.arm.com for the Keil MDK
Community Edition. You can indicate the URL of another server if you want to use a different
license.
• Silence Licensing Notifications: Select this checkbox to turn the “Activate license for Arm
tools?” notifications off. This can be useful if you have already activated your licenses before
starting using the Keil Studio extensions.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 37 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
9.2 Troubleshooting
Provides solutions to some common issues you might experience when you use the extensions.
Solution
1. If you have installed the CMSIS csolution extension separately, not using the Keil Studio Pack,
ensure you follow the instructions for installing and setting up CMSIS-Toolbox. In particular,
ensure the CMSIS_COMPILER_ROOT environment variable is set correctly. Alternatively, you can
install the Keil Studio Pack to benefit from an automated setup with Microsoft vcpkg.
2. Clean the solution. In particular, delete the out and tmp directories.
3. Run the build again.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 38 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Solution
• Run Device Manager (Windows), System Information (Mac), or a Linux system utility tool like
hardinfo (Linux) and check for warnings beside your hardware. Warnings can indicate that
hardware drivers are not installed. If necessary, obtain and install the appropriate drivers for
your hardware.
• On Windows: ST development boards and probes require extra drivers. You can download
them from the ST site.
• On Windows: Check if you have an Mbed serial port driver installed on your machine. The
Mbed serial port driver is required with Windows 7 only. Serial ports work out of the box
with Windows 8.1 or newer. The Mbed serial port driver breaks native Windows functionality
for updating drivers as it claims all the boards with a DAPLink firmware by default. It is
recommended to uninstall the driver if you do not need it. Alternatively, you can disable it.
pnputil /enum-drivers
Then, connect your hardware using a USB cable and open the Windows Device Manager.
In Ports (COM & LPT) and Universal Serial Bus controllers, find the mbed entries and
uninstall both by right-clicking them. Finally, disconnect and reconnect your hardware.
◦ Disable the Mbed serial port driver: Open the Windows Device Manager. In Ports (COM &
LPT), find the Mbed Serial Port. Right-click it and select Properties. Select the Driver tab
and click the Update Driver button. Then click Browse my computer for drivers and then
Let me pick from a list of available drivers on my computer. Select USB Serial Device
instead of mbed Serial Port.
• On Linux: udev rules grant permission to access USB boards and devices. You must install udev
rules to be able to build a project and run it on your hardware or debug a project.
Clone the pyOCD repository, then copy the rules files which are available in the udev folder to
/etc/udev/rules.d/ as explained in the Readme. Follow the instructions in the Readme.
After installing the udev rules, your connected hardware is detectable in the Device Manager
extension. You may still encounter a permission issue when accessing the serial output. If this is
the case, run sudo adduser "$USER" dialout then restart your machine.
• Check that the firmware version of your board or debug probe is supported and update the
firmware to the latest version. See Out-of-date firmware for more details.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 39 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
• Your board or device may be claimed by other processes or tools. For example, if you are trying
to access a board or device with several instances of Visual Studio Code, or with Visual Studio
Code and another IDE.
• Activate the Manage All Devices setting. This allows you to select any USB hardware
connected to your computer. By default, the Device Manager extension only gives you access
to hardware from known vendors.
1. Open the settings:
◦ On Windows or Linux, go to: File > Preferences > Settings.
◦ On macOS, go to: Code > Settings > Settings.
2. Find the Device-manager: Manage All Devices setting and select its checkbox.
Solution
Update the firmware of the board or debug probe to the latest version:
• DAPLink. If you cannot find your board or probe on daplink.io, then check the website of the
manufacturer for your hardware.
• ST-LINK.
• For other WebUSB-enabled CMSIS-DAP firmware updates, please contact your board or debug
probe vendor.
If you are using an FRDM-KL25Z board and the standard DAPLink firmware update
procedure does not work, follow this procedure (requires Windows 7 or Windows
XP).
For more information on firmware updates, see also the Debug Probe Firmware Update
Information Application Note.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 40 of 41
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_02_en
Submit feedback
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 41 of 41