Hello All,
I am using nrf9160 based custom board with external flash. I am trying to build an application with mcuboot, primary image in internal flash and secondary image in external flash.
Now I defined about memory layout in pm_static.yml file, where primary image will be in internal flash, secondary image & littlefs storage will be in external flash.
But even though mcuboot fail's to boot the application image.
[00:00:00.258,331] <wrn> mcuboot: Failed reading sectors; BOOT_MAX_IMG_SECTORS=2048 - too small? [00:00:00.258,331] <wrn> mcuboot: Cannot upgrade: not a compatible amount of sectors
dts file
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
w25q32jv: w25q32jv@0 {
compatible = "jedec,spi-nor";
status = "okay";
label = "W25Q32JV";
reg = <0>;
spi-max-frequency = <8000000>;
wp-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
size = <0x4000000>;
has-dpd;
t-enter-dpd = <3000>;
t-exit-dpd = <30000>;
jedec-id = [ef 40 17];
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
storage_partition: partition@0 {
label = "storage";
reg = <0x00000000 DT_SIZE_M(7)>;
};
};
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x10000>;
};
slot0_partition: partition@10000 {
label = "image-0";
};
slot0_ns_partition: partition@50000 {
label = "image-0-nonsecure";
};
slot1_partition: partition@80000 {
label = "image-1";
};
slot1_ns_partition: partition@c0000 {
label = "image-1-nonsecure";
};
scratch_partition: partition@f0000 {
label = "image-scratch";
reg = <0x000f0000 0xa000>;
};
};
};
pm_static.yml file
mcuboot: address: 0x0 size: 0x10000 region: flash_primary mcuboot_pad: address: 0x10000 size: 0x200 region: flash_primary spm: address: 0x10200 region: flash_primary size: 0xc000 app: address: 0x1c200 region: flash_primary size: 0xd3e00 mcuboot_primary: orig_span: &id001 - mcuboot_pad - spm - app span: *id001 address: 0x10000 size: 0xe0000 region: flash_primary mcuboot_primary_app: orig_span: &id002 - spm - app span: *id002 address: 0x10200 size: 0xdfe00 region: flash_primary mcuboot_secondary: address: 0x0 size: 0xe0000 device: W25Q32JV region: external_flash littlefs_storage: address: 0xe0000 device: W25Q32JV region: external_flash size: 0x720000
mcuboot.conf
CONFIG_SPEED_OPTIMIZATIONS=y # Disable memory guard to avoid false faults in application after boot CONFIG_HW_STACK_PROTECTION=n #CONFIG_SYSTEM_CLOCK_DISABLE=y CONFIG_TIMESLICING=n CONFIG_CBPRINTF_NANO=y CONFIG_MAIN_STACK_SIZE=10240 CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_BOOTSTRAP=n CONFIG_BOOT_ENCRYPT_RSA=n CONFIG_BOOT_SIGNATURE_TYPE_RSA=n CONFIG_BOOT_ECDSA_CC310=y CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y CONFIG_BOOT_SIGNATURE_KEY_FILE="root-ec-p256.pem" # Flash CONFIG_FLASH=y CONFIG_IMG_MANAGER=y CONFIG_MCUBOOT_IMG_MANAGER=y CONFIG_BOOT_ERASE_PROGRESSIVELY=y CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y # Logger CONFIG_LOG=y # External flash CONFIG_MULTITHREADING=y CONFIG_BOOT_MAX_IMG_SECTORS=2048 CONFIG_NORDIC_QSPI_NOR=n CONFIG_SPI=y CONFIG_SPI_NOR=y CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 CONFIG_SPI_NOR_SFDP_DEVICETREE=n CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=32 #CONFIG_SPI_NOR_SFDP_RUNTIME=y # Size optimization for release build CONFIG_BOOT_BANNER=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_SERIAL=y CONFIG_USE_SEGGER_RTT=n CONFIG_ERRNO=n CONFIG_PRINTK=y CONFIG_RESET_ON_FATAL_ERROR=n CONFIG_I2C=n
Any hint to set the correct partition layout and chain the application from mcuboot?