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

Failed reading sectors; BOOT_MAX_IMG_SECTORS=1024 - too small?

Hi, I have enabled DFU in my custom ble_hid_keyboard in NCS v1.6.1

when i copy the same project and placed in another name after that build successful but while running through error as

D: Event: NRF_CLOCK_EVENT_LFCLKSTARTED
D: lfclk: Clock started
*** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
I: Starting bootloader
W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=1024 - too small?
E: Image in the primary slot is not valid!
E: Unable to find bootable image

Parents
  • Hi,

    when i copy the same project and placed in another name after that build successful but while running through error as

     Can you please list the exact steps of what you did? I assume it worked before you renamed the project? And please note that it's important that you program the correct hex file when you have MCUBoot enabled: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/readme-ncs.html

  • Yes, as you said it works before the project copy and rename.

    sometimes When i do Project -> reload

    and run cmake.

    I not getting this error

    i think this error is from sdk itself

    why because i used v1.4.2  there no these king of issue.

    also found this git https://github.com/zephyrproject-rtos/zephyr/issues/24243

  • Have you found a consistent way to reproduce this, and can you verify that MCUBoot is still enabled in your project when it fails?

  • How to check that MCUBOOT is enabled

    Here i will show you the things i made

    cMake

    #
    # 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(.)
    

    prj.conf

    
    
    #CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    #BT config
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_SMP=y
    CONFIG_BT_TINYCRYPT_ECC=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    
    #Devie Name config
    CONFIG_BT_DEVICE_NAME="Glosdex Headset"
    CONFIG_BT_DEVICE_APPEARANCE=961
    
    #Device Info service config
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="Glosdex"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEEF
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    #Battery Service Config
    CONFIG_BT_BAS=y
    
    #HID config
    CONFIG_BT_HIDS=y
    CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
    CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y
    CONFIG_BT_GATT_UUID16_POOL_SIZE=40
    CONFIG_BT_GATT_CHRC_POOL_SIZE=20
    
    CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
    CONFIG_BT_CONN_CTX=y
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE1=y
    CONFIG_SERIAL=y		
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=y
    CONFIG_PRINTK=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    CONFIG_MAIN_STACK_SIZE=4096
    
    # Config logger
    CONFIG_LOG=y
    CONFIG_LOG_BUFFER_SIZE=2048
    CONFIG_LOG_PRINTK=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y
    
    # Clock configuration
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    
    # I2C Enable
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    
    # NFC configuration
    CONFIG_NFC_OOB_PAIRING=n
    
    # Pair Keys
    CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
    
    # Optimize for debug
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    # Added
    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    CONFIG_BT_USER_PHY_UPDATE=y
    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
    
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_ATT_PREPARE_COUNT=2
    CONFIG_BT_CONN_TX_MAX=10
    CONFIG_BT_L2CAP_TX_BUF_COUNT=10
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
    CONFIG_BT_CTLR_PHY_2M=y
    CONFIG_BT_CTLR_RX_BUFFERS=2
    CONFIG_BT_BUF_ACL_TX_COUNT=10
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    
    # 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_MCUBOOT_UTIL_LOG_LEVEL_WRN=y

    in child_image/mcuboot.conf

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    #CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP=0
    #CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF=0
    CONFIG_BOOT_SWAP_USING_SCRATCH=y
    CONFIG_BOOT_MAX_IMG_SECTORS=1024
    
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_LOG_OVERRIDE_LEVEL=4

Reply
  • How to check that MCUBOOT is enabled

    Here i will show you the things i made

    cMake

    #
    # 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(.)
    

    prj.conf

    
    
    #CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    #BT config
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_MAX_CONN=2
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_SMP=y
    CONFIG_BT_TINYCRYPT_ECC=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=5
    CONFIG_BT_PERIPHERAL=y
    
    #Devie Name config
    CONFIG_BT_DEVICE_NAME="Glosdex Headset"
    CONFIG_BT_DEVICE_APPEARANCE=961
    
    #Device Info service config
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=y
    CONFIG_BT_DIS_MANUF="Glosdex"
    CONFIG_BT_DIS_PNP_VID_SRC=2
    CONFIG_BT_DIS_PNP_VID=0x1915
    CONFIG_BT_DIS_PNP_PID=0xEEEF
    CONFIG_BT_DIS_PNP_VER=0x0100
    
    #Battery Service Config
    CONFIG_BT_BAS=y
    
    #HID config
    CONFIG_BT_HIDS=y
    CONFIG_BT_HIDS_MAX_CLIENT_COUNT=1
    CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y
    CONFIG_BT_GATT_UUID16_POOL_SIZE=40
    CONFIG_BT_GATT_CHRC_POOL_SIZE=20
    
    CONFIG_BT_LL_SOFTDEVICE_DEFAULT=y
    CONFIG_BT_CONN_CTX=y
    
    # Enable the NUS service
    CONFIG_BT_NUS=y
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y
    
    # Enable DK LED and Buttons library
    CONFIG_DK_LIBRARY=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE1=y
    CONFIG_SERIAL=y		
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=y
    CONFIG_PRINTK=y
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    CONFIG_MAIN_STACK_SIZE=4096
    
    # Config logger
    CONFIG_LOG=y
    CONFIG_LOG_BUFFER_SIZE=2048
    CONFIG_LOG_PRINTK=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y
    
    # Clock configuration
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    
    # I2C Enable
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    
    # NFC configuration
    CONFIG_NFC_OOB_PAIRING=n
    
    # Pair Keys
    CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
    
    # Optimize for debug
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    # Added
    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    CONFIG_BT_USER_PHY_UPDATE=y
    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
    
    CONFIG_BT_BUF_ACL_RX_SIZE=251
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_ATT_PREPARE_COUNT=2
    CONFIG_BT_CONN_TX_MAX=10
    CONFIG_BT_L2CAP_TX_BUF_COUNT=10
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
    CONFIG_BT_CTLR_PHY_2M=y
    CONFIG_BT_CTLR_RX_BUFFERS=2
    CONFIG_BT_BUF_ACL_TX_COUNT=10
    CONFIG_BT_BUF_ACL_TX_SIZE=251
    CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
    
    # 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_MCUBOOT_UTIL_LOG_LEVEL_WRN=y

    in child_image/mcuboot.conf

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y
    #CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP=0
    #CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_TEMP_DIFF=0
    CONFIG_BOOT_SWAP_USING_SCRATCH=y
    CONFIG_BOOT_MAX_IMG_SECTORS=1024
    
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_LOG_OVERRIDE_LEVEL=4

Children
No Data
Related