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

Secure Bootloader and repeated flash storage in NCS v1.4.2

Hi,

1.  I have implement DFU example without private key (open bootloader !) . How to implement secure bootloader for NCS .

2.  when i use the DFU with hid_keyboard the Flash storage starts at 0xFE000, and every restart device the DFU* setup alone write 32bytes at every power resets. how to control it

  • Hey Sunil

    1. Please check out the Bootloader and DFU App development page which should take you through how you can create your own either Immutable or Upgradable secure bootloader.

    2. It sounds like you're overlapping data for the bootloader and application. I think you have stored the bootloader at this address, and then you're trying to store data from the application over the same addresses. You need to modify where your application stores data to not overlap the DFU region.

    Best regards,

    Simon

  • I am unable to debug with bootloader.

    and also I have a problem that

    the custom board .dts file i have mentioned flash storage at 0xF5000 and assign only 3 pages 0x3000

    without bootloader the application runs in 0xF5000 but when added Bootloader address moved to 0xFE000

    why and how it is possible.

    2. without bootloader i have controlled the multiple times CCCD updates in flash storage and settings pages . but with adding bootloader can't able to debug where the flash is written and not able to control the address start

  • Hey Sunil

    I'm sorry, but what address specifically moved from F5000 to FE000? Is this where the flash data is stored? I'm guessing it is moved to a free place because the bootloader takes up that space when you add it. I would recommend moving where you store flash data to somewhere that is not affected by the bootloader instead though, maybe further "down" in the flash storage, so that the "top" of flash memory is kept for the bootloader.

    2. Can you explain how exactly you've added the bootloader? Are you adding a secure or an immutable bootloader to your application?

    Best regards,

    Simon

  • Hi Simon, I have created new ticket https://devzone.nordicsemi.com/f/nordic-q-a/78838/flash-storage-unable-to-write-and-read-1024-and-2048-bytes

    as clearly

    1. The adding DFU the starting address moved from F5000 / F8000 to FE000  and uses 2 pages to store pairing data and ble settings . but i can't able to write my own data

    2. for bootloader i used

    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
    #include <tinycbor/cbor.h>
    #include "cborattr/cborattr.h"
    #include <mgmt/mgmt.h>
    #include <mgmt/mcumgr/smp_bt.h>
    #include <mgmt/mcumgr/buf.h>
    #include <mgmt/mcumgr/smp.h>
    #include "os_mgmt/os_mgmt.h"
    #include "os_mgmt/os_mgmt_impl.h"
    #include "os_mgmt/os_mgmt_config.h"
    #include "img_mgmt/image.h"
    #include "img_mgmt/img_mgmt.h"
    #include "img_mgmt/img_mgmt_impl.h"
    #include "img_mgmt/img_mgmt_config.h"
    
    ...
    ...
    void main()
    {
    ..
    ...
     // For FOTA
            os_mgmt_register_group();
            img_mgmt_register_group();
            smp_bt_register();
            for(;;)
            {
            }
    }

Related