Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Partition Manager for External Memory doesn't create correctly the partitions.

Hello,


   I created the regions.yml and pm_static.yml. If I enable this flag the compiler works well

but doesn't create the correct partitions I wrote on pm_static.

##CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL=y

  If I uncomment, these errors appears:


-- Found partition manager static configuration: C:/Nordic/peripheral_uart/pm_static.yml
Dropping partition 'nonsecure_storage' since it is empty.
Traceback (most recent call last):
  File "C:/ncs/v2.3.0-rc1/nrf/scripts/partition_manager.py", line 1978, in <module>
    main()
  File "C:/ncs/v2.3.0-rc1/nrf/scripts/partition_manager.py", line 1028, in main
    solution.update(solve_region(pm_config, region, region_config,
  File "C:/ncs/v2.3.0-rc1/nrf/scripts/partition_manager.py", line 971, in solve_region
    get_region_config(partitions, region_config, static_partitions, system_reqs=pm_config)
  File "C:/ncs/v2.3.0-rc1/nrf/scripts/partition_manager.py", line 742, in get_region_config
    solve_simple_region(pm_config, start, size, placement_strategy, region_name, device,
  File "C:/ncs/v2.3.0-rc1/nrf/scripts/partition_manager.py", line 790, in solve_simple_region
    address += pm_config[partition_name]['size']
KeyError: 'size'
CMake Error at C:/ncs/v2.3.0-rc1/nrf/cmake/partition_manager.cmake:304 (message):
  Partition Manager failed, aborting.

   Could you help me?

Thanks,

Flavio.

  

file app.overlay

/{
   
    chosen {
        nordic,nus-uart = &uart0;
        nordic,pm-ext-flash = &mx25r64;
        nordic,nrf-adc  = &adc;
    };

    aliases {
        adc = &adc;
        dg0 = &dig0;
        dg1 = &dig1;
        dg2 = &dig2;
        dg3 = &dig3;
        dg4 = &dig4;
    };
file prj.conf

CONFIG_NORDIC_QSPI_NOR=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=1024

CONFIG_SETTINGS_NVS=y

CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_PARTITION_MANAGER_ENABLED=y

CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL=y
CONFIG_PM_PARTITION_REGION_NVS_STORAGE_EXTERNAL=y


file regions.yml
external_flash:
  base_address: 0x0
  default_driver_kconfig: CONFIG_PM_EXTERNAL_FLASH_HAS_DRIVER
  device: DT_CHOSEN(nordic_pm_ext_flash)
  dynamic_partition: null
  name: external_flash
  placement_strategy: start_to_end
  size: 0x800000
file pm_static.yml
partition_1:
  address: 0x0
  end_address: 0x7FFFFF
  region: external_flash
  size: 0x800000
Created by build:
file regions.yml
external_flash:
  base_address: 0x0
  default_driver_kconfig: CONFIG_PM_EXTERNAL_FLASH_HAS_DRIVER
  device: DT_CHOSEN(nordic_pm_ext_flash)
  dynamic_partition: null
  name: external_flash
  placement_strategy: start_to_end
  size: 0x800000
flash_primary:
  base_address: 0x0
  default_driver_kconfig: CONFIG_SOC_FLASH_NRF
  device: flash_controller
  dynamic_partition: null
  name: flash_primary
  placement_strategy: complex
  size: 0x100000
file partitions.yml
app:
  address: 0x8000
  end_address: 0xfc000
  region: flash_primary
  size: 0xf4000
external_flash:
  address: 0x0
  end_address: 0x800000
  region: external_flash
  size: 0x800000
nonsecure_storage:
  address: 0xfc000
  end_address: 0xfe000
  orig_span: &id001
  - settings_storage
  region: flash_primary
  size: 0x2000
  span: *id001
  • I'm having the same problem.

    Traceback (most recent call last):
      File "/home/eetnev/git/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 1978, in <module>
        main()
      File "/home/eetnev/git/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 1028, in main
        solution.update(solve_region(pm_config, region, region_config,
      File "/home/eetnev/git/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 971, in solve_region
        get_region_config(partitions, region_config, static_partitions, system_reqs=pm_config)
      File "/home/eetnev/git/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 742, in get_region_config
        solve_simple_region(pm_config, start, size, placement_strategy, region_name, device,
      File "/home/eetnev/git/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 790, in solve_simple_region
        address += pm_config[partition_name]['size']
    KeyError: 'size'

    I changed pm.yml.settings as  described and now I'm getting:

    v2.3.0/nrf/modules/tfm/tfm/boards/common/assert.c:17:2: error: #error "TF-M non-secure address start is not aligned on SPU region size"

    Which relates to this.

  • Hello 3Nigma,

        With this patch you created worked fine.  Now is building without any error. I have some difficulties in understand why is creating automaticly the partition "external-flash". I defined on pm-static.yml other partitions but the builder create only the partition external-flash.

    Thanks,

    Flavio.

  • Hello Eetu,

        It's not easy to put to work. I couldn't find examples.Unfortunately the explanation on Nordic web site is not clear.

  • Hey Flavio,

    I will look into your issue more carefully and come back to you, hopefully, with some feedback (if you don't find the solution in the meantime).

    Take care,

    V

  • Flavio,

    I think I understand better what's happening. The short version is that, if you rename your pm-static.yml file to pm_static.yml and remove the line "ncs_add_partition_manager_config(pm-static.yml)" from your CMakeLists.txt, your static definitions will be picked up by the partition-manager  The partition-manager will then complain that the partitions aren't properly defined -- I'll let you investigate the cause of this.

    The longer answer to this is that ncs_add_partition_manager_config doesn't have effect after calling "find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})". That's because, by the time cmake executes your "ncs_add_partition_manager_config " function call, it has already executed the partition-manager script with whatever it had at its disposal.

    Just as a FYI: in order to investigate this, I added a couple of cmake message statements:

    1. "message(STATUS "Found zephyr!!!")" after your "project(NONE)" line
    2. another one in <nrf>/subsys/partition_manager/CMakeLists.txt (line 155) that reads: "
      message(STATUS "PM_SUBSYS_PATHS is ${PM_SUBSYS_PATHS}")"

    And, sure enough, after I ran "west build", I saw the "PM_SUBSYS_PATHS is..." message BEFORE the "Found zephyr!!!" one!

    If you still want to use the non-standard pm-static.yml file name, you can do a "set(PM_STATIC_YML_FILE "C:/Nordic/peripheral_uart/pm-static.yml")" just before the "find_package(Zephyr ...)" call in your CMakeLists.txt file as described in the nrf docs.

    I hope this helps,

    Best wishes,

    V

Related