Awesome
Visual Studio Code get started solution
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).
How to setup your CMSIS Csolution CLI Environment
Refer to the installation guide of CMSIS-Toolbox.
How to setup your CMSIS Csolution Development Environment
- 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 and puts it into the PATH: cmake, ninja, cmsis-toolbox as well as arm-none-eabi-gcc.
- 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
*.csolution.yml
file of the solution context (e.g. get_started.csolution.yml) to build all contexts of the solution.
Note: Any terminal that is opened 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
.cbuild
for an orchestrated build of one or moreconfigurations
of a csolution.
Additional Tools
- Other Arm Tools available via vcpkg e.g.:
- Models: Arm Virtual Hardware for Cortex-M based on FastModels
- Toolchain: Arm Compiler for Embedded
- Debugger: Arm Debugger
Project Structure
The project is written in the CMSIS-Toolbox Project Format
:
- [
cdefault.yml
] is located in the ./etc directory of the CMSIS-Toolbox. It sets the default toolchain specific command line options for supported toolchains. In case a solution specific version is required, you can copy the file locally and it will be used by the tools instead. get_started.csolution.yml
lists and defines the required packs, hardware targets, build-types and projects.hello/hello.cproject.yml
defines components and source files.
Build Solution/Project
Use the cbuild
command from CMSIS-Toolbox to generate and build one or all configurations of the solution:
-
find out which
contexts
are specified by the solution:cbuild list contexts get_started.csolution.yml hello.debug+avh hello.release+avh
-
build the context
hello.debug+avh
and install the required CMSIS Packs if not installed:cbuild get_started.csolution.yml --packs --update-rte --context hello.debug+avh info cbuild: Build Invocation 2.2.1 (C) 2023 Arm Ltd. and Contributors /tmp/vscode-get-started/get_started.cbuild-idx.yml - info csolution: file generated successfully /tmp/vscode-get-started/hello/hello.debug+avh.cbuild.yml - info csolution: file generated successfully /tmp/vscode-get-started/get_started.cbuild-pack.yml - info csolution: file is already up-to-date /tmp/vscode-get-started/hello/hello.debug+avh.cprj - info csolution: file generated successfully info cbuild: Processing 1 context(s) info cbuild: Retrieve build information for context: "hello.debug+avh" ====================================================== info cbuild: (1/1) Building context: "hello.debug+avh" M650: Command completed successfully. M652: Generated file for project build: '/tmp/vscode-get-started/tmp/hello/avh/debug/CMakeLists.txt' : info cbuild: build finished successfully!
-
build the configuration
.debug+avh
using Arm Compiler 6 (AC6) Add the Arm Compiler for Embedded 6 e.g. via vcpkg (vcpkg use armclang
) and rebuild the context specifying--rebuild
and the required compiler--toolchain AC6
:cbuild get_started.csolution.yml --context .debug+avh --packs --update-rte --rebuild --toolchain AC6
Execute Project
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 MDK Professional Edition and removes the requirement for a physical hardware board. It DOES NOT WORK with the MDK Community Edition.
Note: depending on the toolchain used the extension of the application file is either elf
(GCC, Clang) or axf
(AC6):
FVP_MPS2_Cortex-M3 -f fvp-config.txt -a out/hello/avh/debug/hello.axf