Build and program
After the application has been created, you can use the supported IDE of your choice for building and programming. You can also use command line tools. The ModusToolbox™ build system infrastructure provides several make variables to control the build. So, whether you are using an IDE or command line tools, you edit the
Makefile
variables as appropriate. See the
ModusToolbox™ build system
chapter for detailed documentation on the build system infrastructure.
Variable | Description |
|---|---|
TARGET | Specifies the target board/kit. For example, KIT_PSC3M5_EVK |
APPNAME | Specifies the name of the application |
TOOLCHAIN | Specifies the build tools used to build the application |
CONFIG | Specifies the configuration option for the build [Debug Release] |
VERBOSE | Specifies whether the build is silent or verbose [0 - 3] |
ModusToolbox™ software is tested with various versions of the TOOLCHAIN values listed in the following table. Refer to the release information for each product for specific versions of the toolchains.
TOOLCHAIN | Tools | Host OS | Variable |
|---|---|---|---|
GCC_ARM | GNU Arm® Embedded Compiler | macOS, Windows, Linux™ | |
ARM | Arm® compiler | Windows, Linux™ | |
IAR | Embedded Workbench | Windows | |
LLVM_ARM | Open-source compiler | macOS, Windows, Linux™ | |
In the Makefile, set the
TOOLCHAIN
variable to the build tools of your choice. For example:
TOOLCHAIN=GCC_ARM
. There are also variables you can use to pass compiler and linker flags to the toolchain.
ModusToolbox™ software installs the GNU Arm® toolchain and uses it by default. If you wish to use another toolchain, you must provide it and specify the path to the tools. For example,
CY_COMPILER_IAR_DIR=[yourpath]
. If this path is blank, the build infrastructure looks in the
ModusToolbox
install directory. These variables can also be set as environment variables for your system, so you don't have to change it for each application. See
Path make variables
for details about different variables' usage.
Use an IDE
The ModusToolbox™ ecosystem supports third-party IDEs, and we provide user guides for using those IDEs with a ModusToolbox™ application:
Use command line
make build
When the Project Creator tool finishes creating the application and imports all the required dependencies, the application is ready to build. From the appropriate terminal, type the following:
make build
This instructs the build system to find and gather the source files in the application and initiate the build process. In order to improve the build speed, you may parallelize it by giving it a
-j
flag (optionally specifying the number of processes to run). For example:
make build -j16
In multi-core applications, it is possible to build only the current project instead of the entire application by using the following command:
make build_proj
make program
Connect the target board to the machine and type the following in the terminal:
make program
This performs an application build and then programs the application artifact (usually an .
elf
or .
hex
file) to the board using the recipe-specific programming routine (usually OpenOCD). You may also skip the build step by using qprogram instead of program. This will program the existing build artifact.