nRF9160dk FOTA using external flash, ncs 2.0.2

Hi, 

I am using nRf9160dk with mcuboot secondary image on external flash base on AZURE_FOTA example, ncs 2.0.2.

Found the bootloader cannot runs primary image.

So, I need advice on how to set up the mcuboot secondary with SPI flash.

*** Booting Zephyr OS build v3.0.99-ncs1-1  ***
I: Starting bootloader
W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
E: Image in the primary slot is not valid!
E: Unable to find bootable image

Checked the partition with west build -t partition_manager_report .

+------------------------------------------+
| 0x0: external_flash (0x800000 - 8192kB)  |
| 0x0: mcuboot_secondary (0x70000 - 448kB) |
+------------------------------------------+

  flash_primary (0x100000 - 1024kB):
+--------------------------------------------------+
| 0x0: mcuboot (0xc000 - 48kB)                     |
| 0xc000: EMPTY_0 (0x4000 - 16kB)                  |
+---0x10000: mcuboot_primary (0xe8000 - 928kB)-----+
+---0x10000: tfm_secure (0xc200 - 48kB)------------+
| 0x10000: mcuboot_pad (0x200 - 512B)              |
+---0x10200: mcuboot_primary_app (0xe7e00 - 927kB)-+
| 0x10200: tfm (0xc000 - 48kB)                     |
+---0x1c200: tfm_nonsecure (0xdbe00 - 879kB)-------+
| 0x1c200: app (0xdbe00 - 879kB)                   |
+---0xf8000: nonsecure_storage (0x8000 - 32kB)-----+
| 0xf8000: settings_storage (0x2000 - 8kB)         |
| 0xfa000: littlefs_storage (0x6000 - 24kB)        |
+--------------------------------------------------+

  otp (0x2f4 - 756B):
+------------------------------+
| 0xff8108: otp (0x2f4 - 756B) |
+------------------------------+

  sram_primary (0x40000 - 256kB):
+--------------------------------------------------+
+---0x20000000: sram_secure (0x10000 - 64kB)-------+
| 0x20000000: tfm_sram (0x10000 - 64kB)            |
+---0x20010000: sram_nonsecure (0x30000 - 192kB)---+
+---0x20010000: nrf_modem_lib_sram (0x44e8 - 17kB)-+
| 0x20010000: nrf_modem_lib_ctrl (0x4e8 - 1kB)     |
| 0x200104e8: nrf_modem_lib_tx (0x2000 - 8kB)      |
| 0x200124e8: nrf_modem_lib_rx (0x2000 - 8kB)      |
+--------------------------------------------------+
| 0x200144e8: sram_primary (0x2bb18 - 174kB)       |
+--------------------------------------------------+

My configuration as follows:

child_image\mcuboot\boards\nrf9160dk_nrf9160_mcuboot.overlay

/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};
};

&spi3 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	pinctrl-0 = <&spi3_default_alt>;
	pinctrl-1 = <&spi3_sleep_alt>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
	mx25r64: mx25r6435f@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <80000000>;
		label = "MX25R64";
		jedec-id = [c2 28 17];
		size = <67108864>;
	};
};

&pinctrl {
	spi3_default_alt: spi3_default_alt {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
				<NRF_PSEL(SPIM_MOSI, 0, 11)>,
				<NRF_PSEL(SPIM_MISO, 0, 12)>;
		};
	};

	spi3_sleep_alt: spi3_sleep_alt {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
				<NRF_PSEL(SPIM_MOSI, 0, 11)>,
				<NRF_PSEL(SPIM_MISO, 0, 12)>;
			low-power-enable;
		};
	};

};

child_image\mcuboot\prj_mcuboot.conf

CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

CONFIG_MULTITHREADING=y

# MCUboot requires a large stack size, otherwise an MPU fault will occur
CONFIG_MAIN_STACK_SIZE=10240

CONFIG_DEBUG_OPTIMIZATIONS=y

# Enable flash operations
CONFIG_FLASH=y

# This must be increased to accommodate the bigger images.
CONFIG_BOOT_MAX_IMG_SECTORS=256

nrf9160dk_nrf9160_ns.overlay

/ {
    	chosen {
    		nordic,pm-ext-flash = &mx25r64;
    	};
};

&spi3 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	pinctrl-0 = <&spi3_default_alt>;
	pinctrl-1 = <&spi3_sleep_alt>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
	mx25r64: mx25r6435f@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <80000000>;
		label = "MX25R64";
		jedec-id = [c2 28 17];
		size = <67108864>;
	};
};

