1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Stack area - Load and Run (Linker Command File)

Discussion in 'Embedded' started by karthikbg, Jan 22, 2007.

  1. karthikbg

    karthikbg Guest

    Hi,

    I have an application whose DataMemory clashes with the DataMemory of
    my Bootloader.
    So, I have thought of shifting the Applications Datamemory mapping.
    Now, i have rempped it. But, When my application starts, the the MMU
    is disabled & The MMU is enabled inside the application only. So, there

    is a situation that my stack will be pointing to one location when the
    MMU is disabled and will get pointed to another location when i enable
    the MMU inside my application for my requirements.


    So, i have thought of using 'load' and 'run' facilities in the CMD
    file(Linker command file) . Now, as long as my application has not
    enabled the MMU, it will be pointing to the physical area (Load area),
    and as soon as my application enables the MMU, it will be pointing to
    the virtual memory area(Run Area) .

    After the changes, i find that the application behaves abnormally. So,
    i suspect
    if the stack has some issues.

    Can i assign Stack area as 'load' and 'run' type in CMD
    file(Linker command File) ? Will my application be able to retreive the

    proper values when it gets switched between the 'MMU Enabled' and 'MMU
    Disabled' modes ? Any problems if i implement Stack in that manner ?


    Thx in advans,
    Karthik Balaguru
     
    karthikbg, Jan 22, 2007
    #1
    1. Advertisements

  2. karthikbg

    karthikbg Guest

    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
     
    karthikbg, Jan 23, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.