Hi,
I am using s32k314 running FreeRTOS and s32design studio. In my device the total RAM is 192K. In FreeRTOSConfig.h the default heap size is 8192 bytes I have changed the heap size to 12288 bytes and it is working but when I change it to 16384 the code is not building.
It is showing the error message:
c:/nxp/s32ds.3.5/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: Final_S32K312.elf section `.heap' will not fit in region `int_sram'
c:/nxp/s32ds.3.5/s32ds/build_tools/gcc_v10.2/gcc-10.2-arm32-eabi/bin/../lib/gcc/arm-none-eabi/10.2.0/../../../../arm-none-eabi/bin/real-ld.exe: region `int_sram' overflowed by 3608 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:45: Final_S32K312.elf] Error 1
I am mentioning the linker file memory configuration.
int_flash : ORIGIN = 0x00400000, LENGTH = 0x001D4000 /* 2048K - 176K (sBAF + HSE)*/
int_itcm : ORIGIN = 0x00000000, LENGTH = 0x00008000 /* 32K */
int_dtcm : ORIGIN = 0x20000000, LENGTH = 0x00010000 /* 64K */
int_sram : ORIGIN = 0x20400000, LENGTH = 0x00006F00 /* 27 KB */
int_sram_fls_rsv : ORIGIN = 0x20406F00, LENGTH = 0x00000100
int_sram_stack_c0 : ORIGIN = 0x20407000, LENGTH = 0x00001000
int_sram_no_cacheable : ORIGIN = 0x20408000, LENGTH = 0x00007F00 /* 32kb , needs to include int_results */
int_sram_results : ORIGIN = 0x2040FF00, LENGTH = 0x00000100
int_sram_shareable : ORIGIN = 0x20410000, LENGTH = 0x00008000 /* 32KB */
ram_rsvd2 : ORIGIN = 0x20418000, LENGTH = 0 /* End of SRAM */
How to change this configuration?
Hi Dan,
Here, who uses "int_sram_no_cacheable" section of memory ? I see that it takes around 32K. Can we use that memory in our code ?
Also, we used .dtcm0_data compiler pragme to use the D-TCM memory. But eventhough the script file says the size of the DTCM memory to be 64KB, we are not in a position to use more than 27 KBytes here. Why this restriction ?
Regards, Biju
Hi biju_nair,
1, who uses "int_sram_no_cacheable" section of memory ? I see that it takes around 32K. Can we use that memory in our code ?
=> In my opinion, this section was used to save specific data in the modules of the driver as MCL, SPI,...
You can use this memory in your code.
2. We used .dtcm0_data compiler pragme to use the D-TCM memory. But eventhough the script file says the size of the DTCM memory to be 64KB, we are not in a position to use more than 27 KBytes here. Why this restriction ?
=> I placed init_sram on the dtcm memory and I didn't got your issue. In my opinion, you can check your .map file to figure out the root cause.
Best regards,
Dan
Hi abhijith_r,
To calculate the max size of the heap area, you can follow as below:
Follow the linker_flash_s32k314.ld file:
init_sram = sram_data + sram_bss + heap.
For calculate example:
__sram_data_begin__ = 0x20400000 (this value got from .map file)
__sram_data_end__ = 0x204000fc (this value got from .map file)
=> sram_data = __sram_data_end__ - __sram_data_begin__ = 0xFC
__sram_bss_start = 0x20400100 (Align 4 byte from __sram_data_end__) (this value got from .map file)
__sram_bss_end = 0x204033bc (this value got from .map file)
=> sram_bss = __sram_bss_end - __sram_bss_start = 0x32BC
=> init_sram = 0x6F00 = 0xFC + 4 bytes align + 0x32BC + maxsize_of_heap
=> maxsize_of_heap = 0x3B44 = 15,172 bytes.
Based on the above calculation, If the size of init_sram is not change:
If I config heap size > 15172 bytes => the program build fail because the int_sram' overflowed.
So, In your situation, you can increase the init_sram additional N bytes (N >= 3608) or decrease heap size N bytes (N >= 3608) to fix the int_sram overflowed error.
Best regards,
Dan