&pinctrl {
	spi3_default_alt: spi3_default_alt {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
				<NRF_PSEL(SPIM_MOSI, 0, 11)>,
				<NRF_PSEL(SPIM_MISO, 0, 12)>;
		};
	};

	spi3_sleep_alt: spi3_sleep_alt {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
				<NRF_PSEL(SPIM_MOSI, 0, 11)>,
				<NRF_PSEL(SPIM_MISO, 0, 12)>;
			low-power-enable;
		};
	};

};

pm_static.yml

#include <autoconf.h>
#include <devicetree_legacy_unfixed.h>

external_flash:
  address: 0x0
  device: mx25r6435f
  region: external_flash
  size: 0x800000 
mcuboot_secondary:
  address: 0x0
  device: mx25r6435f
  region: external_flash
  size: 0x70000

prj.conf

#
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# General config
CONFIG_REBOOT=y

# Log
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_MODE_LTE_M=n
CONFIG_LTE_NETWORK_MODE_NBIOT=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

# AT Host
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_AT_HOST_LIBRARY=y

# MQTT
CONFIG_MQTT_KEEPALIVE=900

# Azure IoT Hub library
CONFIG_AZURE_IOT_HUB=y
CONFIG_AZURE_IOT_HUB_DEVICE_ID="nordic_960074368"
# Host name must be configured if DPS is not used
CONFIG_AZURE_IOT_HUB_HOSTNAME=""
# Change the security tag to the tag where relevant certificates are provisioned
CONFIG_AZURE_IOT_HUB_SEC_TAG=11
# Uncomment to get more verbose logging when debugging
# CONFIG_AZURE_IOT_HUB_LOG_LEVEL_DBG=y

# Uncomment and configure the options below to use DPS for device provisioning
CONFIG_AZURE_IOT_HUB_DPS=y
CONFIG_AZURE_IOT_HUB_DPS_ID_SCOPE="0ne0053A4FD"


# Azure FOTA
CONFIG_CJSON_LIB=y
CONFIG_AZURE_FOTA=y
CONFIG_AZURE_FOTA_APP_VERSION_AUTO=n
CONFIG_AZURE_FOTA_APP_VERSION="v0.0.1"
CONFIG_AZURE_FOTA_TLS=y
# Change the security tag to the tag where the certificates are provisioned
# for the server where the FOTA image is hosted
CONFIG_AZURE_FOTA_SEC_TAG=10
# Uncomment the below line to get more debug logging
# CONFIG_AZURE_FOTA_LOG_LEVEL_DBG=y

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=6144
CONFIG_MAIN_STACK_SIZE=1536

# Settings, needed for Azure Device Provisioning Service
CONFIG_FLASH=y
CONFIG_FCB=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n

# Modem library
CONFIG_NRF_MODEM_LIB=y

# newlibc
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# FOTA Download
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
CONFIG_AZURE_FOTA_FILE_PATH_MAX_LEN=200

# Download Client
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_INF=y
CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=2300

# DFU Target
CONFIG_DFU_TARGET=y

# Application update support
CONFIG_BOOTLOADER_MCUBOOT=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

#################################################
# Config using external flash memory and littleFS.
#################################################
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=32
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
# Need this when storage is on flash
# CONFIG_MPU_ALLOW_FLASH_WRITE=y

CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

Parents
  • Hi,

     

    child_image\mcuboot\prj_mcuboot.conf

    You have two choices wrt. configuring a child_image:

    child_image/$image.conf

    This overrides the original default configuration for the child_image.

    Or:

    Replace the default configuration by setting:

    child_image/$image/prj.conf

     

    This approach will not use the default configuration for the image, and will require larger configuration files (ie. def_config + your wanted local configs)

     

    I would recommend that you move this file to:

    child_image\mcuboot.conf

     

    child_image\mcuboot\boards\nrf9160dk_nrf9160_mcuboot.overlay

    This should be child_image\mcuboot\boards\nrf9160dk_nrf9160.overlay

     

    The algorithm here must follow the following rule:

    child_image/$image/boards/$BOARD

     

    Note that mcuboot runs in secure, so it will be "nrf9160dk_nrf9160" that is the board chosen for this child image.

     

    pm_static.yml

    You have overlapping sections in this file:

    external_flash:
      address: 0x0
      device: mx25r6435f
      region: external_flash
      size: 0x800000 
    mcuboot_secondary:
      address: 0x0
      device: mx25r6435f
      region: external_flash
      size: 0x70000

     

    You should define "external_flash" with a start address after the end_addr of mcuboot_secondary.

     

    Since you've already setup the corresponding "nordic,pm-ext-flash" section in device-tree, you can remove (or move the pm_static.yml to a backed up location) and rely on the generated build\partitions.yml file instead.

     

    Kind regards,

    Håkon

  • Hi,

    My code is struck in an infinite loop when booting the mcuboot_primary slot.

    *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000

    I am taking your advice and doing:

    I would recommend that you move this file to:

    child_image\mcuboot.conf

    Rounding the mcuboot.conf as your recommend.

    This should be child_image\mcuboot\boards\nrf9160dk_nrf9160.overlay

    This suggestion has also been implemented in my project.

    Since you've already setup the corresponding "nordic,pm-ext-flash" section in device-tree, you can remove (or move the pm_static.yml to a backed up location) and rely on the generated build\partitions.yml file instead.

    Remove pm_static.yml since I have define "nordic.pm-ext-flash"

    Could you provide me some advice and confirm my configuration from my initial post is the root cause of the issue?

