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.

GNU Linker (LD) PowerPC stack definition

Discussion in 'Embedded' started by tbarrett, Jul 10, 2005.

  1. tbarrett

    tbarrett Guest

    I have not been able to use the ADDR() and SIZEOF() with MEMORY
    defintions. These functions appear to work with SECTIONS definitions
    only. With the Diab linker, I use these functions to define stack,
    heap, and small data area pointers. Here are a couple of examples.
    Not all details are shown to save space.



    Diab Example - assume MPC565 internal memory:

    MEMORY
    {
    rom1 : org = 0x0, len = 512K
    rom2 : org = 0x80000, len = 512K
    ram : org = 0x3F7000, len = 20K
    stack : org = 0x3FC000, len = 16K
    }

    _SP_INIT = ADDR(stack) + SIZEOF(stack);


    This technique doesn't work with GNU LD. The ADDR() and SIZEOF()
    functions can only take SECTIONS definitions as arguments. Therefore,
    a stack section needs to be defined.

    GNU Example:

    MEMORY
    {
    rom1 : org = 0x0, len = 512K
    rom2 : org = 0x80000, len = 512K
    ram : org = 0x3F7000, len = 20K
    stack : org = 0x3FC000, len = 16K
    }

    SECTIONS
    {
    .stack {
    .start = . ;
    . += 16K;
    .end = . ;
    }
    }

    _SP_INIT = ADDR(.stack) + SIZEOF(.stack);


    Does anyone know if the Diab method is possible with GNU?


    Thanks in advance your advice,

    Tony Barrett
     
    tbarrett, Jul 10, 2005
    #1
    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.