CMSIS-Build: Setup Build Environment

| CMSIS-Build Version 0.9.0 (beta) Tools, software frameworks, and work flows for productivity with CMSIS based projects

- Main Page
- Usage and Description

All Pages
Setup Build Environment

The command line build environment for projects that are based on the CMSIS-Pack standard requires:

- Required: Bash for script execution.
- Optional: xmllint for XML schema verification.

With most Linux distributions these tools are already available. The installation for Windows is explained below.

Required for Windows: Bash

- git for Windows includes Git Bash which is easy to download and install.

# cbuild_install.sh: Install Build Tools

CMSIS-Build tools are available for download as an asset of the respective CMSIS Release Version (starting 5.7.0 e/o April 2020).

To install the command line build environment start from the Bash prompt:

$ ./cbuild_install.sh

This install script queries for:

- Directory for the installation of the CMSIS command line build tools (default ./cbuild).
- When Keil MDK is installed, enter the base directory of the MDK installation (default /c/Keil_v5).
- Directory to store the content of the software packs in CMSIS-Pack format.

# Environment Variables

The file ./cbuild/etc/setup configures the CMSIS command line build environment. It contains the following section that should reflect the actual installation.

File: ./cbuild/etc/setup

############### EDIT BELOW ###############
export CMSIS_PACK_ROOT=/C/Users/myname/AppData/Local/Arm/Packs
export CMSIS_COMPILER_ROOT=/C/myname/cbuild
export MDK_ROOT=/C/Keil_v5

The file ./cbuild/etc/setup is used to setup environment variables in Bash using the source command:

$ source ./cbuild/etc/setup

Variable | Description
--- | ---
`$CMSIS_PACK_ROOT` | Directory that contains the software packs in CMSIS-Pack format.
`$CMSIS_COMPILER_ROOT` | Directory that contains the Compiler Configuration.
`$CMSIS_BUILD_ROOT` | Base directory of the CMSIS command line build tools.
`$MDK_ROOT` | Base directory of the MDK installation (optional).

# Compiler Configuration

The CMSIS cbuildgen: Build Process Manager uses toolchain specific .mak files that map the CMSIS project settings to the toolchain. For each supported toolchain a .mak files is provided in the directory ./cbuild/etc and specifies the base directory of the toolchain installation (TOOLCHAIN_ROOT). In addition other toolchain specific environment variables may be setup here (e.g. license file and product variant). The user is required to update the these settings after installation to reflect the actual installation.

Example file: ./cbuild/etc/ARMCC.6.13.1.mak

# Version: 1.0.0
# Date: 2020-02-11
# This file maps the CMSIS project options to toolchain settings.
#
# - Applies to toolchain: ARMCC 6.13.1
#
############### EDIT BELOW ###############
# Set base directory of toolchain
TOOLCHAIN_ROOT:=/C/Keil_v5/ARM/ARMCLANG
# Licensing
#export ARMLMD_LICENSE_FILE=todo
#export ARM_PRODUCT_DEF=$(TOOLCHAIN_ROOT)/../../mappings/gold.elmap
############ DO NOT EDIT BELOW ###########

The toolchain for compilation is defined in project file *.cprj and used by cbuildgen: Build Process Manager. The cbuildgen: Build Process Manager first searches for the toolchain specific .mak file in the project directory. If the toolchain specific .mak file is not present there, it uses the directory that is specified by the $CMSIS_BUILD_ROOT environment variable.

# libxml (optional for Windows)

For Windows the libxml provides an XML processor that provides the functionality of xmllint.

Note
  The installation is optional and not required to run the command line build tools.

Download the following ZIP files:

- iconv-1.9.2.win32.zip
- libxml2-2.7.8.win32.zip
- libxmlsec-1.2.18.win32.zip
- zlib-1.2.5.win32.zip

Extract the /bin directory of each ZIP file to a directory, for example C:\xmllint and add this directory to the Windows PATH environment variable.

Note
  Restart the Git Bash after changing the PATH environment variable.
  When xmllint is not installed, the XML schema verification is skipped by the cbuild.sh script.

xmllint is also provided by the xsltproc package that can be installed via Chocolatey:

> choco install xsltproc