Reply
  • Hi,

    My code is struck in an infinite loop when booting the mcuboot_primary slot.

    *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000

    I am taking your advice and doing:

    I would recommend that you move this file to:

    child_image\mcuboot.conf

    Rounding the mcuboot.conf as your recommend.

    This should be child_image\mcuboot\boards\nrf9160dk_nrf9160.overlay

    This suggestion has also been implemented in my project.

    Since you've already setup the corresponding "nordic,pm-ext-flash" section in device-tree, you can remove (or move the pm_static.yml to a backed up location) and rely on the generated build\partitions.yml file instead.

    Remove pm_static.yml since I have define "nordic.pm-ext-flash"

    Could you provide me some advice and confirm my configuration from my initial post is the root cause of the issue?

Children
  • Hi,

     

    Q1: Could you delete your build directory, then re-generate the project and flash again?

    This is to ensure a clean slate after changing/adding .overlay files.

    Q2: Can you share your build-folder/partitions.yml file?

     

    Kind regards,

    Håkon

  • Hi,

    A1: Already delete build directory and flash again. The result is the same, mcuboot reboot forever loop.

    A2: build-folder/partitions.yml

    EMPTY_0:
      address: 0xc000
      end_address: 0x10000
      placement:
        before:
        - mcuboot_pad
      region: flash_primary
      size: 0x4000
    EMPTY_1:
      address: 0xfa000
      end_address: 0x100000
      placement:
        after:
        - settings_storage
      region: flash_primary
      size: 0x6000
    app:
      address: 0x1c200
      end_address: 0xf8000
      region: flash_primary
      size: 0xdbe00
    external_flash:
      address: 0xe8000
      end_address: 0x800000
      region: external_flash
      size: 0x718000
    mcuboot:
      address: 0x0
      end_address: 0xc000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0x10000
      end_address: 0x10200
      placement:
        align:
          start: 0x8000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x10000
      end_address: 0xf8000
      orig_span: &id001
      - app
      - tfm
      - mcuboot_pad
      region: flash_primary
      size: 0xe8000
      span: *id001
    mcuboot_primary_app:
      address: 0x10200
      end_address: 0xf8000
      orig_span: &id002
      - app
      - tfm
      region: flash_primary
      size: 0xe7e00
      span: *id002
    mcuboot_secondary:
      address: 0x0
      device: MX25R64
      end_address: 0xe8000
      placement:
        align:
          start: 0x4
      region: external_flash
      share_size:
      - mcuboot_primary
      size: 0xe8000
    nonsecure_storage:
      address: 0xf8000
      end_address: 0xfa000
      orig_span: &id003
      - settings_storage
      region: flash_primary
      size: 0x2000
      span: *id003
    nrf_modem_lib_ctrl:
      address: 0x20010000
      end_address: 0x200104e8
      inside:
      - sram_nonsecure
      placement:
        after:
        - tfm_sram
        - start
      region: sram_primary
      size: 0x4e8
    nrf_modem_lib_rx:
      address: 0x200124e8
      end_address: 0x200144e8
      inside:
      - sram_nonsecure
      placement:
        after:
        - nrf_modem_lib_tx
      region: sram_primary
      size: 0x2000
    nrf_modem_lib_sram:
      address: 0x20010000
      end_address: 0x200144e8
      orig_span: &id004
      - nrf_modem_lib_ctrl
      - nrf_modem_lib_tx
      - nrf_modem_lib_rx
      region: sram_primary
      size: 0x44e8
      span: *id004
    nrf_modem_lib_tx:
      address: 0x200104e8
      end_address: 0x200124e8
      inside:
      - sram_nonsecure
      placement:
        after:
        - nrf_modem_lib_ctrl
      region: sram_primary
      size: 0x2000
    otp:
      address: 0xff8108
      end_address: 0xff83fc
      region: otp
      size: 0x2f4
    settings_storage:
      address: 0xf8000
      end_address: 0xfa000
      inside:
      - nonsecure_storage
      placement:
        align:
          start: 0x8000
        before:
        - end
      region: flash_primary
      size: 0x2000
    sram_nonsecure:
      address: 0x20010000
      end_address: 0x20040000
      orig_span: &id005
      - sram_primary
      - nrf_modem_lib_ctrl
      - nrf_modem_lib_tx
      - nrf_modem_lib_rx
      region: sram_primary
      size: 0x30000
      span: *id005
    sram_primary:
      address: 0x200144e8
      end_address: 0x20040000
      region: sram_primary
      size: 0x2bb18
    sram_secure:
      address: 0x20000000
      end_address: 0x20010000
      orig_span: &id006
      - tfm_sram
      region: sram_primary
      size: 0x10000
      span: *id006
    tfm:
      address: 0x10200
      end_address: 0x1c200
      inside:
      - mcuboot_primary_app
      placement:
        before:
        - app
      region: flash_primary
      size: 0xc000
    tfm_nonsecure:
      address: 0x1c200
      end_address: 0xf8000
      orig_span: &id007
      - app
      region: flash_primary
      size: 0xdbe00
      span: *id007
    tfm_secure:
      address: 0x10000
      end_address: 0x1c200
      orig_span: &id008
      - mcuboot_pad
      - tfm
      region: flash_primary
      size: 0xc200
      span: *id008
    tfm_sram:
      address: 0x20000000
      end_address: 0x20010000
      inside:
      - sram_secure
      placement:
        after:
        - start
      region: sram_primary
      size: 0x10000
    

  • Hi,

     

    I reproduced the same issue, and it is related to the trusted firmware m (tfm) module. It currently has a bug in the handling of the mcuboot secondary slot, which we are addressing with this pull-request:

    https://github.com/nrfconnect/sdk-nrf/pull/8363

     

    For now, I would recommend that you add this to your prj.conf to use SPM for the time being:

    CONFIG_BUILD_WITH_TFM=n
    CONFIG_SPM=y
    

    Could you test with this and see if this runs as expected?

     

    Kind regards,

    Håkon

  • Hi,

    I got a build error after applying your suggestion.

    Please advise. 

    [193/205] Building C object zephyr/kernel/CMakeFiles/kernel.dir/work.c.obj
    [194/205] Linking C static library zephyr\kernel\libkernel.a
    [195/205] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    cmd.exe /C "cd . && C:\ncs\toolchains\v2.0.2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=C:/Users/TDCAdmin/Workspace/azure_fota_exFlash/build/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/boards/boards/arm/nrf9160dk_nrf9160/libboards__arm__nrf9160dk_nrf9160.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/spi/libdrivers__spi.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"c:/ncs/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/thumb/v8-m.main+fp/hard"  -LC:/Users/TDCAdmin/Workspace/azure_fota_exFlash/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -no-pie  -mcpu=cortex-m33  -mthumb  -mabi=aapcs  -mfpu=fpv5-sp-d16  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  C:/ncs/v2.0.2/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_platform_0.9.14.a  C:/ncs/v2.0.2/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cmd.exe /C "cd /D C:\Users\TDCAdmin\Workspace\azure_fota_exFlash\build\mcuboot\zephyr && C:\ncs\toolchains\v2.0.2\opt\bin\cmake.exe -E echo ""
    c:/ncs/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: zephyr\zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
    c:/ncs/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.exe: region `FLASH' overflowed by 1108 bytes
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [15/287] No configure step for 'spm_subimage'
    FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf 
    cmd.exe /C "cd /D C:\Users\TDCAdmin\Workspace\azure_fota_exFlash\build\mcuboot && C:\ncs\toolchains\v2.0.2\opt\bin\cmake.exe --build . --"
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'c:\ncs\toolchains\v2.0.2\opt\bin\cmake.EXE' --build 'c:\Users\TDCAdmin\Workspace\azure_fota_exFlash\build'
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

  • It looks like mcuboot is failing to compile due to a flash overflow (ie. too large image).

    Try commenting out this line in child_image/mcuboot.conf:

    CONFIG_DEBUG_OPTIMIZATIONS=y

    Kind regards,

    Håkon

Related