Run a demo using Keil MDK/μVision

This section describes the steps required to build, run, and debug example applications provided in the MCUXpresso SDK.

Install CMSIS device pack

After the MDK tools are installed, Cortex Microcontroller Software Interface Standard (CMSIS) device packs must be installed to fully support the device from a debug perspective. These packs include things such as memory map information, register definitions, and flash programming algorithms. Follow these steps to install the appropriate CMSIS pack.

  1. Open the MDK IDE, which is called μVision. In the IDE, select the Pack Installer icon.

  2. After the installation finishes, close the Pack Installer window and return to the μVision IDE.

Build an example application

  1. Open the desired example application workspace in:

    <install_dir>/boards/<board_name>/<example_type>/<application_name>/mdk
    

    The workspace file is named as <demo_name>.uvmpw. For this specific example, the actual path is:

  2. To build the demo project, select Rebuild, highlighted in red.

  3. The build completes without errors.

Run an example application

To download and run the application, perform these steps:

  1. Ensure the host driver for the debugger firmware has been installed. See On-board debugger.

  2. Connect the development platform to your PC via USB cable using USB connector.

  3. Open the terminal application on the PC, such as PuTTY or TeraTerm and connect to the debug serial port number (to determine the COM port number, see How to determine COM port. Configure the terminal with these settings:

    1. 115200 or 9600 baud rate, depending on your board (reference BOARD_DEBUG_UART_BAUDRATE variable in the board.h file)

    2. No parity

    3. 8 data bits

    4. 1 stop bit

  4. In μVision, after the application is built, click the Download button to download the application to the target.

  5. After clicking the Download button, the application downloads to the target and is running. To debug the application, click the Start/Stop Debug Session button, highlighted in red.

  6. Run the code by clicking the Run button to start the application.

    The hello_world application is now running and a banner is displayed on the terminal. If this does not appear, check your terminal settings and connections.

Build a multicore example application

This section describes the steps to build and run a dual-core application. The demo applications workspace files are located in this folder:

<install_dir>/boards/<board_name>/multicore_examples/<application_name>/<core_type>/mdk

Begin with a simple dual-core version of the Hello World application. The multicore Hello World Keil MSDK/μVision workspaces are located in this folder:

<install_dir>/boards/lpcxpresso54114/multicore_examples/hello_world/cm0plus/mdk/hello_world_cm0plus.uvmpw
<install_dir>/boards/lpcxpresso54114/multicore_examples/hello_world/cm4/mdk/hello_world_cm4.uvmpw

Build both applications separately by clicking the Rebuild button. Build the application for the auxiliary core (cm0plus) first because the primary core application project (cm4) must know the auxiliary core application binary when running the linker. It is not possible to finish the primary core linker when the auxiliary core application binary is not ready.

Run a multicore example application

The primary core debugger flashes both the primary and the auxiliary core applications into the SoC flash memory. To download and run the multicore application, switch to the primary core application project and perform steps 1 – 5 as described in Run an example application. These steps are common for both single-core and dual-core applications in μVision.

Both the primary and the auxiliary image is loaded into the device flash memory. After clicking the “Run” button, the primary core application is executed. During the primary core code execution, the auxiliary core is released from the reset. The hello_world multicore application is now running and a banner is displayed on the terminal. If this does not appear, check your terminal settings and connections.

An LED controlled by the auxiliary core starts flashing indicating that the auxiliary core has been released from the reset and is running correctly.

Attach the running application of the auxiliary core by opening the auxiliary core project in the second μVision instance and clicking the “Start/Stop Debug Session” button. After this, the second debug session is opened and the auxiliary core application can be debugged.

Arm describes multicore debugging using the NXP LPC54114 Cortex-M4/M0+ dual-core processor and Keil uVision IDE in Application Note 318 at www.keil.com/appnotes/docs/apnt_318.asp. The associated video can be found here.

Build a TrustZone example application

This section describes the particular steps that must be done in order to build and run a TrustZone application. The demo applications workspace files are located in this folder:

<install_dir>/boards/<board_name>/trustzone_examples/<application_name>/<application_name>_ns/mdk
<install_dir>/boards/<board_name>/trustzone_examples/<application_name>/<application_name>_s/mdk

Begin with a simple TrustZone version of the Hello World application. The TrustZone Hello World Keil MSDK/μVision workspaces are located in this folder:

<install_dir>/boards/<board_name>/trustzone_examples/hello_world/hello_world_ns/mdk/hello_world_ns.uvmpw
<install_dir>/boards/<board_name>/trustzone_examples/hello_world/hello_world_s/mdk/hello_world_s.uvmpw
<install_dir>/boards/<board_name>/trustzone_examples/hello_world/hello_world_s/mdk/hello_world.uvmpw

This project hello_world.uvmpw contains both secure and non-secure projects in one workspace and it allows the user to easily transition from one project to another.

Build both applications separately by clicking Rebuild. It is requested to build the application for the secure project first, because the non-secure project must know the secure project since CMSE library is running the linker. It is not possible to finish the non-secure project linker with the secure project because CMSE library is not ready.

Run a TrustZone example application

The secure project is configured to download both secure and non-secure output files so debugging can be fully managed from the secure project.

To download and run the TrustZone application, switch to the secure application project and perform steps as described in Run an example application. These steps are common for single core, dual-core, and TrustZone applications in μVision. After clicking Download and Debug, both the secure and non-secure images are loaded into the device flash memory, and the secure application is executed. It stops at the main() function.

Run the code by clicking Run to start the application.

The hello_world application is now running and a banner is displayed on the terminal. If not, check your terminal settings and connections.