AM263x MCU+ SDK  09.00.00
HSM Services Example

Introduction

This example demonstrates the use of HSM services.

Three services are available.

  1. UID is a unique identifier for each device. It can be extracted using get uid service.
  2. HSM get version service serves the client with TIFS-MCU version information.
  3. HSM set firewall service is used to configure MPU firewall regions.

Supported Combinations

Parameter Value
CPU + OS r5fss0_0 nortos
Toolchain ti-arm-clang
Boards am263x-cc
Example folder /examples/hsm_client/hsm_services/

Steps to Run the Example

Via SBL_qspi bootloader

Build sbl_qspi

cd ~/ti/mcu_plus_sdk
make -s -C examples/drivers/boot/sbl_qspi/am263x-cc/r5fss0-0_nortos/ti-arm-clang/ all DEVICE=am263x

Build sbl_uart_uniflash

cd ~/ti/mcu_plus_sdk
make -s -C examples/drivers/boot/sbl_uart_uniflash/am263x-cc/r5fss0-0_nortos/ti-arm-clang/ all DEVICE=am263x

Edit default_sbl_qspi.cfg to include the correct images

  • Example config file.
#-----------------------------------------------------------------------------#
# #
# DEFAULT CONFIGURATION FILE TO BE USED WITH THE FLASHWRITER SCRIPT #
# #
#-----------------------------------------------------------------------------#
#
# By default this config file,
# - points to pre-built flash writer, bootloader for this EVM
# - The application image points to relative path of the ipc echo application image for this EVM
# - Make sure this application is built before running this script
# - You can customized this config file to point to your own bootloader and/or application images
# - You can use --operation=flashverify if you just want to verify the flash contents and not flash the file.
#
# First point to sbl_uart_uniflash binary, which function's as a server to flash one or more files
--flash-writer=sbl_prebuilt/am263x-cc/sbl_uart_uniflash.release.tiimage
# Now send one or more files to flash or flashverify as needed. The order of sending files does not matter
# When sending bootloader make sure to flash at offset 0x0. ROM expects bootloader at offset 0x0
--file=sbl_prebuilt/am263x-cc/sbl_qspi.release.tiimage --operation=flash --flash-offset=0x0
# When sending application image, make sure to flash at offset 0x80000 (default) or to whatever offset your bootloader is configured for
--file=../../examples/drivers/hsmclient/hsm_services/am263x-cc/r5fss0-0_nortos/ti-arm-clang/hsm_services.release.appimage --operation=flash --flash-offset=0x80000

Sample output

On successful boot, following message will be seen on terminal.

[HSM_CLIENT] New Client Registered with Client Id = 0
Starting QSPI Bootloader ...
[BOOTLOADER_PROFILE] Boot Media : NOR SPI FLASH
[BOOTLOADER_PROFILE] Boot Media Clock : 80.000 MHz
[BOOTLOADER_PROFILE] Boot Image Size : 0 KB
[BOOTLOADER_PROFILE] Cores present :
r5f0-0
[BOOTLOADER PROFILE] System_init : 290us
[BOOTLOADER PROFILE] Drivers_open : 75us
[BOOTLOADER PROFILE] LoadHsmRtFw : 14518us
[BOOTLOADER PROFILE] Board_driversOpen : 2971us
[BOOTLOADER PROFILE] CPU load : 130us
[BOOTLOADER_PROFILE] SBL Total Time Taken : 17987us
Image loading done, switching to application ...
[HSM_CLIENT] New Client Registered with Client Id = 2
[HSM CLIENT] Sending UID Request to HSM Server..
[HSM CLIENT] Device UID Suceessfully retrived from the HSM Server.
[HSM CLIENT_PROFILE] Time taken by GetUID Request : 84us
[HSM CLIENT] Device UID is : 06D3BF416160CDD6DDF8CB8D7DEE63DFB42EDFE805726C0DE705D76CC586BD03E18B601A6D5854C810CBD00
[HSM CLIENT] TIFS-MCU Information
[Soc Type] = AM263x
[Device Type] = HS-FS
[HSM Type] = HSM_V1
[Bin Type] = STANDARD
[TIFS-MCU Version] = 9.0.0
Firewall request status = 11111111 11111111
Firewall Id = 12
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 13
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 14
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 15
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 16
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 17
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall request status = 11111111 11111111
Firewall Id = 8
Firewall region number = 0
Start Address = 0x72000400
End Address = 0x720007ff
Aid Config = 0xe0
Supervisor Read = 0
Supervisor Write = 0
Supervisor Execute = 0
User Read = 0
User Write = 0
User Execute = 0
Non Secure Access = 1
Emulation = 1

Set board for UART boot

See EVM setup

Load image

Power cycle and load image via xmodem (teraterm/minicom, baud rate 115200bps)

Sample Output

On successful boot, following message will be seen on terminal. Please note that the R5F application has not been side-loaded yet.

[HSM_CLIENT] New Client Registered with Client Id = 2
[HSM CLIENT] Sending UID Request to HSM Server..
[HSM CLIENT] Device UID Suceessfully retrived from the HSM Server.
[HSM CLIENT_PROFILE] Time taken by GetUID Request : 84us
[HSM CLIENT] Device UID is : 06D3BF416160CDD6DDF8CB8D7DEE63DFB42EDFE805726C0DE705D76CC586BD03E18B601A6D5854C810CBD00
[HSM CLIENT] TIFS-MCU Information
[Soc Type] = AM263x
[Device Type] = HS-FS
[HSM Type] = HSM_V1
[Bin Type] = STANDARD
[TIFS-MCU Version] = 9.0.0
Firewall request status = 11111111 11111111
Firewall Id = 12
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 13
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 14
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 15
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 16
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall Id = 17
Firewall region number = 2
Start Address = 0x502f0000
End Address = 0x502f0fff
Aid Config = 0x10
Supervisor Read = 1
Supervisor Write = 1
Supervisor Execute = 1
User Read = 1
User Write = 1
User Execute = 1
Non Secure Access = 1
Emulation = 1
Firewall request status = 11111111 11111111
Firewall Id = 8
Firewall region number = 0
Start Address = 0x72000400
End Address = 0x720007ff
Aid Config = 0xe0
Supervisor Read = 0
Supervisor Write = 0
Supervisor Execute = 0
User Read = 0
User Write = 0
User Execute = 0
Non Secure Access = 1
Emulation = 1
HSM_V1
#define HSM_V1
HSM Version flag.
Definition: hsmclient_utils.h:77