Partition Manager failing with MCUBoot after enabling signed images

Hello! I've tried really hard to do my homework on this issue, and while I found a lot of similar issues I haven't been able to figure out just how it applies to my configuration and project.

I am starting from a point where I have MCUBoot + SMP DFU working (with two images slots), along with a static NVS partition set up in `pm_static.yml'. I believe the partition manager handles allocating the rest of the space. I have a `child_image/mcuboot.conf' that is being recognized as well. I am using an NRF52 DK / nrf52832.

I added the following to child_image/mcuboot.conf to attempt to enable image signing (the partition size was there already and working fine).

# Set minimum 0x1000 aligned size
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x8000

# Enable bootloader signature
CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y
CONFIG_PCD=y

Based on this ticket ( CMake warning: Using default MCUBoot key, it should not be used for production.) I added the following to my app CMakeLists

# Configure MCUBOOT key location
set(mcuboot_key_file ${CMAKE_CURRENT_LIST_DIR}/ssum_sign.pem)
set(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE "\"${mcuboot_key_file}\"")

The above appears to work, since this appears in my build output:

MCUBoot bootloader key file: /*******************************/app/ssum_sign.pem
-- Configuring done
-- Generating done
-- Build files have been written to: /*******************************/app/build_release/mcuboot
=== child image mcuboot -  end ===

When I run a build after adding the above, I get the following error:

=== child image mcuboot -  end ===

-- Found partition manager static configuration: /*********/*********/app/pm_static.yml
Traceback (most recent call last):
  File "/*********/nrf/scripts/partition_manager.py", line 2045, in <module>
    main()
  File "/*********/nrf/scripts/partition_manager.py", line 1034, in main
    solution.update(solve_region(pm_config, region, region_config,
  File "/*********/nrf/scripts/partition_manager.py", line 977, in solve_region
    get_region_config(partitions, region_config, static_partitions, system_reqs=pm_config)
  File "/*********/nrf/scripts/partition_manager.py", line 764, in get_region_config
    solve_complex_region(pm_config, start, size, placement_strategy, region_name, device, static_conf, dp, system_reqs)
  File "/*********/nrf/scripts/partition_manager.py", line 872, in solve_complex_region
    set_addresses_and_align(pm_config, sub_partitions, solution, free_size, dp, start=start, system_reqs=system_reqs)
  File "/*********/nrf/scripts/partition_manager.py", line 422, in set_addresses_and_align
    reqs[dp]['size'] = dynamic_partitions_size(reqs, size, dp)
  File "/*********/nrf/scripts/partition_manager.py", line 393, in dynamic_partitions_size
    size = total_size - sum([req['size'] for name, req in reqs.items() if 'size' in req.keys() and name != dp])
TypeError: unsupported operand type(s) for +: 'int' and 'str'
CMake Error at /*********/nrf/cmake/partition_manager.cmake:323 (message):
  Partition Manager failed, aborting.  Command:
  /opt/nordic/ncs/toolchains/20d68df7e5/opt/[email protected]/bin/python3.9;/*********/nrf/scripts/partition_manager.py;--input-files;/*********/*********/app/build_release/mcuboot/zephyr/include/generated/pm.yml;/*********/*********/app/build_release/mcuboot/modules/nrf/subsys/partition_manager/pm.yml.pcd;/*********/*********/app/build_release/zephyr/include/generated/pm.yml;/*********/*********/app/build_release/modules/nrf/subsys/partition_manager/pm.yml.settings;--regions;sram_primary;flash_primary;--output-partitions;/*********/*********/app/build_release/partitions.yml;--output-regions;/*********/*********/app/build_release/regions.yml;--static-config;/*********/*********/app/pm_static.yml;--sram_primary-size;0x10000;--sram_primary-base-address;0x20000000;--sram_primary-placement-strategy;complex;--sram_primary-dynamic-partition;sram_primary;--flash_primary-size;0x80000;--flash_primary-base-address;0x0;--flash_primary-placement-strategy;complex;--flash_primary-device;flash_controller;--flash_primary-default-driver-kconfig;CONFIG_SOC_FLASH_NRF
Call Stack (most recent call first):
  /*********/zephyr/cmake/modules/kernel.cmake:248 (include)
  /*********/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
  /*********/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  /*********/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:13 (find_package)

Here are my other settings:

pm_static.yml:

nvs_storage:
  address: 0x7C000
  end_address: 0x80000
  region: flash_primary
  size: 0x4000

Excerpt from prf.conf:

# Bootloader
CONFIG_MCUMGR=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_MCUMGR_TRANSPORT_BT=y
CONFIG_DK_LIBRARY=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y

I have read through a lot of other tickets. These in particular seemed relevant but I wasn't able to resolve my issue with any of them

Exact error ->  nRF Connect SDK 2.3.0: Partition Manager Fails with thingy91_nrf9160_ns board but they were using TFM, which is not applicable to my build

Related to application -  MCUBoot private key on nrf5340dk 

For kicks, I did take the partition.yml file generated before making these changes and try to stick it in pm_static.yml, but I ended up with the same error.

Thank you!

Related