This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

secure bootloader in NCS v1.6.1

Hi,

I am trying to implement FOTA in my application. I can implement non secure bootloader and run successful

in prj.conf

# Added for FOTA
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_SMP_BT=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n

in main.c

// For FOTA
#ifdef CONFIG_MCUMGR_CMD_FS_MGMT
#include <device.h>
#include <fs/fs.h>
#include "fs_mgmt/fs_mgmt.h"
#include <fs/littlefs.h>
#endif
#ifdef CONFIG_MCUMGR_CMD_OS_MGMT
#include "os_mgmt/os_mgmt.h"
#endif
#ifdef CONFIG_MCUMGR_CMD_IMG_MGMT
#include "img_mgmt/img_mgmt.h"
#endif
#ifdef CONFIG_MCUMGR_CMD_STAT_MGMT
#include "stat_mgmt/stat_mgmt.h"
#endif
#ifdef CONFIG_MCUMGR_SMP_BT
#include "mgmt\mcumgr\smp_bt.h"
#endif
#ifdef CONFIG_MCUMGR_CMD_SHELL_MGMT
#include "shell_mgmt/shell_mgmt.h"
#endif
#ifdef CONFIG_MCUMGR_CMD_FS_MGMT
#include "fs_mgmt/fs_mgmt.h"
#endif
...


void main() {
....

.....
...
...

    // For FOTA
        os_mgmt_register_group();
        img_mgmt_register_group();
        smp_bt_register();
    while(1)
    {
    ...
    }
}

And Now I am need to add secure bootloader

generate priv.pem and placed in

and added these line extra in prj.conf

CONFIG_SECURE_BOOT=y
CONFIG_SB_SIGNING_KEY_FILE="priv.pem"

but project getting failed

how to add secure bootloader to our project

and also

How to use Single slot bank instead of using Dual banking

Parents
  • Hi Sunil, 

    See this tutorial. You need the following configuration:

    CONFIG_SECURE_BOOT=y
    CONFIG_BUILD_S1_VARIANT=y
    CONFIG_FW_INFO=y
    CONFIG_FW_INFO_FIRMWARE_VERSION=1
    CONFIG_SB_SIGNING_KEY_FILE="priv.pem"

    You could do serial dfu within the bootloader itself. Otherwise, it has to be "dual banked"

    Regards,
    Amanda

  • does anything i need to change in cMakelist.txt

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    cmake_minimum_required(VERSION 3.13.1)
    list(APPEND mcuboot_OVERLAY_CONFIG
      "${CMAKE_CURRENT_SOURCE_DIR}/child_image/mcuboot.conf"
      )
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(NONE)
    # bt_services/*.c MLX90393/*.c NFC/*.c
    FILE(GLOB app_sources src/*.c ../driverSource/bt_services/*.c ../driverSource/MLX90393/*.c ../driverSource/NFC/*.c)
    # NORDIC SDK APP START
    target_sources(app PRIVATE ${app_sources})
    # NORDIC SDK APP END
    
    zephyr_library_include_directories(.)
    

Reply
  • does anything i need to change in cMakelist.txt

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    cmake_minimum_required(VERSION 3.13.1)
    list(APPEND mcuboot_OVERLAY_CONFIG
      "${CMAKE_CURRENT_SOURCE_DIR}/child_image/mcuboot.conf"
      )
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(NONE)
    # bt_services/*.c MLX90393/*.c NFC/*.c
    FILE(GLOB app_sources src/*.c ../driverSource/bt_services/*.c ../driverSource/MLX90393/*.c ../driverSource/NFC/*.c)
    # NORDIC SDK APP START
    target_sources(app PRIVATE ${app_sources})
    # NORDIC SDK APP END
    
    zephyr_library_include_directories(.)
    

Children
No Data
Related