Available make variables
The following variables customize various make targets. They can be defined in the application Makefile or passed through the make invocation. The following sections group the variables for how they can be used.
Basic configuration make variables
These variables define basic aspects of building an application. For example:
make build TOOLCHAIN=GCC_ARM CONFIG=CustomConfig -j8
Variable | Description |
|---|---|
TARGET | Specifies the target board/kit (that is, BSP). For example, CY8CPROTO-062-4343W. Example usage: |
CORE | Specifies the name of the Arm® core for which a project is building (e.g. CM4). Example Usage: Use this variable to select compiler and linker options to build a project for a specified Arm® core. |
CORE_NAME | Specifies the name of the on-chip core for which a project is building (e.g. CM7_0). Example Usage: Use this variable to select compiler and linker options to build a project for a specified on-chip core. This variable is applicable for some multi-core devices only (e.g. XMC7xxx). |
APPNAME | Specifies the name of the application. For example, "AppV1" > AppV1.elf. Example usage: This variable is used to set the name of the application artifact (programmable image). This variable may also be used when generating launch configs when invoking the target. |
TOOLCHAIN | Specifies the toolchain used to build the application. For example, IAR. Example Usage: Supported toolchains for this include GCC_ARM, IAR, ARM and LLVM_ARM. When setting , you should also specify the heap type using . The option is required if the program uses a library that requires it. |
CONFIG | Specifies the configuration option for the build [Debug Release]. Example Usage: The variable is not limited to Debug/Release. It can be other values. However in those instances, the build system will not configure the optimization flags. Debug=lowest optimization, Release=highest optimization. The optimization flags are toolchain specific. If you go with your custom config, then you can manually set the optimization flag in the . |
VERBOSE | Specifies whether the build is silent [false] or verbose [true]. Example Usage: Setting to true may help in debugging build errors/warnings. By default, it is set to false. |
Advanced configuration make variables
These variables define advanced aspects of building an application.
Variable | Description |
|---|---|
SOURCES | Specifies C/C++ and assembly files outside of application directory. Example Usage (within Makefile ): This can be used to include files external to the application directory. The path can be both absolute or relative to the application directory. |
INCLUDES | Specifies include paths outside of the application directory. Example Usage (within Makefile ): These MUST NOT have prepended. The path can be either absolute or relative to the application directory. |
DEFINES | Specifies additional defines passed to the compiler. Example Usage (within Makefile ): These MUST NOT have prepended. |
VFP_SELECT | Selects hard/soft ABI or full software for floating-point operations [softfp hardfp softfloat]. If not defined, this value defaults to softfp. Example Usage (within Makefile ): |
VFP_SELECT_PRECISION | Selects single-precision or double-precision operating mode for floating-point operations. If not defined, this value defaults to double-precision. Enable single-precision mode by using the "singlefp" option. Example Usage (within Makefile ): |
CFLAGS | Prepends additional C compiler flags. Example Usage (within Makefile ): |
CXXFLAGS | Prepends additional C++ compiler flags. Example Usage (within Makefile ): |
ASFLAGS | Prepends additional assembler flags. Usage is similar to . |
LDFLAGS | Prepends additional linker flags. Example Usage (within Makefile ): |
LINKER_SCRIPT | Specifies a custom linker script location. Example Usage (within Makefile ): This linker script overrides the default. Additional linker scripts can be added for GCC via the variable as a option. |
COMPONENTS | Adds component-specific files to the build. Example Usage (within Makefile ): Create a directory named COMPONENT_<VALUE> and place your files. Then include the corresponding make variable to have that feature library be included in the build. For example, create a directory named COMPONENT_ACCELEROMETER into auto-discovery. Then, add the following make variable to the Makefile : . If the make variable does not include the , then that library will not be included in the build. |
DISABLE_COMPONENTS | Removes component-specific files from the build. Example Usage (within Makefile ): Include a to this make variable to have that feature library be excluded in the build. For example, to exclude the contents of the directory, set . |
SEARCH | List of paths to include in auto-discovery. For example, ../mtb_shared/lib1 . Example Usage (within Makefile ): SEARCH+=directory_containing_source_files The SEARCH variable can also be used by the application to include other directories to auto-discovery. |
SKIP_CODE_GEN | Disables code generation from configurators when building. When set to a non-empty value, the build process will no longer run code generation from configurators. |
MERGE | List of projects in the application to generate a combined hex file from. By default, building a multi-project application will generate a combined hex file from its sub-projects. This variable can be set from the application Makefile to override the set of projects to generate combined hex file from. |
VCORE_ATTRS | Virtual core attribute. Currently supported values are "TRUSTZONE_SECURE" and "TRUSTZONE_NON_SECURE" which specify the core property for Arm® TrustZone. |
TRUSTZONE_VENEER | The path of the veneer object file used for Arm® TrustZone. When specified for a secure project, it specifies the path of the veneer object file to generated. When specified for a non-secure project, it specifies the path of the veneer object file to include. |
BSP make variables
Variable | Description |
|---|---|
DEVICE | Device ID for the primary MCU on the target board/kit. Set by bsp.mk . The device identifier is mandatory for all board/kits. |
ADDITIONAL_DEVICES | IDs for additional devices on the target board/kit. Set by bsp.mk . These include devices such as radios on the board/kit. This variable is optional. |
BSP_PROGRAM_INTERFACE | Specifies the debugging and programming interface to use. The default value and valid values all depend on the BSP. Possible values include KitProg3, JLink, and FTDI. Most BSPs will only support a subset of this list. |
Getlibs make variables
These variables are used with the
make getlibs
target.
Note:
When entering variables that require a path, use a Windows-style path (not Cygwin-style, like /cygdrive/c/). Also, use forward slashes. For example, "C:/MyPath/ModusToolbox/tools_<version>."
Variable | Description |
|---|---|
MTB_USE_LOCAL_CONTENT | If set to non-empty, enable local content storage. Enable local content storage to allow use of ModusToolbox™ software without requiring internet access. Refer to the LCS Manager CLI User guide for more details. |
CY_GETLIBS_PATH | Path to the intended location of libs info directory. The directory contains local libraries and metadata files about shared libraries. |
CY_GETLIBS_DEPS_PATH | Path to where the library-manager stores . mtb files. Setting this path allows relocating the directory that the library-manager uses to store the .mtb files in your application. The default location is in a directory named deps. |
CY_GETLIBS_SHARED_PATH | Relative path to the shared repo location. All . mtb files have the format, . If the field begins with , then the repo is deposited in the path specified by the variable. The default is set from the project Makefile . |
CY_GETLIBS_SHARED_NAME | Directory name of the shared repo location. All . mtb files have the format, . If the field begins with , then the repo is deposited in the directory specified by the variable. By default, this is set from the project Makefile . |
Path make variables
These variables are used to specify various paths.
Note:
When entering variables that require a path, use a Windows-style path (not Cygwin-style, like /cygdrive/c/). Also, use forward slashes. For example, "C:/MyPath/ModusToolbox/tools_<version>."
Variable | Description |
|---|---|
CY_APP_PATH | Relative path to the top-level of application. For example, ./ Settings this path to other than ./ allows the auto-discovery mechanism to search from a root directory location that is higher than the application directory. For example, allows auto-discovery of files from a location that is two directories above the location of the Makefile. |
CY_COMPILER_GCC_ARM_DIR | Absolute path to the gcc-arm toolchain directory. Setting this path overrides the default GCC_ARM toolchain directory. It is used when the compiler is located at a non-default directory. Make uses this variable for the path to the assembler, compiler, linker, objcopy, and other toolchain binaries. For example, When set in the Makefile , no quotes are required. |
CY_COMPILER_IAR_DIR | Absolute path to the IAR toolchain directory. Setting this path overrides the default IAR toolchain directory. It is used when the compiler is located at a non-default directory. Make uses this variable for the path to the assembler, compiler, linker, objcopy, and other toolchain binaries. For example, When set in the Makefile , no quotes are required. |
CY_COMPILER_ARM_DIR | Absolute path to the ARM toolchain directory. Setting this path overrides the default ARM toolchain directory. It is used when the compiler is located at a non-default directory. Make uses this variable for the path to the assembler, compiler, linker, objcopy, and other toolchain binaries. For example, When set in the Makefile , no quotes are required. |
CY_COMPILER_LLVM_ARM_DIR | Absolute path to the LLVM toolchain directory. Setting this path overrides the default LLVM toolchain directory. It is used when the compiler is located at a non-default directory. Make uses this variable for the path to the assembler, compiler, linker, objcopy, and other toolchain binaries. For example, When set in the Makefile , no quotes are required. |
CY_TOOLS_DIR | Absolute path to the tools root directory. Example Usage: make build Applications must specify the tools_<version> directory location, which contains the root Makefile and the necessary tools and scripts to build an application. Application Makefiles are configured to automatically search in the standard locations for various platforms. If the tools are not located in the standard location, you may explicitly set this. |
CY_BUILD_LOCATION | Absolute path to the build output directory (default: pwd/build ). The build output directory is structured as /TARGET/CONFIG . Setting this variable allows the build artifacts to be located in the directory pointed to by this variable. |
CY_PYTHON_PATH | Specifies the path to a specific Python executable. Example Usage: For make targets that depend on Python, the build system looks for Python 3 in the user's and uses that to invoke python. If however is defined, it will use that python executable. |
MTB_JLINK_DIR | Specifies the path to the SEGGER J-Link software install directory "JLink". Example Usage: Setting this path allows the make system to locate the JLink executable when calling make program. If not specified, make will default to the JLink executable in the variable. When generating launch configurations for IDEs, this will override the default J-Link path. |
Miscellaneous make variables
These are miscellaneous variables used for various make targets.
Note:
When entering variables that require a path, use a Windows-style path (not Cygwin-style, like /cygdrive/c/). Also, use forward slashes. For example, "C:/MyPath/ModusToolbox/tools_<version>."
Variable | Description |
|---|---|
CY_IGNORE | Adds to the directory and file ignore list. For example, ./file1.c ./inc1 Example Usage: Directories and files listed in this variable are ignored in auto-discovery. This mechanism works in combination with any existing .cyignore files in the application. |
CY_IDE_PRJNAME | This variable contains the name that will be used to create the application name and support files for an IDE during application export. Use this variable to provide a custom name of an application for the IDE during application export. If is not set on the command line, then (which is specified in the Makefile ) is used as the default. This name can be important for some IDEs to set a correct meaningful name for the application, support files, and launch configurations in the IDE. |
CY_SIMULATOR_GEN_AUTO | If set to 1, automatically generate a simulator archive (if supported by the target device). When enabled, the build make target will generate a debugging tgz archive for the Infineon online simulator as part of the post-build process. |