Porting SE050 example to RT1060 MCU

cancel
Showing results for 
Search instead for 
Did you mean: 

Porting SE050 example to RT1060 MCU

Porting SE050 example to RT1060 MCU

Introduction

This is an exercise porting one of the SE050 examples from the NXP Secure Element Host library (se_hostlib) to another NXP MCU.  Appnote AN12448 EdgeLockTM SE050 Plug & Trust middleware porting guidelines is a great resource for porting the library to other targets.  This exercise provides additional details porting a project for MCUXpresso IDE to a different MCU.  The se_hostlib example used here is the se05x_get_info project.  The library provides this example for the RT1050 devices, and this exercise ports to the similar RT1060.  A simpler method might be to take the existing se_hostlib project, and change the device for the new target MCU, and tweak some other project settings.  But this exercise builds the ported project from scratch, to demonstrate how se_hostlib project can be created or added to another application.  NXP’s MCUXpresso IDE is used for this, but these general steps should also apply to other IDEs. 

 

The projects and software used here are included in NXP’s MCUXpresso Software Development Kit (SDK), and can be download from https://mcuxpresso.nxp.com/, using SDK version 2.7.0.  The se_hostlib is provided in the SDK package for EVKB-IMXRT1050, and the example ported is \SDK_2.7.0\boards\evkbimxrt1050\se_hostlib_examples\se_SE05x_Get_Info.  The targeted MCU for the port uses the SDK package for EVK-MIMXRT1060, and the initial project used to start the port is hello_world at \SDK_2.7.0\boards\evkmimxrt1060\demo_apps\hello_world.  MCUXpresso IDE v 11.1.1 is used in this exercise.

 

Change application source files

The hello_world demo for RT1060 is imported into MCUXpresso IDE using the default project settings.  The new project is renamed evkmimxrt1060_se_hostlib_se05x_get_info.  Then the following changes are made:

 

Removed:

Source/hello_world.c

 

Copied the following source folders from evkbimxrt1050_se_hostlib_se05x_get_info:

Doc

MbedTLS

se_hostlib

source

 

For the RT1060 app, I kept these files from hello_world:

Board

CMSIS

Component

Device

Drivers

Startup

Utilities

Xip

 

And added these additional driver files used in the RT1050 example from \SDK_2.7.0\devices\MIMXRT1062\drivers to project \evkmimxrt1060_se_hostlib_se05x_get_info\drivers

fsl_dcp.c

fsl_dcp.h

fsl_lpi2c.c

fsl_lpi2c.h

fsl_pit.c

fsl_pit.h

fsl_trng.c

fsl_trng.h

 

 Project_Files.png

Copy project preprocessor definitions

The se_hostlib uses many preprocessor definitions to configure the library.  Updated the project properties for the compiler preprocessor definitions from the RT1050 example are used, and made the following changes to the RT1060 project:

 

Added:

SDK_DEBUGCONSOLE_UART

PHDRIVER_IMXRT1050RC663_BOARD

IMX_RT

MBEDTLS_CONFIG_FILE='"a71ch_mbedtls_evkbimxrt1050_config.h"'

MBEDTLS

SCP_MODE=C_MAC_C_ENC_R_MAC_R_ENC

T1oI2C

T1oI2C_UM1225_SE050

SSS_USE_FTR_FILE

NO_SECURE_CHANNEL_SUPPORT

__NEWLIB__ (MCUXpresso IDE does this automatically with the linker changes below)

 

Changed:

PRINTF_ADVANCED_ENABLE=1

 

Removed:                                                                                                                          

__REDLIB__ (MCUXpresso IDE does this automatically with the linker changes below)

 

 Preprocessor.png

Change linker settings

Based on the preprocessor definitions above, I realized the RT1050 project used the NewLibNano runtime library in the IDE.  The linker settings were updated to change the library from RedLib to NewLibNano (this step could have been done during the SDK project import into MCUXpresso IDE).  Also the linker placement of all RAM is changed to the RT1060 SRAM_DTC region, and heap and stack sizes updated to match the RT1050 example.

 

 Linker_Settings.png

Change compiler include paths

Added the following paths for se_hostlib and mbedTLS to the compiler includes:
"${workspace_loc:/${ProjName}/mbedtls/port/ksdk}"

"${workspace_loc:/${ProjName}/se_hostlib/hostlib/hostLib/inc}"

"${workspace_loc:/${ProjName}/se_hostlib/sss/inc}"

"${workspace_loc:/${ProjName}/se_hostlib/sss/port/ksdk}"

"${workspace_loc:/${ProjName}/se_hostlib/hostlib/hostLib/platform/inc}"

"${workspace_loc:/${ProjName}/se_hostlib/hostlib/hostLib/libCommon/smCom/T1oI2C}"

"${workspace_loc:/${ProjName}/se_hostlib/hostlib/hostLib/libCommon/smCom}"

"${workspace_loc:/${ProjName}/se_hostlib/hostlib/hostLib/libCommon/infra}"

"${workspace_loc:/${ProjName}/se_hostlib/sss/ex/inc}"

"${workspace_loc:/${ProjName}/se_hostlib/sss/ex/src}"

"${workspace_loc:/${ProjName}/se_hostlib/hostlib/hostLib/se05x_03_xx_xx}"

"${workspace_loc:/${ProjName}/se_hostlib/hostlib/hostLib/mbedtls/inc}"

"${workspace_loc:/${ProjName}/se_hostlib/sss/plugin/mbedtls}"

"${workspace_loc:/${ProjName}/mbedtls/include}"

 

 Includes.png

Port macros in source code

Some of the application source configures for the RT1050 MCU using macros defined in the preprocessor settings.  This code should all apply to the RT1060 as well, but needs to be modified to use different macros.  Source updated the following in a few places.  Search for CPU_MIMXRT1052DVL6B to find these:

#ifdefined(CPU_MIMXRT1052DVL6B)

 

Changed to #if(defined(CPU_MIMXRT1052DVL6B) || defined(CPU_MIMXRT1062DVL6A))

 

In the following locations:

axReset_HostConfigure() In ax_reset.c

i2c_imxrt10xx.c

ex_ss_main_inc_imx_rt.h in the header file includes

se_reset_config.h

 

Configure RT1060 pins

To interface to the SE050, the example uses I2C peripheral and a GPIO pin for reset.  The new project needs to enable these pins in the pinmux settings, configured in pinmux.c.  Copying I2CPins() from RT1050 pinmux.c, and adding to RT1060 pinmux.c.  Then add call to I2CPins() in BOARD_InitBootPins() in pinmux.c, and add declaration of I2CPins() to pinmux.h

 

For the GPIO reset pin, the RT1050 example set the pinmux in spiPins().  Since SPI is not used, I just added this pin to the existing BOARD_InitPins().  Copy the line below from RT1050 pinmux.c, and add to BOARD_InitPins() for RT1060.

      //Reset

      IOMUXC_SetPinMux(

      IOMUXC_GPIO_AD_B0_10_GPIO1_IO10,        /* GPIO_AD_B0_10 is configured as GPIO1_IO10 */

      0U);                                    /* Software Input On Field: Input Path is determined by functionality */

 

Summary

With these changes, the RT1060 project builds without any errors or warnings, and runs on the RT1060 as documented in the readme files from the RT1050 project.  The completed ported project for RT1060 is attached here.

Labels (1)
Attachments
Version history
Revision #:
1 of 1
Last update:
‎05-27-2020 06:23 AM
Updated by: