Enabling Secure Boot

Introduction

This document provides a step-by-step guide to configure any SDK example to support secure boot (signed binaries). The SDK supports two types of signing:

  1. ROM Signing (SIGNED_ROM) — Application signed with ROM key. This application is secure booted by device ROM. e.g MCUBoot based bootloader is signed using SIGNED_ROM.

  2. MCUBoot Signing (SIGNED_MCUBOOT) — Application signed with MCUBoot key. This application is secure booted by MCUBoot based bootloader.

There are two approaches to enable secure boot

  1. Using CCS Project

  2. Using CMake build

Note

am13e230x is used as the device name in many commands and paths below. Replace with other supported device names based on the device you are using.

Secure Boot Prerequisites

Before enabling secure boot on your application:

  1. Device must be in HSSE state - Keys must be provisioned via CyberShield Toolkit (see Security Overview for details)

  2. CyberShield Toolkit installed - pip install tools/<device>/cybershield_toolkit-x.x.x.whl

  3. TI ARM CLANG toolchain - Secure boot is currently supported with TI ARM CLANG only

  4. Signing key available - Key must match one of the provisioned keys on the device

Secure Boot Flow using Device ROM (ROM Signing)

Once the device is in HSSE state, secure boot is enabled:

  1. Device ROM boots and validates the application signature

  2. Application binary’s CMAC signature is verified against stored OTP key

  3. If signature is valid, application executes normally

  4. If signature is invalid or missing, boot fails and device does not execute application

In this boot flow, ROM signing is used,

  • This corresponds to the ReleaseSignedROM config in the examples/security/security_empty CCS projectspec

  • This corresponds to the SIGNED_ROM TARGET_TYPES in the examples/security/security_empty CMakelists.txt

Secure Boot Flow and Firmware Update using MCUBoot (MCUBoot Signing)

Overview

MCUBoot is the secure bootloader that validates application signatures and enables in-field firmware updates without requiring a debugger. The SDK integrates a customized MCUBoot 2.4.0 with two key features:

  1. CMAC-based image authentication — Applications are signed and verified using AES-CMAC-128 instead of RSA/ECDSA. This key is compiled directly into the bootloader, not provisioned via OTP keys.

  2. Direct XIP boot strategy — The bootloader executes images directly from flash (no copying at boot), using hardware flash bank swapping to switch between images.

In this boot flow, MCUBoot signing is used,

  • This corresponds to the ReleaseSignedMCUBOOT config in the examples/security/security_empty CCS projectspec

  • This corresponds to the SIGNED_MCUBOOT TARGET_TYPES in the examples/security/security_empty CMakelists.txt

Flash Layout

The device flash is organized as two banks that can be swapped in hardware:

Region

Address Range

Size

Bank

Bootloader

0x00000000 – 0x0000FFFF

64 KB

Bank 0

Primary slot

0x00010000 – 0x0003FFFF

192 KB

Bank 0

Reserved

0x00040000 – 0x0004FFFF

64 KB

Bank 1

Secondary slot

0x00050000 – 0x0007FFFF

192 KB

Bank 1

The application entry point is always fixed at 0x00010100 (primary slot + 32-byte header), regardless of which physical bank is mapped. After a bank swap, the secondary image becomes accessible through the primary slot’s address range.

Secure Boot Flow

On every reset, the MCUBoot based bootloader validates both image slots:

  1. Reads the image header and TLV trailer from primary and secondary slots

  2. Verifies each image’s AES-CMAC-128 signature against the key built into the bootloader

  3. Selects the validly-signed image with the higher version number

  4. If the selected image is in the secondary slot, triggers a hardware flash bank swap

  5. Configures the processor to start at the fixed entry address and hands off control to the application

  6. If neither image passes authentication, the bootloader halts and the application does not run

Boot behavior:

  • Successful boot is silent — no LED or log output from bootloader; control passes to the application

  • If both images fail authentication, the bootloader enters an infinite loop; a validly-signed image must be reprogrammed before the device will boot again

  • On HSSE devices: the boot manager itself must be signed via the ROM signing flow so the device ROM can validate it before handing off control

Secure Firmware Update Flow

The MCUBoot Firmware Update example (examples\security\mcuboot_fw_update) demonstrates replacing firmware while the application runs:

  1. A new firmware image is signed offline with the same fixed key built into the bootloader

  2. The image is transferred to the running application over UART using fixed-size packets

  3. The application buffers data and writes it directly to the secondary slot without disrupting its own execution from the primary slot

  4. Once complete, the application verifies the transfer against a checksum (this checks transport corruption only; the bootloader performs full AES-CMAC-128 validation on the next reset)

  5. On the next reset, the boot manager re-validates both slots and selects the new image if it is validly signed and has a higher version number than the currently active image

  6. If version check passes, a flash bank swap activates the new image; otherwise, the current image continues to boot

Important: Simply completing a firmware transfer does not activate the new firmware. Activation only happens on the next reset if the boot manager considers the new image both validly signed and newer than the currently running version. If the new image’s version number is not higher, the device keeps booting the current image even though the transfer reported success.

Firmware Update Protocol

Firmware is exchanged over UART using fixed-size 262-byte command packets and 5-byte acknowledgement packets. All checksums are CRC16 (CCITT, polynomial 0x1021, initial value 0x0000).

Packet types:

Type

Purpose

START

Begin transfer with total image size and expected checksum

DATA

Send up to 256 bytes of image data

END

Confirm completion; device verifies packet count and checksum

PING

Query device update state without side effects

Update states:

State

Meaning

Idle

No transfer in progress

Ready

Transfer started; waiting for image data

Downloading

Receiving and writing data to flash

Complete

Full image received and checksum verified

Error

Transfer failed; send new START packet to retry

Each DATA packet is acknowledged individually. If a checksum, sequence, or flash write error occurs at any step, or if packet count does not match, the device moves to Error state. A fresh START packet can be sent at any time to restart.

Status LED during update:

Update State

LED Behavior

Idle

Off

Ready / Downloading

Slow blink

Error

Fast blink

Complete

Solid on

Example Applications

Two examples work together to demonstrate the complete MCUBoot flow:

  1. MCUBoot Boot Manager (examples\security\mcuboot_boot_manager) — The secure bootloader; runs in the Bootloader region (0x00000000). On HSSE devices, must be signed via the ROM signing flow

  2. MCUBoot Firmware Update (examples\security\mcuboot_fw_update) — Runs as the application in the primary slot; receives new images over UART and stages them in the secondary slot.

