4.3. Freedom K64F Build (CMake - Advanced)¶
For the advanced users and users who are aware of CMake / want to use true potential of CMake, the plug and trust MW supports build system where developers can run exactly the same example on PC/Windows/Linux and embedded targets.
e.g. Using this, developer can develop/extend example on a Windows Machine with visual studio which supports multiple break points, watch points, etc. and then recompile same example for K64F and test it there.
4.3.1. Prerequisite¶
MCUXpresso installed. Refer to Setting up MCUXPresso IDE for details on installation
CMake is installed .
Python is installed and projects are created using
scripts/create_camke_projects.py
Refer https://www.nxp.com/docs/en/application-note/AN12396-Quick_start_guide_kinetis_k64.pdf for more details on Prerequisite installation steps.
4.3.2. Importing the Project¶
Import a project using the option provided by MCUXPresso. Do not use the “Quickstart Panel” to import project.

Import existing projects into Workspace

First import the project generated by
scripts/create_cmake_projects.py
. We are going to use that workarea to build the examples.Never select “Copy projects into workspace” for this CMake configuration.

Then import the project from “projects” directory. Import only the project for your board. In this case we import
cmake_project_XXXX
, where XXXX is the board name. This project is used to debug and download to the target. It’s a manually maintained project.Never select “Copy projects into workspace” for this CMake configuration.

You may have to run cmake’s
edit_cache
to change the configuration of your example. e.g. choice of RTOS, Applet, Board, optimization level, etc.

You would mostly have to change the target that you want to build and download. Modify
cmake_project_XXXX/Debug/Makefile
.As you can see, the default selection is
se05x_Minimal
.You can run the help target of this project a shown in next image to see which projects are supported.

cmake_project_XXXX
project’s settings also supports helpful target to edit_cache or list supported projects by that configuration.

4.3.3. Running / Debugging example¶
Click on Build to compile and generate the executables

Click on debug to program the binary into the device

Select J-Link OpenSDA and click on OK. For more details on OpenSDA, refer to

Click on the Resume button to start program execution

4.3.4. Logging on console¶
For UART, a serial terminal application(for e.g Tera Term) on PC for VCOM
serial device needs to be configured as follows ( in Tera Term goto Setup
–> Serial port
)
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Once the program execution begins, logs are printed on the terminal(e.g. Tera Term) indicating the status of execution and test results. The ATR and the various module versions are printed followed by a SELECT-DONE after which the respective test logs are printed.