[MCU BOOT] `RAM' overflowed

Hello, 

I'm trying to implement the MCU BOOT in order to introduce the Firmware uptdate but I get the following error: 

c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: zephyr\zephyr_pre0.elf section `bss' will not fit in region `RAM'
c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: region `RAM' overflowed by 246080 bytes
collect2.exe: error: ld returned 1 exit status

I'm trying to reduce the RAM usage but with no succes.

When I build my program without the MCU BOOT I get this following build report: 

[0/418] Performing build step for 'tfm'
ninja: warning: premature end of file; recovering
[8/18] Linking C executable zephyr\zephyr_pre0.elf

[11/18] Linking C executable zephyr\zephyr_pre1.elf

[16/18] Linking C executable zephyr\zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      186748 B       256 KB     71.24%
             RAM:       51044 B        64 KB     77.89%
           SRAM1:          0 GB        64 KB      0.00%
        IDT_LIST:          0 GB         2 KB      0.00%

[401/414] Linking CXX executable zephyr\zephyr_pre0.elf

[405/414] Linking CXX executable zephyr\zephyr_pre1.elf

[411/414] Linking CXX executable zephyr\zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      240064 B       992 KB     23.63%
             RAM:       96280 B       416 KB     22.60%
        IDT_LIST:          0 GB         2 KB      0.00%

In my _cpuapp_common.dts

/ {

	reserved-memory {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		sram0_image: image@20000000 {
			/* Zephyr image(s) memory */
		};

		sram0_s: image_s@20000000 {
			/* Secure image memory */
		};

		sram0_ns: image_ns@20040000 {
			/* Non-Secure image memory */
		};
	};
};

In my cpuapp_partition_conf.dts : 

&slot0_partition {
	reg = <0x00010000 0x40000>;
};

&slot0_ns_partition {
	reg = <0x00050000 0x30000>;
};

&slot1_partition {
	reg = <0x00080000 0x40000>;
};

&slot1_ns_partition {
	reg = <0x000c0000 0x30000>;
};

&sram0_image {
	reg = <0x20000000 DT_SIZE_K(448)>;
};

&sram0_s {
	reg = <0x20000000 0x40000>;
};    

&sram0_ns {
	reg = <0x20040000 0x30000>;
};

I'm using the TF-M image for the moment (using the board file with ns at the end), I'm not quite sur to understand the use of secure and non secure partition for flash and RAM.

Is thoses partition needed even If I use only secured or only non secured image ? 

Thanks in advance.

Best regards. 
Martin

EDIT:

I have an external flash that I can use for the second image, but I've not configured the partition and the program to use it yet.

Since the error is linked to RAM I though it was not useful to implement it at the moment.

Parents
  • When not using the /ns (no TF-M) board file I can successfully build with the following output :

    [29/29] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       23142 B      34176 B     67.71%
                 RAM:        3464 B        64 KB      5.29%
               SRAM1:          0 GB        64 KB      0.00%
            IDT_LIST:          0 GB         2 KB      0.00%
    [10/26] Linking C executable zephyr\zephyr_pre0.elf
    ...
    [20/24] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      187452 B       222 KB     82.46%
                 RAM:       51044 B        64 KB     77.89%
               SRAM1:          0 GB        64 KB      0.00%
            IDT_LIST:          0 GB         2 KB      0.00%
    [21/24] Generating zephyr/app.hex
    ...
    [347/356] Linking CXX executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      201016 B     523776 B     38.38%
                 RAM:       89248 B       440 KB     19.81%
            IDT_LIST:          0 GB         2 KB      0.00%
    [348/356] Generating zephyr/mcuboot_primary.hex

    I was already using 

    CONFIG_TFM_PROFILE_TYPE_MINIMAL=y
    in the previous configuration.
  • Hi, 

    Apologies for the long response time. The case were in between a couple of engineers before it came upon my desk. 

    So first of I'm a bit curious as to what causes a RAM overflow of 240kB? What is the difference between the MCUboot and non-MCUboot versions?

    Have you seen https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-8-bootloaders-and-dfu-fota/? I would recommend that you go through this w.r.t adding MCUboot and DFU support for your device

    My current best guess at what is wrong is that you've defined the SRAM wrongly in your partitioning, maybe the region overlaps with the a secure area

    I'm not quite sur to understand the use of secure and non secure partition for flash and RAM.

    Not necessarily an answer that completely addresses your uncertainty, but anyways this is the differences between the build types:

    A secure build (nrf5340dk_nrf9160 or nrf5340dk/nrf5340/cpuapp for example) means that the application is inherently trusted and runs in the Secure Processing Environment (SPE). This means that everything in your application is trusted and there is no Security by Separation. This can be a security hazard if the user application is buggy or compromised as it can easily access sensitive data such as passwords stored in the flash memory.

    A non-secure build (nrf5340dk_nrf9160_ns or nrf5340dk/nrf5340/cpuapp/ns for example) means that the application runs in the Non-Secure Processing Environment (NSPE). In this case, two images are created: the application firmware and the Trusted Firmware M (TF-M). The TF-M runs in the Secure Processing Environment (SPE) and provides the security services needed by the application firmware. This separation ensures that security-sensitive data is in a secure processing environment and access to it is heavily restricted. The TF-M governs the access of the user application to the flash memory and handles security-related tasks, adding an extra layer of security through this separation.

    https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-3-elements-of-an-nrf-connect-sdk-application/topic/configuration-files/#multi-image-build does also go into this 

    I would recommend that you go through atleast those two lessons in these two courses and then return if you have any follow up questions. I believe that most of your uncertainties may be answered by doing so

    Kind regards,
    Andreas

  • Hello Andreas, 

    Sorry for the late response and thanks you for all the information.

    I've been through the bootloader lessons, I've tested the hello_world sample with bootloader and get the same error with my custom board.

    It seems that the partition manager is not well configurate, for my custom board.

    Note that it build well with for the nrf5340dk and that I use the nrf5340dk board file as example for my custom board.

     

    Using the Memory report I've seen that there is some difference between the two.

    nrf5340dk :

    custom board :  

    Is there a yml file or conf that I've missed ?

  • Hi,

    Are you using the same pfj.conf and overlay for these two bords? It seems to me that the nrf5340dk variant does not use it's external flash, leading me to believe that it has not been configured for the DK.

    Could you share any prj.conf and overlay files for the firmware you used for the DK?

    And are you using QSPI or SPI for external flash purposes?

    Kind regards,
    Andreas

  • Hi, 

    I've finally succeed to build the hello world samples with my board:

    The use of 

    nordic,pm-ext-flash = &mx25r64;
     and 
    &mx25r64 {
        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;
    
            lfs1_part: partition@0 {
                label = "lfs1";
                reg = <0x00000000 0x00800000>;
            };
        };
    };
     

    make the partition manager doing unwanted partitioning.

    If found out that I have to clean "by hand" my build configuration and build folder when playing with those parameters.

    But back to my project where after applying the patch explained above I get new errors see :

    === child image mcuboot -  end ===
    
    CMake Warning at C:/ncs/v2.3.0/nrf/modules/mcuboot/CMakeLists.txt:286 (message):
      
    
              ---------------------------------------------------------
              --- WARNING: Using default MCUBoot key, it should not ---
              --- be used for production.                           ---
              ---------------------------------------------------------
              
    
    
    
    -- Build type:  
    -- Host:    Windows/AMD64
    -- Target:  Generic/arm
    -- libmetal version: 1.3.0 (C:/Users/dev/dev/BPI/Concentrateur)
    -- Machine: arm
    -- open-amp version: 1.3.0 (C:/ncs/v2.3.0/modules/lib/open-amp/open-amp)
    -- Host:    Windows/AMD64
    -- Target:  Generic/arm
    -- Machine: arm
    -- C_FLAGS :  -Wall -Wextra
    Partition manager failed: The current configuration is invalid because it requires app's size to be less than 0.Unable to fulfill alignment requirement automatically.
    Please re-size the configured partition sizes to get a valid configuration.
    If you are not able to get a valid configuration either re-evaluate th e
    alignment requirements, or use 'static configuration' (see docs) to specify the
     partitioning. Note that aligning more than one partition which shares size
     with the dynamic partition (e.g. 'app')  is not supported.
    Failed to partition region flash_primary, size of region: 1048576
    Partition Configuration:
    littlefs_storage:
      placement:
        align:
          start: 16384
        before:
        - end
      size: 8388608
    mcuboot:
      placement:
        before:
        - mcuboot_primary
      size: 49152
    mcuboot_pad:
      placement:
        align:
          start: 16384
        before:
        - mcuboot_primary_app
      size: 512
    mcuboot_secondary:
      placement:
        after:
        - mcuboot_primary
        align:
          start: 16384
      size: -3694592
    tfm:
      placement:
        before:
        - app
      size: 32256
    
    CMake Error at C:/ncs/v2.3.0/nrf/cmake/partition_manager.cmake:304 (message):
      Partition Manager failed, aborting.  Command:
      C:/ncs/toolchains/v2.3.0/opt/bin/python.exe;C:/ncs/v2.3.0/nrf/scripts/partition_manager.py;--input-files;C:/Users/dev/dev/BPI/Concentrateur/build_release/mcuboot/zephyr/include/generated/pm.yml;C:/Users/dev/dev/BPI/Concentrateur/build_release/mcuboot/modules/nrf/subsys/partition_manager/pm.yml.pcd;C:/Users/dev/dev/BPI/Concentrateur/build_release/zephyr/include/generated/pm.yml;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.file_system;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.rpmsg_nrf53;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.tfm;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.trustzone;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.mcuboot;--regions;sram_primary;otp;flash_primary;--output-partitions;C:/Users/dev/dev/BPI/Concentrateur/build_release/partitions.yml;--output-regions;C:/Users/dev/dev/BPI/Concentrateur/build_release/regions.yml;--sram_primary-size;0x80000;--sram_primary-base-address;0x20000000;--sram_primary-placement-strategy;complex;--sram_primary-dynamic-partition;sram_primary;--otp-size;764;--otp-base-address;0xff8100;--otp-placement-strategy;start_to_end;--flash_primary-size;0x100000;--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):
      C:/ncs/v2.3.0/zephyr/cmake/modules/kernel.cmake:246 (include)
      C:/ncs/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:117 (include)
      C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
      CMakeLists.txt:5 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/Users/dev/dev/BPI/Concentrateur/build_release/CMakeFiles/CMakeOutput.log".
    See also "C:/Users/dev/dev/BPI/Concentrateur/build_release/CMakeFiles/CMakeError.log".
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FAILED: build.ninja 
    C:\ncs\toolchains\v2.3.0\opt\bin\cmake.exe --regenerate-during-build -SC:\Users\dev\dev\BPI\Concentrateur -BC:\Users\dev\dev\BPI\Concentrateur\build_release
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\v2.3.0\opt\bin\cmake.EXE' --build 'c:\Users\dev\dev\BPI\Concentrateur\build_release'
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

  • I'm not using any overlay since I use my custom board files.

    And yes I use QSPI external flash feature.

    #File system on external flash
    CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
    CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
    CONFIG_FCB=y
    CONFIG_PM_PARTITION_REGION_SETTINGS_STORAGE_EXTERNAL=n
    CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x00800000

    Edit:

    Since I want to use QSPI external flash I think I need to put 

            nordic,pm-ext-flash = &mx25r64;

    But I need to defined the PM behavior for this flash otherwise it use it as a image space and then I get 

    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: zephyr\zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: region `FLASH' overflowed by 4988 bytes
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    Do you have a Idea how can I do so ? 

  • So I've try using a static partition : 

    external_flash:
      address: 0x800000
      region: external_flash
      device: mx25r6435f
      size: 0x0
    littlefs_storage:
      address: 0x00000000
      region: external_flash
      device: mx25r6435f
    size: 0x00800000
    app:
      address: 0x14000
      end_address: 0x84000
      region: flash_primary
      size: 0x70000
    mcuboot:
      address: 0x0
      end_address: 0xc000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0xc000
      end_address: 0xc200
      placement:
        align:
          start: 0x4000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0xc000
      end_address: 0x84000
      orig_span: &id001
      - tfm
      - app
      - mcuboot_pad
      region: flash_primary
      sharers: 0x1
      size: 0x78000
      span: *id001
    mcuboot_primary_app:
      address: 0xc200
      end_address: 0x84000
      orig_span: &id002
      - app
      - tfm
      region: flash_primary
      size: 0x77e00
      span: *id002
    mcuboot_secondary:
      address: 0x84000
      end_address: 0xfc000
      placement:
        after:
        - mcuboot_primary
        align:
          start: 0x4000
        align_next: 0x4000
    mcuboot_sram:
      address: 0x20000000
      end_address: 0x20008000
      orig_span: &id003
      - tfm_sram
      region: sram_primary
      size: 0x8000
      span: *id003
    otp:
      address: 0xff8100
      end_address: 0xff83fc
      region: otp
      size: 0x2fc
    sram_nonsecure:
      address: 0x20008000
      end_address: 0x20080000
      orig_span: &id004
      - sram_primary
      region: sram_primary
      size: 0x78000
      span: *id004
    sram_primary:
      address: 0x20008000
      end_address: 0x20080000
      region: sram_primary
      size: 0x78000
    sram_secure:
      address: 0x20000000
      end_address: 0x20008000
      orig_span: &id005
      - tfm_sram
      region: sram_primary
      size: 0x8000
      span: *id005
    tfm:
      address: 0xc200
      end_address: 0x14000
      inside:
      - mcuboot_primary_app
      placement:
        before:
        - app
      region: flash_primary
      size: 0x7e00
    tfm_nonsecure:
      address: 0x14000
      end_address: 0x84000
      orig_span: &id006
      - app
      region: flash_primary
      size: 0x70000
      span: *id006
    tfm_secure:
      address: 0xc000
      end_address: 0x14000
      orig_span: &id007
      - mcuboot_pad
      - tfm
      region: flash_primary
      size: 0x8000
      span: *id007
    tfm_sram:
      address: 0x20000000
      end_address: 0x20008000
      inside:
      - sram_secure
      placement:
        after:
        - start
      region: sram_primary
      size: 0x8000
    

    But I get the same error : 

    -- Found partition manager static configuration: C:/Users/dev/dev/BPI/Concentrateur/pm_static.yml
    Traceback (most recent call last):
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 1978, in <module>
        main()
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 1018, in main
        static_config = load_static_configuration(args, pm_config) if args.static_config else dict()
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 980, in load_static_configuration
        fix_syntactic_sugar(static_config)
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 948, in fix_syntactic_sugar
        if 'region' not in v:
    TypeError: argument of type 'int' is not iterable
    CMake Error at C:/ncs/v2.3.0/nrf/cmake/partition_manager.cmake:304 (message):
      Partition Manager failed, aborting.  Command:
      C:/ncs/toolchains/v2.3.0/opt/bin/python.exe;C:/ncs/v2.3.0/nrf/scripts/partition_manager.py;--input-files;C:/Users/dev/dev/BPI/Concentrateur/build_release/mcuboot/zephyr/include/generated/pm.yml;C:/Users/dev/dev/BPI/Concentrateur/build_release/mcuboot/modules/nrf/subsys/partition_manager/pm.yml.pcd;C:/Users/dev/dev/BPI/Concentrateur/build_release/zephyr/include/generated/pm.yml;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.file_system;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.rpmsg_nrf53;--regions;sram_primary;otp;flash_primary;external_flash;--output-partitions;C:/Users/dev/dev/BPI/Concentrateur/build_release/partitions.yml;--output-regions;C:/Users/dev/dev/BPI/Concentrateur/build_release/regions.yml;--static-config;C:/Users/dev/dev/BPI/Concentrateur/pm_static.yml;--sram_primary-size;0x80000;--sram_primary-base-address;0x20000000;--sram_primary-placement-strategy;complex;--sram_primary-dynamic-partition;sram_primary;--otp-size;764;--otp-base-address;0xff8100;--otp-placement-strategy;start_to_end;--flash_primary-size;0x100000;--flash_primary-base-address;0x0;--flash_primary-placement-strategy;complex;--flash_primary-device;flash_controller;--flash_primary-default-driver-kconfig;CONFIG_SOC_FLASH_NRF;--external_flash-size;8388608;--external_flash-base-address;0;--external_flash-placement-strategy;start_to_end;--external_flash-device;DT_CHOSEN(nordic_pm_ext_flash);--external_flash-default-driver-kconfig;CONFIG_PM_EXTERNAL_FLASH_HAS_DRIVER
    Call Stack (most recent call first):
      C:/ncs/v2.3.0/zephyr/cmake/modules/kernel.cmake:246 (include)
      C:/ncs/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:117 (include)
      C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:5 (find_package)
    
    
    -- Configuring incomplete, errors occurred!

