Hi,
We are using FreeRTOS (v8.2.1) and try to create multi segment heap memory. The RAM is divided in two parts:
1. 0x2000000-0x20003FFF as bootloader, and
2. 0x20004000-0x2002FFFF that contains stack, text, data etc. as per below linker file.
--retain=g_pfnVectors
#define RAM_BASE 0x20004000
MEMORY
{
SRAM_BLOCK (RWX) : origin = 0x20004000, length = 0x3C000
}
SECTIONS
{
.intvecs: > RAM_BASE
.init_array: > SRAM_BLOCK
.vtable : > SRAM_BLOCK
.text : > SRAM_BLOCK
.const : > SRAM_BLOCK
.cinit : > SRAM_BLOCK
.pinit : > SRAM_BLOCK
.data : > SRAM_BLOCK
.bss : > SRAM_BLOCK
.sysmem : > SRAM_BLOCK
.stack : > SRAM_BLOCK(HIGH)
}
For multiple segment heap we are able to successfully claim first memory part means boot loader as well as second part with predetermined/manual determined unused memory(After text, data, stack etc section). The problem arises when we try to automate the determination of unused memory (rather than using pre-determined value) in second part using "__TI_static_base__" and ending at symbol "__stack". Below is code snippet to create multiple segments heaps with automate determination of unused memory for heap:
HeapRegion_t xHeapRegions[] = {
{ ( _u8 * ) 0x20000000UL, 0x04000 }, // portion of memory used by bootloader
{ ( _u8 * ) &__TI_static_base__, (size_t) &__stack },
{ NULL, 0 }
} ;
xHeapRegions[1].xSizeInBytes -= (size_t) xHeapRegions[1].pucStartAddress ;
vPortDefineHeapRegions(xHeapRegions) ;
When we use the symbol "__TI_static_base__" in the xHeapRegions array, we get the compiler warning as below although the code runs perfectly fine.
" warning #10229-D: output section ".data" refers to load symbol "__TI_static_base__" and hence cannot be compressed; compression "rle" is ignored "
So, our question is:
How can we FORCE a segment created using the #pragma directive to always be located AFTER the LAST data segment or in other words how can we use the existing symbols to accurately and safely determine the start of unused memory that can be used as the start of the second heap segment?
Regards,
Aashish