Typical First Run

  1. Build and program the MCUBoot Boot Manager (signed on HSSE, unsigned on HSFS) at 0x00000000

  2. Build, sign (via MCUBoot signing, and program the MCUBoot Firmware Update example at 0x00010000

  3. Reset; the boot manager validates and boots the application (heartbeat LED confirms success)

  4. Build a second version with a higher version number, sign it, and send over UART:

    # .py located at examples\security\mcuboot_fw_update
    python mcuboot_fw_update_host.py --file app_v2_signed.bin --port {/dev/ttyUSBx in Linux or COMxx in Windows}
    
  5. Reset again; the boot manager finds the new, higher-versioned image, authenticates it, swaps banks, and boots it

CCS Project Configuration

This section describes how to enable secure boot for Code Composer Studio (CCS) projects with support for both ROM signing and MCUBoot signing. You have two options:

Use secure_empty project as reference

For a complete and automated setup, refer to the examples/security/security_empty example’s example.projectspec file. This file contains all the secure boot configuration for both ROM and MCUBoot signing that you can adapt for your own examples.

Manual configuration of a CCS project

Follow the steps below to manually configure your project for the signing type you need (ROM or MCUBoot).

Step 1: Import the Project in CCS

First, ensure that your project is imported in Code Composer Studio (CCS):

  1. Open Code Composer Studio

  2. Go to File → Import projects

  3. Navigate to your project directory and select it

  4. Click Finish to import the project into your workspace

Step 2: Update the Linker Command File

Replace the contents of your project’s linker command file (.cmd) with the appropriate linker command file from the SDK based on your signing type

For ROM Signing
<SDK_PATH>/ti_sdk_config/am13e230x/default/linker_m33_ti_arm_clang_signed_rom.cmd
For MCUBoot Signing
<SDK_PATH>/ti_sdk_config/am13e230x/default/linker_m33_ti_arm_clang_signed_mcuboot.cmd

Each linker script includes the necessary sections (.header and .trailer) for its respective signing type with the appropriate sizes.

Step 3: Add Signature Header and Trailer Definitions

Add the signature header and trailer definitions to your application source code. These are placeholder sections that will be filled with actual signature data during the post-build process. Choose the appropriate code for your signing type.

For ROM Signing

Add the following code to your application (e.g., in main.c or a dedicated app_cfg.h):

#ifdef ENABLE_SIGNING_ROM
const uint8_t App_SignatureHeader[128U] __attribute__((section(".header"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual header binary */
};

const uint8_t App_SignatureTrailer[44U] __attribute__((section(".trailer"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual trailer binary */
};
#endif
For MCUBoot Signing

Add the following code to your application:

#ifdef ENABLE_SIGNING_MCUBOOT
const uint8_t App_SignatureHeader[32U] __attribute__((section(".header"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual header binary */
};

const uint8_t App_SignatureTrailer[24U] __attribute__((section(".trailer"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual trailer binary */
};
#endif

Key points:

  • ROM signing: Header = 128 bytes, Trailer = 44 bytes

  • MCUBoot signing: Header = 32 bytes, Trailer = 24 bytes

  • Each signing type has its own preprocessor guard: ENABLE_SIGNING_ROM or ENABLE_SIGNING_MCUBOOT

  • Signature header and trailer are placed in dedicated sections (.header and .trailer) via __attribute__((section(...)))

  • The used attribute ensures the symbols are preserved by the compiler

  • These placeholders will be replaced with actual signature data during the post-build signing process

Step 4: Configure Post-Build Steps in CCS

Add the post-build steps to your CCS project to sign the binary. The SDK provides a Makefile that handles the signing process for each type. You can use either the development session or a custom session with keys.

  1. Right-click on your project in CCS

  2. Select Properties → Build → Steps → Post-build steps

  3. Add the appropriate post-build command for your signing type and key source:

For ROM Signing with Development Session:

$(MAKE) -f ${COM_TI_AM13E230X_SDK_INSTALL_DIR}/make/ti_cst_sign_binary.mk sign-rom \
  ELF_FILE=${ProjName}.out DEVICE=AM13E230x CG_TOOL_ROOT=${CG_TOOL_ROOT} KEY_INDEX=1

For ROM Signing with Custom Session:

$(MAKE) -f ${COM_TI_AM13E230X_SDK_INSTALL_DIR}/make/ti_cst_sign_binary.mk sign-rom \
  ELF_FILE=${ProjName}.out DEVICE=AM13E230x CG_TOOL_ROOT=${CG_TOOL_ROOT} \
  KEY_INDEX=1 SESSION=my_session SESSION_PASSWORD=my_password

For MCUBoot Signing with Development Session:

$(MAKE) -f ${COM_TI_AM13E230X_SDK_INSTALL_DIR}/make/ti_cst_sign_binary.mk sign-mcuboot \
  ELF_FILE=${ProjName}.out DEVICE=AM13E230x CG_TOOL_ROOT=${CG_TOOL_ROOT} KEY_INDEX=1

For MCUBoot Signing with Custom Session:

$(MAKE) -f ${COM_TI_AM13E230X_SDK_INSTALL_DIR}/make/ti_cst_sign_binary.mk sign-mcuboot \
  ELF_FILE=${ProjName}.out DEVICE=AM13E230x CG_TOOL_ROOT=${CG_TOOL_ROOT} \
  KEY_INDEX=1 SESSION=my_session SESSION_PASSWORD=my_password

Setting the image version (optional):

Append ROM_IMG_VERSION or MCUBOOT_IMG_VERSION to the post-build command of the matching signing type. These can be combined with SESSION and SESSION_PASSWORD. For example:

$(MAKE) -f ${COM_TI_AM13E230X_SDK_INSTALL_DIR}/make/ti_cst_sign_binary.mk sign-rom \
  ELF_FILE=${ProjName}.out DEVICE=AM13E230x CG_TOOL_ROOT=${CG_TOOL_ROOT} KEY_INDEX=1 ROM_IMG_VERSION=2
$(MAKE) -f ${COM_TI_AM13E230X_SDK_INSTALL_DIR}/make/ti_cst_sign_binary.mk sign-mcuboot \
  ELF_FILE=${ProjName}.out DEVICE=AM13E230x CG_TOOL_ROOT=${CG_TOOL_ROOT} KEY_INDEX=1 MCUBOOT_IMG_VERSION=1.2

Makefile Variables:

  • ${COM_TI_AM13E230X_SDK_INSTALL_DIR} — CCS variable pointing to the SDK installation directory (CCS variable, auto-set)

  • ${ProjName} — Your project name (CCS variable, auto-set)

  • ${CG_TOOL_ROOT} — Compiler toolchain path (CCS variable, auto-set)

  • sign-rom or sign-mcuboot — Makefile target for the respective signing type

  • DEVICE=AM13E230x — Device identifier

  • ELF_FILE — Path to the output ELF file to be signed (CCS variable, auto-set)

  • KEY_INDEX — Key slot number (1-4) to use for signing (default 1)

  • ROM_IMG_VERSION — (Optional) Image version for sign-rom, integer 1-4 (default 1)

  • MCUBOOT_IMG_VERSION — (Optional) Image version for sign-mcuboot, dotted version such as 1.0 (default 1.0)

  • SESSION — (Optional) Custom session name; if omitted, development session is used

  • SESSION_PASSWORD — (Optional) Custom session password; required only if SESSION is provided

Post-build step explanation:

The Makefile (ti_cst_sign_binary.mk) automates the entire signing process:

  1. Determines key source — Uses development session if SESSION is not provided, otherwise uses custom session

  2. Extracts binary — Removes header and trailer sections from the ELF file

  3. Generates signature — Creates appropriate header and trailer files based on signing type:

  4. Embeds signature — Inserts the generated header and trailer into the ELF file

  5. Produces signed binary — Final signed .out file ready for device programming

Step 5: Build the Project

Once you have configured the post-build steps:

  1. Right-click on your project in CCS

  2. Select Build Project (or use Project → Build Project from the menu)

  3. The build will compile your application and automatically run the post-build steps to sign the binary

  4. Upon successful completion, your signed binary will be available at the project output location

Build Output

The post-build steps will generate the following files based on signing type:

For ROM Signing:

  • <project_name>.bin - The extracted binary (intermediate)

  • rom_header.bin - The generated ROM signature header

  • rom_trailer.bin - The generated ROM signature trailer

  • <project_name>.out - The final ROM-signed executable with header and trailer embedded

For MCUBoot Signing:

  • <project_name>.bin - The extracted binary (intermediate)

  • mcuboot_header.bin - The generated MCUBoot signature header

  • mcuboot_trailer.bin - The generated MCUBoot signature trailer

  • <project_name>.out - The final MCUBoot-signed executable with header and trailer embedded

Step 6: Program the Signed Image to Device

After building the project with signing enabled, program the signed binary to the device using CCS Flash Plugin:

  1. Right-click on your project in CCS

  2. Select Debug Project

  3. Once the debugger connects to the device, the signed .out file will be automatically loaded

  4. Alternatively, use Run → Debug Project from the menu to load and run the signed image

CMake Based Build Configuration

This section describes how to enable secure boot for CMake-based builds.

Use secure_empty CMakeLists.txt as reference

For a complete and automated setup, refer to the examples/security/security_empty example’s am13e230x_lp/m33_nortos/CMakeLists.txt file. This file contains all the secure boot configuration for both ROM and MCUBoot signing that you can adapt for your own examples.

Manual configuration of a CMakeLists.txt

Step 1: Update CMakeLists.txt

Modify the CMakeLists.txt file in your example’s directory (e.g., am13e230x_lp/m33_nortos/CMakeLists.txt) to support building signed targets.

Replace the existing target setup with a loop that builds unsigned and both signing variants (ROM and/or MCUBoot):

#
# TI_SDK_SIGN_SESSION empty => --dev-session is used.
#
set(TI_SDK_SIGN_KEY_INDEX
    "1"
    CACHE STRING "Key index used for signing")
set(TI_SDK_SIGN_ROM_IMG_VERSION
    "1"
    CACHE STRING "Image version used for ROM signing (integer 1-4)")
set(TI_SDK_SIGN_MCUBOOT_IMG_VERSION
    "1.0"
    CACHE STRING "Image version used for MCUBOOT signing")
set(TI_SDK_SIGN_SESSION
    ""
    CACHE STRING "Signing session name, empty uses --dev-session")
set(TI_SDK_SIGN_SESSION_PASSWORD
    ""
    CACHE STRING "Signing session password")
set(SIGN_ARGS_ROM
    KEY_INDEX
    ${TI_SDK_SIGN_KEY_INDEX}
    IMG_VERSION
    ${TI_SDK_SIGN_ROM_IMG_VERSION}
    SESSION
    "${TI_SDK_SIGN_SESSION}"
    SESSION_PASSWORD
    "${TI_SDK_SIGN_SESSION_PASSWORD}")
set(SIGN_ARGS_MCUBOOT
    KEY_INDEX
    ${TI_SDK_SIGN_KEY_INDEX}
    IMG_VERSION
    ${TI_SDK_SIGN_MCUBOOT_IMG_VERSION}
    SESSION
    "${TI_SDK_SIGN_SESSION}"
    SESSION_PASSWORD
    "${TI_SDK_SIGN_SESSION_PASSWORD}")

#
# Loop to build unsigned, ROM-signed, and MCUBoot-signed targets
#
set(TI_SDK_CONFIG ti_sdk_cfg_default)
set(TARGET_TYPES UNSIGNED SIGNED_ROM SIGNED_MCUBOOT)

foreach(TARGET_TYPE IN LISTS TARGET_TYPES)

    if(TARGET_TYPE STREQUAL "UNSIGNED")
        set(TARGET ex_<example_name>_<board>)

        get_target_property(LINKER_SCRIPT ${TI_SDK_CONFIG} LINKER_SCRIPT_DEFAULT)
    elseif(TARGET_TYPE STREQUAL "SIGNED_ROM")
        set(TARGET ex_<example_name>_<board>_signed_rom)

        get_target_property(LINKER_SCRIPT ${TI_SDK_CONFIG} LINKER_SCRIPT_DEFAULT_SIGNED_ROM)
        if(NOT EXISTS ${LINKER_SCRIPT})
            # if linker script is not found, then ROM signing is not supported and we skip
            continue()
        endif()
    elseif(TARGET_TYPE STREQUAL "SIGNED_MCUBOOT")
        set(TARGET ex_<example_name>_<board>_signed_mcuboot)

        get_target_property(LINKER_SCRIPT ${TI_SDK_CONFIG} LINKER_SCRIPT_DEFAULT_SIGNED_MCUBOOT)
        if(NOT EXISTS ${LINKER_SCRIPT})
            # if linker script is not found, then MCUBoot signing is not supported and we skip
            continue()
        endif()
    endif()

    add_executable(${TARGET})

    #
    # ... regular cmake commands to add source files, includes, link libraries, syscfg files, ...
    #

    if(TARGET_TYPE STREQUAL "SIGNED_ROM")
        target_compile_definitions(${TARGET} PRIVATE ENABLE_SIGNING_ROM)
        ti_sdk_sign_executable(${TARGET} ROM ${SIGN_ARGS_ROM})
    endif()
    if(TARGET_TYPE STREQUAL "SIGNED_MCUBOOT")
        target_compile_definitions(${TARGET} PRIVATE ENABLE_SIGNING_MCUBOOT)
        ti_sdk_sign_executable(${TARGET} MCUBOOT ${SIGN_ARGS_MCUBOOT})
    endif()

endforeach()
#
# End loop to build unsigned, ROM-signed, and MCUBoot-signed targets
#

Key points:

  • Replace <example_name> with your example name (e.g., gpio_output_toggle)

  • Replace <board> with your board variant (e.g., lp, som)

  • TARGET_TYPES defines which binaries to build. The loop supports:

    • UNSIGNED — Standard unsigned binary

    • SIGNED_ROM — Application signed with ROM key

    • SIGNED_MCUBOOT — Application signed with MCUBoot key

  • Each signing type uses its own linker script:

    • ROM signing: LINKER_SCRIPT_DEFAULT_SIGNED_ROM

    • MCUBoot signing: LINKER_SCRIPT_DEFAULT_SIGNED_MCUBOOT

  • Compile definitions enable signing-specific code:

    • ENABLE_SIGNING_ROM for ROM-signed builds

    • ENABLE_SIGNING_MCUBOOT for MCUBoot-signed builds

    • Use #ifdef ENABLE_SIGNING_ROM or #ifdef ENABLE_SIGNING_MCUBOOT in source code

  • ti_sdk_sign_executable(${TARGET} ROM ${SIGN_ARGS_ROM}) and ti_sdk_sign_executable(${TARGET} MCUBOOT ${SIGN_ARGS_MCUBOOT}) handle respective signing

  • Signing parameters are CMake cache variables and can be overridden at configure time with -D<NAME>=<value>:

    • TI_SDK_SIGN_KEY_INDEX — Key index used for signing (default 1)

    • TI_SDK_SIGN_ROM_IMG_VERSION — Image version for ROM signing, integer 1-4 (default 1)

    • TI_SDK_SIGN_MCUBOOT_IMG_VERSION — Image version for MCUBoot signing (default 1.0)

    • TI_SDK_SIGN_SESSION — Signing session name; when empty, --dev-session is used

    • TI_SDK_SIGN_SESSION_PASSWORD — Signing session password

  • If a linker script is unavailable for a signing type, that target is skipped with continue()

Step 2: Add Signature Header and Trailer Definitions

Add the signature header and trailer definitions to your application. You can place these in any convenient location:

  • In a dedicated header file (e.g., app_cfg.h)

  • Directly in main.c

  • In an existing board-specific header file

  • In any other source file that is built into your binary

Implementation for ROM Signing:

#ifdef ENABLE_SIGNING_ROM
const uint8_t App_SignatureHeader[128U] __attribute__((section(".header"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual header binary */
};

const uint8_t App_SignatureTrailer[44U] __attribute__((section(".trailer"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual trailer binary */
};
#endif

Implementation for MCUBoot Signing:

#ifdef ENABLE_SIGNING_MCUBOOT
const uint8_t App_SignatureHeader[32U] __attribute__((section(".header"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual header binary */
};

const uint8_t App_SignatureTrailer[24U] __attribute__((section(".trailer"), used)) = {
    0x00U /* Dummy initialization — will be updated with actual trailer binary */
};
#endif

Key points:

  • ROM signing uses different header/trailer sizes than MCUBoot signing:

    • ROM: Header = 128 bytes, Trailer = 44 bytes

    • MCUBoot: Header = 32 bytes, Trailer = 24 bytes

  • Each signing type has its own #ifdef guard: ENABLE_SIGNING_ROM or ENABLE_SIGNING_MCUBOOT

  • The header and trailer are placed in dedicated sections (.header and .trailer)

  • These placeholders will be filled with actual signature data during the signing process

  • The __attribute__((section(".header"), used)) ensures the symbols are preserved and placed correctly

Generated Targets

After building your CMake project, the following targets will be generated:

  • Unsigned target: ex_<example_name>_<board> (e.g., ex_gpio_output_toggle_lp)

  • ROM-signed target: ex_<example_name>_<board>_signed_rom (e.g., ex_gpio_output_toggle_lp_signed_rom)

  • MCUBoot-signed target: ex_<example_name>_<board>_signed_mcuboot (e.g. ex_gpio_output_toggle_lp_signed_mcuboot)

Each signed target will only be created if the appropriate signed linker script is available for that signing type.

Step 3: Load Signed Image to Device

After building the signed target, load the image to the device using CCS manual flash programming:

If you need to program the signed image manually without debugging:

  1. Select the appropriate device configuration (CCXML file)

  2. Right-click on the CCXML file and click Start Project-less Debug

  3. Right-click on the CORTEX_M33 core and click Connect

  4. Go to Run → Load → Load Program

  5. Click Browse and select the signed .out file from the build directory:

    • Release build: build/am13e230x/m33_ti_arm_clang_release/

    • Debug build: build/am13e230x/m33_ti_arm_clang_debug/

  6. Click OK to flash the signed image to the device