Exploring CLI Build Options
In a previous article, we demonstrated how to build a simple project using the CLI. However, we can easily build more complex projects using west build options. We can specify a specific toolchain, compiler, core, etc. To view the complete list of build options run the command:
west build -h
Dual Core Device Example
For single core devices there is no need to specify a core ID. However, this must be done when working with a dual core device. For example, to build Hello_World for the FRDM MCXN947, the following command needs to be run:
west build -b frdmmcxn947 example/demo_apps/hello_world -Dcore_id=cm33_core0
Specifying a Toolchain
The MCUXpresso SDK supports several toolchains. To take the example above and build for IAR, we simply specify the IAR toolchain with a build option as follows:
west build -b frdmmcxn947 example/demo_apps/hello_world -Dcore_id=cm33_core0 --toolchain iar
Specifying a Different Build Directory
As you can see the CLI is quick and easy to use for building projects. So far, we have covered some of the major build options to consider. What happens when we want to evaluate with different builds simultaneously? Well, we can specify different build directories within our workspace. To designate a different build directory for the project above, simply run:
west build -b frdmmcxn947 examples/demo_apps/hello_world -Dcore_id=cm33_core0 --toolchain iar -d C:\temp-sdk\mcuxsdk\custom_build
*Note the path shown has been personalized. The path for your system will vary.