[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.

Related