This repository builds an ELF file that prints "GetStarted World" and a counter value via semihosting output on an Arm Virtual Hardware model (Cortex-M3).
- Download & Install Microsoft Visual Studio Code for your operating system.
- Launch Visual Studio Code. From the 'View' menu open 'Extensions' (ctrl+shift+x). Search for "Keil Studio Pack" and select the install button.
- From the 'View' menu open 'Source Control'. Select 'Clone Repository' and copy the url: https://github.com/Open-CMSIS-Pack/vscode-get-started into the input dialog
- Specify the destination folder to clone to and select 'Open' when asked 'Would you like to open the cloned directory?'
- Open the 'Explorer' view (ctrl-shift-e) and select the file 'vcpkg-configuration.json'. This file instructs Microsoft vcpkg to install the prerequisite artifacts required for building the solution.
- ctools 1.5.0 CMSIS-Toolbox
- cmake 3.25.2
- ninja 1.10.2
- arm-none-eabi-gcc 10.3.1-2021.10 (GNU Arm Embedded Toolchain 10.3.1)
- In case vcpkg shows an error in the VSCode status bar, you can see furth information in the "OUTPUT" for 'vcpkg'.
In case of 'Error: Unable to resolve dependency ... in ' you may need to update the registry by running 'vcpkg: Run vcpkg command'
from the 'View' menu's 'Command Palette...' (ctrl+shift+p) typing:
z-ce update <registry>
. - Open the 'CMSIS' view from the side bar and press the 'Build' button. The last line of the ninja build output will tell you where you can
find the application elf file. Alternatively you can select 'Build' or 'Rebuild' from the context menu of the
*.cprj
file of the solution context (e.g. hello.debug+vht.cprj)
Note: Any terminal that is openened within VSCode after vcpkg got activated for the folder, will have all the above tools added to the path. This allows you to run tools from the CMSIS-Toolbox like:
cpackget
for installing and uninstalling CMSIS-Packscsolution
for updating, validating and converting from the CMSIS Project Management YML input format to the CMSIS Build XMLcprj
format used bycbuildgen
.cbuildgen
cbuild
for an orchestrated build of one or moreconfigurations
of a csolution.
- Keil MDK 5.38a or later
- VHT_MPS2_Cortex-M3: Arm Virtual Hardware for Cortex-M3 (v11.19.23 - Windows only - requires MDK-Professional license)
- set the environment variable PATH to point to the 'VHT' directory of the MDK installation (
c:\Keil_v5\ARM\VHT
).
- set the environment variable PATH to point to the 'VHT' directory of the MDK installation (
- Arm Compiler 6.19 (included in Keil MDK: Community Edition is sufficient for building the solution)
- set the environment variable AC6_TOOLCHAIN_6_19_0 to point to the bin directory of the installed toolchain to register the Arm Compiler 6.
- VHT_MPS2_Cortex-M3: Arm Virtual Hardware for Cortex-M3 (v11.19.23 - Windows only - requires MDK-Professional license)
The project is generated using the CMSIS-Toolbox and is written in the csolution
format:
.cdefault.yml
sets the default toolchain and specifies toolchain specific commandline options for supported toolchains.get_started.csolution.yml
lists and defines the hardware targets, build-types and projects.hello/hello.cproject.yml
defines the packs, components, source files and output files.
Use the cbuild
command from CMSIS-Toolbox to generate and build one or all configurations of the solution:
- find out which
configurations
are specified by the solution:
./ $ cbuild list configurations get_started.csolution.yml
.debug+vht
.release+vht
- build the configuration
.debug+vht
and install the required CMSIS Packs if not installed:
./ $ cbuild get_started.csolution.yml --packs --configuration .debug+vht
info cbuild: Build Invocation 1.5.0 (C) 2023 Arm Ltd. and Contributors
ARM::CMSIS
:
info cbuild: Building context: "hello.debug+vht"
================================================
M650: Command completed successfully.
M652: Generated file for project build: 'hello/tmp/hello/debug/vht/CMakeLists.txt'
:
info cbuild: build finished successfully!
- build the configuration
.debug+vht
using Arm Compiler 6 (AC6) Open.cdefault.yml
file in the edito and configure AC6 as default compiler:
default:
compiler: AC6
rebuild the configuration adding also missing configuration files:
./ $ cbuild get_started.csolution.yml --configuration .debug+vht --packs --update-rte -r
The project is configured for execution on Arm Virtual Hardware (AVH) modelling an MPS2 board running an Arm Cortex-M3 processor. This model is part of the Keil MDK Professional Edition for Windows and removes the requirement for a physical hardware board.
./ $ VHT_MPS2_Cortex-M3 -f vht-config.txt -a hello/out/hello/debug/vht/debug+vht.axf