Hi, I got some special tricks for the Linker Scripts for a non-contiguous memory map in which i can distribute code or data among more than one memory area.
MEMORY { PR_MEM1: origin = 0a000h, length = 0500h; PR_MEM2: origin = 0d000h, length = 0300h; }
SECTIONS { .text_1: { test1.obj(.text), test2.obj(.text), test3.obj(.text) }
.text_2: { test4.obj(.text), test5.obj(.text) } > PR_MEM2 }
Another trick of splitting the output sections among multiple memory areas to automatically achieve an efficient allocation of the output section among several memory areas as below :
SECTIONS { .text: { *(.text) } >> PR_MEM1 | PR_MEM2 }
But, i have many other queries. Consider the below scenario. Application 'A' gets loaded first and starts running. After application 'A' starts to run, Application 'B' gets loaded and starts running.
Consider that application 'A' has for following memory map Data_Mem -> 0x20001000 to 0x20006000 (Though so much is allocated, this application 'A' actually uses only upto 0x20002000 in runtime - This info, i collected from MAP file) ( Has the bss,stack,bss,data,idata )
Application 'B' has the following memory map. Data_Mem -> 0x20001000 to 0x20006000 (This uses only upto 0x20004000 in runtime).( Has the bss,stack,bss,data,idata )
Though both application A and Application B point to same memory area w.r.t Data_Mem, from the above it is clear that there is some memory area unused by application A that can be used by application B. How to tell the Application B to take the unused memory space of the Application A. ?
Is there any feature for doing that in Linker Scripts ? If we allocate certain regions via Linker Scripts, is it not possible to allocate some part of that region to other module ?
I thought 'Load' and 'Run' feature can be used. But, i find that they both allocate separate memory blocks and so result in wastage of usable area.
In short, How to do Dynamic Memory Usage using Linker Script Programming ?
Thx in advans, Karthik Balaguru