arm_keil_studio_visual_studio_code_extensions_user_guide_108029_0000_08_en
arm_keil_studio_visual_studio_code_extensions_user_guide_108029_0000_08_en
User Guide
Non-Confidential Issue 08
Copyright © 2023 Arm Limited (or its affiliates). 108029_0000_08_en
All rights reserved.
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 2 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
undertaken no analysis to identify or understand the scope and content of, patents, copyrights,
trade secrets, or other rights.
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.
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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 3 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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
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 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Contents
Contents
1. Introduction...................................................................................................................................................... 8
1.1 Conventions......................................................................................................................................................8
1.2 Other information........................................................................................................................................... 9
Contents
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 6 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Contents
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 7 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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.
Requirements for the system. Not following these requirements might result in
system failure or damage.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 8 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Introduction
Requirements for the system. Not following these requirements will result in system
failure or damage.
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 9 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
You can install and use the extension pack with Visual Studio Code Desktop. An extension pack is a
set of related extensions that are installed together.
The Arm Virtual Hardware extension is experimental, and is not described in this
guide.
The extensions contained in the pack 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 pack Readme for more details.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 10 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
• Arm Debugger (Identifier: arm.arm-debugger): This extension provides access to the Arm
Debugger engine for Visual Studio Code by implementing the Microsoft Debug Adapter
Protocol (DAP). Arm Debugger supports connections to physical targets, either through
external debug probes such as the Arm’s ULINK™ family of debug probes, or through on-board
low-cost debugging such as ST-Link or CMSIS-DAP based debug probes.
• Memory Inspector (Identifier: eclipse-cdt.memory-inspector): This extension allows you to
analyze and monitor the memory contents in an embedded system. It helps you to identfiy and
debug memory-related issues during the development phase of your project.
• Peripheral Inspector (Identifier: eclipse-cdt.peripheral-inspector): This extension
uses System View Description (SVD) files to display peripheral details. SVD files provide
a standardized way to describe the memory-mapped registers and peripherals of a
microcontroller or a System-on-Chip (SoC).
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 11 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 12 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 using Microsoft vcpkg.
Each example also comes with a tasks.json and launch.json to build, run, and debug the project.
Finalize the setup 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 13 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 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. The file records the vcpkg artifacts, such as the
compiler toolchain version, that you need to work with your projects. 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 14 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Procedure
1. Go to keil.arm.com.
2. Connect your board over USB and click Detect Connected Hardware 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 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 file is available. The file records the vcpkg artifacts, such as the
compiler toolchain version, that you need to work with your projects. 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 15 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
• Configure an HTTP proxy. This step is only required if you are working behind an HTTP proxy.
• The 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.
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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 16 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Procedure
1. Build the project:
• From the Explorer:
a.
Go to the Explorer view .
b. Right-click the *.csolution.yml file and select Build.
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 Build (clean) option is also available when you click the arrow next to Build. Build
(clean) is the same as Rebuild in the right-click menu.
You can configure a build task in a tasks.json file to customise the behaviour of the build
button. A tasks.json is provided for all the examples available on keil.arm.com. 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 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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.
You can configure a run task in a tasks.json file to customise the behaviour of the run button. A
tasks.json is provided for all the examples available on keil.arm.com. 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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 18 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Procedure
1.
Click the CMSIS icon in the Activity Bar.
2.
Click the Debug button in the ACTIONS panel.
You can configure a launch configuration in a launch.json file to customise the behaviour of the
debug button. A launch.json is provided for all the examples available on keil.arm.com. See
Debug your project with Arm Embedded Debugger or Debug your project with Arm Debugger
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 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
The artifacts for your project are stored in the vcpkg-configuration.json file in the project source
code. This means that the same tools are available to everyone using the project.
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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 20 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
The artifacts provided by Arm are listed on the Arm tools available in vcpkg page on keil.arm.com.
Simply copy the code snippets for the artifacts you want to install and paste them in the vcpkg-
configuration.json manifest file of your project in the "requires": section, then save the file.
The newly added or updated artifacts are automatically downloaded and activated.
Procedure
1. From the Explorer, open your workspace.
2. Right-click the vcpkg-configuration.json file.
Depending on the activation status of your environment and the Environment Manager
settings selected, the following options are available:
• Activate environment: Activate the environment. This option is available only if you
previously deactivated your environment or if you modified the Activate On Config
Creation or Activate On Workspace Open settings for the Environment Manager. Tools
are available on the PATH.
• Deactivate environment: Deactivate the active environment. Tools are also removed from
the PATH.
• Reactivate environment: Deactivate and activate the environment (for example, if you have
changed your vcpkg configuration).
• Update vcpkg registries: Check for fresh artifacts published in the registries.
The Arm Developer Learning Paths also have an example scenario that shows you how to install
and initialize vcpkg, and how to create and use the configuration file. See Install tools on the
command line using vcpkg.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 21 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 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-
files. YAML syntax support helps you with editing.
K32L3A6.cproject.yml
4. Go to the PROBLEMS tab and check for errors.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 22 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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.
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 and ACTIONS panels.
The SOLUTION outline shows the cprojects included in the solution. Each cproject file contains
configuration settings, source code files, build settings, and other project-specific information. The
extension uses these to manage and build a software project for a given board or device.
When you hover over the SOLUTION label, you can choose one of the following actions:
•
Create a solution: Click the Create a solution icon to create a csolution project from
scratch. Note that the Create New CMSIS Solution view is still under development. To get
access to it, go to the settings, search for Cmsis-csolution: Experimental Features (in the
Extensions > CMSIS csolution category) and enable it.
•
Manage software components: Click the Manage software components icon to open the
Software Components view.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 23 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
•
Open csolution file: Click the Open csolution file icon to open the main csolution.yml file.
•
Collapse All: Click the Collapse All icon to close all the entries in the outline.
When you hover over a project, you can click the Open file icon to open the corresponding
cproject.yml file. An Open file icon is also available for each layer.
Press Ctrl+F (Windows) or Cmd+F (macOS) to look for an element in the SOLUTION outline.
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.
Procedure
1.
Click the CMSIS icon in the Activity Bar to open the Arm CMSIS csolution extension.
2. Hover over the SOLUTION outline under the CONTEXT and ACTIONS panels, then 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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 24 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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 6-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.
• 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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 25 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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
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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 26 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
6.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.
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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 27 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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}",
"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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 28 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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.
Procedure
1.
Click the CMSIS icon in the Activity Bar to open the Arm CMSIS csolution extension.
2. Hover over the SOLUTION outline under the CONTEXT and ACTIONS panels, then click the
Create a solution icon .
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 29 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
.
4. Click Select.
You can create a blank solution or a TrustZone solution. TrustZone is a hardware-based security
feature that provides a secure execution environment on Arm-based processors. It allows the
isolation of secure and non-secure zones, enabling the secure processing of sensitive data and
applications. If the board or device you selected is compatible, you can decide if your solution
should use the TrustZone technology and define which project in the solution should use
secure or non-secure zones.
5. From the Template drop-down list, select Blank solution or TrustZone solution.
6. Type a name for your solution in the Solution Name field.
7. Configure the projects in your solution:
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 30 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
• If you selected Blank solution: One project is added for each processor in the target
hardware. Project Name and Core are filled in based on the board or device selected in the
Target drop-down list. You can change the project names. You can decide to add secure or
non-secure zones with the TrustZone drop-down list. By default, TrustZone is off.
• If you selected TrustZone solution: A secure and a non-secure projects are added for each
processor in the target hardware that supports TrustZone. The Project Name field and Core
and TrustZone drop-down lists are filled in based on the board or device selected in the
Target drop-down list. You can change the project names. You can also change the zones,
secure or non-secure in the TrustZone drop-down list, or remove TrustZone by selecting
off.
8. Click Add Project to add projects to your solution and configure them. For TrustZone, you can
add as many secure or non-secure projects as you need for a given processor.
9. Select a compiler: Arm Compiler 6, GCC, or LLVM.
10. Click Browse next to the Location field to choose where to store the files of the solution.
If you already have a workspace opened, by default the extension creates the files in the folder
of the current workspace. To store the files in a different folder, use the system dialog box that
opens to create and select a new folder.
11. Check the default options:
• Initialize Git repo: The extension initializes the solution as a Git repository. Clear the
checkbox if you do not want to turn your solution into a Git repository.
• Install required Packs: The extension automatically installs the CMSIS-Packs required by
the newly created solution.
12. Click Create.
A dialog box displays. You can:
• Open the solution in a new workspace (Open option)
• Open the solution in a new window and new workspace (Open project in new window
option)
• Add the solution to the current workspace (Add project to vscode workspace option)
13. Select one of the options.
The extension creates the solution.
14.
Click the Explorer icon in the Activity Bar to check that the files for the solution have been
created.
• A <solution_name>.csolution.yml file.
• One or more <project_name>.cproject.yml files, each available in a separate folder.
• A main.c template file for each project.
Next steps
Explore the autocomplete feature available to edit the csolution.yml and cproject.yml files. Read
the CMSIS-Toolbox > Build Overview documentation for project examples.
Add CMSIS components with the Software Components view. When you add components, the
cproject.yml files are updated.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 31 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Procedure
1. From the Explorer, open your workspace.
2. Right-click anywhere in the workspace and select Initialize CMSIS project.
The extension generates a vcpkg-configuration.json, a tasks.json, and a launch.json that
are already pre-configured.
For the API specification, see the CMSIS csolution extension API page.
For information about authoring extensions, see the Extension API chapter in the Visual Studio
Code documentation.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 32 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 33 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 34 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 35 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Procedure
1. Open the Command Palette and search for Tasks: Configure Task then select it.
2. Select the embedded-debug.flash:Flash Device task or the embedded-debug.daplink-
flash:Flash Device (DAPLink) task.
This adds the following lines in the tasks.json file that is stored in the .vscode folder of the
project.
{
"label": "Flash Device",
"type": "embedded-debug.flash",
"program": "${command:embedded-debug.getApplicationFile}",
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 36 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
"serialNumber": "${command:device-manager.getSerialNumber}",
"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",
[...]
}
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 37 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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:
{
[...]
"serialNumber": "${command:device-manager.getSerialNumber}",
"cmsisPack": "Keil::[email protected]",
"deviceName": "STM32H745XIHx",
[...]
}
8.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 38 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
8.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
"openSerial" Baud rate for connected device. Opens the serial output of the device in the TERMINAL tab with the baud rate
specified.
"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. Open the Command Palette and search for Tasks: Run Task then select it.
3. Select the embedded-debug.flash:Flash Device task or the embedded-debug.daplink-
flash:Flash Device (DAPLink) task in the drop-down list.
If you have installed the Keil Studio 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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 39 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Procedure
1. Open the launch.json file that is stored in the .vscode folder of your project and add the
following lines inside "configurations":[ ]:
{
"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 40 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
8.2.3 Debug
Start a debug session.
Procedure
1. Check that your device is connected to your computer.
2.
To start a debug session, go to the RUN AND DEBUG view and select the Embedded
Debug configuration in the list , then click the Start Debugging button.
If you have installed the Keil Studio Pack, you can alternatively go to the CMSIS view and click
the Debug button in the ACTIONS panel.
A Debug (no flash) option is also available when you click the arrow next to Debug.
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 41 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Use the Flash Device task for CMSIS-DAP (such as LPC-Link2, Nu-Link2, and ULINKplus™) and ST-
Link hardware. The CMSIS-Packs used in your project control the flash download.
Procedure
1. Open the Command Palette and search for Tasks: Configure Task then select it.
2. Select the arm-debugger.flash: Flash Device task.
This adds the following lines in the tasks.json file that is stored in the .vscode folder of the
project.
{
"type": "arm-debugger.flash",
"serialNumber": "${command:device-manager.getSerialNumber}",
"program": "${command:arm-debugger.getApplicationFile}",
"cmsisPack": "${command:device-manager.getDevicePack}",
"problemMatcher": [],
"label": "arm-debugger.flash: Flash Device"
}
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.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 42 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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:
{
[...]
"serialNumber": "${command:device-manager.getSerialNumber}",
"cmsisPack": "Keil::[email protected]",
"deviceName": "STM32H745XIHx",
[...]
}
9.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.
Configuration Description
option
"cmsisPack" Path (file or URL) to a DFP (Device Family Pack) CMSIS-Pack for your hardware. Command available: device-
manager.getDevicePack - Gets the CMSIS-Pack for the selected device.
"connectMode" Connection mode. Possible values: auto (debugger decides), haltOnConnect (halts for any reset before running),
underReset (holds external NRST line asserted), preReset (pre-reset using NRST), running (connects to
running target without altering state). Default: auto.
"deviceName" CMSIS-Pack device name. Command available: device-manager.getDeviceName - Gets the device name from
the DFP (Device Family Pack) of the selected device.
"openSerial" Baud rate to open the serial output of a device after flash (requires Arm Device Manager). Possible values: 115200,
57600, 38400, 19200, 9600, 4800, 2400, 1800, 1200, 600.
"pdsc" Path (file or URL) to a PDSC file.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 43 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Configuration Description
option
"probe" Name of probe to use for the debug connection. Possible values: ULINKpro, ULINKpro D, ULINK2, CMSIS-DAP,
ULINKplus, FTDI MPSSE JTAG, ST-Link, DSTREAM. Default: CMSIS-DAP.
"processorName" CMSIS-Pack processor name for multi-core devices.
"program" or Path(s) (file or URL) to the project(s) to use. Command available: arm-debugger.getApplicationFile -
"programs" Returns an AXF or ELF file used for CMSIS run and debug.
"serialNumber" Serial number of the connected USB hardware to use. Command available: device-
manager.getSerialNumber - Gets the serial number of the selected device.
"targetAddress" Synonymous with serialNumber.
"vendorName" CMSIS-Pack vendor name.
"verifyFlash" Verify the contents downloaded to flash. Default: true.
Procedure
1. Check that your hardware is connected to your computer.
2. Open the Command Palette and search for Tasks: Run Task then select it.
3. Select arm-debugger.flash: Flash Device in the drop-down list.
If you have installed the Keil Studio 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.
If the Arm Debugger engine cannot be found on your machine, an Arm Debugger not found
dialog box displays.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 44 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Procedure
1. Open the launch.json file that is stored in the .vscode folder of your project and add the
following lines inside "configurations":[ ]:
{
"name": "Arm Debugger",
"type": "arm-debugger",
"request": "launch",
"serialNumber": "${command:device-manager.getSerialNumber}",
"program": "${command:embedded-debug.getApplicationFile}",
"cmsisPack": "${command:device-manager.getDevicePack}"
}
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 45 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
9.2.3 Debug
Start a debug session.
Procedure
1. Check that your device is connected to your computer.
2.
To start a debug session, go to the RUN AND DEBUG view and select the Arm Debugger
A Debug (no flash) option is also available when you click the arrow next to Debug.
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.
If the Arm Debugger engine cannot be found on your machine, an Arm Debugger not found
dialog box displays.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 46 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
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 47 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
After you have installed the pack, 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 Don’t Ask Again in the pop-up to ignore the Keil
MDK Community Edition license activation.
To turn the licensing notifications off, you can also go to the Keil Studio Pack category in the
settings and select the Silence Licensing Notifications checkbox.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 48 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
If you used an official example from keil.arm.com and installed the Keil Studio Pack as
recommended, then CMSIS-Toolbox is already available on your machine as explained in Get
started with an example project.
The main tools that CMSIS-Toolbox provides and that you can use with the command line are:
• cpackget:Pack Manager. Used to install and manage CMSIS-Packs in your development
environment.
• cbuild:Build invocation. Used to orchestrate the build process that translates a project to
an executable binary image. cbuild invokes the different tools (csolution, cpackget and
cbuildgen) and launches the CMake compilation process.
• csolution: Project Manager. Used to create build information for embedded applications that
consist of one or more related projects.
The Build Tools page describes how to use these tools with the command line.
If you install CMSIS-Toolbox without using the Environment Manager extension, add the
installation path to the system PATH, or use the Cmsis-csolution: Cmsis Toolbox Path setting to
add the path.
This section gives you an overview on how to manage the different types of packs.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 49 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Alternatively, you can use the cpackget add command from the terminal to install the latest
published version of public packs listed in the package index of a vendor. A package index
file lists all the CMSIS-Packs hosted and maintained by a vendor. See the Open-CMSIS-Pack
documentation for more information on package index files.
For example, the following command installs the latest public version of a public pack:
Where:
• Vendor: Is the name of the vendor who created the CMSIS-Pack
• PackName: Is the name of the CMSIS-Pack
After running cpackget add, reload Visual Studio Code to update the packs available in the UI.
For example, the following command registers a local pack using a PDSC (pack description) file:
Where:
• Vendor: Is the name of the vendor who created the CMSIS-Pack
• PackName: Is the name of the CMSIS-Pack
After running cpackget add to add packs to the pack root folder, reload Visual Studio Code to
update the packs available in the UI.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 50 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
If you cannot see the components from the pack or packs that you have just added in the
Software Components view, check the Cmsis-csolution: Pack Cache Path setting and the
CMSIS_PACK_ROOT environment variable.
For example, the following command installs a pack version that can be downloaded from the web:
Where:
• Vendor: Is the name of the vendor who created the CMSIS-Pack
• PackName: Is the name of the CMSIS-Pack
• x.y.z: Is the specific version of the pack you want to install
After running cpackget add, reload Visual Studio Code to update the packs available in the UI.
cpackget rm Vendor.PackName.x.y.z
Where:
• Vendor: Is the name of the vendor who created the CMSIS-Pack
• PackName: Is the name of the CMSIS-Pack
• x.y.z: Is the specific version of the pack you want to remove
After running cpackget rm, reload Visual Studio Code to update the packs available in the UI.
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 51 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
12.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, make sure that you follow the instructions for installing and setting up CMSIS-Toolbox.
In particular, make sure that 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 52 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 53 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_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 54 of 55
Arm Keil Studio Visual Studio Code Extensions User Guide Document ID: 108029_0000_08_en
Submit feedback
Copyright © 2023 Arm Limited (or its affiliates). All rights reserved.
Non-Confidential
Page 55 of 55