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

ncs1.6.0 ota problem b0 or (immutable MCUboot)

Hello 

I want to test ncs ota function. b0 module following this link.

ncs1.6.0 

borad:nrf52840dk_nrf52840

projece: ncs/zephyr/samples/hello_world

1. b0 + spm test.

prj.conf

# nothing here
CONFIG_SECURE_BOOT=y

CONFIG_MCUMGR=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y

CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n

copy ncs/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c to  ncs/zephyr/samples/hello_world/src

copy ncs/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/src/common.h to  ncs/zephyr/samples/hello_world/src

Change CMakeLists.txt

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hello_world)

target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/bluetooth.c )
Change main.c
/*
 * Copyright (c) 2012-2014 Wind River Systems, Inc.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr.h>
#include <sys/printk.h>

#include "os_mgmt/os_mgmt.h"
#include "img_mgmt/img_mgmt.h"
#include "mgmt/mcumgr/smp_bt.h"

#include "common.h"

void main(void)
{
	os_mgmt_register_group();
	img_mgmt_register_group();
	smp_bt_register();
	start_smp_bluetooth();
	printk("Hello World! %s\n", CONFIG_BOARD);
}

I can't build it without problems.

I notised that  CONFIG_BOOTLOADER_MCUBOOT=y need configed but I don't want to test MCUBoot, so I go to the next step adding MCUboot as an immutable bootloader.

2.adding MCUboot as an immutable bootloader

Change the first step prj.conf 

# nothing here
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_MCUMGR_SMP_BT_AUTHEN=n

Copy ncs/zephyr/samples/hello_world/build/zephyr/app_update.bin to android app nRF Connect,But I can't update it below is the video.

Thank you.

Parents Reply
  • If you want to do this, then you can refer to the nRF Desktop projects that use B0 only to see how that is done. You need to adjust your prj.conf as well as your main.c. It is also covered briefly in this tutorial.

    Specifically, for B0 you need the following configuration (adapt key path):

    CONFIG_SECURE_BOOT=y
    CONFIG_BUILD_S1_VARIANT=y
    CONFIG_FW_INFO=y
    CONFIG_FW_INFO_FIRMWARE_VERSION=1
    CONFIG_SB_SIGNING_KEY_FILE="path/to/key.pem"

    However, you would also need to remove the mcumgr related code and add something similar to what is in nrf\applications\nrf_desktop\src\modules\dfu.c (which is added to the nRF Desktop projects by the Kconfig CONFIG_DESKTOP_CONFIG_CHANNEL_DFU_ENABLE configuration to handle the DFU process.

Children
Related