Reply
  • So I've try using a static partition : 

    external_flash:
      address: 0x800000
      region: external_flash
      device: mx25r6435f
      size: 0x0
    littlefs_storage:
      address: 0x00000000
      region: external_flash
      device: mx25r6435f
    size: 0x00800000
    app:
      address: 0x14000
      end_address: 0x84000
      region: flash_primary
      size: 0x70000
    mcuboot:
      address: 0x0
      end_address: 0xc000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0xc000
      end_address: 0xc200
      placement:
        align:
          start: 0x4000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0xc000
      end_address: 0x84000
      orig_span: &id001
      - tfm
      - app
      - mcuboot_pad
      region: flash_primary
      sharers: 0x1
      size: 0x78000
      span: *id001
    mcuboot_primary_app:
      address: 0xc200
      end_address: 0x84000
      orig_span: &id002
      - app
      - tfm
      region: flash_primary
      size: 0x77e00
      span: *id002
    mcuboot_secondary:
      address: 0x84000
      end_address: 0xfc000
      placement:
        after:
        - mcuboot_primary
        align:
          start: 0x4000
        align_next: 0x4000
    mcuboot_sram:
      address: 0x20000000
      end_address: 0x20008000
      orig_span: &id003
      - tfm_sram
      region: sram_primary
      size: 0x8000
      span: *id003
    otp:
      address: 0xff8100
      end_address: 0xff83fc
      region: otp
      size: 0x2fc
    sram_nonsecure:
      address: 0x20008000
      end_address: 0x20080000
      orig_span: &id004
      - sram_primary
      region: sram_primary
      size: 0x78000
      span: *id004
    sram_primary:
      address: 0x20008000
      end_address: 0x20080000
      region: sram_primary
      size: 0x78000
    sram_secure:
      address: 0x20000000
      end_address: 0x20008000
      orig_span: &id005
      - tfm_sram
      region: sram_primary
      size: 0x8000
      span: *id005
    tfm:
      address: 0xc200
      end_address: 0x14000
      inside:
      - mcuboot_primary_app
      placement:
        before:
        - app
      region: flash_primary
      size: 0x7e00
    tfm_nonsecure:
      address: 0x14000
      end_address: 0x84000
      orig_span: &id006
      - app
      region: flash_primary
      size: 0x70000
      span: *id006
    tfm_secure:
      address: 0xc000
      end_address: 0x14000
      orig_span: &id007
      - mcuboot_pad
      - tfm
      region: flash_primary
      size: 0x8000
      span: *id007
    tfm_sram:
      address: 0x20000000
      end_address: 0x20008000
      inside:
      - sram_secure
      placement:
        after:
        - start
      region: sram_primary
      size: 0x8000
    

    But I get the same error : 

    -- Found partition manager static configuration: C:/Users/dev/dev/BPI/Concentrateur/pm_static.yml
    Traceback (most recent call last):
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 1978, in <module>
        main()
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 1018, in main
        static_config = load_static_configuration(args, pm_config) if args.static_config else dict()
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 980, in load_static_configuration
        fix_syntactic_sugar(static_config)
      File "C:/ncs/v2.3.0/nrf/scripts/partition_manager.py", line 948, in fix_syntactic_sugar
        if 'region' not in v:
    TypeError: argument of type 'int' is not iterable
    CMake Error at C:/ncs/v2.3.0/nrf/cmake/partition_manager.cmake:304 (message):
      Partition Manager failed, aborting.  Command:
      C:/ncs/toolchains/v2.3.0/opt/bin/python.exe;C:/ncs/v2.3.0/nrf/scripts/partition_manager.py;--input-files;C:/Users/dev/dev/BPI/Concentrateur/build_release/mcuboot/zephyr/include/generated/pm.yml;C:/Users/dev/dev/BPI/Concentrateur/build_release/mcuboot/modules/nrf/subsys/partition_manager/pm.yml.pcd;C:/Users/dev/dev/BPI/Concentrateur/build_release/zephyr/include/generated/pm.yml;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.file_system;C:/Users/dev/dev/BPI/Concentrateur/build_release/modules/nrf/subsys/partition_manager/pm.yml.rpmsg_nrf53;--regions;sram_primary;otp;flash_primary;external_flash;--output-partitions;C:/Users/dev/dev/BPI/Concentrateur/build_release/partitions.yml;--output-regions;C:/Users/dev/dev/BPI/Concentrateur/build_release/regions.yml;--static-config;C:/Users/dev/dev/BPI/Concentrateur/pm_static.yml;--sram_primary-size;0x80000;--sram_primary-base-address;0x20000000;--sram_primary-placement-strategy;complex;--sram_primary-dynamic-partition;sram_primary;--otp-size;764;--otp-base-address;0xff8100;--otp-placement-strategy;start_to_end;--flash_primary-size;0x100000;--flash_primary-base-address;0x0;--flash_primary-placement-strategy;complex;--flash_primary-device;flash_controller;--flash_primary-default-driver-kconfig;CONFIG_SOC_FLASH_NRF;--external_flash-size;8388608;--external_flash-base-address;0;--external_flash-placement-strategy;start_to_end;--external_flash-device;DT_CHOSEN(nordic_pm_ext_flash);--external_flash-default-driver-kconfig;CONFIG_PM_EXTERNAL_FLASH_HAS_DRIVER
    Call Stack (most recent call first):
      C:/ncs/v2.3.0/zephyr/cmake/modules/kernel.cmake:246 (include)
      C:/ncs/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:117 (include)
      C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:5 (find_package)
    
    
    -- Configuring incomplete, errors occurred!

