Arm® TrustZone® Technology Getting Started Application on PIC32CK SG01: Step 1

Last modified by Microchip on 2024/03/26 10:31

  

Create an MPLAB® Harmony v3 Arm® TrustZone® Technology Project using MPLAB® X IDE.

Select File > New Project from the main MPLAB X IDE menu.

Open a new project

Information

Note: Close all existing opened projects before you start creating a new project.

In the Categories pane of the New Project dialog, select Microchip Embedded.

In the Projects pane, select Application Project(s), then click Next.

project creation setup

Enter the Device name as follows:

Device: Select PIC32CK2051SG01144 as the target device.

Information

Note: You can select the Device Family or enter a partial device name to filter the list in Target Device to make it easier to locate the desired device.

After selecting the target device, click Next to select the compiler.

project dev name

In the Select Compiler window, select the Compiler version in the Compiler toolchains pane, expand the XC32 section, and select 
XC32 (v4.35) [C:\Program Files\Microchip\xc32\v4.35\bin].

Click Next to proceed to Select Project Name and Folder.

project compiler

In the Select Project Name and Folder window, apply the following settings:

  • Project Name: Indicates the name of the project that will be shown in MPLAB X IDE. Enter "tz_pic32ck_sg01_cult" to set the project's name.
  • Project Location: Indicates the path to the root folder of the new project. All project files will be placed inside this folder. The project location can be any valid path, for example: C:\mchp_harmony_v3\dev\getting_started_tz_pic32ck_sg01_cult\firmware

project path setup

Information

Note: The Project Folder is read-only. It will update as you make changes to the entries.

After selecting the Project Name and Folder, click Finish to launch MPLAB Code Configurator (MCC).

The MCC plugin’s main window for the project will be displayed as shown in the accompanying image.

Launched MCC View

Before proceeding, set up the Device Family Pack (DFP) and Compiler toolchain for both the Secure and Non-Secure projects. 

Note: The Application is built and developed using PIC32CK-SG_DFP version 1.2.161. Please use PIC32CK-SG_DFP version 1.2.161 or above to build this application. If you need help regarding the DFP versions, kindly contact Microchip Sales.

  • Click on the Projects tab on the top left pane in MPLAB X IDE. Right-click on the project name tz_pic32ck_sg01_cult.

Go to Set Configuration and click on the Customize...

nonsecure project view

  • Check that XC32 (v4.35) is selected as the Compiler Toolchain for XC32 and select the PIC32CK-SG_DFP package 1.2.161.
  • Click on Apply and then click on OK.

xc32 setup

  • Click the Projects tab on the top left pane in MPLAB X IDE. Right-click on the project name tz_pic32ck_sg01_cult_Secure.
  • Go to Set Configuration and click on the Customize...

secure project view

  • Make sure that XC32 (v4.35) is selected as the Compiler Toolchain for XC32 and select the PIC32CK-SG_DFP package 1.2.161.
  • Click on Apply and then click on OK.

secure xc32 setup

Tool Tip:

  • Make sure to select the same DFP package and XC32 compiler version for both the Secure and Non-Secure projects.
  • If you closed MCC accidentally and would like to open it again, go to Tools > Embedded > MPLAB Code Configurator v5: Open/Close in MPLAB X IDE.

Back to Top


Verify Clock Settings

Launch Clock Easy View by going to the Project Graph tab in MPLAB X IDE and then select Plugins > Clock Configuration.

Open the Clock Configuration menu

A new window, Clock Easy View, is opened inside MCC.

Click the Clock Easy View tab, scroll to the right, and verify that the Main Clock is set to 120 MHz.

Clock Easy View window

Back to Top


Configure Secure and Non-Secure Peripherals

Launch Arm TrustZone for Armv8-M by going to the Project Graph tab in MPLAB X IDE and then select Plugins > Arm TrustZone for Armv8-M.

Tools > TrustZone-M Manager menu

A new window, Arm TrustZone for Armv8-M, is opened inside MCC.

Click the Peripheral Configuration tab to configure Peripherals to run in Secure and Non-Secure mode.

TrustZone-M Manager window

Default PIC32CK SG01 Peripheral Configuration.

Information

Tool Tip:

  • Click on peripherals to change from Secure (Green in color) to Non-Secure (Orange in color) vice-versa.

As per the project design, configure DMA0 and SERCOM5 as NonSecure Peripherals.

TrustZone-M Manager window

Back to Top


Verify Secure and Non-Secure Memory Regions

Click on the Memory Configuration tab to verify the default Memory Configuration.

memory configuration tab

Back to Top