Arm® TrustZone® Technology Getting Started Application on PIC32CM LS60: Step 1

Last modified by Microchip on 2024/06/26 15:06

  

Create an MPLAB® Harmony v3 with Arm® TrustZone® technology project using MPLAB® X IDE.

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

Open a new project

Figure 1

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

Figure 2

Enter the Device name as follows:

Device: Select PIC32CM5164LS60100 as the target device.

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

Figure 3

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

Click Next to proceed to Select Project Name and Folder.

project compiler

Figure 4

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_pic32cm_ls60_cpro" 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_h3\dev\pic32cm_ls60_cpro_tz_getting_started\firmware
project path setup

Figure 5

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

Figure 6

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

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

Figure 7

  • Check that XC32 (v4.40) is selected as the Compiler Toolchain for XC32 and select the PIC32CM-LS_DFP package 1.3.278.
  • Click on Apply and then click OK.
xc32 setup

Figure 8

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

Figure 9

  • Make sure that XC32 (v4.40) is selected as the Compiler Toolchain for XC32 and select the PIC32CM-LS_DFP package 1.3.278.
  • Click on Apply and then click on OK.
secure xc32 setup

Figure 10

Tool Tip:

  • Make sure to select the same DFP package and MPLAB 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

Figure 11

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 48 MHz.

clock configuration setup

Figure 12

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

Figure 13

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

Figure 14

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 DMAC and SERCOM3 as NonSecure Peripherals.

TrustZone-M Manager window

Figure 15

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

Figure 16

Back to Top