Children
  • I managed to make it work the issues was that I have to set the proper configuration for both files: 

    • In mcuboot.conf
      CONFIG_HW_CC3XX=n
      CONFIG_NRF_CC3XX_PLATFORM=n
      CONFIG_NORDIC_QSPI_NOR=n
    • In the prj.conf
      CONFIG_BOOTLOADER_MCUBOOT=y
      CONFIG_MCUBOOT_IMAGE_VERSION="0.0.1+0"
      CONFIG_TFM_PROFILE_TYPE_MINIMAL=y
      CONFIG_IMG_MANAGER=y
      CONFIG_PARTITION_MANAGER_ENABLED=y
      
      CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
      CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x7FFFFF
      CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=n
      
      #Flash
      CONFIG_FLASH=y
      CONFIG_FLASH_MAP=y
      CONFIG_FLASH_PAGE_LAYOUT=y
      CONFIG_STREAM_FLASH=y
      
      #QSPI External flash
      CONFIG_NORDIC_QSPI_NOR=y
      CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
      
      #File system
      CONFIG_FILE_SYSTEM=y
      CONFIG_FILE_SYSTEM_LITTLEFS=y
      CONFIG_SETTINGS=y
      CONFIG_SETTINGS_FS=y
      CONFIG_FS_LITTLEFS_NUM_FILES=15
      
      CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
      CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x7FFFFF
      CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=n
      
      

    What I've understand is that 

    CONFIG_NORDIC_QSPI_NOR
    was enable by default in the mcuboot.conf making the partition manager create a partition for the image 2, this will introduce a conflict with the LittleFs image since 
    CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
    CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x7FFFFF
    .

    Edit:

    As discussed above the chosen  

    nordic,pm-ext-flash = &mx25r64;
    has to be set too.

    Thanks for the help.

    Kinds regards.

    Martin

  • Hi,

    Apologies for the long response time, I've been out of office. I will go through your information today and come back with a response

    What I see immediately is that your static partition is a bit wrong, the "size" part of your littlefs_storage region needs to be aligned with the rest of the parameters for that partition:

    You will most likely get the flash overflow error again, but could you fix this and see if you do?

    Kind regards,
    Andreas

  • Oh and I see you just replied with another update! Happy to hear that you resolved it with those configurations, and thank you very much for sharing your progress!

    Kind regards,
    Andreas

Related